UNPKG

framework

Version:

The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.

428 lines 1.44 MB
import{a as e,d as t,f as n,i as r,l as i,m as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"../chunks/chunk-BF9pJudf.js";/* empty css                      */var p=f((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),m=f(((e,t)=>{t.exports=p()})),h=f((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(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 I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),g=f(((e,t)=>{t.exports=h()})),_=f((e=>{var t=g();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),v=f(((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=_()})),y=f((e=>{var t=m(),n=g(),r=v();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],B=-1;function ee(e){return{current:e}}function V(e){0>B||(e.current=z[B],z[B]=null,B--)}function H(e,t){B++,z[B]=e.current,e.current=t}var te=ee(null),U=ee(null),W=ee(null),ne=ee(null);function re(e,t){switch(H(W,t),H(U,e),H(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wd(t),e=Gd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(te),H(te,e)}function ie(){V(te),V(U),V(W)}function ae(e){e.memoizedState!==null&&H(ne,e);var t=te.current,n=Gd(t,e.type);t!==n&&(H(U,e),H(te,n))}function oe(e){U.current===e&&(V(te),V(U)),ne.current===e&&(V(ne),tp._currentValue=R)}var se,ce;function le(e){if(se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||``,ce=-1<e.stack.indexOf(`
    at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+se+e+ce}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
`),l=s.split(`
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ue=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?le(n):``}function fe(e,t){switch(e.tag){case 26:case 27:case 5:return le(e.type);case 16:return le(`Lazy`);case 13:return e.child!==t&&t!==null?le(`Suspense Fallback`):le(`Suspense`);case 19:return le(`SuspenseList`);case 0:case 15:return de(e.type,!1);case 11:return de(e.type.render,!1);case 1:return de(e.type,!0);case 31:return le(`Activity`);default:return``}}function pe(e){try{var t=``,n=null;do t+=fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
Error generating stack: `+e.message+`
`+e.stack}}var me=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,ge=t.unstable_cancelCallback,_e=t.unstable_shouldYield,ve=t.unstable_requestPaint,ye=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,xe=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,we=t.unstable_LowPriority,Te=t.unstable_IdlePriority,Ee=t.log,De=t.unstable_setDisableYieldValue,Oe=null,ke=null;function Ae(e){if(typeof Ee==`function`&&De(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var je=Math.clz32?Math.clz32:Pe,Me=Math.log,Ne=Math.LN2;function Pe(e){return e>>>=0,e===0?32:31-(Me(e)/Ne|0)|0}var Fe=256,Ie=262144,Le=4194304;function Re(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Re(n))):i=Re(o):i=Re(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Re(n))):i=Re(o)):i=Re(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function He(){var e=Le;return Le<<=1,!(Le&62914560)&&(Le=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Je(e,t){var n=t&-t;return n=n&42?1:Ye(n),(n&(e.suspendedLanes|t))===0?n:0}function Ye(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ze(){var e=L.p;return e===0?(e=window.event,e===void 0?32:_p(e.type)):e}function Qe(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var $e=Math.random().toString(36).slice(2),et=`__reactFiber$`+$e,tt=`__reactProps$`+$e,nt=`__reactContainer$`+$e,rt=`__reactEvents$`+$e,it=`__reactListeners$`+$e,at=`__reactHandles$`+$e,ot=`__reactResources$`+$e,st=`__reactMarker$`+$e;function ct(e){delete e[et],delete e[tt],delete e[rt],delete e[it],delete e[at]}function lt(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nt]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mf(e);e!==null;){if(n=e[et])return n;e=mf(e)}return t}e=n,n=e.parentNode}return null}function ut(e){if(e=e[et]||e[nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function dt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ft(e){var t=e[ot];return t||=e[ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function pt(e){e[st]=!0}var mt=new Set,ht={};function gt(e,t){_t(e,t),_t(e+`Capture`,t)}function _t(e,t){for(ht[e]=t,e=0;e<t.length;e++)mt.add(t[e])}var vt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),yt={},bt={};function xt(e){return me.call(bt,e)?!0:me.call(yt,e)?!1:vt.test(e)?bt[e]=!0:(yt[e]=!0,!1)}function St(e,t,n){if(xt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ct(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function wt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Tt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Et(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Dt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ot(e){if(!e._valueTracker){var t=Et(e)?`checked`:`value`;e._valueTracker=Dt(e,t,``+e[t])}}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Et(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function At(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Tt(t)):e.value!==``+Tt(t)&&(e.value=``+Tt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ft(e,o,Tt(n)):Ft(e,o,Tt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Tt(s):e.removeAttribute(`name`)}function Pt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ot(e);return}n=n==null?``:``+Tt(n),t=t==null?n:``+Tt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ot(e)}function Ft(e,t,n){t===`number`&&At(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function It(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=``+Tt(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 Lt(e,t,n){if(t!=null&&(t=``+Tt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Tt(n)}function Rt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Tt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ot(e)}function zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Vt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ht(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Vt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Vt(e,o,t[o])}function Ut(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Wt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Gt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Kt(e){return Gt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function qt(){}var Jt=null;function Yt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xt=null,Zt=null;function Qt(e){var t=ut(e);if(t&&(e=t.stateNode)){var n=e[tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[tt]||null;if(!a)throw Error(i(90));Nt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&kt(r)}break a;case`textarea`:Lt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&It(e,!!n.multiple,t,!1)}}}var $t=!1;function en(e,t,n){if($t)return e(t,n);$t=!0;try{return e(t)}finally{if($t=!1,(Xt!==null||Zt!==null)&&(bu(),Xt&&(t=Xt,e=Zt,Zt=Xt=null,Qt(t),e)))for(t=0;t<e.length;t++)Qt(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[tt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,"passive",{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.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 cn=i.slice(e,1<r?1-r:void 0)}function un(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 dn(){return!0}function fn(){return!1}function pn(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)?dn:fn,this.isPropagationStopped=fn,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=dn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=dn)},persist:function(){},isPersistent:dn}),t}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hn=pn(mn),gn=f({},mn,{view:0,detail:0}),_n=pn(gn),vn,yn,bn,xn=f({},gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mn,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!==bn&&(bn&&e.type===`mousemove`?(vn=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=vn=0,bn=e),vn)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=pn(xn),Cn=pn(f({},xn,{dataTransfer:0})),wn=pn(f({},gn,{relatedTarget:0})),Tn=pn(f({},mn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=pn(f({},mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Dn=pn(f({},mn,{data:0})),On={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},kn={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`},An={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=An[e])?!!t[e]:!1}function Mn(){return jn}var Nn=pn(f({},gn,{key:function(e){if(e.key){var t=On[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=un(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mn,charCode:function(e){return e.type===`keypress`?un(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?un(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Pn=pn(f({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Fn=pn(f({},gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mn})),In=pn(f({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=pn(f({},xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Rn=pn(f({},mn,{newState:0,oldState:0})),zn=[9,13,27,32],Bn=nn&&`CompositionEvent`in window,Vn=null;nn&&`documentMode`in document&&(Vn=document.documentMode);var Hn=nn&&`TextEvent`in window&&!Vn,Un=nn&&(!Bn||Vn&&8<Vn&&11>=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=ln(),cn=sn=on=null,Jn=!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 Un&&t.locale!==`ko`?null:t.data;default:return null}}var Zn={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 Qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Zn[e.type]:t===`textarea`}function $n(e,t,n,r){Xt?Zt?Zt.push(r):Zt=[r]:Xt=r,t=Od(t,`onChange`),0<t.length&&(n=new hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var er=null,tr=null;function nr(e){bd(e,0)}function rr(e){if(kt(dt(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(nn){var or;if(nn){var sr=`oninput`in document;if(!sr){var cr=document.createElement(`div`);cr.setAttribute(`oninput`,`return;`),sr=typeof cr.oninput==`function`}or=sr}else or=!1;ar=or&&(!document.documentMode||9<document.documentMode)}function lr(){er&&(er.detachEvent(`onpropertychange`,ur),tr=er=null)}function ur(e){if(e.propertyName===`value`&&rr(tr)){var t=[];$n(t,tr,e,Yt(e)),en(nr,t)}}function dr(e,t,n){e===`focusin`?(lr(),er=t,tr=n,er.attachEvent(`onpropertychange`,ur)):e===`focusout`&&lr()}function fr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(tr)}function pr(e,t){if(e===`click`)return rr(t)}function mr(e,t){if(e===`input`||e===`change`)return rr(t)}function G(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:G;function gr(e,t){if(hr(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(!me.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(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=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=At(e.document)}return t}function xr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Sr=nn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==At(r)||(r=Cr,`selectionStart`in r&&xr(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}),Tr&&gr(Tr,r)||(Tr=r,r=Od(wr,`onSelect`),0<r.length&&(t=new hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};nn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),gt(t,[e])}var Ur=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<pu)throw pu=0,X=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ii(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ai(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=Kf(e,n,te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ti(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return oi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ti(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ti(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ti(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:pe(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:pe(t)}}var fi=[],pi=0,mi=null,hi=0,gi=[],_i=0,vi=null,yi=1,bi=``;function xi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function Si(e,t,n){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,vi=e;var r=yi;e=bi;var i=32-je(r)-1;r&=~(1<<i),n+=1;var a=32-je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,yi=1<<32-je(t)+i|n<<i|r,bi=a+e}else yi=1<<a|n<<i|r,bi=e}function Ci(e){e.return!==null&&(xi(e,1),Si(e,1,0))}function wi(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===vi;)vi=gi[--_i],gi[_i]=null,bi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null}function Ti(e,t){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,yi=t.id,bi=t.overflow,vi=e}var Ei=null,Di=null,Oi=!1,ki=null,Ai=!1,ji=Error(i(519));function Mi(e){throw Ri(di(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ji}function Ni(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[et]=e,t[tt]=r,n){case`dialog`:xd(`cancel`,t),xd(`close`,t);break;case`iframe`:case`object`:case`embed`:xd(`load`,t);break;case`video`:case`audio`:for(n=0;n<vd.length;n++)xd(vd[n],t);break;case`source`:xd(`error`,t);break;case`img`:case`image`:case`link`:xd(`error`,t),xd(`load`,t);break;case`details`:xd(`toggle`,t);break;case`input`:xd(`invalid`,t),Pt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:xd(`invalid`,t);break;case`textarea`:xd(`invalid`,t),Rt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Pd(t.textContent,n)?(r.popover!=null&&(xd(`beforetoggle`,t),xd(`toggle`,t)),r.onScroll!=null&&xd(`scroll`,t),r.onScrollEnd!=null&&xd(`scrollend`,t),r.onClick!=null&&(t.onclick=qt),t=!0):t=!1,t||Mi(e,!0)}function Pi(e){for(Ei=e.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:Ei=Ei.return}}function Fi(e){if(e!==Ei)return!1;if(!Oi)return Pi(e),Oi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Kd(e.type,e.memoizedProps)),n=!n),n&&Di&&Mi(e),Pi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=pf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=pf(e)}else t===27?(t=Di,ef(e.type)?(e=ff,ff=null,Di=e):Di=t):Di=Ei?df(e.stateNode.nextSibling):null;return!0}function Ii(){Di=Ei=null,Oi=!1}function Li(){var e=ki;return e!==null&&($l===null?$l=e:$l.push.apply($l,e),ki=null),e}function Ri(e){ki===null?ki=[e]:ki.push(e)}var zi=ee(null),Bi=null,Vi=null;function K(e,t,n){H(zi,t._currentValue),t._currentValue=n}function Hi(e){e._currentValue=zi.current,V(zi)}function Ui(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 Wi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ui(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ui(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Gi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ne.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[tp]:e.push(tp))}a=a.return}e!==null&&Wi(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){Bi=e,Vi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(Bi,e)}function Yi(e,t){return Bi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Vi===null){if(e===null)throw Error(i(308));Vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vi=Vi.next=t;return n}var Zi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=fd(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ua=I.S;I.S=function(e,t){nu=ye(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=ee(null);function fa(){var e=da.current;return e===null?Ll.pooledCache:e}function pa(e,t){t===null?H(da,da.current):H(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(i(460)),ga=Error(i(474)),_a=Error(i(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(qt,qt);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ri(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=si(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===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=li(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=oi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=ai(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case _:return t=li(t,e.mode,n),t.return=e,t;case O:return t=xa(t),f(e,t,n)}if(F(t)||M(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Yi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case h:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case O:return n=xa(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Yi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=xa(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Yi(t,r),i);ka(t,r)}return null}function g(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Oi&&xi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Oi&&xi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(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(i,e)}),Oi&&xi(i,h),l}function v(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Oi&&xi(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 Oi&&xi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(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)}),Oi&&xi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case _:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=li(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=xa(o),b(e,r,o,c)}if(F(o))return g(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),v(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===C)return b(e,r,Yi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Il&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(zl&p)===p:(r&p)===p){p!==0&&p===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Na=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ql|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=ee(null),Ka=ee(0);function qa(e,t){e=Gl,H(Ka,e),H(Ga,t),Gl=e|t.baseLanes}function Ja(){H(Ka,Gl),H(Ga,Ga.current)}function Ya(){Gl=Ka.current,V(Ga),V(Ka)}var Xa=ee(null),Za=null;function Qa(e){var t=e.alternate;H(ro,ro.current&1),H(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){H(ro,ro.current),H(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(H(ro,ro.current),H(Xa,e),Za===null&&(Za=e)):to(e)}function to(){H(ro,ro.current),H(Xa,Xa.current)}function no(e){V(Xa),Za===e&&(Za=null),V(ro)}var ro=ee(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||cf(n)||lf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=0,oo=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return ao=a,oo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ls:Rs,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){I.H=Is;var t=so!==null&&so.next!==null;if(ao=0,co=so=oo=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||tc||(e=e.dependencies,e!==null&&Ki(e)&&(tc=!0))}function xo(e,t,n,r){oo=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=so=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=zs,o=t(n,r)}while(uo);return o}function So(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(oo.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}ao=0,co=so=oo=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?oo.memoizedState=co=e:co=co.next=e,co}function Do(){if(so===null){var e=oo.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?oo.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw oo.alternate===null?Error(i(467)):Error(i(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?oo.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=ba(ho,e,t),t=oo,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ls:Rs),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Ji(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=oo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=oo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),oo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),so,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(zl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===aa&&(d=!0);else if((ao&p)===p){u=u.next,p===aa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,oo.lanes|=p,ql|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,oo.lanes|=f,ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!hr(o,e.memoizedState)&&(tc=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);hr(o,t.memoizedState)||(tc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=oo,a=Do(),o=Oi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!hr((so||a).memoizedState,n);if(s&&(a.memoizedState=n,tc=!0),a=a.queue,cs(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||ao&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=oo.updateQueue,t===null?(t=Oo(),oo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Vo(e){var t=Xr(e,2);t!==null&&Z(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){Ae(!0);try{n()}finally{Ae(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,so,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(Ns(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(Oi){var n=Ll.formState;if(n!==null){a:{var r=oo;if(Oi){if(Di){b:{for(var i=Di,a=Ai;i.nodeType!==8;){if(!a){i=null;break b}if(i=df(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Di=df(i.nextSibling),r=i.data===`F!`;break a}}Mi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=As.bind(null,oo,r),r.dispatch=n,r=Ho(!1),a=Ms.bind(null,oo,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,oo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),so,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===ha?_a:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(oo.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=so;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=oo.updateQueue,t===null&&(t=Oo(),oo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();oo.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(oo.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function ss(e,t){is(8390656,8,e,t)}function cs(e,t){as(2048,8,e,t)}function ls(e){oo.flags|=4;var t=oo.updateQueue;if(t===null)t=Oo(),oo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function us(e){var t=Do().memoizedState;return ls({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ds(e,t){return as(4,2,e,t)}function fs(e,t){return as(4,4,e,t)}function ps(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ms(e,t,n){n=n==null?null:n.concat([e]),as(4,4,ps.bind(null,t,e),n)}function hs(){}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function _s(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r}function vs(e,t,n){return n===void 0||ao&1073741824&&!(zl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),oo.lanes|=e,ql|=e,n)}function ys(e,t,n,r){return hr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(zl&261930)?(tc=!0,e.memoizedState=n):(e=hu(),oo.lanes|=e,ql|=e,t):(e=vs(e,n,r),hr(e,t)||(tc=!0),e)}function bs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,Ms(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?js(e,t,la(c,r),mu(e)):js(e,t,r,mu(e))}catch(n){js(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function xs(){}function Ss(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Cs(e).queue;bs(e,a,t,R,n===null?xs:function(){return ws(e),n(r)})}function Cs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ws(e){var t=Cs(e);t.next===null&&(t=e.alternate.memoizedState),js(e,t.next.queue,{},mu())}function Ts(){return Ji(tp)}function Es(){return Do().memoizedState}function Ds(){return Do().memoizedState}function Os(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ia(n);var r=La(t,e,n);r!==null&&(Z(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function ks(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ns(e)?Ps(t,n):(n=Yr(e,t,n,r),n!==null&&(Z(n,e,r),Fs(n,t,r)))}function As(e,t,n){js(e,t,n,mu())}function js(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ns(e))Ps(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,hr(s,o))return Jr(e,t,i,0),Ll===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return Z(n,e,r),Fs(n,t,r),!0}return!1}function Ms(e,t,n,r){if(r={lane:2,revertLane:fd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ns(e)){if(t)throw Error(i(479))}else t=Yr(e,n,r,2),t!==null&&Z(t,e,2)}function Ns(e){var t=e.alternate;return e===oo||t!==null&&t===oo}function Ps(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Is={readContext:Ji,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Is.useEffectEvent=_o;var Ls={readContext:Ji,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:ss,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,ps.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){Ae(!0);try{n(t)}finally{Ae(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ks.bind(null,oo,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=As.bind(null,oo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:hs,useDeferredValue:function(e,t){return vs(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=bs.bind(null,oo,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=oo,a=Eo();if(Oi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));zl&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ss(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Ll.identifierPrefix;if(Oi){var n=bi,r=yi;n=(r&~(1<<32-je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ts,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ms.bind(null,oo,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Os.bind(null,oo)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Rs={readContext:Ji,use:Ao,useCallback:gs,useContext:Ji,useEffect:cs,useImperativeHandle:ms,useInsertionEffect:ds,useLayoutEffect:fs,useMemo:_s,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:hs,useDeferredValue:function(e,t){return ys(Do(),so.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Es,useHostTransitionStatus:Ts,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),so,e,t)},useMemoCache:jo,useCacheRefresh:Ds};Rs.useEffectEvent=us;var zs={readContext:Ji,use:Ao,useCallback:gs,useContext:Ji,useEffect:cs,useImperativeHandle:ms,useInsertionEffect:ds,useLayoutEffect:fs,useMemo:_s,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:hs,useDeferredValue:function(e,t){var n=Do();return so===null?vs(n,e,t):ys(n,so.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Es,useHostTransitionStatus:Ts,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,so,e,t)},useMemoCache:jo,useCacheRefresh:Ds};zs.useEffectEvent=us;function Bs(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 Vs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(Z(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(Z(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(Z(t,e,n),Ra(t,e,n))}};function Hs(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?!gr(n,r)||!gr(i,a):!0}function Us(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&&Vs.enqueueReplaceState(t,t.state,null)}function Ws(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Gs(e){Ur(e)}function Ks(e){console.error(e)}function qs(e){Ur(e)}function Js(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Xs(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Js(e,t)},n}function Zs(e){return e=Ia(e),e.tag=3,e}function Qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ys(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ys(t,n,r),typeof i!=`function`&&(au===null?au=new Set([this]):au.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function $s(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,a,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?Du():n.alternate===null&&Kl===0&&(Kl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Ku(e,r,a)),!1;case 22:return n.flags|=65536,r===va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Ku(e,r,a)),!1}throw Error(i(435,n.tag))}return Ku(e,r,a),Du(),!1}if(Oi)return t=Xa.current,t===null?(r!==ji&&(t=Error(i(423),{cause:r}),Ri(di(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=di(r,n),a=Xs(e.stateNode,r,a),za(e,a),Kl!==4&&(Kl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ji&&(e=Error(i(422),{cause:r}),Ri(di(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=di(o,n),Ql===null?Ql=[o]:Ql.push(o),Kl!==4&&(Kl=2),t===null)return!0;r=di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Xs(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(au===null||!au.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Zs(a),Qs(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var ec=Error(i(461)),tc=!1;function nc(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function rc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return qi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!tc?(wo(e,t,i),Dc(e,t,i)):(Oi&&s&&Ci(t),t.flags|=1,nc(e,t,r,i),t.child)}function ic(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ac(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Oc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return Dc(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function ac(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref)if(tc=!1,t.pendingProps=r=a,Oc(e,i))e.flags&131072&&(tc=!0);else return t.lanes=e.lanes,Dc(e,t,i)}return pc(e,t,n,r,i)}function oc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return cc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,cc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return nc(e,t,i,n),t.child}function sc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function cc(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function lc(e,t){return t=Sc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function uc(e,t,n){return ja(t,e.child,null,n),e=lc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function dc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Oi){if(r.mode===`hidden`)return e=lc(t,r),t.lanes=536870912,sc(null,e);if($a(t),(e=Di)?(e=sf(e,Ai),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return t.lanes=536870912,null}return lc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if($a(t),a)if(t.flags&256)t.flags&=-257,t=uc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(tc||Gi(e,t,n,!1),a=(n&e.childLanes)!==0,tc||a){if(r=Ll,r!==null&&(s=Je(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Xr(e,s),Z(r,e,s),ec;Du(),t=uc(e,t,n)}else e=o.treeContext,Di=df(s.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=lc(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pc(e,t,n,r,i){return qi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!tc?(wo(e,t,i),Dc(e,t,i)):(Oi&&r&&Ci(t),t.flags|=1,nc(e,t,n,i),t.child)}function mc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!tc?(wo(e,t,a),Dc(e,t,a)):(Oi&&r&&Ci(t),t.flags|=1,nc(e,t,n,a),t.child)}function hc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Vs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Bs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Vs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ws(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Ji(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Us(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Bs(t,n,d,r),l=t.memoizedState),(c=Na||Hs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Ws(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ji(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Us(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Bs(t,n,s,r),p=t.memoizedState),(u=Na||Hs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,fc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):nc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Dc(e,t,i),e}function gc(e,t,n,r){return Ii(),t.flags|=256,nc(e,t,n,r),t.child}var _c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vc(e){return{baseLanes:e,cachePool:ma()}}function yc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Xl),e}function bc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(ro.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Oi){if(a?Qa(t):to(t),(e=Di)?(e=sf(e,Ai),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return lf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(to(t),a=t.mode,c=Sc({mode:`hidden`,children:c},a),r=oi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=vc(n),r.childLanes=yc(e,s,n),t.memoizedState=_c,sc(null,r)):(Qa(t),xc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Qa(t),t.flags&=-257,t=Cc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,a=t.mode,r=Sc({mode:`visible`,children:r.children},a),c=oi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=vc(n),r.childLanes=yc(e,s,n),t.memoizedState=_c,t=sc(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),lf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ri({value:r,source:null,stack:null}),t=Cc(e,t,n)}else if(tc||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,tc||s){if(s=Ll,s!==null&&(r=Je(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),Z(s,e,r),ec;cf(c)||Du(),t=Cc(e,t,n)}else cf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Di=df(c.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=xc(t,r.children),t.flags|=4096);return t}return a?(to(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,a,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,sc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=vc(n):(a=c.cachePool,a===null?a=ma():(l=ea._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=yc(e,s,n),t.memoizedState=_c,sc(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ri(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function xc(e,t){return t=Sc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Sc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function Cc(e,t,n){return ja(t,e.child,null,n),e=xc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ui(e.return,t,n)}function Tc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Ec(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,H(ro,o),nc(e,t,r,n),r=Oi?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wc(e,n,t);else if(e.tag===19)wc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Tc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Tc(t,!0,n,null,a,r);break;case`together`:Tc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Dc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Oc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ki(e))):!0}function kc(e,t,n){switch(t.tag){case 3:re(t,t.stateNode.containerInfo),K(t,ea,e.memoizedState.cache),Ii();break;case 27:case 5:ae(t);break;case 4:re(t,t.stateNode.containerInfo);break;case 10:K(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=Dc(e,t,n),e===null?null:e.sibling):bc(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ec(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(ro,ro.current),r)break;return null;case 22:return t.lanes=0,oc(e,t,n,t.pendingProps);case 24:K(t,ea,e.memoizedState.cache)}return Dc(e,t,n)}function Ac(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)tc=!0;else{if(!Oc(e,n)&&!(t.flags&128))return tc=!1,kc(e,t,n);tc=!!(e.flags&131072)}else tc=!1,Oi&&t.flags&1048576&&Si(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Ws(e,r),t.tag=1,t=hc(null,t,e,r,n)):(t.tag=0,t=pc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=rc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=ic(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return pc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ws(r,t.pendingProps),hc(e,t,r,a,n);case 3:a:{if(re(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,K(t,ea,r),r!==o.cache&&Wi(t,[ea],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=gc(e,t,r,n);break a}else if(r!==a){a=di(Error(i(424)),t),Ri(a),t=gc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Di=df(e.firstChild),Ei=t,Oi=!0,ki=null,Ai=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ii(),r===a){t=Dc(e,t,n);break a}nc(e,t,r,n)}t=t.child}return t;case 26:return fc(e,t),e===null?(n=Mf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Oi||(n=t.type,e=t.pendingProps,r=Ud(W.current).createElement(n),r[et]=t,r[tt]=e,Ld(r,n,e),pt(r),t.stateNode=r):t.memoizedState=Mf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ae(t),e===null&&Oi&&(r=t.stateNode=hf(t.type,t.pendingProps,W.current),Ei=t,Ai=!0,a=Di,ef(t.type)?(ff=a,Di=df(r.firstChild)):Di=a),nc(e,t,t.pendingProps.children,n),fc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oi&&((a=r=Di)&&(r=af(r,t.type,t.pendingProps,Ai),r===null?a=!1:(t.stateNode=r,Ei=t,Di=df(r.firstChild),Ai=!1,a=!0)),a||Mi(t)),ae(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Kd(a,o)?r=null:s!==null&&Kd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),tp._currentValue=a),fc(e,t),nc(e,t,r,n),t.child;case 6:return e===null&&Oi&&((e=n=Di)&&(n=of(n,t.pendingProps,Ai),n===null?e=!1:(t.stateNode=n,Ei=t,Di=null,e=!0)),e||Mi(t)),null;case 13:return bc(e,t,n);case 4:return re(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):nc(e,t,r,n),t.child;case 11:return rc(e,t,t.type,t.pendingProps,n);case 7:return nc(e,t,t.pendingProps,n),t.child;case 8:return nc(e,t,t.pendingProps.children,n),t.child;case 12:return nc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,K(t,t.type,r.value),nc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,qi(t),a=Ji(a),r=r(a),t.flags|=1,nc(e,t,r,n),t.child;case 14:return ic(e,t,t.type,t.pendingProps,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 19:return Ec(e,t,n);case 31:return dc(e,t,n);case 22:return oc(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(a=fa(),a===null&&(a=Ll,o=ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),K(t,ea,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,K(t,ea,r),r!==a.cache&&Wi(t,[ea],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),K(t,ea,r))),nc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function jc(e){e.flags|=4}function Mc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(wu())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function Nc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!qf(t))if(wu())e.flags|=8192;else throw Sa=va,ga}function Pc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:He(),e.lanes|=t,Zl|=t)}function Fc(e,t){if(!Oi)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 Ic(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Lc(e,t,n){var r=t.pendingProps;switch(wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ic(t),null;case 1:return Ic(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hi(ea),ie(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?jc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Li())),Ic(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(jc(t),o===null?(Ic(t),Mc(t,a,null,r,n)):(Ic(t),Nc(t,o))):o?o===e.memoizedState?(Ic(t),t.flags&=-16777217):(jc(t),Ic(t),Nc(t,o)):(e=e.memoizedProps,e!==r&&jc(t),Ic(t),Mc(t,a,e,r,n)),null;case 27:if(oe(t),n=W.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ic(t),null}e=te.current,Fi(t)?Ni(t,e):(e=hf(a,r,n),t.stateNode=e,jc(t))}return Ic(t),null;case 5:if(oe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ic(t),null}if(o=te.current,Fi(t))Ni(t,o);else{var s=Ud(W.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[et]=t,o[tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Ld(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&jc(t)}}return Ic(t),Mc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=W.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ei,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Pd(e.nodeValue,n)),e||Mi(t,!0)}else e=Ud(e).createTextNode(r),e[et]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[et]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Ic(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[et]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),a=!1}else a=Li(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Pc(t,t.updateQueue),Ic(t),null);case 4:return ie(),e===null&&wd(t.stateNode.containerInfo),Ic(t),null;case 10:return Hi(t.type),Ic(t),null;case 19:if(V(ro),r=t.memoizedState,r===null)return Ic(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Fc(r,!1);else{if(Kl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Fc(r,!1),e=o.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return H(ro,ro.current&1|2),Oi&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ye()>ru&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}else{if(!a)if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),Fc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Oi)return Ic(t),null}else 2*ye()-r.renderingStartTime>ru&&n!==536870912&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ic(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ye(),e.sibling=null,n=ro.current,H(ro,a?n&1|2:n&1),Oi&&xi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ic(t),t.subtreeFlags&6&&(t.flags|=8192)):Ic(t),n=t.updateQueue,n!==null&&Pc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&V(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Ic(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),ie(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return oe(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(ro),null;case 4:return ie(),null;case 10:return Hi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&V(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function zc(e,t){switch(wi(t),t.tag){case 3:Hi(ea),ie();break;case 26:case 27:case 5:oe(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:V(ro);break;case 10:Hi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&V(da);break;case 24:Hi(ea)}}function Bc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Gu(t,t.return,e)}}function Vc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Gu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Gu(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Gu(e,e.return,t)}}}function Uc(e,t,n){n.props=Ws(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Gu(e,t,n)}}function Wc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Gu(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Gu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Gu(e,t,n)}else n.current=null}function Kc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Gu(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Rd(r,e.type,n,t),r[tt]=t}catch(t){Gu(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ef(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ef(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qt));else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&ef(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ld(t,r,n),t[et]=e,t[tt]=n}catch(t){Gu(e,e.return,t)}}var $c=!1,el=!1,tl=!1,nl=typeof WeakSet==`function`?WeakSet:Set,rl=null;function il(e,t){if(e=e.containerInfo,Vd=up,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Hd={focusedElem:e,selectionRange:n},up=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ws(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Gu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:rf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,rl=e;break}rl=t.return}}function al(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:bl(e,n),r&4&&Bc(5,n);break;case 1:if(bl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Gu(n,n.return,e)}else{var i=Ws(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Gu(n,n.return,e)}}r&64&&Hc(n),r&512&&Wc(n,n.return);break;case 3:if(bl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Gu(n,n.return,e)}}break;case 27:t===null&&r&4&&Qc(n);case 26:case 5:bl(e,n),t===null&&r&4&&Kc(n),r&512&&Wc(n,n.return);break;case 12:bl(e,n);break;case 31:bl(e,n),r&4&&dl(e,n);break;case 13:bl(e,n),r&4&&fl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Yu.bind(null,n),uf(e,n))));break;case 22:if(r=n.memoizedState!==null||$c,!r){t=t!==null&&t.memoizedState!==null||el,i=$c;var a=el;$c=r,(el=t)&&!a?Sl(e,n,(n.subtreeFlags&8772)!=0):bl(e,n),$c=i,el=a}break;case 30:break;default:bl(e,n)}}function ol(e){var t=e.alternate;t!==null&&(e.alternate=null,ol(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ct(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var sl=null,cl=!1;function ll(e,t,n){for(n=n.child;n!==null;)ul(e,t,n),n=n.sibling}function ul(e,t,n){if(ke&&typeof ke.onCommitFiberUnmount==`function`)try{ke.onCommitFiberUnmount(Oe,n)}catch{}switch(n.tag){case 26:el||Gc(n,t),ll(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:el||Gc(n,t);var r=sl,i=cl;ef(n.type)&&(sl=n.stateNode,cl=!1),ll(e,t,n),gf(n.stateNode),sl=r,cl=i;break;case 5:el||Gc(n,t);case 6:if(r=sl,i=cl,sl=null,ll(e,t,n),sl=r,cl=i,sl!==null)if(cl)try{(sl.nodeType===9?sl.body:sl.nodeName===`HTML`?sl.ownerDocument.body:sl).removeChild(n.stateNode)}catch(e){Gu(n,t,e)}else try{sl.removeChild(n.stateNode)}catch(e){Gu(n,t,e)}break;case 18:sl!==null&&(cl?(e=sl,tf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Ip(e)):tf(sl,n.stateNode));break;case 4:r=sl,i=cl,sl=n.stateNode.containerInfo,cl=!0,ll(e,t,n),sl=r,cl=i;break;case 0:case 11:case 14:case 15:Vc(2,n,t),el||Vc(4,n,t),ll(e,t,n);break;case 1:el||(Gc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Uc(n,t,r)),ll(e,t,n);break;case 21:ll(e,t,n);break;case 22:el=(r=el)||n.memoizedState!==null,ll(e,t,n),el=r;break;default:ll(e,t,n)}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ip(e)}catch(e){Gu(t,t.return,e)}}}function fl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ip(e)}catch(e){Gu(t,t.return,e)}}function pl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nl),t;default:throw Error(i(435,e.tag))}}function ml(e,t){var n=pl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Xu.bind(null,e,t);t.then(r,r)}})}function hl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(ef(c.type)){sl=c.stateNode,cl=!1;break a}break;case 5:sl=c.stateNode,cl=!1;break a;case 3:case 4:sl=c.stateNode.containerInfo,cl=!0;break a}c=c.return}if(sl===null)throw Error(i(160));ul(o,s,a),sl=null,cl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_l(t,e),t=t.sibling}var gl=null;function _l(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:hl(t,e),vl(e),r&4&&(Vc(3,e,e.return),Bc(3,e),Vc(5,e,e.return));break;case 1:hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),r&64&&$c&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=gl;if(hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[st]||o[et]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Ld(o,r,n),o[et]=e,pt(o),r=o;break a;case`link`:var s=Wf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Wf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Ld(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[et]=e,pt(o),r=o}e.stateNode=r}else Gf(a,e.type,e.stateNode);else e.stateNode=zf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&qc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Gf(a,e.type,e.stateNode):zf(a,r,e.memoizedProps))}break;case 27:hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),n!==null&&r&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),e.flags&32){a=e.stateNode;try{zt(a,``)}catch(t){Gu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,qc(e,a,n===null?a:n.memoizedProps)),r&1024&&(tl=!0);break;case 6:if(hl(t,e),vl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Gu(e,e.return,t)}}break;case 3:if(Uf=null,a=gl,gl=yf(t.containerInfo),hl(t,e),gl=a,vl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ip(t.containerInfo)}catch(t){Gu(e,e.return,t)}tl&&(tl=!1,yl(e));break;case 4:r=gl,gl=yf(e.stateNode.containerInfo),hl(t,e),vl(e),gl=r;break;case 12:hl(t,e),vl(e);break;case 31:hl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 13:hl(t,e),vl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(tu=ye()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=$c,d=el;if($c=u||a,el=d||l,hl(t,e),el=d,$c=u,vl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||$c||el||xl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Gu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Gu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?nf(m,!0):nf(l.stateNode,!1)}catch(e){Gu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ml(e,n))));break;case 19:hl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 30:break;case 21:break;default:hl(t,e),vl(e)}}function vl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Jc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Zc(e,Yc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(zt(o,``),n.flags&=-33),Zc(e,Yc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Xc(e,Yc(e),s);break;default:throw Error(i(161))}}catch(t){Gu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function bl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)al(e,t.alternate,t),t=t.sibling}function xl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Vc(4,t,t.return),xl(t);break;case 1:Gc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Uc(t,t.return,n),xl(t);break;case 27:gf(t.stateNode);case 26:case 5:Gc(t,t.return),xl(t);break;case 22:t.memoizedState===null&&xl(t);break;case 30:xl(t);break;default:xl(t)}e=e.sibling}}function Sl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Sl(i,a,n),Bc(4,a);break;case 1:if(Sl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Gu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Gu(r,r.return,e)}}n&&o&64&&Hc(a),Wc(a,a.return);break;case 27:Qc(a);case 26:case 5:Sl(i,a,n),n&&r===null&&o&4&&Kc(a),Wc(a,a.return);break;case 12:Sl(i,a,n);break;case 31:Sl(i,a,n),n&&o&4&&dl(i,a);break;case 13:Sl(i,a,n),n&&o&4&&fl(i,a);break;case 22:a.memoizedState===null&&Sl(i,a,n),Wc(a,a.return);break;case 30:break;default:Sl(i,a,n)}t=t.sibling}}function Cl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&na(n))}function wl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function Tl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)El(e,t,n,r),t=t.sibling}function El(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Tl(e,t,n,r),i&2048&&Bc(9,t);break;case 1:Tl(e,t,n,r);break;case 3:Tl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(i&2048){Tl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Gu(t,t.return,e)}}else Tl(e,t,n,r);break;case 31:Tl(e,t,n,r);break;case 13:Tl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Tl(e,t,n,r):(a._visibility|=2,q(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Tl(e,t,n,r):Dl(e,t),i&2048&&Cl(o,t);break;case 24:Tl(e,t,n,r),i&2048&&wl(t.alternate,t);break;default:Tl(e,t,n,r)}}function q(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:q(a,o,s,c,i),Bc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,q(a,o,s,c,i)):u._visibility&2?q(a,o,s,c,i):Dl(a,o),i&&l&2048&&Cl(o.alternate,o);break;case 24:q(a,o,s,c,i),i&&l&2048&&wl(o.alternate,o);break;default:q(a,o,s,c,i)}t=t.sibling}}function Dl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Dl(n,r),i&2048&&Cl(r.alternate,r);break;case 24:Dl(n,r),i&2048&&wl(r.alternate,r);break;default:Dl(n,r)}t=t.sibling}}var J=8192;function Ol(e,t,n){if(e.subtreeFlags&J)for(e=e.child;e!==null;)Y(e,t,n),e=e.sibling}function Y(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&J&&e.memoizedState!==null&&Jf(n,gl,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=gl;gl=yf(e.stateNode.containerInfo),Ol(e,t,n),gl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=J,J=16777216,Ol(e,t,n),J=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function kl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Vc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Vc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;rl!==null;){var n=rl;switch(n.tag){case 0:case 11:case 15:Vc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,rl=r;else a:for(n=e;rl!==null;){r=rl;var i=r.sibling,a=r.return;if(ol(r),r===n){rl=null;break a}if(i!==null){i.return=a,rl=i;break a}rl=a}}}var Pl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Il=0,Ll=null,Rl=null,zl=0,Bl=0,Vl=null,Hl=!1,Ul=!1,Wl=!1,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=null,$l=null,eu=!1,tu=0,nu=0,ru=1/0,iu=null,au=null,ou=0,su=null,cu=null,lu=0,uu=0,du=null,fu=null,pu=0,X=null;function mu(){return Il&2&&zl!==0?zl&-zl:I.T===null?Ze():fd()}function hu(){if(Xl===0)if(!(zl&536870912)||Oi){var e=Ie;Ie<<=1,!(Ie&3932160)&&(Ie=262144),Xl=e}else Xl=536870912;return e=Xa.current,e!==null&&(e.flags|=32),Xl}function Z(e,t,n){(e===Ll&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)&&(Su(e,0),yu(e,zl,Xl,!1)),We(e,n),(!(Il&2)||e!==Ll)&&(e===Ll&&(!(Il&2)&&(Jl|=n),Kl===4&&yu(e,zl,Xl,!1)),id(e))}function gu(e,t,n){if(Il&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Be(e,t),a=r?Au(e,t):Ou(e,t,!0),o=r;do{if(a===0){Ul&&!r&&yu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!vu(n)){a=Ou(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Ql;var l=c.current.memoizedState.isDehydrated;if(l&&(Su(c,s).flags|=256),s=Ou(c,s,!1),s!==2){if(Wl&&!l){c.errorRecoveryDisabledLanes|=o,Jl|=o,a=4;break a}o=$l,$l=a,o!==null&&($l===null?$l=o:$l.push.apply($l,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Su(e,0),yu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:yu(r,t,Xl,!Hl);break a;case 2:$l=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=tu+300-ye(),10<a)){if(yu(r,t,Xl,!Hl),ze(r,0,!0)!==0)break a;lu=t,r.timeoutHandle=Yd(_u.bind(null,r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,o,`Throttled`,-0,0),a);break a}_u(r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,o,null,-0,0)}}break}while(1);id(e)}function _u(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qt},Y(t,a,d);var m=(a&62914560)===a?tu-ye():(a&4194048)===a?nu-ye():0;if(m=Xf(d,m),m!==null){lu=a,e.cancelPendingCommit=m(Lu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),yu(e,a,o,!l);return}}Lu(e,t,a,n,r,i,o,s,c)}function vu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!hr(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 yu(e,t,n,r){t&=~Yl,t&=~Jl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(e,n,t)}function bu(){return Il&6?!0:(ad(0,!1),!1)}function xu(){if(Rl!==null){if(Bl===0)var e=Rl.return;else e=Rl,Vi=Bi=null,To(e),Ta=null,Ea=0,e=Rl;for(;e!==null;)zc(e.alternate,e),e=e.return;Rl=null}}function Su(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Xd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),lu=0,xu(),Ll=e,Rl=n=ri(e.current,null),zl=t,Bl=0,Vl=null,Hl=!1,Ul=Be(e,t),Wl=!1,Zl=Xl=Yl=Jl=ql=Kl=0,$l=Ql=null,eu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-je(r),a=1<<i;t|=e[i],r&=~a}return Gl=t,qr(),n}function Cu(e,t){oo=null,I.H=Is,t===ha||t===_a?(t=Ca(),Bl=3):t===ga?(t=Ca(),Bl=4):Bl=t===ec?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Vl=t,Rl===null&&(Kl=1,Js(e,di(t,e.current)))}function wu(){var e=Xa.current;return e===null?!0:(zl&4194048)===zl?Za===null:(zl&62914560)===zl||zl&536870912?e===Za:!1}function Tu(){var e=I.H;return I.H=Is,e===null?Is:e}function Eu(){var e=I.A;return I.A=Pl,e}function Du(){Kl=4,Hl||(zl&4194048)!==zl&&Xa.current!==null||(Ul=!0),!(ql&134217727)&&!(Jl&134217727)||Ll===null||yu(Ll,zl,Xl,!1)}function Ou(e,t,n){var r=Il;Il|=2;var i=Tu(),a=Eu();(Ll!==e||zl!==t)&&(iu=null,Su(e,t)),t=!1;var o=Kl;a:do try{if(Bl!==0&&Rl!==null){var s=Rl,c=Vl;switch(Bl){case 8:xu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Bl;if(Bl=0,Vl=null,Pu(e,s,c,l),n&&Ul){o=0;break a}break;default:l=Bl,Bl=0,Vl=null,Pu(e,s,c,l)}}ku(),o=Kl;break}catch(t){Cu(e,t)}while(1);return t&&e.shellSuspendCounter++,Vi=Bi=null,Il=r,I.H=i,I.A=a,Rl===null&&(Ll=null,zl=0,qr()),o}function ku(){for(;Rl!==null;)Mu(Rl)}function Au(e,t){var n=Il;Il|=2;var r=Tu(),a=Eu();Ll!==e||zl!==t?(iu=null,ru=ye()+500,Su(e,t)):Ul=Be(e,t);a:do try{if(Bl!==0&&Rl!==null){t=Rl;var o=Vl;b:switch(Bl){case 1:Bl=0,Vl=null,Pu(e,t,o,1);break;case 2:case 9:if(ya(o)){Bl=0,Vl=null,Nu(t);break}t=function(){Bl!==2&&Bl!==9||Ll!==e||(Bl=7),id(e)},o.then(t,t);break a;case 3:Bl=7;break a;case 4:Bl=5;break a;case 7:ya(o)?(Bl=0,Vl=null,Nu(t)):(Bl=0,Vl=null,Pu(e,t,o,7));break;case 5:var s=null;switch(Rl.tag){case 26:s=Rl.memoizedState;case 5:case 27:var c=Rl;if(s?qf(s):c.stateNode.complete){Bl=0,Vl=null;var l=c.sibling;if(l!==null)Rl=l;else{var u=c.return;u===null?Rl=null:(Rl=u,Fu(u))}break b}}Bl=0,Vl=null,Pu(e,t,o,5);break;case 6:Bl=0,Vl=null,Pu(e,t,o,6);break;case 8:xu(),Kl=6;break a;default:throw Error(i(462))}}ju();break}catch(t){Cu(e,t)}while(1);return Vi=Bi=null,I.H=r,I.A=a,Il=n,Rl===null?(Ll=null,zl=0,qr(),Kl):0}function ju(){for(;Rl!==null&&!_e();)Mu(Rl)}function Mu(e){var t=Ac(e.alternate,e,Gl);e.memoizedProps=e.pendingProps,t===null?Fu(e):Rl=t}function Nu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=mc(n,t,t.pendingProps,t.type,void 0,zl);break;case 11:t=mc(n,t,t.pendingProps,t.type.render,t.ref,zl);break;case 5:To(t);default:zc(n,t),t=Rl=ii(t,Gl),t=Ac(n,t,Gl)}e.memoizedProps=e.pendingProps,t===null?Fu(e):Rl=t}function Pu(e,t,n,r){Vi=Bi=null,To(t),Ta=null,Ea=0;var i=t.return;try{if($s(e,i,t,n,zl)){Kl=1,Js(e,di(n,e.current)),Rl=null;return}}catch(t){if(i!==null)throw Rl=i,t;Kl=1,Js(e,di(n,e.current)),Rl=null;return}t.flags&32768?(Oi||r===1?e=!0:Ul||zl&536870912?e=!1:(Hl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Iu(t,e)):Fu(t)}function Fu(e){var t=e;do{if(t.flags&32768){Iu(t,Hl);return}e=t.return;var n=Lc(t.alternate,t,Gl);if(n!==null){Rl=n;return}if(t=t.sibling,t!==null){Rl=t;return}Rl=t=e}while(t!==null);Kl===0&&(Kl=5)}function Iu(e,t){do{var n=Rc(e.alternate,e);if(n!==null){n.flags&=32767,Rl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Rl=e;return}Rl=e=n}while(e!==null);Kl=6,Rl=null}function Lu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Hu();while(ou!==0);if(Il&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Kr,Ge(e,n,o,s,c,l),e===Ll&&(Rl=Ll=null,zl=0),cu=t,su=e,lu=n,uu=o,du=a,fu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Zu(Ce,function(){return Uu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Il,Il|=4;try{il(e,t,n)}finally{Il=s,L.p=a,I.T=r}}ou=1,Ru(),zu(),Bu()}}function Ru(){if(ou===1){ou=0;var e=su,t=cu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Il;Il|=4;try{_l(t,e);var a=Hd,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}up=!!Vd,Hd=Vd=null}finally{Il=i,L.p=r,I.T=n}}e.current=t,ou=2}}function zu(){if(ou===2){ou=0;var e=su,t=cu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Il;Il|=4;try{al(e,t.alternate,t)}finally{Il=i,L.p=r,I.T=n}}ou=3}}function Bu(){if(ou===4||ou===3){ou=0,ve();var e=su,t=cu,n=lu,r=fu;t.subtreeFlags&10256||t.flags&10256?ou=5:(ou=0,cu=su=null,Vu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(au=null),Xe(n),t=t.stateNode,ke&&typeof ke.onCommitFiberRoot==`function`)try{ke.onCommitFiberRoot(Oe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}lu&3&&Hu(),id(e),i=e.pendingLanes,n&261930&&i&42?e===X?pu++:(pu=0,X=e):pu=0,ad(0,!1)}}function Vu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Hu(){return Ru(),zu(),Bu(),Uu()}function Uu(){if(ou!==5)return!1;var e=su,t=uu;uu=0;var n=Xe(lu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=du,du=null;var o=su,s=lu;if(ou=0,cu=su=null,lu=0,Il&6)throw Error(i(331));var c=Il;if(Il|=4,jl(o.current),El(o,o.current,s,n),Il=c,ad(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,o)}catch{}return!0}finally{L.p=a,I.T=r,Vu(e,t)}}function Wu(e,t,n){t=di(n,t),t=Xs(e.stateNode,t,2),e=La(e,t,2),e!==null&&(We(e,2),id(e))}function Gu(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(au===null||!au.has(r))){e=di(n,e),n=Zs(2),r=La(t,n,2),r!==null&&(Qs(n,r,t,e),We(r,2),id(r));break}}t=t.return}}function Ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;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)||(Wl=!0,i.add(n),e=qu.bind(null,e,t,n),t.then(e,e))}function qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(zl&n)===n&&(Kl===4||Kl===3&&(zl&62914560)===zl&&300>ye()-tu?!(Il&2)&&Su(e,0):Yl|=n,Zl===zl&&(Zl=0)),id(e)}function Ju(e,t){t===0&&(t=He()),e=Xr(e,t),e!==null&&(We(e,t),id(e))}function Yu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ju(e,n)}function Xu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Ju(e,n)}function Zu(e,t){return he(e,t)}var Qu=null,$u=null,ed=!1,td=!1,nd=!1,rd=0;function id(e){e!==$u&&e.next===null&&($u===null?Qu=$u=e:$u=$u.next=e),td=!0,ed||(ed=!0,dd())}function ad(e,t){if(!nd&&td){nd=!0;do for(var n=!1,r=Qu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ud(r,a))}else a=zl,a=ze(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Be(r,a)||(n=!0,ud(r,a));r=r.next}while(n);nd=!1}}function od(){sd()}function sd(){td=ed=!1;var e=0;rd!==0&&Jd()&&(e=rd);for(var t=ye(),n=null,r=Qu;r!==null;){var i=r.next,a=cd(r,t);a===0?(r.next=null,n===null?Qu=i:n.next=i,i===null&&($u=n)):(n=r,(e!==0||a&3)&&(td=!0)),r=i}ou!==0&&ou!==5||ad(e,!1),rd!==0&&(rd=0)}function cd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ve(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=zl,n=ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ge(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Be(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ge(r),Xe(n)){case 2:case 8:n=Se;break;case 32:n=Ce;break;case 268435456:n=Te;break;default:n=Ce}return r=ld.bind(null,e),n=he(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ge(r),e.callbackPriority=2,e.callbackNode=null,2}function ld(e,t){if(ou!==0&&ou!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Hu()&&e.callbackNode!==n)return null;var r=zl;return r=ze(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(gu(e,r,t),cd(e,ye()),e.callbackNode!=null&&e.callbackNode===n?ld.bind(null,e):null)}function ud(e,t){if(Hu())return null;gu(e,t,!0)}function dd(){Qd(function(){Il&6?he(xe,od):sd()})}function fd(){if(rd===0){var e=aa;e===0&&(e=Fe,Fe<<=1,!(Fe&261888)&&(Fe=256)),rd=e}return rd}function pd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Kt(``+e)}function md(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function hd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=pd((i[tt]||null).action),o=r.submitter;o&&(t=(t=o[tt]||null)?pd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(rd!==0){var e=o?md(i,o):new FormData(i);Ss(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?md(i,o):new FormData(i),Ss(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var gd=0;gd<Vr.length;gd++){var _d=Vr[gd];Hr(_d.toLowerCase(),`on`+(_d[0].toUpperCase()+_d.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`onTransitionEnd`),_t(`onMouseEnter`,[`mouseout`,`mouseover`]),_t(`onMouseLeave`,[`mouseout`,`mouseover`]),_t(`onPointerEnter`,[`pointerout`,`pointerover`]),_t(`onPointerLeave`,[`pointerout`,`pointerover`]),gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var vd=`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(` `),yd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(vd));function bd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}}}}function xd(e,t){var n=t[rt];n===void 0&&(n=t[rt]=new Set);var r=e+`__bubble`;n.has(r)||(Td(t,e,2,!1),n.add(r))}function Sd(e,t,n){var r=0;t&&(r|=4),Td(n,e,r,t)}var Cd=`_reactListening`+Math.random().toString(36).slice(2);function wd(e){if(!e[Cd]){e[Cd]=!0,mt.forEach(function(t){t!==`selectionchange`&&(yd.has(t)||Sd(t,!1,e),Sd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Cd]||(t[Cd]=!0,Sd(`selectionchange`,!1,t))}}function Td(e,t,n,r){switch(_p(t)){case 2:var i=dp;break;case 8:i=fp;break;default:i=pp}n=i.bind(null,t,n,e),i=void 0,!rn||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 Ed(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=lt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}en(function(){var r=a,i=Yt(n),s=[];a:{var c=Br.get(e);if(c!==void 0){var l=hn,u=e;switch(e){case`keypress`:if(un(n)===0)break a;case`keydown`:case`keyup`:l=Nn;break;case`focusin`:u=`focus`,l=wn;break;case`focusout`:u=`blur`,l=wn;break;case`beforeblur`:case`afterblur`:l=wn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Fn;break;case Nr:case Pr:case Fr:l=Tn;break;case zr:l=In;break;case`scroll`:case`scrollend`:l=_n;break;case`wheel`:l=Ln;break;case`copy`:case`cut`:case`paste`:l=En;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Pn;break;case`toggle`:case`beforetoggle`:l=Rn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=tn(m,p),g!=null&&d.push(Dd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Jt&&(u=n.relatedTarget||n.fromElement)&&(lt(u)||u[nt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?lt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Pn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:dt(l),h=u==null?c:dt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,lt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=kd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ad(s,c,l,d,!1),u!==null&&f!==null&&Ad(s,f,u,d,!0)}}a:{if(c=r?dt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if(Qn(c))if(ar)v=mr;else{v=fr;var y=dr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ut(r.elementType)&&(v=ir):v=pr;if(v&&=v(e,r)){$n(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ft(c,`number`,c.value)}switch(y=r?dt(r):window,e){case`focusin`:(Qn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(Bn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Jn?Kn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Un&&n.locale!==`ko`&&(Jn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Jn&&(b=ln()):(on=i,sn=`value`in on?on.value:on.textContent,Jn=!0)),y=Od(r,x),0<y.length&&(x=new Dn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=qn(n),b!==null&&(x.data=b)))),(b=Hn?Yn(e,n):Xn(e,n))&&(x=Od(r,`onBeforeInput`),0<x.length&&(y=new Dn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),hd(s,e,r,n,i)}bd(s,t)})}function Dd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Od(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=tn(e,n),i!=null&&r.unshift(Dd(e,i,a)),i=tn(e,t),i!=null&&r.push(Dd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function kd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ad(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=tn(n,a),l!=null&&o.unshift(Dd(n,l,c))):i||(l=tn(n,a),l!=null&&o.push(Dd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var jd=/\r\n?/g,Md=/\u0000|\uFFFD/g;function Nd(e){return(typeof e==`string`?e:``+e).replace(jd,`
`).replace(Md,``)}function Pd(e,t){return t=Nd(t),Nd(e)===t}function Fd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ht(e,r,o);break;case`data`:if(t!==`object`){Ct(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Fd(e,t,`name`,a.name,a,null),Fd(e,t,`formEncType`,a.formEncType,a,null),Fd(e,t,`formMethod`,a.formMethod,a,null),Fd(e,t,`formTarget`,a.formTarget,a,null)):(Fd(e,t,`encType`,a.encType,a,null),Fd(e,t,`method`,a.method,a,null),Fd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Kt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:xd(`beforetoggle`,e),xd(`toggle`,e),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Wt.get(n)||n,St(e,n,r))}}function Id(e,t,n,r,a,o){switch(n){case`style`:Ht(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(e,``+r);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[tt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):St(e,n,r)}}}function Ld(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:xd(`error`,e),xd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,o,s,n,null)}}a&&Fd(e,t,`srcSet`,n.srcSet,n,null),r&&Fd(e,t,`src`,n.src,n,null);return;case`input`:xd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Fd(e,t,r,d,n,null)}}Pt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in xd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Fd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&It(e,!!r,n,!0):It(e,!!r,t,!1);return;case`textarea`:for(s in xd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Fd(e,t,s,c,n,null)}Rt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Fd(e,t,l,r,n,null)}return;case`dialog`:xd(`beforetoggle`,e),xd(`toggle`,e),xd(`cancel`,e),xd(`close`,e);break;case`iframe`:case`object`:xd(`load`,e);break;case`video`:case`audio`:for(r=0;r<vd.length;r++)xd(vd[r],e);break;case`image`:xd(`error`,e),xd(`load`,e);break;case`details`:xd(`toggle`,e);break;case`embed`:case`source`:case`link`:xd(`error`,e),xd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Fd(e,t,u,r,n,null)}return;default:if(Ut(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Id(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Fd(e,t,c,r,n,null))}function Rd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Fd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Fd(e,t,p,m,r,f)}}Nt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Fd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Fd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?It(e,!!n,n?[]:``,!1):It(e,!!n,t,!0)):It(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Fd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Fd(e,t,s,a,r,o)}Lt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Fd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Fd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Fd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Fd(e,t,u,p,r,m)}return;default:if(Ut(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Id(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Id(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Fd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Fd(e,t,f,p,r,m)}function zd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Bd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&zd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&zd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Vd=null,Hd=null;function Ud(e){return e.nodeType===9?e:e.ownerDocument}function Wd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Gd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Kd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var qd=null;function Jd(){var e=window.event;return e&&e.type===`popstate`?e===qd?!1:(qd=e,!0):(qd=null,!1)}var Yd=typeof setTimeout==`function`?setTimeout:void 0,Xd=typeof clearTimeout==`function`?clearTimeout:void 0,Zd=typeof Promise==`function`?Promise:void 0,Qd=typeof queueMicrotask==`function`?queueMicrotask:Zd===void 0?Yd:function(e){return Zd.resolve(null).then(e).catch($d)};function $d(e){setTimeout(function(){throw e})}function ef(e){return e===`head`}function tf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)gf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,gf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[st]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&gf(e.ownerDocument.body);n=i}while(n);Ip(t)}function nf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function rf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rf(n),ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function af(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[st])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=df(e.nextSibling),e===null)break}return null}function of(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=df(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=df(e.nextSibling),e===null))return null;return e}function cf(e){return e.data===`$?`||e.data===`$~`}function lf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function uf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function df(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ff=null;function pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return df(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hf(e,t,n){switch(t=Ud(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ct(e)}var _f=new Map,vf=new Set;function yf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var bf=L.d;L.d={f:xf,r:Sf,D:Tf,C:Ef,L:Df,m:Of,X:Af,S:kf,M:jf};function xf(){var e=bf.f(),t=bu();return e||t}function Sf(e){var t=ut(e);t!==null&&t.tag===5&&t.type===`form`?ws(t):bf.r(e)}var Cf=typeof document>`u`?null:document;function wf(e,t,n){var r=Cf;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),vf.has(i)||(vf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ld(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Tf(e){bf.D(e),wf(`dns-prefetch`,e,null)}function Ef(e,t){bf.C(e,t),wf(`preconnect`,e,t)}function Df(e,t,n){bf.L(e,t,n);var r=Cf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=Nf(e);break;case`script`:a=Lf(e)}_f.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),_f.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Pf(a))||t===`script`&&r.querySelector(Rf(a))||(t=r.createElement(`link`),Ld(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Of(e,t){bf.m(e,t);var n=Cf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Lf(e)}if(!_f.has(a)&&(e=f({rel:`modulepreload`,href:e},t),_f.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Rf(a)))return}r=n.createElement(`link`),Ld(r,`link`,e),pt(r),n.head.appendChild(r)}}}function kf(e,t,n){bf.S(e,t,n);var r=Cf;if(r&&e){var i=ft(r).hoistableStyles,a=Nf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Pf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=_f.get(a))&&Vf(e,n);var c=o=r.createElement(`link`);pt(c),Ld(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Bf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Af(e,t){bf.X(e,t);var n=Cf;if(n&&e){var r=ft(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=f({src:e,async:!0},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),pt(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t){bf.M(e,t);var n=Cf;if(n&&e){var r=ft(n).hoistableScripts,i=Lf(e),a=r.get(i);a||(a=n.querySelector(Rf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=_f.get(i))&&Hf(e,t),a=n.createElement(`script`),pt(a),Ld(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t,n,r){var a=(a=W.current)?yf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Nf(n.href),n=ft(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Nf(n.href);var o=ft(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Pf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),_f.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},_f.set(e,n),o||If(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Lf(n),n=ft(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Nf(e){return`href="`+Mt(e)+`"`}function Pf(e){return`link[rel="stylesheet"][`+e+`]`}function Ff(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function If(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Ld(t,`link`,n),pt(t),e.head.appendChild(t))}function Lf(e){return`[src="`+Mt(e)+`"]`}function Rf(e){return`script[async]`+e}function zf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),Ld(r,`style`,a),Bf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Nf(n.href);var o=e.querySelector(Pf(a));if(o)return t.state.loading|=4,t.instance=o,pt(o),o;r=Ff(n),(a=_f.get(a))&&Vf(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Ld(o,`link`,r),t.state.loading|=4,Bf(o,n.precedence,e),t.instance=o;case`script`:return o=Lf(n.src),(a=e.querySelector(Rf(o)))?(t.instance=a,pt(a),a):(r=n,(a=_f.get(o))&&(r=f({},n),Hf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(a),Ld(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Bf(r,n.precedence,e));return t.instance}function Bf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Uf=null;function Wf(e,t,n){if(Uf===null){var r=new Map,i=Uf=new Map;i.set(n,r)}else i=Uf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[st]||a[et]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Gf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Kf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Jf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Nf(r.href),a=t.querySelector(Pf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Zf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=Ff(r),(i=_f.get(i))&&Vf(r,i),a=a.createElement(`link`),pt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ld(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Zf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Yf=0;function Xf(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Yf===0&&(Yf=62500*Bd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Yf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Zf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qf=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qf=new Map,t.forEach(ep,e),Qf=null,Zf.call(e))}function ep(e,t){if(!(t.state.loading&4)){var n=Qf.get(e);if(n)var r=n.get(null);else{n=new Map,Qf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Zf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var tp={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function np(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function rp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new np(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function ip(e){return e?(e=$r,e):$r}function ap(e,t,n,r,i,a){i=ip(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(Z(n,e,t),Ra(n,e,t))}function op(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function sp(e,t){op(e,t),(e=e.alternate)&&op(e,t)}function cp(e){if(e.tag===13||e.tag===31){var t=Xr(e,67108864);t!==null&&Z(t,e,67108864),sp(e,67108864)}}function lp(e){if(e.tag===13||e.tag===31){var t=mu();t=Ye(t);var n=Xr(e,t);n!==null&&Z(n,e,t),sp(e,t)}}var up=!0;function dp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,pp(e,t,n,r)}finally{L.p=a,I.T=i}}function fp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,pp(e,t,n,r)}finally{L.p=a,I.T=i}}function pp(e,t,n,r){if(up){var i=mp(r);if(i===null)Ed(e,t,r,hp,n),Ep(e,r);else if(Op(i,e,t,n,r))r.stopPropagation();else if(Ep(e,r),t&4&&-1<Tp.indexOf(e)){for(;i!==null;){var a=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}id(a),!(Il&6)&&(ru=ye()+500,ad(0,!1))}}break;case 31:case 13:s=Xr(a,2),s!==null&&Z(s,a,2),bu(),sp(a,2)}if(a=mp(r),a===null&&Ed(e,t,r,hp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ed(e,t,r,null,n)}}function mp(e){return e=Yt(e),gp(e)}var hp=null;function gp(e){if(hp=null,e=lt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return hp=e,null}function _p(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(be()){case xe:return 2;case Se:return 8;case Ce:case we:return 32;case Te:return 268435456;default:return 32}default:return 32}}var vp=!1,yp=null,bp=null,xp=null,Sp=new Map,Cp=new Map,wp=[],Tp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ep(e,t){switch(e){case`focusin`:case`focusout`:yp=null;break;case`dragenter`:case`dragleave`:bp=null;break;case`mouseover`:case`mouseout`:xp=null;break;case`pointerover`:case`pointerout`:Sp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Cp.delete(t.pointerId)}}function Dp(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=ut(t),t!==null&&cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Op(e,t,n,r,i){switch(t){case`focusin`:return yp=Dp(yp,e,t,n,r,i),!0;case`dragenter`:return bp=Dp(bp,e,t,n,r,i),!0;case`mouseover`:return xp=Dp(xp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Sp.set(a,Dp(Sp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Cp.set(a,Dp(Cp.get(a)||null,e,t,n,r,i)),!0}return!1}function kp(e){var t=lt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){lp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){lp(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 Ap(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Jt=r,n.target.dispatchEvent(r),Jt=null}else return t=ut(n),t!==null&&cp(t),e.blockedOn=n,!1;t.shift()}return!0}function jp(e,t,n){Ap(e)&&n.delete(t)}function Mp(){vp=!1,yp!==null&&Ap(yp)&&(yp=null),bp!==null&&Ap(bp)&&(bp=null),xp!==null&&Ap(xp)&&(xp=null),Sp.forEach(jp),Cp.forEach(jp)}function Np(e,n){e.blockedOn===n&&(e.blockedOn=null,vp||(vp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Mp)))}var Pp=null;function Fp(e){Pp!==e&&(Pp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Pp===e&&(Pp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(gp(r||n)===null)continue;break}var a=ut(n);a!==null&&(e.splice(t,3),t-=3,Ss(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ip(e){function t(t){return Np(t,e)}yp!==null&&Np(yp,e),bp!==null&&Np(bp,e),xp!==null&&Np(xp,e),Sp.forEach(t),Cp.forEach(t);for(var n=0;n<wp.length;n++){var r=wp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wp.length&&(n=wp[0],n.blockedOn===null);)kp(n),n.blockedOn===null&&wp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[tt]||null;if(typeof a==`function`)o||Fp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||null)s=o.formAction;else if(gp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Fp(n)}}}function Lp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Rp(e){this._internalRoot=e}zp.prototype.render=Rp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ap(n,mu(),e,t,null,null)},zp.prototype.unmount=Rp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ap(e.current,2,null,e,null,null),bu(),t[nt]=null}};function zp(e){this._internalRoot=e}zp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();e={blockedOn:null,target:e,priority:t};for(var n=0;n<wp.length&&t!==0&&t<wp[n].priority;n++);wp.splice(n,0,e),n===0&&kp(e)}};var Bp=n.version;if(Bp!==`19.2.7`)throw Error(i(527,Bp,`19.2.7`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Vp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Hp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hp.isDisabled&&Hp.supportsFiber)try{Oe=Hp.inject(Vp),ke=Hp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Gs,s=Ks,c=qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=rp(e,1,!1,null,null,n,r,null,o,s,c,Lp),e[nt]=t.current,wd(e),new Rp(t)},e.hydrateRoot=function(e,t,n){if(!a(e))throw Error(i(299));var r=!1,o=``,s=Gs,c=Ks,l=qs,u=null;return n!=null&&(!0===n.unstable_strictMode&&(r=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(s=n.onUncaughtError),n.onCaughtError!==void 0&&(c=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.formState!==void 0&&(u=n.formState)),t=rp(e,1,!0,t,n??null,r,o,u,s,c,l,Lp),t.context=ip(null),n=t.current,r=mu(),r=Ye(r),o=Ia(r),o.callback=null,La(n,o,r),n=r,t.current.lanes=n,We(t,n),id(t),e[nt]=t.current,wd(e),new zp(t)}})),b=a(f(((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=y()}))(),1);function x(e){return e instanceof Function||typeof e==`function`}var S=[`Head`,`bodyAttributes`,`htmlAttributes`];function C(e,t){return e.includes(t)}function w(e,t){let n=t._configViaHook?.[e],r=t.config[e],i=e=>x(e)?e(t):e;return C(S,e)?[...(r??[]).map(i),...n??[]]:n===void 0?i(r):n}var T=a(g(),1);function E(e,t){let n=globalThis[D]=globalThis[D]||{};return n[e]=n[e]||t}var D=`_vike_react`,O=E(`usePageContext.tsx`,{reactContext:T.createContext(void 0)});function k({pageContext:e,children:t}){let{reactContext:n}=O;return T.createElement(n.Provider,{value:e},t)}function A(){let{reactContext:e}=O;return(0,T.useContext)(e)}function j(e){let{Page:t,config:{Loading:n}}=e,r=t?T.createElement(t,null):null,i=e=>n?.layout?T.createElement(T.Suspense,{fallback:T.createElement(n.layout,null)},r):e;r=i(r),[...e.config.Layout||[],...e.config.Wrapper||[]].forEach(e=>{r=T.createElement(e,null,r),r=i(r)}),r=T.createElement(k,{pageContext:e},r);let a,o,s=new Promise((e,t)=>{a=e,o=t});return r=T.createElement(M,{renderPromiseResolve:a},r),e.config.reactStrictMode!==!1&&(r=T.createElement(T.StrictMode,null,r)),{page:r,renderPromise:s,renderPromiseReject:o}}function M({children:e,renderPromiseResolve:t}){return(0,T.useEffect)(t),e}async function N(e,t){if(!e)return[];let n=e.map(e=>x(e)?(u(t),e(t)):e);return await Promise.all(n)}function P(e,t){e!==void 0&&(document.title=e||``),t!==void 0&&(document.documentElement.lang=t||`en`)}function F(e){return Object.entries(e)}function I(e){let t={};return(e.config.react??[]).forEach(n=>{let r=x(n)?n(e):n;r&&F(r).forEach(([e,n])=>{n&&(t[e]??(t[e]={}),F(n).forEach(([n,r])=>{var i;if(!x(r))(i=t[e])[n]??(i[n]=r);else{let i=t[e][n];t[e][n]=(...e)=>{i?.(...e),r(...e)}}}))})}),t}function L(e){return typeof e==`object`&&!!e}function R(e,t){return Object.assign(e,t),e}var z=E(`onRenderClient.tsx`,{});async function B(e){e._headAlreadySet=e.isHydration,await N(e.config.onBeforeRenderClient,e);let{page:t,renderPromise:n,renderPromiseReject:r}=j(e);e.page=t,z.onUncaughtErrorLocal=e=>{r(e)};let i=document.getElementById(`root`),{hydrateRootOptions:a,createRootOptions:o}=I(e);e.isHydration&&i.innerHTML!==``?z.root=b.hydrateRoot(i,t,{...a,onUncaughtError(...e){V.call(this,e,a)}}):(z.root||=b.createRoot(i,{...o,onUncaughtError(...e){V.call(this,e,o)}}),z.root.render(t)),e.root=z.root;try{await n}finally{delete z.onUncaughtErrorLocal}e.isHydration||(e._headAlreadySet=!0,ee(e)),await N(e.config.onAfterRenderClient,e)}function ee(e){P(w(`title`,e),w(`lang`,e))}function V(e,t){let[n,r]=e,i=H(n,r);console.error(i),L(i)&&(i.isAlreadyLogged=!0),z.onUncaughtErrorLocal?.(i),t?.onUncaughtError?.call(this,i,r)}function H(e,t){if(!t?.componentStack||!L(e))return e;let n=String(e.stack).split(`
`),r=n.findIndex(e=>e.includes(`react_stack_bottom_frame`));if(r===-1&&(r=n.findIndex(e=>e.includes(`node_modules`)&&e.includes(`react`))),r===-1)return e;let i=n.slice(0,r),a=n.slice(r),o=t.componentStack.split(`
`).filter(Boolean);return o[0]===i.at(-1)&&o.shift(),R(e,{stack:[...i,...o,...a].join(`
`)})}function te(e,t){let n=Error(e);return n.stack=U(n.stack,t),n}function U(e,t){if(!e)return e;let n=ne(e),r=0;return n.filter(e=>e.includes(` (internal/`)||e.includes(` (node:internal`)?!1:r<t&&W(e)?(r++,!1):!0).join(`
`)}function W(e){return e.startsWith(`    at `)}function ne(e){return e.split(/\r?\n/)}function re(e,t){let n=globalThis[ie]=globalThis[ie]||{};return n[e]||(n[e]=typeof t==`function`?t():t),n[e]}var ie=`_telefunc`,ae={projectName:`Telefunc`,projectVersion:`0.2.22`},oe=`[telefunc@${ae.projectVersion}]`,se=he(`${oe}[Bug]`),ce=he(`${oe}[Wrong Usage]`),le=ge(`${oe}[Warning]`);_e(`${oe}[Info]`);var ue=2;function de(e,t){if(!e)throw te([se,`You stumbled upon a Telefunc bug. Go to https://github.com/telefunc/telefunc/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).`,(()=>{if(!t)return``;let e=typeof t==`string`?t:"`"+JSON.stringify(t)+"`";return`Debug info (this is for the ${ae.projectName} maintainers; you can ignore this): ${e}.`})()].join(` `),ue)}function fe(e,t){if(!e)throw te(`${ce}${t.startsWith(`[`)?``:` `}${t}`,ue)}var pe=re(`assert.ts`,{alreadyLogged:new Set});function me(e,t,{onlyOnce:n,showStackTrace:r}){if(e)return;let i=`${le} ${t}`;if(n){let{alreadyLogged:e}=pe,t=n===!0?i:n;if(e.has(t))return;e.add(t)}console.warn(r?Error(i):i)}function he(e){return i.red(i.bold(e))}function ge(e){return i.yellow(i.bold(e))}function _e(e){return i.blue(i.bold(e))}function ve(e){return typeof e==`object`&&!!e}var ye=`!TelefuncFile:`,be=`!TelefuncBlob:`,xe=`!TelefuncFileDownload:`,Se=`!TelefuncBlobDownload:`,Ce=`!TelefuncStream:`,we=`!TelefuncGenerator:`,Te=`!TelefuncPromise:`,Ee=`!TelefuncChannel:`,De=`!TelefuncFunction:`,Oe=`!TelefuncBroadcast:`,ke={ABORT:`abort`,BUG:`bug`},Ae={BINARY_INLINE:`binary-inline`,CHANNEL:`channel`,SSE_INLINE:`sse-inline`},je={SSE:`sse`,WS:`ws`};Ae.BINARY_INLINE;var Me=[je.SSE,je.WS];je.SSE;var Ne=3e3,Pe=2e3,Fe=2e3,Ie=1e4,Le=6e4,Re=6e4,ze=5e3,Be=5e3,Ve=1024*1024,He=2*1024*1024,Ue=5e3,We=2*1024*1024,Ge=8*1024*1024,Ke=64*1024*1024,qe=5e4,Je=1e4,Ye=1e3,Xe=`x-telefunc-session`,Ze={stream:{},channel:{},extensions:[]};new Proxy({},{get(e,t){return t===`extensions`?new Proxy(Ze.extensions,{get(e,t,n){return t===`push`?(...t)=>{for(let n of t){let t=e.findIndex(e=>e.name===n.name);t>=0?e[t]=n:e.push(n)}return e.length}:Reflect.get(e,t,n)}}):t===`stream`?new Proxy({},{get(e,t){return Ze.stream[t]},set(e,t,n){return typeof t==`string`&&et({...Ze.stream,[t]:n}),!0}}):t===`channel`?new Proxy({},{get(e,t){return Ze.channel[t]},set(e,t,n){return typeof t==`string`&&tt({...Ze.channel,[t]:n}),!0}}):Ze[t]},set(e,t,n){return $e(t,n),!0}});function Qe(){return{headers:Ze.headers??Ze.httpHeaders??null,telefuncUrl:Ze.telefuncUrl||`/_telefunc`,fetch:Ze.fetch??null,stream:Ze.stream.transport?{...Ze.stream}:void 0,channel:{transports:Ze.channel.transports??[...Me]},extensionResponseTypes:Ze.extensions.flatMap(e=>e.responseTypes??[]),extensionRequestTypes:Ze.extensions.flatMap(e=>e.requestTypes??[])}}function $e(e,t){typeof e==`string`&&(e===`telefuncUrl`?(fe(typeof t==`string`,`config.telefuncUrl should be a string`),fe(t.startsWith(`/`)||t.startsWith(`http`)||(e=>/^\d/.test(e))(t),`config.telefuncUrl (client-side) is '${t}' but it should be one of the following: a URL pathname (such as '/_telefunc'), a URL with origin (such as 'https://example.org/_telefunc'), or an IP address (such as '192.158.1.38') — see https://telefunc.com/telefuncUrl`),Ze.telefuncUrl=t):e===`headers`?(fe(typeof t==`object`&&!!t&&Object.values(t).every(e=>typeof e==`string`),"`config.headers` should be an object of strings"),Ze.headers=t):e===`httpHeaders`?(me(!1,"`config.httpHeaders` (client-side) is deprecated, use `config.headers` instead",{onlyOnce:!0,showStackTrace:!0}),fe(typeof t==`object`&&!!t&&Object.values(t).every(e=>typeof e==`string`),"`config.httpHeaders` should be an object of strings"),Ze.httpHeaders=t):e===`fetch`?(fe(typeof t==`function`,"`config.fetch` should be a function"),Ze.fetch=t):e===`stream`?et(t):e===`channel`?tt(t):e===`extensions`?(fe(Array.isArray(t),`config.extensions should be an array`),Ze.extensions=t):fe(!1,`Unknown config.${e}`))}function et(e){fe(ve(e),`config.stream should be an object`);let t={};for(let[n,r]of Object.entries(e))n===`transport`?t.transport=nt(r,`config.stream.transport`):fe(!1,`Unknown config.stream.${n}`);Ze.stream=t}function tt(e){fe(ve(e),`config.channel should be an object`);let t={};for(let[n,r]of Object.entries(e))n===`transports`?t.transports=rt(r,`config.channel.transports`):fe(!1,`Unknown config.channel.${n}`);Ze.channel=t}function nt(e,t){return fe(e===`binary-inline`||e===`sse-inline`||e===`channel`,`\`${t}\` should be 'binary-inline', 'sse-inline', or 'channel'`),e}function rt(e,t){return fe(Array.isArray(e)&&e.length>0&&e.every(e=>e===`sse`||e===`ws`),`\`${t}\` should be an array of transports, e.g. ['sse'] or ['sse', 'ws']`),e}function it(e){(window.__telefunc_errorListeners||[]).forEach(t=>{t(e)})}var at=Symbol.for(`telefuncAbort`);function ot(e,t){let n=e;n[at]=t}function st(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var ct=Symbol.for(`telefuncCloseHandlers`),lt=Symbol.for(`telefuncExtraCloseHandlers`);function ut(e,t){let n=e;n[ct]=t}function dt(e,t){if(t.length===0)return;let n=e;n[lt]=t}var ft,pt=Symbol.for(`telefunc.Abort`),mt=`Aborted`,ht=class extends Error{constructor(e,t){var n;super(t??yt(e)),this[ft]=!0,this.isAbort=!0,Object.setPrototypeOf(this,new.target.prototype),this.name=`Abort`,this.abortValue=e,(n=Error.captureStackTrace)==null||n.call(Error,this,gt)}};ft=pt;var gt=function(e){return fe(!new.target,"Do not use the `new` operator: use `throw Abort()` instead of `throw new Abort()`."),fe(arguments.length<=1,"Abort() accepts only a single argument: use `throw Abort([arg1, arg2])` instead of `throw Abort(arg1, arg2).`"),_t(e)};Object.defineProperty(gt,Symbol.hasInstance,{value:e=>vt(e)});function _t(e,t){return new ht(e,t)}function vt(e){return e instanceof ht||typeof e==`object`&&!!e&&pt in e}function yt(e){if(typeof e==`string`)return e;if(e instanceof Error)return e.message;if(typeof e==`object`&&e&&`message`in e){let{message:t}=e;if(typeof t==`string`)return t}return mt}var bt,xt=Symbol.for(`telefunc.ShieldValidationError`),St=class e extends Error{constructor(t){var n;super(t),this[bt]=!0,Object.setPrototypeOf(this,new.target.prototype),this.name=`ShieldValidationError`,(n=Error.captureStackTrace)==null||n.call(Error,this,e)}};bt=xt;var Ct=re(`withContext.ts`,{pendingContext:null});function wt(){let e=Ct.pendingContext;return Ct.pendingContext=null,e}var Tt=class extends Error{constructor(e,t){var n;super(e),Object.setPrototypeOf(this,new.target.prototype),this.name=`NetworkError`,this.isChannel=t,(n=Error.captureStackTrace)==null||n.call(Error,this,new.target)}},Et=class extends Tt{constructor(e=`No Server Connection`){super(e,!1),this.isConnectionError=!0,this.name=`ConnectionError`}},Dt=class extends Error{constructor(e=`Channel is closed`){super(e),this.name=`ChannelClosedError`}},Ot=new TextEncoder,kt={encode:e=>Ot.encode(e)},At=new TextDecoder,jt=4;function Mt(e){let t=new Uint8Array(jt);return new DataView(t.buffer).setUint32(0,e,!1),t}function Nt(e,t=0){return new DataView(e.buffer,e.byteOffset+t,jt).getUint32(0,!1)}function Pt(...e){if(e.length===2){let[t,n]=e,r=new Uint8Array(t.length+n.length);return r.set(t,0),r.set(n,t.length),r}let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ft(e,t){let n=e=>t?t(e):e,r=0;for(let t of e){let e=n(t);r+=jt+e.byteLength}let i=new Uint8Array(r),a=0;for(let t of e){let e=n(t);i.set(Mt(e.byteLength),a),a+=jt,i.set(e,a),a+=e.byteLength}return i}function It(e,t){let n=kt.encode(e);return new Blob([Mt(n.length),n,...t])}function Lt(e){let t=kt.encode(e),n=new Uint8Array(jt+t.byteLength);return new DataView(n.buffer).setUint32(0,t.byteLength,!1),n.set(t,jt),n}var Rt=1;function zt(e){return{index:e[0],payload:e.subarray(Rt)}}var Bt=`Malformed Telefunc Request`,Vt=`Shield Validation Error`,Ht=`Internal Server Error`;function Ut(e,t){return _t(e,Gt(t))}function Wt(e,t,n){let r=Ut(n,{telefunctionName:e,telefuncFilePath:t});throw it(r),r}function Gt(e){if(e)return typeof e==`string`?e:`Aborted telefunction call ${e.telefunctionName}() (${e.telefuncFilePath}).`}function Kt(e=`${Ht} — see server logs`){return Error(e)}function qt(e){throw Kt(e)}var Jt=class{constructor(e){this.cancelled=!1,this.callContext=e}async readU32(){let e=await this.readExact(4);return this.cancelled?0:Nt(e)}async readNextFrame(){let t=await this.readU32();if(this.cancelled||t===0)return null;if(t===4294967295){let t=await this.readU32(),n=await this.readExact(t),r=e(new TextDecoder().decode(n));de(ve(r)&&`type`in r),r.type===ke.ABORT&&(de(`abortValue`in r),Wt(this.callContext.telefunctionName,this.callContext.telefuncFilePath,r.abortValue)),qt()}let n=await this.readExact(t);return this.cancelled?null:zt(n)}},Yt={prefix:we,revive:(t,n)=>{let{readNextChunk:r,cancel:i,abort:a}=n.receiveStream(t),o=(async function*(){try{for(;;){let t=await r();if(t===null)return;yield e(At.decode(t))}}finally{i()}})(),s=o.return.bind(o);return o.return=(...e)=>(i(),s(...e)),{value:o,async close(){await o.return()},abort:a}}},Xt={prefix:Ce,revive:(e,t)=>{let{stream:n,cancel:r,abort:i}=t.receiveStream(e);return{value:n({cancelBehavior:`close`}),close:r,abort:i}}},Zt={prefix:ye,revive:(e,t)=>{let{bytes:n,cancel:r,abort:i}=t.receiveStream(e),a=n({expectedSize:e.size}).then(t=>new File([t],e.name,{type:e.type,lastModified:e.lastModified}));return t.waitFor(a),{value:a,close:r,abort:i}}},Qt={prefix:be,revive:(e,t)=>{let{bytes:n,cancel:r,abort:i}=t.receiveStream(e),a=n({expectedSize:e.size}).then(t=>new Blob([t],{type:e.type}));return t.waitFor(a),{value:a,close:r,abort:i}}},$t,en,tn=Symbol.for(`telefunc.LazyBlob`),nn=Symbol.for(`telefunc.LazyFile`);function rn(e){return typeof e==`object`&&!!e&&e[tn]===!0}function an(e){return typeof e==`object`&&!!e&&e[nn]===!0}var on=class{async arrayBuffer(){return(await this.bytes()).buffer}async bytes(){let e=this.stream().getReader(),t=0,n=[];for(;;){let{done:r,value:i}=await e.read();if(r)break;n.push(i),t+=i.byteLength}let r=new Uint8Array(t),i=0;for(let e of n)r.set(e,i),i+=e.byteLength;return r}async text(){return new TextDecoder().decode(await this.bytes())}slice(e,t,n){let r=this.size,i=e===void 0?0:e<0?Math.max(r+e,0):Math.min(e,r),a=t===void 0?r:t<0?Math.max(r+t,0):Math.min(t,r),o=Math.max(a-i,0);return new cn(this,i,o,n??``)}get[Symbol.toStringTag](){return`Blob`}},sn=class extends on{static[($t=tn,Symbol.hasInstance)](e){return rn(e)}constructor(e,t,n){super(),this[$t]=!0,this._consumed=!1,this.size=e,this.type=t,this.getStream=n}_markConsumed(){fe(!this._consumed,`Stream has already been consumed — each streaming Blob/File can only be read once.`),this._consumed=!0}stream(){return this._markConsumed(),this.getStream()}},cn=class extends on{constructor(e,t,n,r){super(),this.parent=e,this.start=t,this.size=n,this.type=r}stream(){let e,t=0,n=this.start,r=n+this.size;return new ReadableStream({start:()=>{e=this.parent.stream().getReader()},pull:async i=>{let{done:a,value:o}=await e.read();if(a){i.close();return}let s=Math.max(n-t,0),c=Math.min(r-t,o.byteLength);t+=o.byteLength,c>s&&i.enqueue(o.subarray(s,c)),t>=r&&(i.close(),await e.cancel())},cancel:async()=>{await e?.cancel()}})}},ln=class extends sn{static[(en=nn,Symbol.hasInstance)](e){return an(e)}constructor(e,t,n,r,i){super(e,t,i),this.webkitRelativePath=``,this[en]=!0,this.name=n,this.lastModified=r}get[Symbol.toStringTag](){return`File`}},un=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},dn=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},fn,pn,mn,hn,gn,_n,vn,yn,bn=Symbol.for(`telefunc.client.FileDownload`),xn=Symbol.for(`telefunc.client.BlobDownload`),Sn=class extends ln{constructor(e,t){super(e.size??0,e.type,e.name,e.lastModified,t.stream),this[pn]=!0,fn.set(this,void 0),un(this,fn,new wn(t,e.size,this.name,this.type,()=>this._markConsumed()),`f`)}get loaded(){return dn(this,fn,`f`).state.loaded}onProgress(e){dn(this,fn,`f`).onProgress(e)}cancel(){dn(this,fn,`f`).cancel()}stream(){return dn(this,fn,`f`).stream()}saveToDisk(e){return dn(this,fn,`f`).saveToDisk(e)}saveToOpfs(e){return dn(this,fn,`f`).saveToOpfs(e)}async saveToMemory(){let e=await this.bytes();return new File([e.buffer],this.name,{type:this.type,lastModified:this.lastModified})}};fn=new WeakMap,pn=bn;var Cn=class extends sn{constructor(e,t){super(e.size??0,e.type,t.stream),this[hn]=!0,mn.set(this,void 0),un(this,mn,new wn(t,e.size,``,this.type,()=>this._markConsumed()),`f`)}get loaded(){return dn(this,mn,`f`).state.loaded}onProgress(e){dn(this,mn,`f`).onProgress(e)}cancel(){dn(this,mn,`f`).cancel()}stream(){return dn(this,mn,`f`).stream()}saveToDisk(e){return dn(this,mn,`f`).saveToDisk(e)}saveToOpfs(e){return dn(this,mn,`f`).saveToOpfs(e)}async saveToMemory(){let e=await this.bytes();return new Blob([e.buffer],{type:this.type})}};mn=new WeakMap,hn=xn;var wn=class{constructor(e,t,n,r,i){gn.set(this,void 0),_n.set(this,void 0),vn.set(this,void 0),yn.set(this,void 0),un(this,gn,e,`f`),un(this,_n,n,`f`),un(this,vn,r,`f`),un(this,yn,i,`f`),this.state=Tn(t)}onProgress(e){this.state.callbacks.push(e),this.state.loaded>0&&e(this.state.loaded,this.state.total)}cancel(){dn(this,gn,`f`).cancel()}stream(){return dn(this,yn,`f`).call(this),dn(this,gn,`f`).stream({expectedSize:this.state.total,onChunk:e=>this.state.fire(e)})}async saveToDisk(e={}){dn(this,yn,`f`).call(this);let t=Dn(),n=e.mode??(t?`picker`:`memory`);if(n===`picker`){if(!t)throw Error(`saveToDisk({ mode: "picker" }) requires window.showSaveFilePicker`);let e=await On(t,dn(this,_n,`f`),dn(this,vn,`f`));return kn(dn(this,gn,`f`),this.state,e)}return n===`opfs`?Pn(dn(this,gn,`f`),this.state,dn(this,_n,`f`)):Mn(dn(this,gn,`f`),this.state,dn(this,_n,`f`),dn(this,vn,`f`))}async saveToOpfs(e){dn(this,yn,`f`).call(this);let t=await En(e??`__telefunc_opfs/${crypto.randomUUID()}${dn(this,_n,`f`)?`-${dn(this,_n,`f`)}`:``}`);return kn(dn(this,gn,`f`),this.state,t)}};gn=new WeakMap,_n=new WeakMap,vn=new WeakMap,yn=new WeakMap;function Tn(e){let t={loaded:0,total:e,callbacks:[],fire(n){t.loaded+=n;for(let n of t.callbacks)n(t.loaded,e)}};return t}async function En(e){let t=await navigator.storage.getDirectory(),n=e.split(`/`).filter(Boolean),r=n.pop();if(!r)throw Error(`saveToOpfs(path): path must end in a file name (got '${e}')`);let i=t;for(let e of n)i=await i.getDirectoryHandle(e,{create:!0});return i.getFileHandle(r,{create:!0})}function Dn(){return window.showSaveFilePicker}async function On(e,t,n){return e({suggestedName:t,...n?{types:[{accept:{[n]:[]}}]}:{}})}async function kn(e,t,n){let r=await n.createWritable();return await e.stream({expectedSize:t.total,onChunk:e=>t.fire(e)}).pipeTo(r),n.getFile()}var An=`__telefunc_temp`,jn=6e4;async function Mn(e,t,n,r){let i=await e.bytes({expectedSize:t.total,onChunk:e=>t.fire(e)}),a=new File([i.buffer],n,{type:r});return Nn(a,n),a}function Nn(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),jn)}async function Pn(e,t,n){let r=`${crypto.randomUUID()}-${n||`download`}`,i=await En(`${An}/${r}`),a;try{a=await kn(e,t,i)}catch(e){throw Fn(r),e}return Nn(a,n),setTimeout(()=>void Fn(r),jn),a}async function Fn(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle(An)).removeEntry(e)}catch{}}var In={prefix:xe,revive:(e,t)=>{let n=t.receiveStream(e);return{value:new Sn(e,n),close:n.cancel,abort:n.abort}}},Ln={prefix:Se,revive:(e,t)=>{let n=t.receiveStream(e);return{value:new Cn(e,n),close:n.cancel,abort:n.abort}}},Rn={prefix:Te,revive:(t,n)=>{let{readNextChunk:r,cancel:i,abort:a}=n.receiveStream(t),o=r().then(t=>{if(i(),!t)throw Error(`Stream ended before promise resolved`);return e(At.decode(t))});return o.catch(()=>{}),{value:o,close:i,abort:a}}},zn={prefix:Oe,revive(e,t){let n=t.createBroadcast({channelId:e.channelId,key:e.key});return{value:n,async close(){await n.close()},abort(e){n.abort(e.abortValue,e.message)}}}},Bn={prefix:Ee,revive(e,t){let n=t.createChannel({channelId:e.channelId,ack:e.ack});return{value:n,async close(){await n.close()},abort(e){n.abort(e.abortValue,e.message)}}}};function Vn(e){return e instanceof Function||typeof e==`function`}function Hn(e,t,n=`unknown`){if(!(typeof e==`object`&&e&&t in e))return!1;if(n===`unknown`)return!0;let r=e[t];return n===`array`?Array.isArray(r):n===`string[]`?Array.isArray(r)&&r.every(e=>typeof e==`string`):n===`function`?Vn(r):Array.isArray(n)?typeof r==`string`&&n.includes(r):n===`null`?r===null:n===`true`?r===!0:typeof r===n}var Un=[Yt,Xt,Zt,Qt,In,Ln,Rn,zn,Bn,{prefix:De,revive(e,t){let n=t.createChannel({channelId:e.channelId,ack:!0});return{value:async(...e)=>{let t=await n.send(e,{ack:!0});if(Hn(t,`__telefunc_fn_shield_error`,`true`))throw new St(`${Vt} — see server logs`);return t},async close(){await n.close()},abort(e){n.abort(e.abortValue,e.message)}}}}];function Wn(e,t,n){let r=[...Un,...n];return(n,i,a)=>{for(let n of r)if(i.startsWith(n.prefix)){let r=a(i.slice(n.prefix.length));de(ve(r));let o=n.revive(r,e);return t(o),{replacement:o.value}}}}var Gn=new Uint8Array,Kn=class extends Jt{constructor(e,t){super(t),this.buffer=Gn,this.reader=e,t.abortController.signal.addEventListener(`abort`,()=>e.cancel(),{once:!0})}cancel(){this.cancelled=!0,this.reader.cancel()}async readExact(e){for(;this.buffer.length<e;){let e,t,n;try{({done:e,value:t}=await this.reader.read())}catch(t){n=t,e=!0}if(e){if(this.callContext.abortController.signal.aborted&&Wt(this.callContext.telefunctionName,this.callContext.telefuncFilePath,void 0),this.cancelled)return Gn;throw n??Error(`Connection lost — the server closed the stream before all data was received.`)}this.buffer=this.buffer.length===0?t:Pt(this.buffer,t)}let t=this.buffer.subarray(0,e);return this.buffer=e<this.buffer.length?this.buffer.subarray(e):Gn,t}};Uint8Array.prototype.toBase64;var qn=typeof Uint8Array.fromBase64==`function`;function Jn(e){if(qn)return Uint8Array.fromBase64(e,{alphabet:`base64url`});let t=4-(e.length&3)&3,n=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)+`===`.slice(0,t),r=atob(n),i=r.length,a=new Uint8Array(i);for(let e=0;e<i;e++)a[e]=r.charCodeAt(e);return a}var Yn=new Uint8Array,Xn=class extends Jt{constructor(e,t){super(t),this.binary=Yn,this.decoder=new TextDecoder,this.lineBuf=``,this.pendingData=``,this.reader=e,t.abortController.signal.addEventListener(`abort`,()=>e.cancel(),{once:!0})}cancel(){this.cancelled=!0,this.reader.cancel()}async readExact(e){for(;this.binary.length<e;){let e,t,n;try{({done:e,value:t}=await this.reader.read())}catch(t){n=t,e=!0}if(e){if(this.callContext.abortController.signal.aborted&&Wt(this.callContext.telefunctionName,this.callContext.telefuncFilePath,void 0),this.cancelled)return Yn;throw n??Error(`Connection lost — server closed the SSE stream before all data was received.`)}this.lineBuf+=this.decoder.decode(t,{stream:!0});let r=this.lineBuf.split(`
`);this.lineBuf=r.pop();for(let e of r)e.startsWith(`data: `)?this.pendingData=e.slice(6):e===``&&this.pendingData!==``&&(this.binary=Pt(this.binary,Jn(this.pendingData)),this.pendingData=``)}let t=this.binary.subarray(0,e);return this.binary=e<this.binary.length?this.binary.subarray(e):Yn,t}};function Zn(e,t,n){return{key:e,seq:t,timestamp:n}}function Qn(e){return typeof e==`object`&&!!e&&String(e.$$typeof)===`Symbol(react.element)`}function $n(e){return e instanceof Function||typeof e==`function`}function er(e){return!(typeof e!=`object`||!e||Array.isArray(e))}function tr(e){let t=new WeakMap;return n;function n(n,r){let i=[...t.get(this)??[]];if(n!==``){let e=Array.isArray(this)?parseInt(n,10):n;i.push(e)}return nr(r)&&t.set(r,i),e.call(this,n,r,i)}}function nr(e){return e===Object(e)}function rr(e,{forbidReactElements:t,space:n,valueName:r,sortObjectKeys:i,replacer:a,htmlScriptSafe:o=!0}={}){let c=e=>JSON.stringify(e,tr(u),n),l=c(e);return o&&((o===!0||o.escapeScripts!==!1)&&(l=l.replaceAll(`<`,`\\u003c`)),(o===!0||o.escapeURLs!==!1)&&(l=l.replaceAll(`/`,`\\/`))),l;function u(e,n,o){let l=this[e],u=l;{let t=a?.call(this,e,l,c);if(t&&(u=t.replacement,t.resolved!==!1))return u}if(t&&Qn(u))throw ir({value:u,valueType:`React element`,path:o,rootValueName:r});if($n(u)){let e=u.name;throw ir({value:u,valueType:`function`,path:o,rootValueName:r,problematicValueName:o.length===0?e:void 0})}for(let{is:e,serialize:t}of s.slice().reverse())if(e(u))return t(u,c);if(i&&er(u)){let e={};Object.keys(u).sort().forEach(t=>{e[t]=u[t]}),u=e}return u}}function ir({value:e,valueType:t,path:n,rootValueName:r,problematicValueName:i}){let a=or({path:n,rootValueName:r,problematicValueName:i}),o=`cannot serialize ${a} because it's a ${t}`,s=Error(`[@brillout/json-serializer](https://github.com/brillout/json-serializer) ${o}.`),c=sr(n,!0);return Object.assign(s,{[ar]:!0,messageCore:o,value:e,path:n,pathString:c,subjectName:a}),s}var ar=`_isJsonSerializerError`;function or({path:e,rootValueName:t,problematicValueName:n}){let r=sr(e,!t),i;return r?(i=n?n+` at `:``,i=i+(t||``)+r):i=t||n||`value`,i}function sr(e,t){return e.map((e,n)=>typeof e==`number`?`[${e}]`:n===0&&t&&lr(e)?e:cr(e)).join(``)}function cr(e){return typeof e==`string`&&lr(e)?`.${e}`:`[${JSON.stringify(e)}]`}function lr(e){return/^[a-z0-9\$_]+$/i.test(e)}var ur=e=>e.byteLength-7,dr=16,fr=48,pr=new TextEncoder,mr=new TextDecoder,G={PING:1,PONG:2,FIN:3,RECONCILE:4,RECONCILED:5,STREAM_REQUEST_OPEN_ACK:6,TEXT:16,BINARY:17,TEXT_ACK_REQ:18,BINARY_ACK_REQ:19,ACK_RES:20,PUBLISH:21,PUBLISH_ACK_REQ:22,PUBLISH_BINARY:23,PUBLISH_BINARY_ACK_REQ:24,CLOSE:48,CLOSE_ACK:49,ABORT:50,ERROR:51,WINDOW:52,BROADCAST_SUB:53,BROADCAST_UNSUB:54,BDP_PING:55,BDP_PING_ACK:56,MSG_WINDOW:57};function hr(e){return e>=fr}function gr(e){return e.tag>=dr&&e.tag<fr}var _r={OK:0,ERROR:1,ABORT:2,SHIELD_ERROR:3};function vr(e,t,n,r){e[0]=t,e[1]=n&255,e[2]=n>>8&255,e[3]=r&255,e[4]=r>>8&255,e[5]=r>>16&255,e[6]=r>>24&255}function yr(e,t,n){e[t]=n&255,e[t+1]=n>>8&255,e[t+2]=n>>16&255,e[t+3]=n>>24&255}function br(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function xr(e,t,n,r){let i=pr.encode(n),a=new Uint8Array(7+i.byteLength);return vr(a,e,t,r),a.set(i,7),a}function Sr(e,t,n,r){let i=new Uint8Array(7+n.byteLength);return vr(i,e,t,r),i.set(n,7),i}function Cr(e,t=0){let n=new Uint8Array(7);return vr(n,e,t,0),n}function wr(e,t){let n=pr.encode(JSON.stringify(t)),r=new Uint8Array(7+n.byteLength);return vr(r,e,0,0),r.set(n,7),r}var Tr={text:(e,t,n=0)=>xr(G.TEXT,e,t,n),publish:(e,t,n=0)=>xr(G.PUBLISH,e,t,n),publishAckReq:(e,t,n=0)=>xr(G.PUBLISH_ACK_REQ,e,t,n),textAckReq:(e,t,n=0)=>xr(G.TEXT_ACK_REQ,e,t,n),binary:(e,t,n=0)=>Sr(G.BINARY,e,t,n),publishBinary:(e,t,n=0)=>Sr(G.PUBLISH_BINARY,e,t,n),publishBinaryAckReq:(e,t,n=0)=>Sr(G.PUBLISH_BINARY_ACK_REQ,e,t,n),binaryAckReq:(e,t,n=0)=>Sr(G.BINARY_ACK_REQ,e,t,n),ackRes(e,t,n,r,i=_r.OK){let a=pr.encode(r),o=new Uint8Array(12+a.byteLength);return vr(o,G.ACK_RES,e,t),yr(o,7,n),o[11]=i,o.set(a,12),o},ping:()=>Cr(G.PING),pong:()=>Cr(G.PONG),fin:()=>Cr(G.FIN),reconcile:e=>wr(G.RECONCILE,e),reconciled:e=>wr(G.RECONCILED,e),streamRequestOpenAck:()=>Cr(G.STREAM_REQUEST_OPEN_ACK),close(e,t){let n=new Uint8Array(11);return vr(n,G.CLOSE,e,0),yr(n,7,t),n},closeAck:e=>Cr(G.CLOSE_ACK,e),abort(e,t){let n=pr.encode(t),r=new Uint8Array(7+n.byteLength);return vr(r,G.ABORT,e,0),r.set(n,7),r},error:e=>Cr(G.ERROR,e),window(e,t){let n=new Uint8Array(11);return vr(n,G.WINDOW,e,0),yr(n,7,t),n},msgWindow(e,t){let n=new Uint8Array(11);return vr(n,G.MSG_WINDOW,e,0),yr(n,7,t),n},bdpPing:e=>Cr(G.BDP_PING,e),bdpPingAck:e=>Cr(G.BDP_PING_ACK,e),broadcastSub(e,t){let n=new Uint8Array(8);return vr(n,G.BROADCAST_SUB,e,0),n[7]=+!!t,n},broadcastUnsub(e,t){let n=new Uint8Array(8);return vr(n,G.BROADCAST_UNSUB,e,0),n[7]=+!!t,n}};function Er(e){de(e.length>=7,`frame too short`);let t=e[0],n=e[1]|e[2]<<8,r=br(e,3),i=e.subarray(7);switch(t){case G.TEXT:return{tag:G.TEXT,index:n,seq:r,text:mr.decode(i),bytes:i.byteLength};case G.BINARY:return{tag:G.BINARY,index:n,seq:r,data:i};case G.TEXT_ACK_REQ:return{tag:G.TEXT_ACK_REQ,index:n,seq:r,text:mr.decode(i)};case G.BINARY_ACK_REQ:return{tag:G.BINARY_ACK_REQ,index:n,seq:r,data:i};case G.PUBLISH:{let{text:e,info:t}=Dr(mr.decode(i));return{tag:G.PUBLISH,index:n,seq:r,text:e,info:t}}case G.PUBLISH_ACK_REQ:return{tag:G.PUBLISH_ACK_REQ,index:n,seq:r,text:mr.decode(i)};case G.PUBLISH_BINARY:{let{data:e,info:t}=kr(i);return{tag:G.PUBLISH_BINARY,index:n,seq:r,data:e,info:t}}case G.PUBLISH_BINARY_ACK_REQ:return{tag:G.PUBLISH_BINARY_ACK_REQ,index:n,seq:r,data:i};case G.ACK_RES:{de(i.length>=5,`ACK_RES payload too short`);let e=br(i,0),t=i[4];return de(t===_r.OK||t===_r.ERROR||t===_r.ABORT||t===_r.SHIELD_ERROR,`ACK_RES unknown status ${t}`),{tag:G.ACK_RES,index:n,seq:r,ackedSeq:e,status:t,text:mr.decode(i.subarray(5))}}case G.PING:return{tag:G.PING};case G.PONG:return{tag:G.PONG};case G.FIN:return{tag:G.FIN};case G.RECONCILE:return{tag:G.RECONCILE,payload:JSON.parse(mr.decode(i))};case G.RECONCILED:return{tag:G.RECONCILED,payload:JSON.parse(mr.decode(i))};case G.STREAM_REQUEST_OPEN_ACK:return{tag:G.STREAM_REQUEST_OPEN_ACK};case G.CLOSE:return de(i.length>=4,`CLOSE payload too short`),{tag:G.CLOSE,index:n,timeoutMs:br(i,0)};case G.CLOSE_ACK:return{tag:G.CLOSE_ACK,index:n};case G.ABORT:return{tag:G.ABORT,index:n,abortValue:mr.decode(i)};case G.ERROR:return{tag:G.ERROR,index:n};case G.WINDOW:return de(i.length>=4,`WINDOW payload too short`),{tag:G.WINDOW,index:n,bytes:br(i,0)};case G.MSG_WINDOW:return de(i.length>=4,`MSG_WINDOW payload too short`),{tag:G.MSG_WINDOW,index:n,count:br(i,0)};case G.BDP_PING:return{tag:G.BDP_PING,index:n};case G.BDP_PING_ACK:return{tag:G.BDP_PING_ACK,index:n};case G.BROADCAST_SUB:return de(i.length>=1,`BROADCAST_SUB payload too short`),{tag:G.BROADCAST_SUB,index:n,binary:i[0]===1};case G.BROADCAST_UNSUB:return de(i.length>=1,`BROADCAST_UNSUB payload too short`),{tag:G.BROADCAST_UNSUB,index:n,binary:i[0]===1};default:de(!1,`Unknown wire frame tag ${t}`)}}function Dr(e){let t=e.indexOf(`
`);de(t!==-1,`PUBLISH frame missing info prefix`);let n=e.indexOf(`,`);de(n!==-1&&n<t,`PUBLISH frame malformed info prefix`);let r=Number(e.slice(0,n)),i=Number(e.slice(n+1,t));return de(Number.isFinite(r)&&Number.isFinite(i),`PUBLISH frame info must be finite numbers`),{text:e.slice(t+1),info:{seq:r,timestamp:i}}}var Or=12;function kr(e){de(e.byteLength>=Or,`PUBLISH_BINARY frame too short for info header`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(0,!0),r=t.getFloat64(4,!0);return de(Number.isFinite(n)&&Number.isFinite(r),`PUBLISH_BINARY frame info must be finite numbers`),{data:e.subarray(Or),info:{seq:n,timestamp:r}}}function Ar(e,t){let n,r=!1,i=new ReadableStream({start:e=>{n=e},pull:()=>{t?.()},cancel:()=>{r=!0,e?.()}});return i.push=e=>r?!1:(n.enqueue(e),(n.desiredSize??1)>0),i.close=()=>{r||(r=!0,n.close())},Object.defineProperty(i,"isClosed",{get:()=>r}),i}function jr(e){return Hn(e,`unref`,`function`)&&e.unref(),e}var Mr=class{get seq(){return this._seq}constructor(e,t,n){if(this._seq=0,this.cleanupTimer=null,this.cleanupScheduledAt=1/0,e<=0)throw Error(`maxBytes must be > 0`);this.text=new Nr(e,t),this.binary=new Nr(n,t),this.maxAgeMs=t}nextSeq(){return++this._seq}pushFrame(e,t){return this.push(this.nextSeq(),e,t)}push(e,t,n){e>this._seq&&(this._seq=e);let r=(n?this.binary:this.text).push(e,t);return this.scheduleCleanup(),r}getAfter(e){let t=this.text.getAfter(e),n=this.binary.getAfter(e);if(t.frames.length===0)return n.frames;if(n.frames.length===0)return t.frames;let r=Array(t.frames.length+n.frames.length),i=0,a=0,o=0;for(;i<t.frames.length&&a<n.frames.length;)t.seqs[i]<=n.seqs[a]?r[o++]=t.frames[i++]:r[o++]=n.frames[a++];for(;i<t.frames.length;)r[o++]=t.frames[i++];for(;a<n.frames.length;)r[o++]=n.frames[a++];return r}evict(e=Date.now()){this.text.evict(e),this.binary.evict(e)}get length(){return this.text.length+this.binary.length}get byteLength(){return this.text.byteLength+this.binary.byteLength}dispose(){this.text.dispose(),this.binary.dispose(),this._seq=0,this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null,this.cleanupScheduledAt=1/0)}scheduleCleanup(){let e=Math.min(this.text.oldestTime,this.binary.oldestTime);if(e===1/0)return;let t=e+this.maxAgeMs;if(this.cleanupTimer!==null&&this.cleanupScheduledAt<=t)return;this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.cleanupScheduledAt=t;let n=setTimeout(()=>{this.cleanupTimer=null,this.cleanupScheduledAt=1/0,this.evict(),this.scheduleCleanup()},Math.max(0,t-Date.now()));jr(n),this.cleanupTimer=n}},Nr=class{constructor(e,t){this.seqs=[],this.frames=[],this.times=[],this.head=0,this.totalBytes=0,this.maxBytes=e,this.maxAgeMs=t}get oldestTime(){return this.head<this.times.length?this.times[this.head]:1/0}get length(){return this.frames.length-this.head}get byteLength(){return this.totalBytes}push(e,t){let n=Date.now();return t.byteLength>this.maxBytes?(this.seqs.push(e),this.frames.push(null),this.times.push(n),this._evict(n),!1):(this.seqs.push(e),this.frames.push(t),this.times.push(n),this.totalBytes+=t.byteLength,this._evict(n),!0)}getAfter(e){let t=this.frames.length,n=this.head;for(;n<t&&this.seqs[n]<=e;)n++;if(n>=t||this.frames[n]===null)return{seqs:[],frames:[]};let r=n+1;for(;r<t&&this.frames[r]!==null;)r++;return{seqs:this.seqs.slice(n,r),frames:this.frames.slice(n,r)}}evict(e){if(this.head>=this.frames.length)return;let t=e-this.maxAgeMs;for(;this.head<this.frames.length&&this.times[this.head]<t;){let e=this.frames[this.head];e&&(this.totalBytes-=e.byteLength),this.head++}this.compact()}dispose(){this.seqs.length=0,this.frames.length=0,this.times.length=0,this.head=0,this.totalBytes=0}_evict(e){let t=e-this.maxAgeMs;for(;this.head<this.frames.length&&!(this.times[this.head]>=t&&this.totalBytes<=this.maxBytes);){let e=this.frames[this.head];e&&(this.totalBytes-=e.byteLength),this.head++}this.compact()}compact(){if(this.head>=this.frames.length){this.seqs.length=0,this.frames.length=0,this.times.length=0,this.head=0,this.totalBytes=0;return}this.head>0&&this.head>=this.frames.length-this.head&&(this.seqs=this.seqs.slice(this.head),this.frames=this.frames.slice(this.head),this.times=this.times.slice(this.head),this.head=0)}},Pr=`_telefunc`,Fr=`x-telefunc-request`,Ir={TEXT:`txt`,SSE:`sse`,BINARY:`bin`,MISMATCH:`mismatch`};function Lr(e,t){let n=typeof window>`u`?void 0:window.location.href,r=new URL(e,n);return r.searchParams.set(Pr,t),r.href}function Rr(e){return Lt(JSON.stringify(e))}function zr(e,t){let n=Rr(e);return new Blob(t?[n,t]:[n])}var Br=class{constructor(e){this.run=e,this.timer=null,this.scheduledAt=0}schedule(e){this.timer&&this.scheduledAt<=e||(this.cancel(),this.scheduledAt=e,this.timer=setTimeout(()=>{this.timer=null,this.scheduledAt=0,this.run()},Math.max(0,e-Date.now())))}cancel(){this.timer&&(clearTimeout(this.timer),this.timer=null,this.scheduledAt=0)}},Vr=class{constructor(e,t,n,r){this.intervalMs=e,this.pongTimeoutMs=t,this.send=n,this.onDead=r,this.pingTimer=null,this.pongTimer=null}start(){this.pingTimer||=(this.send(),this.resetPong(),setInterval(this.send,this.intervalMs))}resetPong(){this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=setTimeout(this.onDead,this.pongTimeoutMs)}stop(){this.pingTimer&&=(clearInterval(this.pingTimer),null),this.pongTimer&&=(clearTimeout(this.pongTimer),null)}},Hr=class t{static getOrCreate(e,n,r){let i=`${r.transports.join(`,`)}:${e}|${r.connectionKey??``}`,a=t.cache.get(i);return(!a||a.closed)&&(a=new t(e,r,i),t.cache.set(i,a)),a.register(n),a}get closed(){return this.state.tag===`closed`}get connected(){return this.state.tag===`open`}get inDrain(){return this.state.tag===`open`&&this.state.upgrade.tag===`draining`}constructor(e,t,n){this.state={tag:`fresh`},this.upgradeDisabled=!1,this.serverTransports=null,this.reconciling=!1,this.reconcileTimer=null,this.ttl=null,this.sessionId=null,this.nextIndex=0,this.reconcileIxes=new Set,this.channels=new Map,this.channelIndex=new Map,this.sendBuffer=[],this.lastSeqByChannel=new Map,this.replayBuffers=new Map,this.reconnectTimeoutMs=Le,this.pingIntervalMs=ze,this.clientReplayBufferBytes=Ve,this.clientReplayBufferBinaryBytes=He,this.registerReconcileTimer=null,this.cacheKey=n,this.telefuncUrl=e,this.connectionOptions=t,this.idleTimeoutMs=t.idleTimeout??Re,this.transport=Gr[t.transports[0]](e,t,this)}enterOpen(){this.state.tag!==`open`&&(this.state={tag:`open`,upgrade:{tag:`none`}})}enterReconnecting(e,t,n){this.state.tag===`reconnecting`&&clearTimeout(this.state.timer);let r=setTimeout(()=>this.transport.start(),n);this.state={tag:`reconnecting`,attempt:e,startedAt:t,timer:r}}enterClosed(){this.state={tag:`closed`}}enterUpgradeProbing(e){de(this.state.tag===`open`&&this.state.upgrade.tag===`none`),this.state={tag:`open`,upgrade:{tag:`probing`,attempt:e}}}enterUpgradeDraining(e){de(this.state.tag===`open`&&this.state.upgrade.tag===`probing`&&this.state.upgrade.attempt===e),this.state={tag:`open`,upgrade:{tag:`draining`,attempt:e}}}enterUpgradeHandoff(e){de(this.state.tag===`open`&&this.state.upgrade.tag===`draining`),this.state={tag:`open`,upgrade:{tag:`handoff`,from:e,buffer:[],finReceived:!1,finTimer:null}}}exitUpgradeAttempt(e){if(this.state.tag!==`open`)return;let t=this.state.upgrade;t.tag!==`probing`&&t.tag!==`draining`||t.attempt===e&&(this.state={tag:`open`,upgrade:{tag:`none`}})}exitUpgradeHandoff(){de(this.state.tag===`open`&&this.state.upgrade.tag===`handoff`);let{from:e,buffer:t,finTimer:n}=this.state.upgrade;return this.state={tag:`open`,upgrade:{tag:`none`}},{from:e,buffer:t,finTimer:n}}canSendImmediately(){return this.connected&&!this.reconciling&&!this.inDrain&&this.registerReconcileTimer===null}enterChannelPending(e,t,n){this.channels.set(e,{channel:t,state:{tag:`pending`,initial:n}}),this.channelIndex.set(t,e)}enterChannelOpen(e){let t=this.channels.get(e);de(t&&t.state.tag===`pending`),t.state={tag:`open`}}enterChannelReleasing(e,t){let n=this.channels.get(e);de(n&&n.state.tag===`pending`),n.state={tag:`releasing`,initial:n.state.initial,err:t}}register(e){this.ttl&&=(clearTimeout(this.ttl),null);let t=this.nextIndex++;if(this.enterChannelPending(t,e,!0),this.replayBuffers.set(t,new Mr(this.clientReplayBufferBytes,this.reconnectTimeoutMs,this.clientReplayBufferBinaryBytes)),!this.transport.hasWire()&&!this.transport.isConnecting()){this.transport.start();return}this.scheduleRegisterReconcile()}scheduleRegisterReconcile(){this.registerReconcileTimer===null&&(this.registerReconcileTimer=setTimeout(()=>this.flushPendingRegisterReconcile(),0))}flushPendingRegisterReconcile(){this.registerReconcileTimer!==null&&(this.state.tag!==`open`||this.state.upgrade.tag!==`none`||this.reconciling||(this.sendReconcileBatch(this.stageReconcileBatch()),this.releaseUnconfirmedReleasing()))}cancelPendingRegisterReconcile(){this.cancelRegisterReconcileTimer(),this.releaseUnconfirmedReleasing()}cancelRegisterReconcileTimer(){this.registerReconcileTimer!==null&&(clearTimeout(this.registerReconcileTimer),this.registerReconcileTimer=null)}releaseUnconfirmedReleasing(){let e=!1;for(let[t,n]of this.channels)n.state.tag===`releasing`&&n.state.initial&&(this.releaseChannel(t,n.channel,n.state.err),e=!0);e&&this.startTtlIfIdle()}unregister(e,t=new Dt){let n=this.channelIndex.get(e);if(n!==void 0){if(this.channels.get(n).state.tag===`pending`){this.enterChannelReleasing(n,t);return}this.releaseChannel(n,e,t),this.startTtlIfIdle()}}send(e,t){let n=this.channelIndex.get(e);if(n===void 0)return 0;let r=this.replayBuffers.get(n),i=r.nextSeq(),a=Tr.text(n,t,i);return this.canSendImmediately()?(r.push(i,a),this.transport.sendFrame({kind:`data`,frame:a})):this.sendBuffer.push({frame:a,channelIx:n,seq:i}),ur(a)}sendPublishAckReq(e,t,n){this.sendAckReq(e,(e,n)=>Tr.publishAckReq(e,t,n),!1,n)}sendPublishBinaryAckReq(e,t,n){this.sendAckReq(e,(e,n)=>Tr.publishBinaryAckReq(e,t,n),!0,n)}sendTextAckReq(e,t,n){this.sendAckReq(e,(e,n)=>Tr.textAckReq(e,t,n),!1,n)}sendBinaryAckReq(e,t,n){this.sendAckReq(e,(e,n)=>Tr.binaryAckReq(e,t,n),!0,n)}sendAckReq(e,t,n,r){let i=this.channelIndex.get(e);if(i===void 0)return;let a=this.replayBuffers.get(i),o=a.nextSeq(),s=t(i,o);if(r(o),!this.canSendImmediately()){this.sendBuffer.push({frame:s,channelIx:i,seq:o});return}a.push(o,s,n),this.transport.sendFrame({kind:`ack`,frame:s})}sendBinary(e,t){let n=this.channelIndex.get(e);if(n===void 0)return;let r=this.replayBuffers.get(n),i=r.nextSeq(),a=Tr.binary(n,t,i);if(!this.canSendImmediately()){this.sendBuffer.push({frame:a,channelIx:n,seq:i});return}r.push(i,a,!0),this.transport.sendFrame({kind:`data`,frame:a})}sendAckRes(e,t,n,r=_r.OK){let i=this.channelIndex.get(e);if(i===void 0)return;let a=this.replayBuffers.get(i),o=a.nextSeq(),s=Tr.ackRes(i,o,t,n,r);if(!this.canSendImmediately()){this.sendBuffer.push({frame:s,channelIx:i,seq:o});return}a.push(o,s),this.transport.sendFrame({kind:`ack`,frame:s})}sendAbort(e){let t=this.channelIndex.get(e);if(t===void 0)return;let n=Tr.close(t,0);if(!this.canSendImmediately()){this.sendBuffer.push({frame:n,channelIx:t,seq:void 0});return}this.transport.sendFrame({kind:`control`,frame:n})}sendCloseRequest(e,t){let n=this.channelIndex.get(e);if(n===void 0)return;let r=Tr.close(n,t);if(!this.canSendImmediately()){this.sendBuffer.push({frame:r,channelIx:n,seq:void 0});return}this.transport.sendFrame({kind:`control`,frame:r})}sendCloseAck(e){let t=this.channelIndex.get(e);if(t===void 0)return;let n=Tr.closeAck(t);if(!this.canSendImmediately()){this.sendBuffer.push({frame:n,channelIx:t,seq:void 0});return}this.transport.sendFrame({kind:`control`,frame:n})}sendByteWindowUpdate(e,t){let n=this.channelIndex.get(e);n!==void 0&&this.canSendImmediately()&&this.transport.sendFrame({kind:`flow-control`,frame:Tr.window(n,t)})}sendMsgWindowUpdate(e,t){let n=this.channelIndex.get(e);n!==void 0&&this.canSendImmediately()&&this.transport.sendFrame({kind:`flow-control`,frame:Tr.msgWindow(n,t)})}sendBdpPing(e){let t=this.channelIndex.get(e);if(t===void 0)return;let n=Tr.bdpPing(t);if(!this.canSendImmediately()){this.sendBuffer.push({frame:n,channelIx:t,seq:void 0});return}this.transport.sendFrame({kind:`flow-control`,frame:n})}sendBdpPingAck(e){let t=this.channelIndex.get(e);if(t===void 0)return;let n=Tr.bdpPingAck(t);if(!this.canSendImmediately()){this.sendBuffer.push({frame:n,channelIx:t,seq:void 0});return}this.transport.sendFrame({kind:`flow-control`,frame:n})}sendBroadcastSubscribe(e,t){let n=this.channelIndex.get(e);if(n===void 0)return;let r=Tr.broadcastSub(n,t);if(!this.canSendImmediately()){this.sendBuffer.push({frame:r,channelIx:n,seq:void 0});return}this.transport.sendFrame({kind:`control`,frame:r})}sendBroadcastUnsubscribe(e,t){let n=this.channelIndex.get(e);if(n===void 0)return;let r=Tr.broadcastUnsub(n,t);if(!this.canSendImmediately()){this.sendBuffer.push({frame:r,channelIx:n,seq:void 0});return}this.transport.sendFrame({kind:`control`,frame:r})}_onTransportOpen(e){if(!this.closed&&e===this.transport){if(this.enterOpen(),this.transport.sendReconcileOnOpen){this.sendReconcileBatch(this.stageReconcileBatch());return}if(!this.reconciling){this.flushPendingRegisterReconcile();for(let e of this.drainBufferedFrames(this.channels,void 0))this.transport.sendFrame(e)}this.maybeStartUpgrade()}}_onTransportFrame(e){this.state.tag===`open`&&this.state.upgrade.tag===`handoff`?this.bufferFrameDuringHandoff(e):this.dispatchFrame(e)}dispatchFrame(t){var n;if(gr(t)&&this.trackSeq(t.index,t.seq)===`dup`)return;switch(t.tag){case G.FIN:this.handleHandoffFin();return;case G.RECONCILED:this.handleReconciled(t.payload);return;case G.ABORT:this.closeRemoteChannel(t.index,Ut(e(t.abortValue))),this.startTtlIfIdle();return;case G.ERROR:this.closeRemoteChannel(t.index,Kt()),this.startTtlIfIdle();return}let r=t;(n=this.channels.get(r.index))==null||n.channel._dispatchFrame(r)}bufferFrameDuringHandoff(e){switch(e.tag){case G.FIN:this.handleHandoffFin();return;case G.RECONCILED:this.handleReconciled(e.payload);return}de(this.state.tag===`open`&&this.state.upgrade.tag===`handoff`),this.state.upgrade.buffer.push(e)}installHeartbeat(e,t){if(e.hasHeartbeat()&&this.pingIntervalMs===t)return;e.detachHeartbeat(),this.pingIntervalMs=t;let n=new Vr(t,t*2,()=>e.sendPing(),()=>this.handlePongTimeout(e));e.attachHeartbeat(n),n.start()}handlePongTimeout(e){this.reconciling||(e.detachHeartbeat(),e.abandonActiveTransport(),this._onTransportClosed(e,!1))}enterReconciling(){this.reconciling=!0,this.reconcileTimer&&clearTimeout(this.reconcileTimer),this.reconcileTimer=setTimeout(()=>this.onReconcileTimeout(),Ie)}exitReconciling(){this.reconciling=!1,this.reconcileTimer&&=(clearTimeout(this.reconcileTimer),null)}onReconcileTimeout(){if(this.closed||!this.reconciling)return;let e=this.transport;e.detachHeartbeat(),e.abandonActiveTransport(),this._onTransportClosed(e,!1)}handleHandoffFin(){this.state.tag!==`open`||this.state.upgrade.tag!==`handoff`||(this.state.upgrade.finReceived=!0,this.reconciling&&!this.state.upgrade.finTimer&&(this.state.upgrade.finTimer=setTimeout(()=>{this.state.tag===`open`&&this.state.upgrade.tag===`handoff`&&(this.state.upgrade.finTimer=null),this.abortUpgradeAndReconnectSse(new Tt(`Upgrade FIN without RECONCILED`,!0))},Fe)),this.tryCompleteUpgradeHandoff())}tryCompleteUpgradeHandoff(){if(this.state.tag!==`open`||this.state.upgrade.tag!==`handoff`||!this.state.upgrade.finReceived||this.reconciling)return;let{from:e,buffer:t,finTimer:n}=this.exitUpgradeHandoff();n&&clearTimeout(n),e.detachHeartbeat(),e.abandonActiveTransport(),e.dispose();for(let e of t)this.dispatchFrame(e);this.flushPendingRegisterReconcile()}_onTransportClosed(e,t=!1){if(this.closed)return;if(e.detachHeartbeat(),e!==this.transport){this.state.tag===`open`&&this.state.upgrade.tag===`handoff`&&e===this.state.upgrade.from&&this.abortUpgradeAndReconnectSse(new Tt(`Connection dropped`,!0));return}this.state.tag===`open`&&this.state.upgrade.tag!==`none`&&this.state.upgrade.tag!==`handoff`&&this.state.upgrade.attempt.abort();let n=new Tt(t?`Server rejected ${this.transport.type===je.SSE?`SSE`:`WebSocket`} connection`:`Connection dropped`,!0);this.handleTransportLoss(n,t)}handleReconciled(e){this.transport.applyReconciledSettings(e);let t=this.applyReconciled(e);this.installHeartbeat(this.transport,e.pingInterval),this.transport.closeAbandonedTransport();for(let e of t.frames)this.transport.sendFrame(e);for(let e of t.channelsToOpen)e._onTransportOpen(this.transport.batched);this.tryCompleteUpgradeHandoff(),t.reconcileComplete&&(this.serverTransports=e.transports,this.startTtlIfIdle(),this.flushPendingRegisterReconcile(),this.maybeStartUpgrade())}maybeStartUpgrade(){if(this.upgradeDisabled||this.state.tag!==`open`||this.state.upgrade.tag!==`none`||this.reconciling)return;let e=Kr[this.transport.type];e&&this.isTransportUpgradeAllowed(e)&&this.serverTransports?.includes(e)&&this.probeAndUpgrade(e)}abortUpgradeAndReconnectSse(e){if(!this.closed){if(this.state.tag===`open`){let e=this.state.upgrade;if(e.tag===`probing`||e.tag===`draining`)e.attempt.abort(),this.exitUpgradeAttempt(e.attempt);else if(e.tag===`handoff`){let{from:e,finTimer:t}=this.exitUpgradeHandoff();t&&clearTimeout(t),e.detachHeartbeat(),e.abandonActiveTransport(),e.dispose()}}this.upgradeDisabled=!0,this.transport.abandonActiveTransport(),this.transport.dispose(),this.transport=Gr[je.SSE](this.telefuncUrl,this.connectionOptions,this),this.handleTransportLoss(e)}}isTransportUpgradeAllowed(e){return this.connectionOptions.transports.includes(e)}async probeAndUpgrade(e){this.flushPendingRegisterReconcile();let t=new AbortController;this.enterUpgradeProbing(t);try{let n=this.transport,r=Gr[e](this.telefuncUrl,this.connectionOptions,this),i=await r.probe();if(t.signal.aborted||!i){i?.close();return}let a=new Vr(this.pingIntervalMs,this.pingIntervalMs*2,()=>i.ping(),()=>t.abort());if(i.onPong(()=>a.resetPong()),i.onClose(()=>t.abort()),a.start(),t.signal.addEventListener(`abort`,()=>{a.stop(),i.close()},{once:!0}),!await this.drainOldWire(n,t)){if(this.registerReconcileTimer===null)for(let e of this.drainBufferedFrames(this.channels,void 0))this.transport.sendFrame(e);return}a.stop(),this.transport=r,this.enterUpgradeHandoff(n),r.start()}finally{this.exitUpgradeAttempt(t),this.flushPendingRegisterReconcile()}}async drainOldWire(e,t){return await e.gracefulDrain(Pe),t.signal.aborted?!1:(this.enterUpgradeDraining(t),await e.forceDrain(),!t.signal.aborted)}handleTransportLoss(e,t=!1){if(this.closed)return;if(this.state.tag===`open`&&this.state.upgrade.tag===`handoff`){this.abortUpgradeAndReconnectSse(e);return}this.cancelPendingRegisterReconcile(),this.exitReconciling(),this.reconcileIxes.clear(),this.ttl&&=(clearTimeout(this.ttl),null);let{attempt:n,startedAt:r}=this.state.tag===`reconnecting`?this.state:{attempt:0,startedAt:0};if(t&&n===0){this.closeAll(e instanceof Error?e:new Tt(`Connection dropped`,!0)),this.dispose();return}if(this.channels.size===0){this.dispose();return}let i=r||Date.now();if(Date.now()-i>this.reconnectTimeoutMs){this.closeAll(e instanceof Error?e:new Tt(`Connection dropped`,!0)),this.dispose();return}let a=Math.min(500*2**n,Ue);this.enterReconnecting(n+1,i,a)}startTtlIfIdle(){this.closed||this.channels.size>0||this.ttl||(this.ttl=setTimeout(()=>{this.channels.size===0&&this.dispose()},this.idleTimeoutMs))}dispose(){if(!this.closed){if(this.ttl&&=(clearTimeout(this.ttl),null),this.registerReconcileTimer!==null&&(clearTimeout(this.registerReconcileTimer),this.registerReconcileTimer=null),this.state.tag===`reconnecting`&&clearTimeout(this.state.timer),this.state.tag===`open`){let e=this.state.upgrade;(e.tag===`probing`||e.tag===`draining`)&&e.attempt.abort(),e.tag===`handoff`&&(e.finTimer&&clearTimeout(e.finTimer),e.from.detachHeartbeat(),e.from.abandonActiveTransport(),e.from.dispose())}this.enterClosed(),this.transport.detachHeartbeat(),this.transport.dispose();for(let e of this.replayBuffers.values())e.dispose();this.channels.clear(),this.channelIndex.clear(),this.sendBuffer=[],this.lastSeqByChannel.clear(),this.replayBuffers.clear(),this.reconcileIxes.clear(),this.exitReconciling(),t.cache.delete(this.cacheKey)}}buildReconcileFrame(){this.enterReconciling(),this.reconcileIxes=new Set;let e=[];for(let[t,n]of this.channels){this.reconcileIxes.add(t);let r={id:n.channel.id,ix:t,lastSeq:this.lastSeqByChannel.get(t)??0};n.state.tag!==`open`&&n.state.initial&&(r.initial=!0),e.push(r)}let t={open:e};return this.sessionId&&(t.sessionId=this.sessionId),this.state.tag===`open`&&this.state.upgrade.tag===`handoff`&&(t.upgrade=!0),{kind:`reconcile`,frame:Tr.reconcile(t)}}drainBufferedFramesForReconcile(e){return this.transport.reconcileMode!==`batch-on-reconcile`||e&&this.sessionId!==null?[]:this.drainBufferedFrames(this.channels,void 0)}stageReconcileBatch(e=!1){return this.cancelRegisterReconcileTimer(),{reconcileFrame:this.buildReconcileFrame(),movedBufferedFrames:this.drainBufferedFramesForReconcile(e)}}sendReconcileBatch(e){this.transport.sendFrame(e.reconcileFrame);for(let t of e.movedBufferedFrames)this.transport.sendFrame(t)}appendReconcileBatch(e,t){e.push(t.reconcileFrame);for(let n of t.movedBufferedFrames)e.push(n)}applyReconciled(e){this.sessionId=e.sessionId,e.reconnectTimeout&&(this.reconnectTimeoutMs=e.reconnectTimeout),e.idleTimeout&&(this.idleTimeoutMs=e.idleTimeout),e.clientReplayBuffer&&(this.clientReplayBufferBytes=e.clientReplayBuffer),e.clientReplayBufferBinary&&(this.clientReplayBufferBinaryBytes=e.clientReplayBufferBinary);let t=new Map;for(let n of e.open)t.set(n.ix,n.lastSeq);let n=this.reconcileIxes;this.reconcileIxes=new Set;let r=[],i=[],a=!1;for(let[e,o]of this.channels){if(!n.has(e)){t.has(e)||(a=!0);continue}if(o.state.tag===`releasing`){this.releaseChannel(e,o.channel,o.state.err);continue}if(!t.has(e)){let t=new Tt(`Channel not acknowledged by server after reconnect`,!0);this.releaseChannel(e,o.channel,t),o.channel._onTransportClose(t);continue}o.state.tag===`pending`&&this.enterChannelOpen(e);let s=this.replayBuffers.get(e);if(s)for(let n of s.getAfter(t.get(e)))r.push({kind:`reconcile`,frame:n});o.channel.isClosed||i.push(o.channel)}for(let e of this.drainBufferedFrames(t,this.channels))r.push(e);if(a){let e=this.stageReconcileBatch();this.appendReconcileBatch(r,e)}else this.exitReconciling();return{frames:r,channelsToOpen:i,reconcileComplete:!a}}closeRemoteChannel(e,t){let n=this.channels.get(e);n&&(this.releaseChannel(e,n.channel,t??new Dt),n.channel._onTransportClose(t))}closeAll(e){for(let[,t]of this.channels)t.channel._onTransportClose(e);this.dispose()}trackSeq(e,t){return t<=(this.lastSeqByChannel.get(e)??0)?`dup`:(this.lastSeqByChannel.set(e,t),`accept`)}drainBufferedFrames(e,t){var n;let r=[],i=this.sendBuffer,a=0;for(let o=0;o<i.length;o++){let s=i[o],c=s.frame,l=s.channelIx,u=s.seq;if(!e.has(l)){t?.has(l)&&(i[a++]=s);continue}if(u!==void 0){let e=c[0],t=e===G.BINARY||e===G.PUBLISH_BINARY||e===G.PUBLISH_BINARY_ACK_REQ;(n=this.replayBuffers.get(l))==null||n.push(u,c,t)}r.push({kind:`reconcile`,frame:c})}return i.length=a,r}releaseChannel(e,t,n){this.channels.delete(e),this.channelIndex.delete(t),this.lastSeqByChannel.delete(e),this.replayBuffers.get(e)?.dispose(),this.replayBuffers.delete(e)}};Hr.cache=new Map;var Ur=class{constructor(e,t){this.owner=t,this.type=je.WS,this.reconnectTimeoutMessage=`WebSocket reconnect timed out`,this.sendReconcileOnOpen=!0,this.reconcileMode=`release-after-reconciled`,this.connId=null,this.batched=!1,this.heartbeat=null,this.probedWs=null,this.ws=null,this.abandonedWs=null,this.connecting=!1,this.everOpened=!1;let n=typeof window>`u`?void 0:window.location.href,r=new URL(e,n);r.protocol=r.protocol===`https:`?`wss:`:`ws:`,this.wsUrl=r.href}async probe(){let e;try{e=new WebSocket(this.wsUrl)}catch{return null}e.binaryType=`arraybuffer`;let t=null,n=null;if(e.onmessage=({data:e})=>{Er(new Uint8Array(e)).tag===G.PONG&&t?.()},e.onclose=()=>{this.probedWs===e&&(this.probedWs=null),n?.()},e.onerror=()=>{},e.onopen=()=>e.send(Tr.ping()),!await new Promise(e=>{let r=setTimeout(()=>e(!1),3e3);t=()=>{clearTimeout(r),e(!0)},n=()=>{clearTimeout(r),e(!1)}})){try{e.close()}catch{}return null}return this.probedWs=e,{ping:()=>{try{e.send(Tr.ping())}catch{}},onPong:e=>{t=e},onClose:e=>{n=e},close:()=>{this.probedWs===e&&(this.probedWs=null);try{e.close()}catch{}}}}gracefulDrain(){return Promise.resolve()}forceDrain(){return Promise.resolve()}start(){if(this.connecting||this.hasWire())return;let e=this.probedWs;if(e){this.probedWs=null,this.ws=e,this.setupHandlers(e),this.handleOpen(e);return}this.connecting=!0;let t;try{t=new WebSocket(this.wsUrl)}catch{this.connecting=!1,this.owner._onTransportClosed(this,!1);return}this.ws=t,t.binaryType=`arraybuffer`,t.onopen=()=>{this.ws===t&&this.handleOpen(t)},this.setupHandlers(t)}handleOpen(e){this.ws===e&&(this.everOpened=!0,this.connecting=!1,this.owner._onTransportOpen(this))}attachHeartbeat(e){this.heartbeat=e}detachHeartbeat(){var e;(e=this.heartbeat)==null||e.stop(),this.heartbeat=null}hasHeartbeat(){return this.heartbeat!==null}setupHandlers(e){e.onmessage=({data:e})=>{var t;let n=Er(new Uint8Array(e));if(n.tag===G.PONG){(t=this.heartbeat)==null||t.resetPong();return}this.owner._onTransportFrame(n)},e.onclose=()=>{this.ws===e&&(this.ws=null),this.connecting=!1,this.owner._onTransportClosed(this,!this.everOpened)},e.onerror=()=>{}}hasWire(){return this.ws!==null}isConnecting(){return this.connecting}sendFrame(e){let t=this.ws;de(t),t.send(e.frame)}abandonActiveTransport(){let e=this.ws;e&&(this.ws=null,this.closeAbandonedTransport(),this.abandonedWs=e,e.onopen=e.onerror=e.onclose=null)}closeAbandonedTransport(){let e=this.abandonedWs;if(e){this.abandonedWs=null,e.onmessage=e.onclose=null;try{e.close()}catch{}}}applyReconciledSettings(){}sendPing(){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(Tr.ping())}dispose(){this.connecting=!1;let e=this.probedWs;if(this.probedWs=null,e){e.onopen=e.onmessage=e.onerror=e.onclose=null;try{e.close(1e3)}catch{}}let t=this.ws;if(this.ws=null,t){t.onopen=t.onmessage=t.onerror=t.onclose=null;try{t.close(1e3)}catch{}}this.closeAbandonedTransport()}},Wr=class{async probe(){throw Error(`SSE transport does not implement probe()`)}get batched(){return this.streamRequest.tag!==`active`}constructor(e,t,n,r,i){this.telefuncUrl=e,this.fetchImpl=t,this.sessionToken=n,this.userHeaders=r,this.owner=i,this.type=je.SSE,this.reconnectTimeoutMessage=`SSE reconnect timed out`,this.sendReconcileOnOpen=!1,this.reconcileMode=`batch-on-reconcile`,this.connId=crypto.randomUUID(),this.heartbeat=null,this.connecting=!1,this.startTimer=null,this.transportAbort=null,this.abandonedStream=null,this.abandonedControllers=new WeakSet,this.outbox=[],this.flushScheduler=new Br(()=>{this.flushOutbox()}),this.flushing=!1,this.lastPostStartedAt=0,this.flushThrottleMs=300,this.postIdleFlushDelayMs=50,this.heartbeatFlushDelayMs=Math.floor(ze/2),this.drainCallbacks=[],this.streamRequest={tag:`idle`}}async gracefulDrain(e){if(this.streamRequest.tag===`active`||!this.flushing&&this.outbox.length===0)return;let t=new Promise(e=>this.drainCallbacks.push(e));await Promise.race([t,new Promise(t=>setTimeout(t,e))])}async forceDrain(){if(this.streamRequest.tag===`active`){de(!this.flushing&&this.outbox.length===0);let e=this.streamRequest.fetch;this.closeStreamRequest();try{await e}catch{}return}!this.flushing&&this.outbox.length===0||await new Promise(e=>this.drainCallbacks.push(e))}start(){this.connecting||this.hasWire()||(this.connecting=!0,this.startTimer=setTimeout(()=>{this.startTimer=null,!(!this.connecting||this.hasWire())&&this.openStream()},10))}hasWire(){return this.transportAbort!==null}isConnecting(){return this.connecting}sendFrame(e){if(this.flushing&&e.kind===`heartbeat`){this.schedulePingDuringFlush(e);return}if(this.streamRequest.tag===`active`){this.streamRequest.body.push(Mt(e.frame.byteLength)),this.streamRequest.body.push(e.frame);return}let t=Date.now(),n=this.getFrameDeadline(e.kind,t);this.outbox.push({frame:e.frame,deadline:n}),this.scheduleFlush(),n<=t&&this.flushOutbox()}async openStream(){let e=new AbortController;this.transportAbort=e;let t=this.stageInitialBatch(),n=this.fetchImpl(Lr(this.telefuncUrl,Ir.SSE),{method:`POST`,headers:{...this.userHeaders,Accept:`text/event-stream`,"Content-Type":`application/octet-stream`,[Fr]:Ir.SSE,...this.sessionToken?{[Xe]:this.sessionToken}:void 0},body:zr({connId:this.connId,streamResponse:!0},Ft(t.initialFrames,e=>e.frame)),signal:e.signal}),r;if(this.streamRequest.tag!==`failed`){let t=Ar();t.push(Rr({connId:this.connId,streamRequest:!0}));let n=this.openStreamRequest(t,e.signal);this.streamRequest={tag:`active`,body:t,fetch:n},r=(async()=>{try{await n}catch{}return`fetch-ended`})()}let i=n=>{this.rollbackInitialBatch(t),this.closeStreamRequest(),e.abort(),this.transportAbort=null,this.connecting=!1,this.owner._onTransportClosed(this,n)},a;try{a=await n}catch{i(!1);return}if(!a.ok||!a.body){i(!0);return}let o=qr(a.body.getReader(),e),s,c=new Promise(e=>{s=()=>e(`ok`)});if((async()=>{var t;try{for(;;){let e=await o.readNextEntry();if(!e)break;if(!e.frame)continue;if(e.frame[0]===G.STREAM_REQUEST_OPEN_ACK){s();continue}let n=Er(e.frame);if(n.tag===G.PONG){(t=this.heartbeat)==null||t.resetPong();continue}this.owner._onTransportFrame(n)}}catch{if(e.signal.aborted)return}finally{o.cancel(),this.transportAbort===e&&(this.closeStreamRequest(),this.transportAbort=null),this.abandonedControllers.has(e)||this.owner._onTransportClosed(this,!1)}})(),r){let e=new Promise(e=>setTimeout(()=>e(`timeout`),Ne));await Promise.race([c,e,r])!==`ok`&&(this.closeStreamRequest(),this.streamRequest={tag:`failed`})}this.connecting=!1,this.owner._onTransportOpen(this),this.outbox.length>0&&this.flushOutbox()}stageInitialBatch(){let e=this.owner.stageReconcileBatch(!0),t=[];t.push(e.reconcileFrame);let n=e.movedBufferedFrames,r=this.outbox;this.outbox=[];for(let e of r)t.push({kind:`data`,frame:e.frame});for(let e of n)t.push(e);return{initialFrames:t,movedOutbox:r,movedBufferedFrames:n}}rollbackInitialBatch(e){if(e.movedOutbox.length===0&&e.movedBufferedFrames.length===0)return;let t=Date.now(),n=e.movedBufferedFrames.map(e=>({frame:e.frame,deadline:this.getFrameDeadline(e.kind,t)}));this.outbox=e.movedOutbox.concat(n,this.outbox)}async flushOutbox(){if(!(!this.hasWire()||this.flushing||this.outbox.length===0)){de(this.transportAbort),this.flushScheduler.cancel(),this.flushing=!0;try{let e=Date.now(),t=this.outbox.splice(0,this.outbox.length);this.lastPostStartedAt=e;try{if(!(await this.fetchImpl(Lr(this.telefuncUrl,Ir.SSE),{method:`POST`,headers:{...this.userHeaders,"Content-Type":`application/octet-stream`,"x-telefunc-request":Ir.SSE,...this.sessionToken?{"x-telefunc-session":this.sessionToken}:void 0},body:zr({connId:this.connId},Ft(t,e=>e.frame)),signal:this.transportAbort.signal})).ok)throw Error(`POST failed`)}catch{this.outbox=t.concat(this.outbox),this.abandonActiveTransport(),this.owner._onTransportClosed(this,!1);return}}finally{if(this.flushing=!1,this.outbox.length>0)this.scheduleFlush();else{let e=this.drainCallbacks.splice(0);for(let t of e)t()}}}}schedulePingDuringFlush(e){let t=Math.max(0,this.getFrameDeadline(e.kind)-Date.now());setTimeout(()=>{this.flushing?this.sendConcurrentPost([e.frame]):this.sendFrame(e)},t)}async sendConcurrentPost(e){if(this.hasWire()){de(this.transportAbort);try{await this.fetchImpl(Lr(this.telefuncUrl,Ir.SSE),{method:`POST`,headers:{...this.userHeaders,"Content-Type":`application/octet-stream`,[Fr]:Ir.SSE,...this.sessionToken?{[Xe]:this.sessionToken}:void 0},body:zr({connId:this.connId},Ft(e)),signal:this.transportAbort.signal})}catch{}}}scheduleFlush(){if(this.outbox.length===0||!this.hasWire())return;let e=1/0;for(let t of this.outbox)t.deadline<e&&(e=t.deadline);this.flushScheduler.schedule(e)}getFrameDeadline(e,t=Date.now()){switch(e){case`reconcile`:return t+10;case`control`:return t;case`heartbeat`:return t+this.heartbeatFlushDelayMs;case`flow-control`:case`ack`:case`data`:return t+(t-this.lastPostStartedAt>=this.flushThrottleMs?this.postIdleFlushDelayMs:this.flushThrottleMs)}}abandonActiveTransport(){let e=this.transportAbort;if(!e)return;this.transportAbort=null,this.streamRequest.tag===`active`&&(this.streamRequest={tag:`idle`}),this.closeAbandonedTransport(),this.abandonedStream=e,this.abandonedControllers.add(e);let t=this.drainCallbacks.splice(0);for(let e of t)e()}closeAbandonedTransport(){let e=this.abandonedStream;e&&(this.abandonedStream=null,e.abort())}applyReconciledSettings(e){e.sseFlushThrottle&&(this.flushThrottleMs=e.sseFlushThrottle),e.ssePostIdleFlushDelay&&(this.postIdleFlushDelayMs=e.ssePostIdleFlushDelay),this.heartbeatFlushDelayMs=Math.floor(e.pingInterval/2)}sendPing(){this.hasWire()&&this.sendFrame({kind:`heartbeat`,frame:Tr.ping()})}attachHeartbeat(e){this.heartbeat=e}detachHeartbeat(){var e;(e=this.heartbeat)==null||e.stop(),this.heartbeat=null}hasHeartbeat(){return this.heartbeat!==null}dispose(){var e;this.connecting=!1,this.startTimer&&=(clearTimeout(this.startTimer),null),this.flushScheduler.cancel(),this.outbox=[],this.closeStreamRequest(),(e=this.transportAbort)==null||e.abort(),this.transportAbort=null,this.closeAbandonedTransport();let t=this.drainCallbacks.splice(0);for(let e of t)e()}openStreamRequest(e,t){return this.fetchImpl(Lr(this.telefuncUrl,Ir.SSE),{method:`POST`,headers:{...this.userHeaders,"Content-Type":`application/octet-stream`,[Fr]:Ir.SSE,...this.sessionToken?{[Xe]:this.sessionToken}:void 0},body:e,signal:t,duplex:`half`})}closeStreamRequest(){this.streamRequest.tag===`active`&&(this.streamRequest.body.close(),this.streamRequest={tag:`idle`})}},Gr={[je.WS]:(e,t,n)=>new Ur(e,n),[je.SSE]:(e,t,n)=>new Wr(e,t.fetchImpl,t.sessionToken,t.headers,n)},Kr={[je.SSE]:je.WS};function qr(e,t){let n=new TextDecoder,r=``,i=0,a=null,o=``,s=[],c=!1,l=()=>{c||(c=!0,e.cancel().catch(()=>{}))};t.signal.addEventListener(`abort`,l,{once:!0});let u=()=>{a!==null&&(s.push({comment:a}),a=null),o!==``&&(s.push({frame:Jn(o)}),o=``)},d=()=>{for(;i<r.length;){let e=r.indexOf(`
`,i);if(e===-1)break;let t=r.slice(i,e);if(i=e+1,t.length===0){u();continue}if(t.charCodeAt(0)===58){a=t;continue}t.startsWith(`data: `)&&(o=t.slice(6))}i>16384&&i*2>=r.length&&(r=r.slice(i),i=0)};return{cancel:l,readNextEntry:async()=>{for(;;){if(s.length>0)return s.shift();let i,a,o;try{({done:i,value:a}=await e.read())}catch(e){o=e,i=!0}if(i){if(t.signal.aborted||c)return null;throw o??Error(`Connection lost before all SSE frames were received.`)}r+=n.decode(a,{stream:!0}),d()}}}}var Jr=re(`session-registry.ts`,{registry:new Map});function Yr(e,t){Jr.registry.set(e,t)}function Xr(e){return Jr.registry.get(e)}function Zr(e,t){return e.includes(`?`)?`${e}&session=${t}`:`${e}?session=${t}`}var Qr=class{constructor(){this._byteWindow=We,this._bytesAtPingSent=0,this._bytesReceived=0,this._msgWindow=100,this._msgsAtPingSent=0,this._msgsReceived=0,this._pingInFlight=!1,this._lastPingAt=0,this._probeIntervalMs=50}get byteWindow(){return this._byteWindow}get msgWindow(){return this._msgWindow}onReceive(e){let t=!1;if(!this._pingInFlight&&!(this._byteWindow>=67108864&&this._msgWindow>=5e4)){let e=Date.now();e-this._lastPingAt>=this._probeIntervalMs&&(this._bytesAtPingSent=this._bytesReceived,this._msgsAtPingSent=this._msgsReceived,this._pingInFlight=!0,this._lastPingAt=e,t=!0)}return this._bytesReceived+=e,this._msgsReceived+=1,t}onPingAck(){if(!this._pingInFlight)return{acknowledged:!1,bytes:`sample-too-small`,msgs:`sample-too-small`};this._pingInFlight=!1;let e=this._bytesReceived-this._bytesAtPingSent,t=this._msgsReceived-this._msgsAtPingSent,n=this._byteWindow>=67108864?`at-cap`:e*3>=this._byteWindow*2?`grow`:`sample-too-small`,r=this._msgWindow>=5e4?`at-cap`:t*3>=this._msgWindow*2?`grow`:`sample-too-small`;return n===`grow`||r===`grow`?this._probeIntervalMs=50:this._probeIntervalMs=Math.min(Je,this._probeIntervalMs*2),{acknowledged:!0,bytes:n,msgs:r}}growBytes(){this._byteWindow=Math.min(Ke,this._byteWindow*2)}bumpInitialByteWindow(e){e<=this._byteWindow||(this._byteWindow=Math.min(Ke,e))}growMsgs(){this._msgWindow=Math.min(qe,this._msgWindow*2)}reset(){this._pingInFlight=!1,this._bytesAtPingSent=this._bytesReceived,this._msgsAtPingSent=this._msgsReceived}},$r=class{constructor(){this.channel=null,this.waiters=[],this.posted=!1}yield(){return new Promise(e=>{this.waiters.push(e),!this.posted&&(this.posted=!0,this.ensureChannel().port2.postMessage(null))})}ensureChannel(){var e;if(this.channel)return this.channel;let t=new MessageChannel;t.port1.onmessage=()=>{this.posted=!1;let e=this.waiters.splice(0);for(let t of e)t()};let n=t.port1;return(e=n.unref)==null||e.call(n),this.channel=t,t}},ei=re(`flow-control/macrotask-yield.ts`,()=>({instance:new $r})).instance,ti=class{constructor(e){this._emit=e,this._bdp=new Qr,this._peerWindow=We,this._peerMsgWindow=100,this._consumedBytes=0,this._consumedMessages=0,this._creditReady=null,this._shutdown=!1,this._prevBucket=0,this._curBucket=0,this._curBucketStart=performance.now(),this._openedAt=performance.now()}get byteWindow(){return this._bdp.byteWindow}get msgWindow(){return this._bdp.msgWindow}decrement(e){if(this._peerWindow-=e,--this._peerMsgWindow,this._peerWindow<=0||this._peerMsgWindow<=0)return this._waitForCredit();if(this._selfUtilisation()>.5)return ei.yield()}onPeerByteWindow(e){this._peerWindow=e,this._tryWakeCreditWaiters()}onPeerMessageWindow(e){this._peerMsgWindow=e,this._tryWakeCreditWaiters()}onReceived(e){this._bdp.onReceive(e)&&this._emit.bdpPing()}onConsumed(e){this._consumedBytes+=e,this._consumedMessages+=1,this._consumedBytes>=this._bdp.byteWindow>>2&&(this._consumedBytes=0,this._emit.byteWindowUpdate(this._bdp.byteWindow)),this._consumedMessages>=this._bdp.msgWindow>>2&&(this._consumedMessages=0,this._emit.msgWindowUpdate(this._bdp.msgWindow))}onPingAck(){let e=this._bdp.onPingAck();if(!e.acknowledged)return;let t=e.bytes===`grow`,n=e.msgs===`grow`;!t&&!n||this._selfUtilisation()>.5||(t&&(this._bdp.growBytes(),this._emit.byteWindowUpdate(this._bdp.byteWindow)),n&&(this._bdp.growMsgs(),this._emit.msgWindowUpdate(this._bdp.msgWindow)))}_recordSelfTime(e){this._advanceBuckets(),this._curBucket+=Math.min(e,Ye)}_selfUtilisation(){this._advanceBuckets();let e=performance.now(),t=(e-this._curBucketStart)/Ye,n=this._prevBucket*(1-t)+this._curBucket,r=Math.min(e-this._openedAt,Ye);if(r<=0)return 0;let i=n/r;return i>1?1:i}_advanceBuckets(){let e=performance.now(),t=e-this._curBucketStart;if(!(t<1e3)){if(t<2*1e3){this._prevBucket=this._curBucket,this._curBucket=0,this._curBucketStart+=Ye;return}this._prevBucket=0,this._curBucket=0,this._curBucketStart=e}}reset(){this._peerWindow=We,this._peerMsgWindow=100,this._bdp.reset(),this._tryWakeCreditWaiters()}useBatchTransportInitial(){let e=this._bdp.byteWindow;this._bdp.bumpInitialByteWindow(Ge),this._bdp.byteWindow>e&&this._emit.byteWindowUpdate(this._bdp.byteWindow)}shutdown(){this._shutdown||(this._shutdown=!0,this._tryWakeCreditWaiters())}_tryWakeCreditWaiters(){if(!this._creditReady||!this._shutdown&&(this._peerWindow<=0||this._peerMsgWindow<=0))return;let e=this._creditReady;this._creditReady=null,e.resolve()}_waitForCredit(){if(this._shutdown||this._peerWindow>0&&this._peerMsgWindow>0)return ni;if(!this._creditReady){let e,t=new Promise(t=>{e=t});this._creditReady={promise:t,resolve:e}}return this._creditReady.promise}},ni=Promise.resolve();function ri(e){return typeof e==`object`&&!!e&&`then`in e&&Vn(e.then)}var ii,ai=Symbol.for(`telefunc.ClientBroadcast`),oi=class{constructor({channelId:e,ack:t=!1,key:n,transports:r,connectionKey:i,headers:a,telefuncUrl:o,idleTimeout:s}){this._listeners=[],this._binaryListeners=[],this._openCallbacks=[],this._closeCallbacks=[],this._isClosed=!1,this._didTerminate=!1,this._didFireClose=!1,this._didFireOpen=!1,this._closePromise=null,this._closeDeadline=0,this._closeWaiters=[],this._didReceiveCloseAck=!1,this._expectCloseAck=!1,this._pendingCloseCallbacks=0,this._inflightAcks=0,this._pendingAcks=new Map,this.id=e,this.ack=t,this.key=n,this._flow=new ti({byteWindowUpdate:e=>this._connection.sendByteWindowUpdate(this,e),msgWindowUpdate:e=>this._connection.sendMsgWindowUpdate(this,e),bdpPing:()=>this._connection.sendBdpPing(this)});let c=Qe(),l=Xr(o),u=l?Zr(o,l):o;this._connection=Hr.getOrCreate(u,this,{transports:r,fetchImpl:(c.fetch??globalThis.fetch).bind(globalThis),sessionToken:l,connectionKey:i,headers:a,idleTimeout:s})}get isClosed(){return this._isClosed}send(e,t){let n=performance.now();try{let n=this._send(e,t)??Promise.resolve();return n.catch(()=>{}),n}finally{this._flow._recordSelfTime(performance.now()-n)}}_send(e,t){if(this._isClosed)throw new Dt;let n=t?.ack!==!1&&(t?.ack===!0||this.ack===!0),r=rr(e);return n?this._trackAck(new Promise((e,t)=>{this._connection.sendTextAckReq(this,r,n=>{this._pendingAcks.set(n,{resolve:e,reject:t})})})):this._waitForWindow(this._connection.send(this,r))}sendBinary(e,t){let n=performance.now();try{let n=this._sendBinary(e,t)??Promise.resolve();return n.catch(()=>{}),n}finally{this._flow._recordSelfTime(performance.now()-n)}}_sendBinary(e,t){if(this._isClosed)throw new Dt;return t?.ack===!0?this._trackAck(new Promise((t,n)=>{this._connection.sendBinaryAckReq(this,e,e=>{this._pendingAcks.set(e,{resolve:t,reject:n})})})):(this._connection.sendBinary(this,e),this._waitForWindow(e.byteLength))}_waitForWindow(e){return this._flow.decrement(e)}listen(e){return this._listeners.push(e),()=>{let t=this._listeners.indexOf(e);t>=0&&this._listeners.splice(t,1)}}listenBinary(e){return this._binaryListeners.push(e),()=>{let t=this._binaryListeners.indexOf(e);t>=0&&this._binaryListeners.splice(t,1)}}onClose(e){if(this._didFireClose){this._invokeCloseCallback(e,this._closeError,!1);return}this._closeCallbacks.push(e)}onOpen(e){if(this._didFireOpen){e();return}this._openCallbacks.push(e)}close(e){if(this._closePromise)return this._closePromise;if(this._didTerminate)return Promise.resolve(+!this._didReceiveCloseAck);let t=li(e?.timeout);return this._closeDeadline=Date.now()+t,this._expectCloseAck=!0,this._isClosed=!0,this._connection.sendCloseRequest(this,t),this._closePromise=this._runFinalizationLoop(),this._closePromise}abort(e,t){if(this._didTerminate||this._isClosed)return;this._isClosed=!0;let n=_t(e,t);this._connection.sendAbort(this),this._finalizeClose(n)}_onTransportOpen(e){this._isClosed||(this._flow.reset(),e&&this._flow.useBatchTransportInitial(),this._fireOpen())}_onTransportMessage(t,n){let r=performance.now();try{this._flow.onReceived(n);let r=e(t),i=[];for(let e of this._listeners)try{let t=e(r);ri(t)&&i.push(t.catch(e=>this._handleCallbackError(e)))}catch(e){if(this._handleCallbackError(e))return}i.length>0?Promise.all(i).finally(()=>this._flow.onConsumed(n)):this._flow.onConsumed(n)}finally{this._flow._recordSelfTime(performance.now()-r)}}_onTransportAckReqMessage(e,t){return this._trackAck(this._dispatchAckReq(e,t))}_onTransportBinaryAckReqMessage(e,t){return this._trackAck(this._dispatchBinaryAckReq(e,t))}_onTransportBinaryMessage(e){let t=performance.now(),n=e.byteLength;try{this._flow.onReceived(n);let t=[];for(let n of this._binaryListeners)try{let r=n(e);ri(r)&&t.push(r.catch(e=>this._handleCallbackError(e)))}catch(e){if(this._handleCallbackError(e))return}t.length>0?Promise.all(t).finally(()=>this._flow.onConsumed(n)):this._flow.onConsumed(n)}finally{this._flow._recordSelfTime(performance.now()-t)}}_dispatchFrame(e){if(hr(e.tag)){this._dispatchCtrl(e);return}this._dispatchDataFrame(e)}_dispatchDataFrame(e){switch(e.tag){case G.TEXT:this._onTransportMessage(e.text,e.bytes);return;case G.TEXT_ACK_REQ:this._onTransportAckReqMessage(e.text,e.seq);return;case G.BINARY:this._onTransportBinaryMessage(e.data);return;case G.BINARY_ACK_REQ:this._onTransportBinaryAckReqMessage(e.data,e.seq);return;case G.ACK_RES:this._onPeerAckRes(e.ackedSeq,e.text,e.status);return;case G.PUBLISH:case G.PUBLISH_ACK_REQ:case G.PUBLISH_BINARY:case G.PUBLISH_BINARY_ACK_REQ:return}}_dispatchCtrl(e){switch(e.tag){case G.CLOSE:this._onTransportCloseRequest(e.timeoutMs);return;case G.CLOSE_ACK:this._onTransportCloseAck();return;case G.WINDOW:this._flow.onPeerByteWindow(e.bytes);return;case G.MSG_WINDOW:this._flow.onPeerMessageWindow(e.count);return;case G.BDP_PING:this._connection.sendBdpPingAck(this);return;case G.BDP_PING_ACK:this._flow.onPingAck();return}}_onPeerAckRes(t,n,r){let i=this._pendingAcks.get(t);if(i)switch(this._pendingAcks.delete(t),r){case _r.OK:i.resolve(e(n));return;case _r.ABORT:i.reject(Ut(e(n)));return;case _r.ERROR:i.reject(Kt(n||void 0));return;case _r.SHIELD_ERROR:i.reject(new St(n))}}_onTransportCloseRequest(e){if(this._didTerminate)return;let t=Date.now()+li(e);(!this._closeDeadline||t<this._closeDeadline)&&(this._closeDeadline=t),this._connection.sendCloseAck(this),this._isClosed?this._notifyCloseProgress():(this._isClosed=!0,this._runFinalizationLoop())}_onTransportCloseAck(){this._didTerminate||(this._didReceiveCloseAck=!0,this._expectCloseAck=!1,this._notifyCloseProgress())}_onTransportClose(e){this._isClosed=!0,this._finalizeClose(e)}_fireOpen(){if(!this._didFireOpen){this._didFireOpen=!0;for(let e of this._openCallbacks)try{e()}catch(e){if(this._handleCallbackError(e))return}this._openCallbacks.length=0}}_fireClose(e){if(!this._didFireClose){this._didFireClose=!0;for(let t of this._closeCallbacks)this._invokeCloseCallback(t,e,!0);this._closeCallbacks.length=0,this._openCallbacks.length=0,this._notifyCloseProgress()}}async _runFinalizationLoop(){for(;!this._didTerminate;){if(this._isCloseRoundtripDone()&&this._fireClose(),this._didFireClose&&this._pendingCloseCallbacks===0){this._finalizeClose();break}let e=this._closeDeadline-Date.now();if(e<=0){this._finalizeClose(new Dt(`Channel close timed out`));break}await this._waitForCloseProgress(e)}return+!this._didReceiveCloseAck}_isCloseRoundtripDone(){return this._inflightAcks===0&&(!this._expectCloseAck||this._didReceiveCloseAck)}_waitForCloseProgress(e){return new Promise(t=>{let n=!1,r=setTimeout(()=>{if(n)return;n=!0;let e=this._closeWaiters.indexOf(i);e>=0&&this._closeWaiters.splice(e,1),t()},e),i=()=>{n||(n=!0,clearTimeout(r),t())};this._closeWaiters.push(i)})}_notifyCloseProgress(){let e=this._closeWaiters.splice(0);for(let t of e)t()}async _dispatchAckReq(t,n){if(this._listeners.length===0){this._connection.sendAckRes(this,n,`No listener registered for ack request`,_r.ERROR);return}let r=e(t),i;for(let e of this._listeners)try{i=await e(r)}catch(e){if(this._handleCallbackError(e))return;this._connection.sendAckRes(this,n,`Internal client channel error — see client logs`,_r.ERROR);return}this._connection.sendAckRes(this,n,rr(i))}async _dispatchBinaryAckReq(e,t){if(this._binaryListeners.length===0){this._connection.sendAckRes(this,t,`No listener registered for ack request`,_r.ERROR);return}let n;for(let r of this._binaryListeners)try{n=await r(e)}catch(e){if(this._handleCallbackError(e))return;this._connection.sendAckRes(this,t,`Internal client channel error — see client logs`,_r.ERROR);return}this._connection.sendAckRes(this,t,rr(n))}_trackAck(e){return this._inflightAcks++,e.finally(()=>{this._inflightAcks--,this._notifyCloseProgress()})}_finalizeClose(e){if(this._didTerminate)return;this._didTerminate=!0,this._closeError=e,this._flow.shutdown();let t=e??new Dt;for(let{reject:e}of this._pendingAcks.values())e(t);this._pendingAcks.clear(),this._connection.unregister(this,t),this._fireClose(e),this._notifyCloseProgress()}_invokeCloseCallback(e,t,n){try{let r=e(t);if(!ri(r))return;n?(this._pendingCloseCallbacks++,r.catch(ci).finally(()=>{this._pendingCloseCallbacks--,this._notifyCloseProgress()})):r.catch(ci)}catch(e){ci(e)}}_handleCallbackError(e){if(vt(e)){let t=e;return this.abort(t.abortValue,t.message),!0}return ci(e),!1}},si=class extends oi{constructor(){super(...arguments),this[ii]=!0,this._broadcastListeners=[],this._broadcastBinaryListeners=[]}static isClientBroadcast(e){return Hn(e,ai)}publish(e){if(this._isClosed)throw new Dt;let t=rr(e),n=this._trackAck(new Promise((e,n)=>{this._connection.sendPublishAckReq(this,t,t=>{this._pendingAcks.set(t,{resolve:e,reject:n})})}));return n.catch(ci),n}subscribe(e){return this._broadcastListeners.length===0&&this._connection.sendBroadcastSubscribe(this,!1),this._broadcastListeners.push(e),()=>{let t=this._broadcastListeners.indexOf(e);t>=0&&this._broadcastListeners.splice(t,1),this._broadcastListeners.length===0&&this._connection.sendBroadcastUnsubscribe(this,!1)}}publishBinary(e){if(this._isClosed)throw new Dt;let t=this._trackAck(new Promise((t,n)=>{this._connection.sendPublishBinaryAckReq(this,e,e=>{this._pendingAcks.set(e,{resolve:t,reject:n})})}));return t.catch(ci),t}subscribeBinary(e){return this._broadcastBinaryListeners.length===0&&this._connection.sendBroadcastSubscribe(this,!0),this._broadcastBinaryListeners.push(e),()=>{let t=this._broadcastBinaryListeners.indexOf(e);t>=0&&this._broadcastBinaryListeners.splice(t,1),this._broadcastBinaryListeners.length===0&&this._connection.sendBroadcastUnsubscribe(this,!0)}}_dispatchDataFrame(e){if(e.tag===G.PUBLISH){this._onTransportPublish(e.text,e.info);return}if(e.tag===G.PUBLISH_BINARY){this._onTransportPublishBinary(e.data,e.info);return}super._dispatchDataFrame(e)}_onTransportPublish(t,n){let r=e(t),i=Zn(this.key,n.seq,n.timestamp);for(let e of this._broadcastListeners)try{e(r,i)}catch(e){if(this._handleCallbackError(e))return}}_onTransportPublishBinary(e,t){let n=Zn(this.key,t.seq,t.timestamp);for(let t of this._broadcastBinaryListeners)try{t(e,n)}catch(e){if(this._handleCallbackError(e))return}}};ii=ai;function ci(e){console.error(`[telefunc:channel-error]`,e instanceof Error?e:Error(String(e)))}function li(e){if(e===void 0)return Be;if(!Number.isFinite(e)||e<0)throw Error(`Channel close timeout must be a non-negative finite number`);return e}var ui=new WeakMap;function di(e){if(typeof e==`function`){let t=(...n)=>{let r=e(...n);return fi(r,t),r};return Object.assign(t,e),t}let t=new Proxy({},{get(n,r){let i=Reflect.get(e,r,e);return typeof i==`function`?(...n)=>{let r=i.apply(e,n);return fi(r,t),r}:i},set(t,n,r){return Reflect.set(e,n,r,e)},has(t,n){return Reflect.has(e,n)},ownKeys(){return Reflect.ownKeys(e)},getOwnPropertyDescriptor(t,n){let r=Reflect.getOwnPropertyDescriptor(e,n);return r&&{...r,configurable:!0}},getPrototypeOf(){return Reflect.getPrototypeOf(e)}});return t}function fi(e,t){st(e)&&ui.set(e,t)}var pi=class{constructor(e=5e3){this.periodicScanMs=e,this.entries=new Set,this.scanTimer=null,this.finalReg=new FinalizationRegistry(e=>this.fireCleanup(e))}register(e,t){let n={ref:new WeakRef(e),close:t,cleaned:!1};this.entries.add(n),this.finalReg.register(e,n,n),this.scanTimer||=jr(setInterval(()=>this.scan(),this.periodicScanMs))}scan(){for(let e of this.entries)e.ref.deref()===void 0&&this.fireCleanup(e);this.stopScanIfIdle()}fireCleanup(e){if(!e.cleaned){e.cleaned=!0,this.entries.delete(e),this.finalReg.unregister(e);try{e.close()}catch{}this.stopScanIfIdle()}}stopScanIfIdle(){this.scanTimer&&this.entries.size===0&&(clearInterval(this.scanTimer),this.scanTimer=null)}};function mi(e){let{wasCancelled:t,received:n,readOptions:r}=e;if(t&&(r?.cancelBehavior??`error`)===`error`)return Error(`Stream cancelled before all bytes were received`);let i=r?.expectedSize;return i!==void 0&&i>=0&&n!==i?Error(`Stream truncated — received ${n} of ${i} expected bytes`):null}function hi(e){let t=0;return new ReadableStream({pull:async n=>{var r,i;try{let a=await e.readNextChunk();if(a===null){let r=mi({wasCancelled:e.isCancelled(),received:t,readOptions:e.readOptions});if(r)throw r;n.close();return}t+=a.byteLength,(i=(r=e.readOptions)?.onChunk)==null||i.call(r,a.byteLength),n.enqueue(a)}catch(t){e.cancel(),n.error(t)}},cancel:e.cancel},e.highWaterMark===void 0?void 0:{highWaterMark:e.highWaterMark})}async function gi(e,t,n){var r;let i=[],a=0;for(;;){let t=await e();if(t===null)break;i.push(t),a+=t.byteLength,(r=n?.onChunk)==null||r.call(n,t.byteLength)}let o=mi({wasCancelled:t(),received:a,readOptions:n});if(o)throw o;let s=new Uint8Array(a),c=0;for(let e of i)s.set(e,c),c+=e.byteLength;return s}var _i=class t{constructor(e,t){this.queue=[],this.readHead=0,this.wake=null,this.closed=!1,this.closeError=null,this.cancelled=!1,this.channel=e,this.throwError=t,e.listenBinary(e=>new Promise(t=>{var n;this.queue.push({frame:e,onConsumed:t}),(n=this.wake)==null||n.call(this),this.wake=null})),e.onClose(e=>{var t;this.closed=!0,this.closeError=e??null,(t=this.wake)==null||t.call(this),this.wake=null})}static create(e,n){let r=new t(e,n),i=()=>r.readNextChunk(),a=()=>r.cancel(),o=t=>e.abort(t.abortValue,t.message),s=()=>r.cancelled;return{readNextChunk:i,bytes:e=>gi(i,s,e),stream:e=>hi({readNextChunk:i,cancel:a,isCancelled:s,readOptions:e,highWaterMark:0}),cancel:a,abort:o}}async readNextChunk(){for(;this.readHead>=this.queue.length;){if(this.closed){if(this.closeError)throw this.closeError;return null}await new Promise(e=>{this.wake=e})}let t=this.queue[this.readHead];this.queue[this.readHead]=void 0,this.readHead++,t.onConsumed(),this.readHead>16&&this.readHead>=this.queue.length>>>1&&(this.queue=this.queue.slice(this.readHead),this.readHead=0);let n=t.frame[0],r=t.frame.subarray(1);if(n===1){let t=e(At.decode(r));throw de(ve(t)),this.throwError&&this.throwError(t),Error(`Streaming error frame received`)}return r}cancel(){var e;this.cancelled=!0,this.channel.close(),(e=this.wake)==null||e.call(this),this.wake=null}},vi=re(`wire-protocol/client/response/parse.ts`,{gcRegistry:new pi});async function yi(e,t,n,r){let i=t.channel.transports,a=e.headers.get(`content-type`)??``;if(a.includes(`application/octet-stream`)||a.includes(`text/event-stream`)){de(e.body);let o=e.body.getReader(),s=a.includes(`text/event-stream`)?new Xn(o,t):new Kn(o,t),c=await s.readU32(),l=await s.readExact(c);return bi(new TextDecoder().decode(l),t,i,n,s,r)}return bi(await e.text(),t,i,n,null,r)}async function bi(t,n,r,i,a,o){let{extensionResponseTypes:s}=n,c=new WeakMap,l=e=>{e.type===ke.ABORT&&`abortValue`in e&&Wt(n.telefunctionName,n.telefuncFilePath,e.abortValue),qt()},u=n.headers??void 0,d=n.telefuncUrl,f=[],p={waitFor(e){e.catch(()=>{}),f.push(e)},createChannel(e){return new oi({channelId:e.channelId,ack:e.ack,transports:r,connectionKey:i,headers:u,telefuncUrl:d,idleTimeout:o})},createBroadcast(e){return new si({channelId:e.channelId,key:e.key,transports:r,connectionKey:i,headers:u,telefuncUrl:d,idleTimeout:o})},receiveStream(e){if(`channelId`in e){let t=new oi({channelId:e.channelId,transports:r,connectionKey:i,headers:u,telefuncUrl:d,idleTimeout:o});return _i.create(t,l)}return de(a,`Unexpected receiveStream call in non-streaming response`),xi.getInstance(a).create(e.__index)}},m=[...n.requestCloseHandlers],h=Wn(p,function(e){{let{value:t,close:n}=e;de(st(t));let r=di(t);vi.gcRegistry.register(r,n),e.value=r}{let{value:t,abort:r,close:i}=e;de(st(t)),c.set(t,i),m.push(i),n.abortController.signal.addEventListener(`abort`,()=>{r(Ut(void 0,n))},{once:!0})}},s),g;try{g=e(t,{reviver:h}),f.length>0&&await Promise.all(f)}catch(e){for(let e of m)e();throw e}if(!ve(g))return g;let{ret:_}=g;return st(_)&&(ot(_,n.abortController),ut(_,c),dt(_,n.requestCloseHandlers)),{ret:_}}var xi=class e{static getInstance(t){let n=e.instances.get(t);return n||(n=new e(t),e.instances.set(t,n)),n}constructor(e){this.pendingFrames=new Map,this.pendingBytes=new Map,this.indexWaiters=new Map,this.reading=!1,this.ended=!1,this.streamError=null,this.cancelledIndices=new Set,this.doneIndices=new Set,this.totalConsumers=0,this.streamReader=e}registerConsumer(){this.totalConsumers++}cancelIndex(e){if(this.cancelledIndices.has(e))return;this.cancelledIndices.add(e),this.pendingFrames.delete(e);let t=this.indexWaiters.get(e);t&&(this.indexWaiters.delete(e),t.resolve(null)),this.cancelledIndices.size>=this.totalConsumers&&this.streamReader.cancel()}async readNextChunkForIndex(e){if(this.cancelledIndices.has(e))return null;if(this.streamError)throw this.streamError;let t=this.pendingFrames.get(e);if(t&&t.length>0){let n=t.shift();return this.pendingBytes.set(e,(this.pendingBytes.get(e)??0)-n.byteLength),this.ensureReading(),n}if(this.doneIndices.has(e)||this.ended)return null;let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.indexWaiters.set(e,{resolve:n,reject:r}),this.ensureReading(),i}create(e){this.registerConsumer();let t=()=>this.readNextChunkForIndex(e),n=()=>this.cancelIndex(e),r=()=>this.cancelledIndices.has(e);return{readNextChunk:t,bytes:e=>gi(t,r,e),stream:e=>hi({readNextChunk:t,cancel:n,isCancelled:r,readOptions:e}),cancel:n,abort(){}}}async ensureReading(){if(!this.reading){this.reading=!0;try{for(;this.indexWaiters.size>0;){let t=await this.streamReader.readNextFrame();if(t===null){this.ended=!0;for(let[,e]of this.indexWaiters)e.resolve(null);this.indexWaiters.clear();return}if(this.cancelledIndices.has(t.index))continue;let n=this.indexWaiters.get(t.index);if(t.payload.length===0){this.doneIndices.add(t.index),n&&(this.indexWaiters.delete(t.index),n.resolve(null));continue}if(n){this.indexWaiters.delete(t.index),n.resolve(t.payload);continue}let r=this.pendingFrames.get(t.index);r?r.push(t.payload):this.pendingFrames.set(t.index,[t.payload]);let i=(this.pendingBytes.get(t.index)??0)+t.payload.byteLength;if(this.pendingBytes.set(t.index,i),i>=e.MAX_BUFFER_BYTES_PER_INDEX)break}}catch(e){this.streamError??=e;for(let[,t]of this.indexWaiters)t.reject(e);this.indexWaiters.clear()}finally{this.reading=!1}}}};xi.MAX_BUFFER_BYTES_PER_INDEX=1024*1024,xi.instances=new Map;var Si=`POST`;async function Ci(t){let n=typeof t.httpRequestBody!=`string`,r=n?Ir.BINARY:Ir.TEXT,i=Xr(t.telefuncUrl),a=Lr(i?Zr(t.telefuncUrl,i):t.telefuncUrl,r),o=n?{"Content-Type":`application/octet-stream`}:{"Content-Type":`text/plain`},s={[Fr]:r},c;try{c=await(t.fetch??window.fetch)(a,{method:Si,body:t.httpRequestBody,credentials:`same-origin`,headers:{...o,...s,...t.headers,...i?{[Xe]:i}:void 0},signal:t.abortController.signal})}catch{throw t.abortController.signal.aborted&&Wt(t.telefunctionName,t.telefuncFilePath,void 0),new Et}let l=c.status,u=c.headers.get(`x-telefunc-session`)??void 0;if(u&&Yr(t.telefuncUrl,u),l===200){let e=await yi(c,t,t.connectionKey,t.channelIdleTimeout);return fe(ve(e)&&`ret`in e,wi({method:Si,callContext:t})),e.ret}else if(l===403){let n=e(await c.text());fe(ve(n)&&`ret`in n,wi({method:Si,callContext:t})),de(`abort`in n),Wt(t.telefunctionName,t.telefuncFilePath,n.ret)}else if(l===500)qt(await Ti(Ht,c,t));else if(l===422)throw new St(await Ti(Vt,c,t,` (if enabled: https://telefunc.com/log)`));else l===400?(fe(await c.text()===Bt,wi({method:Si,callContext:t})),fe(!1,`Try again. You may need to reload the page. (The client and server are out of sync.)`)):(fe(l!==404,wi({reason:`a 404 HTTP response`,method:Si,isNotInstalled:!0,callContext:t})),fe(!1,wi({reason:`a status code \`${l}\` which Telefunc never returns`,method:Si,callContext:t})))}function wi({reason:e=`an HTTP response body that Telefunc never generates`,callContext:t,method:n,isNotInstalled:r}){let i=[`Telefunc doesn't seem to be `];return r||i.push(`(properly) `),i.push(`installed on your server`),i.push(`: the HTTP ${n} \`${t.telefuncUrl}\` request returned `,e),i.push(`, see https://telefunc.com/install`),i.join(``)}async function Ti(e,t,n,r=``){return fe(await t.text()===e,wi({method:Si,callContext:n})),`${e} — see server logs${r}`}function Ei(e){return e.charAt(0).toLowerCase()+e.slice(1)}var Di={prefix:ye,detect:e=>e instanceof File,replace:(e,t)=>({metadata:{index:t.registerFile(e),name:e.name,size:e.size,type:e.type,lastModified:e.lastModified},close(){},abort(){}})},Oi={prefix:be,detect:e=>e instanceof Blob,replace:(e,t)=>({metadata:{index:t.registerFile(e),size:e.size,type:e.type},close(){},abort(){}})},ki={prefix:De,detect:e=>typeof e==`function`,replace:(e,t)=>{let n=t.createChannel({ack:!0});return n.listen(t=>e(...t)),{metadata:{channelId:n.id},async close(){await n.close()},abort(){n.abort()}}}},Ai={prefix:Ce,detect:e=>e instanceof ReadableStream,replace:(e,t)=>{let{metadata:n,close:r,abort:i}=t.sendStream(()=>Ai.createProducer(e));return{metadata:n,close:r,abort:i}},createProducer:e=>{let t=e.getReader(),n=(async function*(){try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}})();return{chunks:n,cancel:e=>{n.return(void 0),t.cancel(e)}}}},ji=[Di,Oi,Ai,ki];function Mi(e,t,n){let r=[...ji,...n];return(n,i,a)=>{for(let n of r)if(n.detect(i)){let{metadata:r,close:o,abort:s}=n.replace(i,e);return t({value:i,close:o,abort:s}),{replacement:n.prefix+a(r),resolved:!0}}}}var Ni=new Uint8Array([0]);function Pi(e,t,n,r,i){let a=new oi({channelId:crypto.randomUUID(),transports:t,connectionKey:r,headers:i,telefuncUrl:n}),o=e(),s=!1,c,l=new Promise(e=>{c=e}),u=e=>{s||(s=!0,c({done:!0,value:void 0}),o.cancel(e))};return a.onClose(u),(async()=>{try{for(await new Promise((e,t)=>{a.onOpen(e),a.onClose(()=>t(new Dt))});;){let{done:e,value:t}=await Promise.race([l,o.chunks.next()]);if(e||s)break;let n=a._sendBinary(Pt(Ni,t));n&&await n}}catch{}finally{u(),a.close()}})(),{metadata:{channelId:a.id},async close(){await a.close()},abort(){a.abort()}}}var Fi=re(`client/remoteTelefunctionCall/serializeTelefunctionArguments.ts`,{gcRegistry:new pi});function Ii(e){let t={file:e.telefuncFilePath,name:e.telefunctionName,args:e.telefunctionArgs};if(e.stream?.transport){let{transport:n}=e.stream;t.stream={transport:n}}e.extensions&&(t.extensions=e.extensions);let n=e.channel.transports,r=e.connectionKey,i=e.headers??void 0,a=e.telefuncUrl,o=e.abortController.signal,s=[],c=[],l=Li(t,e,Mi({registerFile(e){let t=s.length;return s.push(e),t},createChannel(e){return new oi({channelId:crypto.randomUUID(),ack:e?.ack,transports:n,connectionKey:r,headers:i,telefuncUrl:a})},sendStream(e){return Pi(e,n,a,r,i)}},function(t){{let{value:e,close:n}=t;de(st(e)),Fi.gcRegistry.register(e,n)}{let{close:n,abort:r}=t;o.addEventListener(`abort`,()=>{r(Ut(void 0,e))},{once:!0}),c.push(n)}},e.extensionRequestTypes));return{httpRequestBody:s.length>0?It(l,s):l,requestCloseHandlers:c}}function Li(e,t,n){let r;try{r=rr(e,{forbidReactElements:!0,replacer:n})}catch(e){de(Hn(e,`message`,`string`)),fe(!1,[`Cannot serialize arguments for telefunction ${t.telefunctionName}() (${t.telefuncFilePath}).`,`Make sure that the arguments passed to telefunction calls are always serializable.`,`Serialization error: ${Ei(e.message)}`].join(` `))}return de(r),r}function Ri(){return typeof window<`u`&&typeof window.scrollY==`number`}function zi(e,t){Object.assign(e,t)}function Bi(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.next==`function`&&typeof t.return==`function`&&typeof t.throw==`function`&&typeof t[Symbol.asyncIterator]==`function`}function Vi(e,t){let n=(async()=>{let n=await e;return fe(Bi(n),"`for await...of` can only be used for an async generator telefunction"),ot(n,t),n})();n.catch(()=>{});let r=new WeakMap;r.set(e,()=>{n.then(e=>e.return(void 0))}),ut(e,r);let i=(async function*(){yield*await n})();zi(e,{next:(...e)=>i.next(...e),return:async e=>(await n).return(e),throw:async e=>(await n).throw(e),[Symbol.asyncDispose]:async()=>{await(await n).return(void 0)},[Symbol.asyncIterator]:()=>e})}function K(e,t,n){fe(Ri(),`The Telefunc Client is meant to be run only in the browser.`);let r=wt(),i={};zi(i,{telefuncFilePath:e,telefunctionName:t,telefunctionArgs:n}),zi(i,Qe()),r?.telefuncUrl&&zi(i,{telefuncUrl:r.telefuncUrl});let a=r?.channel?.connectionKey;a&&zi(i,{connectionKey:a});let o=r?.channel?.idleTimeout;o!==void 0&&zi(i,{channelIdleTimeout:o}),r?.headers&&zi(i,{headers:{...i.headers,...r.headers}}),r?.stream?.transport&&zi(i,{stream:{transport:r.stream.transport}}),r?.channel?.transports&&zi(i,{channel:{transports:r.channel.transports}}),r?.extensions&&zi(i,{extensions:r.extensions});let s=Hi(r?.signal);zi(i,{abortController:s});let{httpRequestBody:c,requestCloseHandlers:l}=Ii(i);zi(i,{httpRequestBody:c,requestCloseHandlers:l});let u=Ci(i);return ot(u,s),Vi(u,s),u}function Hi(e){let t=new AbortController;return e&&(e.aborted?t.abort():e.addEventListener(`abort`,()=>t.abort(),{once:!0})),t}var Ui=(...e)=>K(`/server/reads.telefunc.ts`,`onRuns`,e);Ui._key=`/server/reads.telefunc.ts:onRuns`;var Wi=(...e)=>K(`/server/reads.telefunc.ts`,`onRun`,e);Wi._key=`/server/reads.telefunc.ts:onRun`;var Gi=(...e)=>K(`/server/reads.telefunc.ts`,`onDocs`,e);Gi._key=`/server/reads.telefunc.ts:onDocs`;var Ki=(...e)=>K(`/server/reads.telefunc.ts`,`onProjectLog`,e);Ki._key=`/server/reads.telefunc.ts:onProjectLog`;var qi=(...e)=>K(`/server/reads.telefunc.ts`,`onQueue`,e);qi._key=`/server/reads.telefunc.ts:onQueue`;var Ji=(...e)=>K(`/server/reads.telefunc.ts`,`onOverview`,e);Ji._key=`/server/reads.telefunc.ts:onOverview`;var Yi=(...e)=>K(`/server/reads.telefunc.ts`,`onRecentRuns`,e);Yi._key=`/server/reads.telefunc.ts:onRecentRuns`;var Xi=(...e)=>K(`/server/reads.telefunc.ts`,`onHotTickets`,e);Xi._key=`/server/reads.telefunc.ts:onHotTickets`;var Zi=(...e)=>K(`/server/reads.telefunc.ts`,`onInterventions`,e);Zi._key=`/server/reads.telefunc.ts:onInterventions`;var Qi=(...e)=>K(`/server/reads.telefunc.ts`,`onOpenQuestions`,e);Qi._key=`/server/reads.telefunc.ts:onOpenQuestions`;var $i=(...e)=>K(`/server/reads.telefunc.ts`,`onActivity`,e);$i._key=`/server/reads.telefunc.ts:onActivity`;var ea=(...e)=>K(`/server/reads.telefunc.ts`,`onDashboard`,e);ea._key=`/server/reads.telefunc.ts:onDashboard`;var ta=(...e)=>K(`/server/reads.telefunc.ts`,`onGithubUrl`,e);ta._key=`/server/reads.telefunc.ts:onGithubUrl`;var na=(...e)=>K(`/server/reads.telefunc.ts`,`onGitStatus`,e);na._key=`/server/reads.telefunc.ts:onGitStatus`;var ra=(...e)=>K(`/server/reads.telefunc.ts`,`onProjectFiles`,e);ra._key=`/server/reads.telefunc.ts:onProjectFiles`;var ia=(...e)=>K(`/server/reads.telefunc.ts`,`onProjectFileStatus`,e);ia._key=`/server/reads.telefunc.ts:onProjectFileStatus`;var aa=(...e)=>K(`/server/reads.telefunc.ts`,`onFileDiff`,e);aa._key=`/server/reads.telefunc.ts:onFileDiff`;var oa=(...e)=>K(`/server/reads.telefunc.ts`,`onRunChanges`,e);oa._key=`/server/reads.telefunc.ts:onRunChanges`;var sa=(...e)=>K(`/server/reads.telefunc.ts`,`onFileContent`,e);sa._key=`/server/reads.telefunc.ts:onFileContent`;var ca=(...e)=>K(`/server/reads.telefunc.ts`,`onTickets`,e);ca._key=`/server/reads.telefunc.ts:onTickets`;var la=(...e)=>K(`/server/reads.telefunc.ts`,`onTicket`,e);la._key=`/server/reads.telefunc.ts:onTicket`;var ua=(...e)=>K(`/server/reads.telefunc.ts`,`onTicketsMeta`,e);ua._key=`/server/reads.telefunc.ts:onTicketsMeta`;var da=(...e)=>K(`/server/reads.telefunc.ts`,`onAllTickets`,e);da._key=`/server/reads.telefunc.ts:onAllTickets`;var fa=(...e)=>K(`/server/reads.telefunc.ts`,`onRetainedWorktrees`,e);fa._key=`/server/reads.telefunc.ts:onRetainedWorktrees`;var pa=(...e)=>K(`/server/reads.telefunc.ts`,`onRunWorktree`,e);pa._key=`/server/reads.telefunc.ts:onRunWorktree`;var ma=(...e)=>K(`/server/reads.telefunc.ts`,`onRunHandoff`,e);ma._key=`/server/reads.telefunc.ts:onRunHandoff`;var ha=(...e)=>K(`/server/reads.telefunc.ts`,`onSystemPromptUser`,e);ha._key=`/server/reads.telefunc.ts:onSystemPromptUser`;var ga=(...e)=>K(`/server/reads.telefunc.ts`,`onBridgeQuestion`,e);ga._key=`/server/reads.telefunc.ts:onBridgeQuestion`;var _a=(...e)=>K(`/server/reads.telefunc.ts`,`onBridgeStatus`,e);_a._key=`/server/reads.telefunc.ts:onBridgeStatus`;var va=(...e)=>K(`/server/reads.telefunc.ts`,`onBridgeToken`,e);va._key=`/server/reads.telefunc.ts:onBridgeToken`;var ya=(...e)=>K(`/server/reads.telefunc.ts`,`onBridgeEvents`,e);ya._key=`/server/reads.telefunc.ts:onBridgeEvents`;var ba=(...e)=>K(`/server/reads.telefunc.ts`,`onBridgeAnswer`,e);ba._key=`/server/reads.telefunc.ts:onBridgeAnswer`;var xa=(...e)=>K(`/server/projects.telefunc.ts`,`onProjects`,e);xa._key=`/server/projects.telefunc.ts:onProjects`;var Sa=(...e)=>K(`/server/projects.telefunc.ts`,`sendAddProject`,e);Sa._key=`/server/projects.telefunc.ts:sendAddProject`;var Ca=(...e)=>K(`/server/projects.telefunc.ts`,`onOnboarding`,e);Ca._key=`/server/projects.telefunc.ts:onOnboarding`;var wa=(...e)=>K(`/server/projects.telefunc.ts`,`onClaudeTrust`,e);wa._key=`/server/projects.telefunc.ts:onClaudeTrust`;var Ta=(...e)=>K(`/server/projects.telefunc.ts`,`onAgentReady`,e);Ta._key=`/server/projects.telefunc.ts:onAgentReady`;var Ea=(...e)=>K(`/server/projects.telefunc.ts`,`onRepoAutoMerge`,e);Ea._key=`/server/projects.telefunc.ts:onRepoAutoMerge`;var Da=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Oa=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ka={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Aa=(0,T.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,T.createElement)(`svg`,{ref:c,...ka,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Oa(`lucide`,i),...s},[...o.map(([e,t])=>(0,T.createElement)(e,t)),...Array.isArray(a)?a:[a]])),ja=(e,t)=>{let n=(0,T.forwardRef)(({className:n,...r},i)=>(0,T.createElement)(Aa,{ref:i,iconNode:t,className:Oa(`lucide-${Da(e)}`,n),...r}));return n.displayName=`${e}`,n},Ma=ja(`ArrowDownWideNarrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),Na=ja(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Pa=ja(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Fa=ja(`ArrowUpNarrowWide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),Ia=ja(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),La=ja(`BellOff`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Ra=ja(`Bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),za=ja(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ba=ja(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Va=ja(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ha=ja(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ua=ja(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wa=ja(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ga=ja(`ClipboardList`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Ka=ja(`ClipboardPlus`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M9 14h6`,key:`159ibu`}],[`path`,{d:`M12 17v-6`,key:`1y8rbf`}]]),qa=ja(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ja=ja(`Code`,[[`polyline`,{points:`16 18 22 12 16 6`,key:`z7tu5w`}],[`polyline`,{points:`8 6 2 12 8 18`,key:`1eg1df`}]]),Ya=ja(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Xa=ja(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Za=ja(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Qa=ja(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),$a=ja(`Flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),eo=ja(`FolderGit2`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`path`,{d:`M18 19c-2.8 0-5-2.2-5-5v8`,key:`pkpw2h`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),to=ja(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),no=ja(`FolderX`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),ro=ja(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),io=ja(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),ao=ja(`GitMerge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),oo=ja(`GitPullRequest`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),so=ja(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),co=ja(`Hammer`,[[`path`,{d:`m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9`,key:`eefl8a`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`b7pghm`}]]),lo=ja(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),uo=ja(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),fo=ja(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),po=ja(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),mo=ja(`ListPlus`,[[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 6H3`,key:`1wxfjs`}],[`path`,{d:`M16 18H3`,key:`12xzn7`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),ho=ja(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),go=ja(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),_o=ja(`LockOpen`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),vo=ja(`MessageCircleQuestion`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),yo=ja(`MonitorSmartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),bo=ja(`Monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),xo=ja(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),So=ja(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Co=ja(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),wo=ja(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),To=ja(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Eo=ja(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Do=ja(`SquareCheckBig`,[[`path`,{d:`M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5`,key:`1uzm8b`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Oo=ja(`SquareSlash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),ko=ja(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ao=ja(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),jo=ja(`Ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Mo=ja(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),No=ja(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Po=ja(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Fo=[`claude`,`codex`];function Io(e){return e!==void 0&&Fo.includes(e)}var Lo={claude:`Claude Code`,codex:`Codex`};function Ro(e){return e===`claude-code`||e===`claude-web`||e===`github-actions`?`claude`:Io(e)?e:void 0}function zo(e){return Array.isArray(e)?[...e]:e?[e]:[]}function Bo(e){switch(e.kind){case`session`:return`◆ ${e.fake?`fake`:e.driver}${e.model?` (${e.model})`:``} in ${e.workspace}${e.sessionLink?` — ${e.sessionLink}`:``}`;case`session-update`:return`  session ${e.sessionId}${e.sessionLink?` — ${e.sessionLink}`:``}`;case`system-prompt`:return`  system prompt sent (${e.text.length} chars)`;case`preview`:return`▶ your app is running at ${e.url}`;case`browser-stream`:return`◆ browser preview: http://127.0.0.1:${e.port}/stream`;case`browser`:return`◆ browser: ${e.url}`;case`log`:return`  ${e.message}`;case`view`:return`▶ view: ${e.title}`;case`session-name`:return`  session: ${e.name}`;case`ready-for-merge`:return`✓ ready for merge`;case`settled`:return`◆ done for now — waiting for your next message`;case`bind`:return`◆ bound to project ${e.projectId}`;case`ticket`:return`  implementing ${e.path}`;case`queue-entry`:return`  working the queue entry: ${e.entry}`;case`branch`:return`  branch: ${e.branch}`;case`on-before-mergeable`:switch(e.outcome){case`queued`:return`✓ post-merge cleanup: quality follow-ups queued`;case`incomplete`:return`  ! post-merge cleanup: queueing did not complete cleanly`;case`skipped`:return`  ~ post-merge cleanup skipped: ${Uo(e.reason)}`}case`handoff-armed`:return e.pr&&e.merge?`  when this ends: push the branch, open a PR, and merge it`:e.pr?`  when this ends: push the branch and open a draft PR`:e.push?`  when this ends: push the branch`:`  when this ends: nothing — push and PR are both off`;case`handoff`:{let t=e.outcome!==`failed`&&e.merge?`\n${Vo(e.merge)}`:``;switch(e.outcome){case`done`:return(e.url?`✓ opened ${e.url}`:`✓ branch pushed`)+t;case`skipped`:return`  ~ handoff skipped: ${Wo(e.reason)}`+t;case`failed`:return`  ! could not ${e.step===`pr`?`open the PR`:`push the branch`}: ${e.error}`}}case`usage`:{let t=`over ${e.turns} turn${e.turns===1?``:`s`}`;return e.costUsd===void 0?`  tokens: ${(e.inputTokens+e.cacheReadTokens+e.outputTokens).toLocaleString(`en-US`)} (${e.outputTokens.toLocaleString(`en-US`)} out) ${t} — no price reported`:`  spend: $${e.costUsd.toFixed(4)}${e.budgetUsd?` / $${e.budgetUsd}`:``} ${t}`}case`modes`:return`  modes: ${e.all.map(t=>`${e.active.includes(t)?`[x]`:`[ ]`} ${t}`).join(`  `)}`;case`choice`:{let t=t=>e.multi?t.default?`[x]`:`[ ]`:t.id===e.recommended?`●`:`○`,n=e.options.map(e=>`    ${t(e)} ${e.label}`).join(`
`);return`? ${e.title}\n${n}`}case`choice-resolved`:return`  ✓ chose ${zo(e.picked).join(`, `)||`(none)`} (${e.by})`;case`driver`:return Go(e.event);case`bootstrap`:return qo(e.event);case`end`:return e.ok?`✓ finished`:e.stopped?`■ stopped`:`✗ failed: ${e.detail??`unknown error`}`}}function Vo(e){switch(e.outcome){case`auto-armed`:return`✓ auto-merge armed: the PR lands when its checks pass`;case`watched`:return`✓ merge on green: the daemon merges the PR when its checks pass`;case`merged`:return`✓ merged the PR`;case`withheld`:return`  ~ merge withheld: ${Ho(e.reason)}`;case`failed`:return`  ! could not merge the PR: ${e.error}`}}function Ho(e){switch(e){case`not-ready-for-merge`:return`the session never signalled ready-for-merge`;case`session-todo-open`:return`the session's own TODO file still has open entries`}}function Uo(e){switch(e){case`not-ready-for-merge`:return`the session never signalled ready-for-merge`;case`run-stopped`:return`the run was stopped`;case`fake-run`:return`this was a fake run`;case`no-session-name`:return`the session never called setSessionName()`;case`no-bin-path`:return`the framework binary path is unknown`}}function Wo(e){switch(e){case`not-armed`:return`push and PR are both off for this session`;case`branch-gone`:return`the branch no longer exists`;case`no-commits`:return`the session committed nothing`;case`commit-failed`:return`the session's pending work could not be committed, so nothing was published (the work stays on its branch)`;case`no-remote`:return`this repo has no remote to push to`;case`already-open`:return`the branch already has a pull request`;case`already-pushed`:return`the branch is already on the remote`;case`run-stopped`:return`the run was stopped`;case`fake-run`:return`this was a fake run`}}function Go(e){switch(e.type){case`start`:return`  › prompt: ${Jo(e.prompt,140)}`;case`session`:return`  session ${e.sessionId}`;case`text`:return`    ${Jo(e.text)}`;case`action`:return`    · ${e.label}`;case`result`:return`  ‹ turn complete`;case`rate-limit`:return`    ${Ko(e.limit)}`;case`error`:return`  ! agent error: ${e.message}`;case`notice`:return`  ~ ${e.message}`}}function Ko(e){let t=new Date(e.resetsAt).toISOString();return e.status===`rejected`?`✗ quota exhausted (${e.window}), resets ${t}`:e.status===`allowed_warning`?`! quota running low (${e.window}), resets ${t}`:`· quota ${e.status} (${e.window}), resets ${t}`}function qo(e){switch(e.type){case`scope`:return`▶ scope: ${e.scope} — "${e.intent}"`;case`narrate`:return`  ${e.message}`;case`build`:return`    build/${e.event.type}`;case`checklist`:return e.passing?`  ✓ checklist pass ${e.pass}: no blockers`:`  ✗ checklist pass ${e.pass}: ${e.blockers.join(`; `)}`;case`improve`:return`  → improving: ${e.blockers.join(`; `)}`;case`deploy`:return`▶ deploy: ${e.plan.render.toUpperCase()} → ${e.plan.target} (${e.plan.reason})`;case`done`:return e.result.passes>0?`✓ ${e.result.productionGrade?`review passed`:`blockers remain`} after ${e.result.passes} pass(es)`:`✓ done`}}function Jo(e,t=100){let n=e.replace(/\s+/g,` `).trim();return n.length>t?n.slice(0,t-1)+`…`:n}var Yo=[`B`,`KB`,`MB`,`GB`,`TB`];function Xo(e,t=`–`){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return t;let n=e,r=0;for(;n>=1024&&r<Yo.length-1;)n/=1024,r++;return`${n<10&&r>0?Math.round(n*10)/10:Math.round(n)} ${Yo[r]}`}function Zo(e){return e instanceof Error?e.message:String(e)}function Qo(e){let t=null;for(let n of e){if(n.kind!==`bootstrap`)continue;let e=n.event;if(e.type===`checklist`)t={pass:e.pass,passing:e.passing,blockers:[...e.blockers],productionGrade:e.passing,finished:!1};else if(e.type===`improve`)t={pass:e.pass,passing:!1,blockers:[...e.blockers],productionGrade:!1,finished:!1};else if(e.type===`done`){let n=e.result;if(n.passes===0&&!t)continue;t={pass:n.passes,passing:n.productionGrade,blockers:[...n.blockers],productionGrade:n.productionGrade,finished:!0}}}return t}function $o(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.kind!==`bootstrap`||n.event.type!==`deploy`)continue;let r=n.event.plan;return{render:r.render,target:r.target,reason:r.reason}}return null}function es(e){let t={readyForMerge:!1};for(let n of e)n.kind===`session-name`?t.sessionName=n.name:n.kind===`ready-for-merge`&&(t.readyForMerge=!0);return t}function ts(e,t){let n={push:t?.push??!0,pr:t?.pr??!0,merge:t?.merge??!1};for(let t of e)t.kind===`handoff-armed`?(n.push=t.push,n.pr=t.pr,t.merge!==void 0&&(n.merge=t.merge)):t.kind===`handoff`&&(n.result=t.outcome===`done`?{outcome:`done`,...t.url?{url:t.url}:{}}:t.outcome===`failed`?{outcome:`failed`,error:t.error}:{outcome:`skipped`,reason:t.reason});return n}function ns(e){let t=null;for(let n of e)n.kind===`session`?t={driver:n.driver,fake:n.fake,workspace:n.workspace,...n.sessionLink?{sessionLink:n.sessionLink}:{},...n.model?{model:n.model}:{}}:n.kind===`session-update`&&(t={...t??{},sessionId:n.sessionId,...n.sessionLink?{sessionLink:n.sessionLink}:{}});return t}var rs=/\$\{\{([\s\S]*?)\}\}/g,is=class extends Error{fragment;constructor(e,t){super(`[framework] template fragment \${{${e}}} ${t}`),this.name=`TemplateFragmentError`,this.fragment=e}};function as(e,t){let n=Object.keys(t),r=n.map(e=>t[e]);return e.replace(rs,(e,t)=>{let i;try{i=Function(...n,`'use strict'; return (${t});`)(...r)}catch(e){throw new is(t,`failed to evaluate: ${Zo(e)}`)}if(i===void 0)throw new is(t,`evaluated to undefined (typo in the expression?)`);return String(i)})}var ss=`Open TODO_AGENTS.md and work on the FIRST open entry only, then check it off. Do not start any other entry.`,cs=`Note the current UTC time before you fetch anything, in ISO 8601.

Import this repo's open GitHub issues into tickets/, one file per issue, following the ticket format.

Finish by writing \`tickets/meta.json\` as \`{"lastImportedAt": "<the UTC time you noted at the start>"}\`, so a later update knows where to resume from.`,ls=`Refactor \${{ tf.params.what }} to make it as maintainable as possible:
- Look for maintainability red flags, and fix them.`,us=`Analyze \${{ tf.params.what }} and look for opportunities to refactor code.

For each codebase subset that needs it, add following entries to TODO_AGENTS.md (usually as low priority) and replace <CODEBASE_SUBSET> with a clear designation.
- "Apply \${{ tf.presets.maintainability.filePath }} with tf.params.what set to <CODEBASE_SUBSET>"
- "Apply \${{ tf.presets.security_audit.filePath }} with tf.params.what set to <CODEBASE_SUBSET>"
\${{ tf.settings.technical_control ? '- "Apply ' + tf.presets.readability.filePath + ' with tf.params.what set to <CODEBASE_SUBSET>"\\n' : '' }}`,ds=`- Make a thorough market research
- Write it to \`knowledge-base/MARKET_RESEARCH.md\`
- Add TODO_AGENTS.md entry: "Read <SESSION_NAME> then suggest new tickets"

SESSION_NAME: the name of the session`,fs='For the <COUNT> most important tickets `tickets/<TICKET>.md` without `<TICKET>.plan.md` and `<TICKET>.lock.md`, add the following to TODO_AGENTS.md\n- "Create tickets/<TICKET>.plan.md"\n\nPut the entries in the right `## Priority` following a mix of sensible criteria after reading `tickets/<TICKET>.md` (e.g. if ticket seems low effort => higher priority).\n\nCOUNT: 10',ps=`Refactor \${{ tf.params.what }} to make it as easy as possible for humans to read:
- Pinnacle architectural split
  - Does each file and each <FUNCTION> represent a sensible and natural abstraction?
  - Rate the *seams*, not just the boxes: for each call site, ask whether the responsibility sits on the right side of the boundary — should a caller's wrapper move down into the callee (or vice versa)? A <FUNCTION> can be clean, DRY and well-tested in isolation yet still be in the wrong place. "Well-factored" is not "well-located".
- Linearity (for humans)
  - Put yourself in the shoes of a human reader who reads everything in a linear fashion
  - Top to bottom: place callers above callees so readers encounter high-level logic before implementation details (humans think high-level first)
  - Altitude pass: for each entry-point / orchestration <FUNCTION>, read it top-to-bottom as prose. Flag any line that drops the reader into lower-level mechanism (a flag, a thunk, a log verb, error plumbing) in the middle of what should be a high-level narrative. For each, ask: can that mechanism move down into the callee so the caller reads at one consistent altitude? Prioritize the reading path of all the <FUNCTION> a reader hits first.
- Before starting to work: list *ALL* files and *ALL* <FUNCTION> in this chat, rate them all (0: convoluted abstraction, hard to read, wrong place — 10: perfect), and give a reason for your rating
  - DON'T skip any file nor any <FUNCTION> in your rating list — write an extra separated list in this chat of all files and all <FUNCTION> and put a ✅ tick to each entry to double check whether you forgot to rate something. So two lists: one list of ratings & explanation, and a second confirmation list.
- Separate commit for each refactor
- Work until it's exceptionally good. We as an expert team will check against every little detail.
  - If we see that you gave mostly a 10/10 rating, that's a sign you've been lazy... so make sure you scrutinize everything and spend a substantial amount of time. We don't want to prompt you again and again to achieve quality — autonomously strive for quality on your own without us pushing you.
- Give summary of what you worked on: print the lists again with old rating => new rating with link to commit(s)

FUNCTION: an actual function or a class, procedure, etc. (anything that represents a unit of logic)`,ms=`Measure "problem variability" of \${{ tf.params.what }}
- List all high-level flows the code implements, i.e. the list of all "problems" the code solves
- Give a rating for each problem (from 0 to 10) following this criteria: does the code solves the problem in an obviously optimal way (10), or is it highly unclear whether the problem can be solved in a better way (0)?
- Write down the ratings in a new file <REVIEW_FILE>
- Show the list to the user and enable him to select problems via \`showMultiSelect()\`, <AWAIT>
  - Set default to \`true\` for entries with low rating
- For all problems the user selected, add a new entry to <TODO_FILE>
  - The entry: "Deep-dive research for alternative solutions, see <REVIEW_FILE>"

AWAIT: Stop, await user answer before resuming
REVIEW_FILE: \`REVIEW-PROBLEMS_<SESSION_NAME>.agent.md\`
TODO_FILE: \`TODO_<SESSION_NAME>.agent.md\`
SESSION_NAME: the name of the current Git branch — sanitize it to be a SLUG, if name is generic (e.g. \`main\`) then create a succinct SLUG`,hs=`Security audit \${{ tf.params.what }}
- Scrutinize the entire code for potential security issues
- Make it exhaustive (100% coverage)
- List every aspect you considered and, for each aspect, include a verdict as well as an explanation for non-obvious verdicts
- If you see any security issue, fix each security issue in a separate commit`,gs=`1. Study what this product does today: skim the README, the docs, and the main user-facing surfaces, plus the existing \`tickets/\`
2. Think like a product manager and propose net-new features the product should have next
   - Net-new capabilities a user would want, not bugs, refactors, or chores
   - Skip anything an existing ticket already covers, and anything already built
   - Favour features that fit the product's direction and are worth building
3. Write each proposed feature as a new ticket under \`tickets/\`, following the ticket format
4. Show a short summary of what you proposed via \`showMarkdown()\``,_s=`Suggest new tickets`,vs="1. Look at all tickets and pick tickets to work on next\n2. Show the tickets you picked via `showMultiSelect()`\n  - For each ticket, if high confidence the ticket is a good candidate to work on next => set its default to `true`, otherwise `false`\n3. <AWAIT>\n4. Add approved tickets to `TODO_AGENTS.md`\n\nAWAIT: Stop, await user answer before resuming",ys=`1. Look at all tickets and choose tickets to work on next
   - Only pick tickets that are significant (no quick-wins) and consensual (zero open questions, zero variability, e.g. a single fairly obvious plan)
2. Add tickets to TODO_AGENTS.md

Always set <SESSION_NAME> to triage-consensual
- If branch the-framework/<SESSION_NAME> already exists, abort and tell user that the branch already exists and that triage is already pending.`,bs="Look at `tickets/*` and choose tickets to work on next:\n- Pick a ticket if it has a `.plan.md` that shows it's a quick-win (low `effort` value) with `uncertainty: 0`\n- Add tickets to TODO_AGENTS.md\n  - With sensible prioritization, and consider bumping the priority of lowest effort tickets (e.g. to make `effort: 0` the next tasks agents work on)\n\nAlways set <SESSION_NAME> to triage-quick\n- If branch the-framework/<SESSION_NAME> already exists, abort and tell user the branch already exists and triage is already pending.",xs='Update `tickets/` from this repo\'s GitHub issues, bringing across what has changed since the last import rather than starting over.\n\nNote the current UTC time before you fetch anything, in ISO 8601. That is the timestamp you will record at the end, and taking it first is deliberate: an issue edited while you work is then picked up by the next update instead of being missed.\n\nRead `tickets/meta.json` for `lastImportedAt`.\n\nDo one of the following:\n- [Error] If there are existing `tickets/*.md` but `lastImportedAt` is missing, or `gh` is missing or logged out, show an error to the user and abort\n- [Empty] If `tickets/` is empty (or doesn\'t exist), treat it as a first import and bring every open issue across\n- [Update] Fetch only what changed: `gh issue list --state all --limit 500 --json number,title,body,state,labels,updatedAt --search "updated:>=<lastImportedAt>"`, and the discussion with `gh api --paginate "repos/{owner}/{repo}/issues/comments?since=<lastImportedAt>"`\n\nThen reconcile, one ticket file per issue:\n- An issue with no ticket yet gets one\n- An issue that already has a ticket has that ticket updated in place. Keep its filename, and keep its `.plan.md` but consider setting `outdated: yes`.\n- New comments are worth folding into the ticket only where they change what the work is. Do not paste the thread.\n- If an issue is now closed, remove its ticket, `.plan.md`, and `.lock.md`\n\nFinish by writing `tickets/meta.json` as `{"lastImportedAt": "<the UTC time you noted at the start>"}`, and say in one line how many tickets you added, updated and removed.',Ss=`Review all UI flows of \${{ tf.params.what }}
1. Before starting to work: list *ALL* UI flows
   - DON'T skip any UI flow (100% coverage)
2. Then, give a UX rating for each UI flow (10: perfect UX, 0: unusable UX), and give a reason for your rating
3. Improve UI flows with bad UX rating
   - Separate commit for each UI flow you improved
   - Work until it's exceptionally good. We as an expert team will check against every little detail.
     - If we see that you gave mostly a 10/10 rating, that's a sign you've been lazy... so make sure you scrutinize everything and spend a substantial amount of time. We don't want to prompt you again and again to achieve quality — autonomously strive for quality on your own without us pushing you.
   - Give summary of what you worked on: print the UI flow list again with old rating => new rating with link to commits`,Cs='## Awaiting a choice\nWhen these instructions tell you to showChoices() / showMultiSelect() / showMarkdown() and then AWAIT, do not decide for the user.\nEnd your turn with one fenced code block, then stop.\nFor a single choice (showChoices, pick one), tag it `await-choices`:\n```await-choices\n{ "title": "<the question>", "options": [{ "label": "<option>", "detail": "<optional one-liner>" }], "recommended": "<the label to default to>" }\n```\nFor a multi-select (showMultiSelect, pick any number), tag it `await-multiselect` and set `default` on the entries that start checked:\n```await-multiselect\n{ "title": "<the prompt>", "options": [{ "label": "<option>", "detail": "<optional one-liner>", "default": true }] }\n```\nFor a plan/document approval (showMarkdown of a file you wrote, then AWAIT), tag it `await-confirmation` and name the file:\n```await-confirmation\n{ "title": "<what to approve>", "file": "PLAN_<slug>.agent.md" }\n```\nThe framework shows it, waits for the user, and re-prompts you with their answer. Do not continue past it on your own.\n\n## Handing the browser to a human\nWhen you are working in a browser and hit something you cannot or should not get past yourself — a login wall, a captcha, an SSO or 2FA step — stop and hand it over. Never type a password, never attempt a captcha, and never use a credential you found lying around in the repo or the environment. Tag the block `await-browser`:\n```await-browser\n{ "title": "<what the human needs to do>", "url": "<the page you are stuck on>" }\n```\nThe user acts in that browser, then you are re-prompted. Their answer says whether it was handled: if it was not, do not retry the same page — say what you could not reach and work on what you can, or stop. Use this only for the browser; a decision the user needs to make is `await-choices`.\n\n## Showing a document without waiting\nTo display markdown in the side panel without blocking (a plan, a summary, a writeup) and keep working, put a `show-markdown` block anywhere in your turn. The first line is its title:\n```show-markdown\n# <title>\n<the markdown body>\n```\nThis just shows it; you do not stop. Re-emit the same title to update that view in place.\nshowMarkdown() and showMarkdownSecondary() are both this block: emit the same `show-markdown` block for either.',ws="## You have a real browser\n\nThis run has a real Chrome attached, through the `chrome-devtools` tools (`new_page`, `navigate_page`, `click`, `fill`, `take_snapshot`, `evaluate_script`). It is the same browser a human can watch and take over, so use it for anything you need to *see* or *act on*: pages that render their content with JavaScript, a flow you have to click through, a form to fill, an app you are checking actually works.\n\nWhen you only need to read a page, `WebFetch` is still the better tool: it is faster and hands you the text directly. Use the browser when `WebFetch` would come back with nothing useful, such as a page that is blank until its JavaScript runs.\n\nPrefer navigating within a single page rather than opening new pages, so the user can more easily watch you navigate.",Ts=`## Await gates are not available in this session
This session runs hands-off: it was handed to a remote service, and nothing that can answer an
await gate is attached to it. A gate you park on may never be answered, and the session is spent
for nothing.
So when these instructions say to showChoices() / showMultiSelect() / showMarkdown() and then
AWAIT, that capability is not available here. Do not emit an await block and do not stop:
- take the most plausible interpretation, the option you would have marked \`recommended\`
- state in one line which assumption you made
- carry the work through to the end
The non-blocking blocks (show-markdown, set-session-name, ready-for-merge) are unaffected.`,Es="## Session name\nWhen you call setSessionName(<name>) (after creating and checking out the `the-framework/<name>` branch), also emit a `set-session-name` block naming it, so the dashboard shows which session this is. The first non-empty line is the name (a `[a-z0-9-]` slug):\n```set-session-name\n<name>\n```\nYou do not stop; re-emit it if you rename the session.\n\n## Ready for merge\nWhen you call setReadyForMerge() — you believe the work is complete and ready for human review — emit an empty `ready-for-merge` block. This flips the dashboard status from building to ready; it does not stop your turn.\n```ready-for-merge\n```",Ds=`# System prompt

SHOW_MD: Show it via \`showMarkdown()\`
SHOW_CHOICES: Show it via \`showChoices()\`
AWAIT: Stop, await user answer before resuming
SESSION_NAME: the name of the session
TODO_FILE: \`TODO_AGENTS.md\`
ADD_ANALYSIS_ENTRY: Add entry to the ANALYSIS_RESULT.md list

## Analyze the user prompt

Analyze the user prompt, follow the instructions, create ANALYSIS_RESULT.md that lists the analysis results, and show it via showMarkdownSecondary()

### Ambiguous prompt

If it isn't clear what you should do (e.g. unclear scope, unclear user prompt), make a list of interpretations sorted by plausibility, <SHOW_CHOICES>, <AWAIT>

<ADD_ANALYSIS_ENTRY> whether YES/NO the prompt is ambiguous

### Scope

- If the scope of what you'll work on is *large*, create a \`PLAN_<SESSION_NAME>.agent.md\` of what you'll work on, <SHOW_MD>, <AWAIT>
- If the scope is potentially *very large* (e.g. spans over many hours/days of work), consider adding entries to <TODO_FILE> (backlog of follow-up tasks) and show new entries <SHOW_MD>

<ADD_ANALYSIS_ENTRY> whether the scope is small, large, or very large


## Before starting changes

Do the following before applying your first change.

### Session name

1. Create a <SESSION_NAME> as a string [a-z0-9-]+ that succinctly represents the intention of the user prompt
2. Create a new branch \`the-framework/<SESSION_NAME>\` and \`$ git checkout\` it — do all the work in that branch
3. Call setSessionName(<SESSION_NAME>)


## Before applying changes

Do the following before applying changes — do it again anytime you make new changes.

### Alternatives

Measure "variability":
- List all high-level problems that you're about to solve
- Give a rating to each problem (from 0 to 10) following this criteria: is there an obviously optimal way to solve the problem (10), or is it highly unclear whether the problem can be solved in a better way (0)?
- Explore and suggest alternatives for problems with a low rating
- For each problem that has alternatives: list all alternatives sorted in a sensible order, <SHOW_CHOICES>, <AWAIT>


## After applying changes

After you're done, decide: is <SESSION_NAME> finished, with no work left to do?
- Yes: call setReadyForMerge() — required, the work is never merged without it
- No: don't call it; say what's left instead



# User prompt

\${{tf.prompt}}`,Os=`# Ticketing format


## tickets/<DATE>_<SLUG>.md

DATE: yyyy-mm-dd
SLUG: succinct kebab-case slug of the ticket title
Body:
\`\`\`md
Priority: 0-10 [optional, 10: critical — act immediately, 0: only if capacity]
Topics: [list-of-topics] [optional]
GitHub: [#42](https://github.com/org/repo/issues/42) [optional]

# Ticket title

## TLDR

...

## Why it matters

...

[optional: more info (any heading and format you want)]
\`\`\`

When a ticket is closed, it should be removed from the repository (also its \`.plan.md\` and \`.lock.md\`), so that \`tickets/*\` only contains open tickets.


## tickets/<DATE>_<SLUG>.lock.md

Body:
\`\`\`md
CLAIMED: <SESSION_ID> (<SESSION_NAME>)
\`\`\`

Whenever an agent is working/planning a ticket, a \`.lock.md\` file must be created to avoid two agents working/planning the same ticket.


## tickets/<DATE>_<SLUG>.plan.md

For an existing ticket (e.g. \`tickets/2042-01-01_some-ticket.md\`), a plan can be created (\`tickets/2042-01-01_some-ticket.plan.md\`).

Body:
\`\`\`md
Effort: 0-10 [0: implementation is trivial, 10: implementation takes months]
Uncertainty: 0-10 [0: implementation without meaningful alternatives, 10: highly uncertain how to implement]
Outdated: yes [optional, only if the ticket was updated in a way that makes the plan outdated]

# [Plan] Ticket title

Single-sentence describing this file's content.

## TLDR [optional]

Brief overiew of this file's content.

## Problems [optional]

List of all significant aspects with low confidence on how to implement, with explanation why uncertain.

## Solutions [optional]

For each problem, list of ways to solve the problem (including meaningful shortcuts, for quicker implementation).

## Considerations [optional]

Exhaustive list of all significant aspects to be considered (including edge cases).

## Implementation [optional]

Concrete plan to implement the ticket.
\`\`\`

Notes:
- Covers both spiking (e.g. high-level research without implementation plan) and planning (e.g. concrete implementation proposal)
- The \`.plan.md\` file can be modified multiple times over an extended period (e.g. a ticket requiring repeated human intervention, transitioning from spiking to concrete plan)
- All sections are just proposals and optional: you can use any headings with any format
- The uncertainty value:
  - Gauges whether there are *significant* alternatives, minor variability such as syntax should be ignored
  - Is used for evaluating whether human intervention is needed (0 => clearly no human intervention needed)
- Example of how to gauge uncertainty and alternatives:
  - List all aspects that need to be considered
  - Give an uncertainty rating (0-10) to each aspect following this criteria: is there an obviously optimal way to implement it (0), or is it highly unclear whether it can be implemented in a better way (10)?
  - Explore and suggest alternatives for each aspect with a low rating`,ks=`# TODO_AGENTS.md

Content:
\`\`\`md
## Priority 10 (critical — act immediately)

...

## Priority 9

- [Succinct description](/link-for-more-details)
- Or self-contained TODO item with complete description of what should be done

...

## Priority 0 (only if capacity)

...
\`\`\`

The TODO_AGENTS.md file lists *all* tasks AI will work on next, sorted by priority.

To remove an item (e.g. when done), simply remove it from \`TODO_AGENTS.md\`.

Priority 10 is rarely used (e.g. critical production bugs) and should be treated as utmost priority.

Within a priority, the first tasks have higher priority (they're the "next" tasks within that "priortiy queue").`,As=Cs,js=Ts,Ms=ws,Ns=Es,Ps=[`## Binding this run to a project`,`This run started with no project, in a scratch directory with no repo. When your work needs a real project to act on, end your turn with one fenced block, then stop.`,"To bind to a project that is already registered, tag it `await-bind-project` (the framework shows you the list of projects to pick from):","```await-bind-project",`{ "title": "<why you need a project>" }`,"```","To register a new project by its absolute path and bind this run to it, tag it `await-create-project`:","```await-create-project",`{ "title": "<what this project is>", "path": "<absolute repo path>" }`,"```",`The framework registers and binds it, then re-prompts you with the result. Do not bind unless the work actually needs a repo.`].join(`
`);function Fs(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function Is(e){return e===void 0?Ps:e.length===0?`${Ps}\n\nNo projects are registered yet, so you will most likely need \`await-create-project\` to register one by its absolute path.`:`${Ps}\n\nProjects already registered that you can bind to with \`await-bind-project\`:\n${e.map(e=>`- ${Fs(e)}: \`${e}\``).join(`
`)}`}var Ls=Ds,Rs={autoPlanning:`### Scope`,autoResearch:`### Alternatives`},zs={prompt:``,params:{}},Bs={path:`knowledge-base/DECISIONS.md`,comment:`decisions taken, and why`},Vs={path:`knowledge-base/FACTS.md`,comment:`non-obvious facts relevant to the project`},Hs={path:`knowledge-base/INSIGHTS.md`,comment:`insights relevant to the project`},Us=[Os,ks],Ws=[Bs,{path:`GOAL.md`,comment:`the goal of the project (long-term direction, scope, non-scope, ...)`},{path:`BUSINESS_LOGIC.md`,comment:`codebase business logic`},Vs,Hs,{path:`knowledge-base/MARKET_RESEARCH.md`,comment:`the market the project competes in`},{path:`knowledge-base/**.md`,comment:`more files holding knowledge related to the project`},{path:`tickets/**.md`,comment:`things to potentially work on; format: the "Ticketing format" section below`},{path:`.the-framework/conversations/**.md`,comment:`conversations between humans, recorded by agents (e.g. the agent Discord bot)`},{path:`TODO_AGENTS.md`,comment:`the AI task queue; format: the "TODO_AGENTS.md" section below`}],Gs=`
# User prompt
`;function Ks(e,t){let n=e.indexOf(`\n${t}`);if(n===-1)return e;let r=/^#+/.exec(t)?.[0].length??2,i=n+t.length+1,a=RegExp(`\\n#{1,${r}} `).exec(e.slice(i)),o=a?i+a.index:e.length;return e.slice(0,n)+e.slice(o)}function qs(e,t){if(!t)return e;let n=e;for(let[e,r]of Object.entries(Rs))t[e]&&(n=Ks(n,r));return n}function Js(e=zs){let t=Ls.indexOf(Gs),n=qs(t===-1?Ls:Ls.slice(0,t),e.params.eco),r=t===-1?"${{tf.prompt}}":Ls.slice(t+15);return{system:as(n,{tf:e}).trim(),user:as(r,{tf:e}).trim()}}function Ys(e={}){let t=[],n=e.context?.map(e=>e.trim()).filter(Boolean)??[],r=e.antiLazyPill!==!1,i=r?Ws:[];if(n.length||i.length){let e=`Context:${n.length?` ${n.join(`, `)}`:``}`,r=i.map(e=>`- \`${e.path}\` (${e.comment})`);t.push([e,...r].join(`
`))}r&&t.push(...Us,Js(e.tf).system);let a=e.user?.trim();return a&&t.push(a),t.join(`

`)}function Xs(e={}){if(e.transparent)return``;let t=Ys(e),n=e.browser?[Ms]:[],r=e.topic?[Is(e.topicProjects)]:[],i=e.handsOff?[js]:[];return[...t?[t]:[],...n,As,...i,...r,Ns].join(`

`)}var Zs=`.the-framework`,Qs=[`maintainability`,`readability`,`security_audit`,`research`,`ux`,`maintenance`],$s=`${Zs}/presets`;function ec(e){return`${$s}/${e}.md`}function tc(){return Object.fromEntries(Qs.map(e=>[e,{filePath:ec(e)}]))}var nc='${{ tf.session_name || "entire codebase" }}';function rc(e){return{session_name:e.session_name,settings:e.settings??{},presets:e.presets??tc()}}function ic(e={}){return as(nc,{tf:{...rc(e),params:{}}})}function ac(e){let{template:t,what:n}=e;return n===void 0?{...e,params:[],render:()=>t}:{...e,params:[{name:`what`,default:nc,description:n}],render:(e,n={})=>{let r=e?.trim()||ic(n);return as(t,{tf:{...rc(n),params:{what:r}}})}}}var oc={research:ac({name:`research`,template:ms,what:`What to measure problem variability of`,label:`Research`}),maintainability:ac({name:`maintainability`,template:ls,what:`What to refactor for maintainability`,label:`Maintainability`}),readability:ac({name:`readability`,template:ps,what:`What to refactor for readability`,label:`Readability`}),securityAudit:ac({name:`security-audit`,template:hs,what:`What to security-audit`,label:`Security audit`}),ux:ac({name:`ux`,template:Ss,what:`What to review the UX of`,label:`UX (auto)`}),maintenance:ac({name:`maintenance`,template:us,what:`What to analyze for refactor opportunities`,label:`Maintenance`,tooltip:`Queue maintainability + security work per codebase subset (TODO_AGENTS.md)`}),marketResearch:ac({name:`market-research`,template:ds,label:`Market research`}),importTickets:ac({name:`import-tickets`,template:cs,label:`Import tickets from GitHub`,newSession:!0,tooltip:"Fill `tickets/` from the GitHub issues. Always runs in a new session."}),updateTickets:ac({name:`update-tickets`,template:xs,label:`Update from GitHub`,newSession:!0,tooltip:"Bring `tickets/` up to date with the issues and comments changed since the last import."}),planTickets:ac({name:`plan-tickets`,template:fs,label:`Plan tickets (aka spike)`}),suggestNewTickets:ac({name:`suggest-new-tickets`,template:_s,label:`Suggest new tickets`}),suggestNewFeatures:ac({name:`suggest-new-features`,template:gs,label:`Suggest new features`,tooltip:"Propose net-new features as tickets in `tickets/`"}),suggestTicketsToWorkOn:ac({name:`suggest-tickets-to-work-on`,template:vs,label:`Suggest tickets to work on`,tooltip:`Add tickets to queue (TODO_AGENTS.md)`}),drainQueue:ac({name:`drain-queue`,template:ss,label:`Spin up agents working on the AI queue`}),triageQuick:ac({name:`triage-quick`,template:bs,label:`Add quick-win work to AI Queue`,tooltip:"Add `tickets/*.md` to queue (TODO_AGENTS.md), only quick-win and consensual tickets"}),triageConsensual:ac({name:`triage-consensual`,template:ys,label:`Add consensual work to AI Queue`,tooltip:"Add `tickets/*.md` to queue (TODO_AGENTS.md), only significant (no quick-wins) and consensual tickets"})},sc=[oc.research,oc.readability,oc.maintainability,oc.securityAudit,oc.ux,oc.suggestNewTickets,oc.suggestNewFeatures,oc.suggestTicketsToWorkOn,oc.planTickets,oc.marketResearch,oc.importTickets,oc.updateTickets,oc.maintenance,oc.triageQuick,oc.triageConsensual],cc=[`autopilot`,`technical`,`vanilla`,`eco`,`ecoPlanning`,`ecoResearch`,`ecoMaintenance`,`onBeforeMergeableQuality`,`browser`,`autoPushBranch`,`autoOpenPr`,`autoMerge`,`transparent`,`model`,`agent`,`target`],lc={notifyBrowser:!0,notifyHumanIntervention:!0,notifyNewActivity:!1,notifyDiscord:!1,discordBot:!1};function uc(e,t){return e[t]??lc[t]}var dc=[{name:oc.updateTickets.name,prompt:oc.updateTickets.render(),label:oc.updateTickets.label},{name:oc.triageQuick.name,prompt:oc.triageQuick.render(),label:oc.triageQuick.label,pinnedBranch:`the-framework/${oc.triageQuick.name}`},{name:oc.triageConsensual.name,prompt:oc.triageConsensual.render(),label:oc.triageConsensual.label,pinnedBranch:`the-framework/${oc.triageConsensual.name}`},{name:oc.planTickets.name,prompt:oc.planTickets.render(),label:oc.planTickets.label,fansOut:!0}],fc={name:oc.drainQueue.name,prompt:oc.drainQueue.render(),label:oc.drainQueue.label,drains:!0,autoMerge:!0},pc={name:oc.maintenance.name,prompt:oc.maintenance.render(),describe:`sweeping the codebase for maintenance work`,label:oc.maintenance.label},mc=[fc,...dc,pc];function hc(e){return e.kind===`awaiting`?`awaiting:${e.projectId}:${e.awaitId??``}`:e.kind===`unpushed`?`unpushed:${e.projectId}:${e.runId??``}`:e.url}function gc(e,t){return t.filter(t=>!e.has(hc(t)))}function _c(e){return`${e.kind}:${e.projectId}:${e.runId}`}function vc(e,t){return t.filter(t=>!e.has(_c(t)))}function yc(e){return{...e.autopilot===void 0?{}:{autopilot:e.autopilot},...e.technical===void 0?{}:{technical:e.technical},...e.transparent===void 0?{}:{transparent:e.transparent},...e.antiLazyPill===void 0?{}:{vanilla:!e.antiLazyPill},...e.autoPushBranch===void 0?{}:{autoPushBranch:e.autoPushBranch},...e.autoOpenPr===void 0?{}:{autoOpenPr:e.autoOpenPr},...e.autoMerge===void 0?{}:{autoMerge:e.autoMerge}}}function bc(e){return e.autopilot??!0}function xc(e){let t=e.autoPushBranch??!0;return{push:t,pr:t&&(e.autoOpenPr??!0)}}function Sc(e,t=[]){let n=bc(e),r=e.vanilla??!1,i=e.transparent??!1,a=e.eco??!1,o=e.technical??!1,s=e.onBeforeMergeableQuality??!1,c=e.browser??!1,l=xc(e),u=e.model??``,d=e.agent??`claude`,f=e.target??`local`,p={...e.ecoPlanning?{autoPlanning:!0}:{},...e.ecoResearch?{autoResearch:!0}:{},...e.ecoMaintenance?{autoMaintenance:!0}:{}};return{autopilot:n,technical:o,vanilla:r,transparent:i,...a&&!r&&!i&&Object.keys(p).length?{eco:p}:{},...s?{onBeforeMergeable:!0}:{},autoPushBranch:l.push,autoOpenPr:l.pr,autoMerge:e.autoMerge??!1,...c&&d===`claude`?{browser:!0}:{},...u?{model:u}:{},...d===`claude`?{}:{agent:d},...f&&f!==`local`?{target:f}:{},...t.length?{context:t}:{}}}var Cc={botToken:`DISCORD_BOT_TOKEN`,webhook:`DISCORD_WEBHOOK`};Object.keys(Cc);function wc(e){return Cc[e]}function Tc(e,t){let n=t.trim();if(!n)return;if(e===`botToken`)return n.toLowerCase().startsWith(`bot `)?`Paste the token itself, without the "Bot " prefix.`:/\s/.test(n)?`A bot token is a single word with no spaces.`:n.length<20?`That is too short to be a bot token.`:void 0;let r;try{r=new URL(n)}catch{return`That is not a URL.`}if(r.protocol!==`https:`&&r.protocol!==`http:`)return`A webhook URL must be http or https.`}function Ec(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ec(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Dc(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ec(e))&&(r&&(r+=` `),r+=t);return r}var Oc=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,kc=Dc,Ac=(e,t)=>n=>{if(t?.variants==null)return kc(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Oc(t)||Oc(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return kc(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},jc=`-`,Mc=e=>{let t=Ic(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(jc);return n[0]===``&&n.length!==1&&n.shift(),Nc(n,t)||Fc(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},Nc=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?Nc(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(jc);return t.validators.find(({validator:e})=>e(a))?.classGroupId},Pc=/^\[(.+)\]$/,Fc=e=>{if(Pc.test(e)){let t=Pc.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},Ic=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Bc(Object.entries(e.classGroups),n).forEach(([e,n])=>{Lc(n,r,e,t)}),r},Lc=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:Rc(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(zc(e)){Lc(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{Lc(i,Rc(t,e),n,r)})})},Rc=(e,t)=>{let n=e;return t.split(jc).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},zc=e=>e.isThemeGetter,Bc=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,Vc=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Hc=`!`,Uc=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;l<e.length;l++){let u=e[l];if(o===0){if(u===i&&(r||e.slice(l,l+a)===t)){n.push(e.slice(s,l)),s=l+a;continue}if(u===`/`){c=l;continue}}u===`[`?o++:u===`]`&&o--}let l=n.length===0?e:e.substring(s),u=l.startsWith(Hc);return{modifiers:n,hasImportantModifier:u,baseClassName:u?l.substring(1):l,maybePostfixModifierPosition:c&&c>s?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Wc=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},Gc=e=>({cache:Vc(e.cacheSize),parseClassName:Uc(e),...Mc(e)}),Kc=/\s+/,qc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Kc),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Wc(c).join(`:`),h=l?m+Hc:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Jc(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=Yc(t))&&(r&&(r+=` `),r+=n);return r}var Yc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Yc(e[r]))&&(n&&(n+=` `),n+=t);return n};function Xc(e,...t){let n,r,i,a=o;function o(o){return n=Gc(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=qc(e,n);return i(e,a),a}return function(){return a(Jc.apply(null,arguments))}}var Zc=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Qc=/^\[(?:([a-z-]+):)?(.+)\]$/i,$c=/^\d+\/\d+$/,el=new Set([`px`,`full`,`screen`]),tl=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nl=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,il=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,al=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ol=e=>cl(e)||el.has(e)||$c.test(e),sl=e=>xl(e,`length`,Sl),cl=e=>!!e&&!Number.isNaN(Number(e)),ll=e=>xl(e,`number`,cl),ul=e=>!!e&&Number.isInteger(Number(e)),dl=e=>e.endsWith(`%`)&&cl(e.slice(0,-1)),fl=e=>Qc.test(e),pl=e=>tl.test(e),ml=new Set([`length`,`size`,`percentage`]),hl=e=>xl(e,ml,Cl),gl=e=>xl(e,`position`,Cl),_l=new Set([`image`,`url`]),vl=e=>xl(e,_l,Tl),yl=e=>xl(e,``,wl),bl=()=>!0,xl=(e,t,n)=>{let r=Qc.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},Sl=e=>nl.test(e)&&!rl.test(e),Cl=()=>!1,wl=e=>il.test(e),Tl=e=>al.test(e),El=Xc(()=>{let e=Zc(`colors`),t=Zc(`spacing`),n=Zc(`blur`),r=Zc(`brightness`),i=Zc(`borderColor`),a=Zc(`borderRadius`),o=Zc(`borderSpacing`),s=Zc(`borderWidth`),c=Zc(`contrast`),l=Zc(`grayscale`),u=Zc(`hueRotate`),d=Zc(`invert`),f=Zc(`gap`),p=Zc(`gradientColorStops`),m=Zc(`gradientColorStopPositions`),h=Zc(`inset`),g=Zc(`margin`),_=Zc(`opacity`),v=Zc(`padding`),y=Zc(`saturate`),b=Zc(`scale`),x=Zc(`sepia`),S=Zc(`skew`),C=Zc(`space`),w=Zc(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,fl,t],O=()=>[fl,t],k=()=>[``,ol,sl],A=()=>[`auto`,cl,fl],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,fl],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],L=()=>[cl,fl];return{cacheSize:500,separator:`:`,theme:{colors:[bl],spacing:[ol,sl],blur:[`none`,``,pl,fl],brightness:L(),borderColor:[e],borderRadius:[`none`,``,`full`,pl,fl],borderSpacing:O(),borderWidth:k(),contrast:L(),grayscale:F(),hueRotate:L(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[dl,sl],inset:D(),margin:D(),opacity:L(),padding:O(),saturate:L(),scale:L(),sepia:F(),skew:L(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,fl]}],container:[`container`],columns:[{columns:[pl]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...j(),fl]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,ul,fl]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,fl]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,ul,fl]}],"grid-cols":[{"grid-cols":[bl]}],"col-start-end":[{col:[`auto`,{span:[`full`,ul,fl]},fl]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[bl]}],"row-start-end":[{row:[`auto`,{span:[ul,fl]},fl]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,fl]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,fl]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,fl,t]}],"min-w":[{"min-w":[fl,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[fl,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[pl]},pl]}],h:[{h:[fl,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[fl,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[fl,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[fl,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,pl,sl]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,ll]}],"font-family":[{font:[bl]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,fl]}],"line-clamp":[{"line-clamp":[`none`,cl,ll]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,ol,fl]}],"list-image":[{"list-image":[`none`,fl]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,fl]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,ol,sl]}],"underline-offset":[{"underline-offset":[`auto`,ol,fl]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,fl]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,fl]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),gl]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,hl]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},vl]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[ol,fl]}],"outline-w":[{outline:[ol,sl]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[ol,sl]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,pl,yl]}],"shadow-color":[{shadow:[bl]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,pl,fl]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,fl]}],duration:[{duration:L()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,fl]}],delay:[{delay:L()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,fl]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[ul,fl]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,fl]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,fl]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,fl]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[ol,sl,ll]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function q(...e){return El(Dc(e))}var Dl=f((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),J=f(((e,t)=>{t.exports=Dl()}))(),Ol=Ac(`inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-[var(--color-primary)] text-[var(--color-primary-foreground)] hover:opacity-90`,outline:`border border-[var(--color-border)] bg-transparent hover:bg-[var(--color-accent)] hover:text-[var(--color-accent-foreground)]`,ghost:`hover:bg-[var(--color-accent)] hover:text-[var(--color-accent-foreground)]`,destructive:`bg-[var(--color-danger)] text-[var(--color-background)] hover:opacity-90`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3`,xs:`h-7 gap-1 px-2 text-xs`,icon:`h-9 w-9`,"icon-sm":`h-7 w-7`}},defaultVariants:{variant:`default`,size:`default`}});function Y({className:e,variant:t,size:n,...r}){return(0,J.jsx)(`button`,{className:q(Ol({variant:t,size:n}),e),...r})}function kl({className:e,...t}){return(0,J.jsx)(`span`,{className:q(`inline-flex items-center rounded-full border border-[var(--color-border)] px-2 py-0.5 text-xs font-medium`,e),...t})}function Al(e){let t=new Map;for(let n of e){if(n.kind===`choice-resolved`){t.delete(n.id);continue}if(n.kind===`end`){t.clear();continue}if(n.kind===`choice`){let{kind:e,...r}=n;t.set(n.id,r)}}return[...t.values()]}function jl(e){let t=new Map;for(let n of e)if(n.kind===`view`){let{kind:e,...r}=n;t.set(n.id,r)}return[...t.values()]}function Ml(e){let t=zl(e);return t.length>0&&!t.some(e=>e.kind===`end`)}function Nl(e){let t=!1;for(let n of e)n.kind===`settled`?t=!0:(n.kind===`driver`&&n.event.type===`start`||n.kind===`end`)&&(t=!1);return t}function Pl(e){let t=zl(e).find(e=>e.kind===`end`);if(!(!t||t.kind!==`end`))return{ok:t.ok,stopped:t.stopped===!0,...t.detail===void 0?{}:{detail:t.detail}}}function Fl(e){let t=zl(e),n=t.find(e=>e.kind===`end`);if(n?.kind!==`end`||!n.ok||t.some(e=>e.kind===`handoff`))return!1;let r;for(let t of e)t.kind===`handoff-armed`&&(r=t.push);return r===!0}function Il(e){return e.version>=2&&e.status===`done`&&e.handoff?.push===!0&&e.handoffReport===void 0}function Ll(e){let t;for(let n of e){if(n.kind!==`driver`||n.event.type!==`action`)continue;let e=/^run (https?:\/\/\S+)$/.exec(n.event.label);e&&(t=e[1])}return t}function Rl(e){let t;for(let n of e){if(n.kind!==`driver`||n.event.type!==`action`)continue;let e=/^cloud (https:\/\/claude\.ai\/code\/(session_[A-Za-z0-9]+)\S*)$/.exec(n.event.label);e&&(t={url:e[1],id:e[2]})}return t}function zl(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n]?.kind===`session`){t=n;break}return e.slice(t)}function Bl(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?void 0:t}function Vl(e,t=`—`){let n=Bl(e);return n?n.toLocaleString():t}function Hl(e,t=`—`){let n=Bl(e);return n?n.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}):t}function Ul(e,t=`—`){let n=Bl(e);if(!n)return t;let r=Math.max(0,Math.floor((Date.now()-n.getTime())/1e3));if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);return o<7?`${o}d ago`:o<365?`${Math.floor(o/7)}w ago`:`${Math.floor(o/365)}y ago`}function Wl(e){let t=Math.round((e-Date.now())/6e4);return t<=0?`any moment`:t<60?`in ${t} min`:`in ${Math.round(t/60)} hr`}function Gl(e,t=`—`){let n=Bl(e);if(!n)return t;let r=Math.round((Date.now()-n.getTime())/1e3);if(r<60)return`just now`;let i=Math.round(r/60);if(i<60)return`${i}m ago`;let a=Math.round(i/60);if(a<24)return`${a}h ago`;let o=Math.round(a/24);return o<=7?`${o}d ago`:n.toLocaleDateString()}function Kl(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function ql(e,t){return`${e} ${t}${e===1?``:`s`}`}function Jl(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return ql(t,`second`);let n=Math.floor(t/60);if(n<60)return ql(n,`minute`);let r=Math.floor(n/60);return r<24?ql(r,`hour`):ql(Math.floor(r/24),`day`)}function Yl(e){return e.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`}).toLowerCase().replace(/\s+/g,``)}function Xl(e){let t=new Date(e);return`${t.toLocaleDateString(void 0,{weekday:`long`})} ${Yl(t)}`}function Zl(e){let t=new Date(e),n=t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}),r=Intl.DateTimeFormat().resolvedOptions().timeZone;return`Quota resets on ${n}, ${Yl(t)} (${r})`}var Ql={running:`text-primary`,done:`text-success`,stopped:`text-warning`,failed:`text-danger`};function $l(e){return e.intent?.trim()||e.sessionName?.trim()||e.branch?.trim()||Hl(e.startedAt)}function eu({className:e,title:t}){return(0,J.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,...nu(t),children:[t&&(0,J.jsx)(`title`,{children:t}),(0,J.jsx)(`path`,{d:`m4.714 15.956l4.718-2.648l.079-.23l-.08-.128h-.23l-.79-.048l-2.695-.073l-2.337-.097l-2.265-.122l-.57-.121l-.535-.704l.055-.353l.48-.321l.685.06l1.518.104l2.277.157l1.651.098l2.447.255h.389l.054-.158l-.133-.097l-.103-.098l-2.356-1.596l-2.55-1.688l-1.336-.972l-.722-.491L2 6.223l-.158-1.008l.656-.722l.88.06l.224.061l.893.686l1.906 1.476l2.49 1.833l.364.304l.146-.104l.018-.072l-.164-.274l-1.354-2.446l-1.445-2.49l-.644-1.032l-.17-.619a3 3 0 0 1-.103-.729L6.287.133L6.7 0l.995.134l.42.364l.619 1.415L9.735 4.14l1.555 3.03l.455.898l.243.832l.09.255h.159V9.01l.127-1.706l.237-2.095l.23-2.695l.08-.76l.376-.91l.747-.492l.583.28l.48.685l-.067.444l-.286 1.851l-.558 2.903l-.365 1.942h.213l.243-.242l.983-1.306l1.652-2.064l.728-.82l.85-.904l.547-.431h1.032l.759 1.129l-.34 1.166l-1.063 1.347l-.88 1.142l-1.263 1.7l-.79 1.36l.074.11l.188-.02l2.853-.606l1.542-.28l1.84-.315l.832.388l.09.395l-.327.807l-1.967.486l-2.307.462l-3.436.813l-.043.03l.049.061l1.548.146l.662.036h1.62l3.018.225l.79.522l.473.638l-.08.485l-1.213.62l-1.64-.389l-3.825-.91l-1.31-.329h-.183v.11l1.093 1.068l2.003 1.81l2.508 2.33l.127.578l-.321.455l-.34-.049l-2.204-1.657l-.85-.747l-1.925-1.62h-.127v.17l.443.649l2.343 3.521l.122 1.08l-.17.353l-.607.213l-.668-.122l-1.372-1.924l-1.415-2.168l-1.141-1.943l-.14.08l-.674 7.254l-.316.37l-.728.28l-.607-.461l-.322-.747l.322-1.476l.388-1.924l.316-1.53l.285-1.9l.17-.632l-.012-.042l-.14.018l-1.432 1.967l-2.18 2.945l-1.724 1.845l-.413.164l-.716-.37l.066-.662l.401-.589l2.386-3.036l1.439-1.882l.929-1.086l-.006-.158h-.055L4.138 18.56l-1.13.146l-.485-.456l.06-.746l.231-.243l1.907-1.312Z`})]})}function tu({className:e,title:t}){return(0,J.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,...nu(t),children:[t&&(0,J.jsx)(`title`,{children:t}),(0,J.jsx)(`path`,{d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.0201 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`})]})}function nu(e){return e?{role:`img`}:{"aria-hidden":`true`}}function ru({agent:e,className:t,title:n}){return(0,J.jsx)(e===`codex`?tu:eu,{className:t,...n?{title:n}:{}})}function iu(){let[e,t]=(0,T.useState)(!1),[n,r]=(0,T.useState)(null);return{busy:e,error:n,reset:(0,T.useCallback)(()=>r(null),[]),run:(0,T.useCallback)(async(e,n=`Something went wrong.`)=>{t(!0),r(null);try{let t=await e();if(au(t)){r(t.error??n);return}return t}catch(e){r(e instanceof Error?e.message:n);return}finally{t(!1)}},[])}}function au(e){return typeof e==`object`&&!!e&&`ok`in e&&e.ok===!1}function ou(){}var su=Object.freeze([]),cu=Object.freeze({});function lu({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=T.useRef(e!==void 0),[a,o]=T.useState(t);return[i?e:a,T.useCallback(e=>{i||o(e)},[])]}var uu={};function du(e,t){let n=T.useRef(uu);return n.current===uu&&(n.current=e(t)),n}var fu=T[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],pu=fu&&fu!==T.useLayoutEffect?fu:e=>e();function X(e){let t=du(mu).current;return t.next=e,pu(t.effect),t.trampoline}function mu(){let e={next:void 0,callback:hu,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function hu(){}var Z=typeof document<`u`?T.useLayoutEffect:()=>{};function gu(e,t,n,r){let i=du(vu).current;return yu(i,e,t,n,r)&&xu(i,[e,t,n,r]),i.callback}function _u(e){let t=du(vu).current;return bu(t,e)&&xu(t,e),t.callback}function vu(){return{callback:null,cleanup:null,refs:[]}}function yu(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function bu(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function xu(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var Su={clip:`rect(0 0 0 0)`,overflow:`hidden`,whiteSpace:`nowrap`,position:`fixed`,top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},Cu=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),wu=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Tu={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Eu={valid(e){return e===null?null:e?{[wu.valid]:``}:{[wu.invalid]:``}}};function Du(e){return T.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[Cu.checked]:``}:{[Cu.unchecked]:``}},...Eu}),[e.indeterminate])}function Ou(e,...t){let n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var ku=19;function Au(e){return ku>=e}function ju(e){if(!T.isValidElement(e))return null;let t=e,n=t.props;return(Au(19)?n?.ref:t.ref)??null}function Mu(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Nu(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Pu(e,t){return typeof e==`function`?e(t):e}function Fu(e,t){return typeof e==`function`?e(t):e}var Iu={};function Lu(e,t,n,r,i){let a={...Uu(e,Iu)};return t&&(a=zu(a,t)),n&&(a=zu(a,n)),r&&(a=zu(a,r)),i&&(a=zu(a,i)),a}function Ru(e){if(e.length===0)return Iu;if(e.length===1)return Uu(e[0],Iu);let t={...Uu(e[0],Iu)};for(let n=1;n<e.length;n+=1)t=zu(t,e[n]);return t}function zu(e,t){return Hu(t)?t(e):Bu(e,t)}function Bu(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Mu(e.style,r);break;case`className`:e[n]=Ku(e.className,r);break;default:Vu(n,r)?e[n]=Wu(e[n],r):e[n]=r}}return e}function Vu(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Hu(e){return typeof e==`function`}function Uu(e,t){return Hu(e)?e(t):e??Iu}function Wu(e,t){return t?e?n=>{if(qu(n)){let r=n;Gu(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function Gu(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Ku(e,t){return t?e?t+` `+e:t:e}function qu(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}var Ju={style:{transition:`none`}},Yu=`data-base-ui-click-trigger`,Xu={fallbackAxisSide:`none`},Zu={fallbackAxisSide:`end`},Qu={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function $u(e,t,n={}){let r=t.render,i=ed(t,n);return n.enabled===!1?null:td(e,r,i,n.state??cu)}function ed(e,t={}){let{className:n,style:r,render:i}=e,{state:a=cu,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Pu(n,a):void 0,d=l?Fu(r,a):void 0,f=l?Nu(a,c):cu,p=l?Mu(f,Array.isArray(s)?Ru(s):s)??cu:cu;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=_u([p.ref,ju(i),...o]):p.ref=gu(p.ref,ju(i),o):gu(null,null)),l?(u!==void 0&&(p.className=Ku(p.className,u)),d!==void 0&&(p.style=Mu(p.style,d)),p):cu}function td(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Lu(n,t.props);return e.ref=n.ref,T.cloneElement(t,e)}if(e&&typeof e==`string`)return nd(e,n);throw Error(Ou(8))}function nd(e,t){return e===`button`?(0,T.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,T.createElement)(`img`,{alt:``,...t,key:t.key}):T.createElement(e,t)}var rd={...T},id=0;function ad(e,t=`mui`){let[n,r]=T.useState(e),i=e||n;return T.useEffect(()=>{n??(id+=1,r(`${t}-${id}`))},[n,t]),i}var od=rd.useId;function sd(e,t){if(od!==void 0){let n=od();return e??(t?`${t}-${n}`:n)}return ad(e,t)}function cd(e){return sd(e,`base-ui`)}function ld(){return typeof window<`u`}function ud(e){return pd(e)?(e.nodeName||``).toLowerCase():`#document`}function dd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fd(e){return((pd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function pd(e){return ld()?e instanceof Node||e instanceof dd(e).Node:!1}function md(e){return ld()?e instanceof Element||e instanceof dd(e).Element:!1}function hd(e){return ld()?e instanceof HTMLElement||e instanceof dd(e).HTMLElement:!1}function gd(e){return!ld()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof dd(e).ShadowRoot}function _d(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Od(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function vd(e){return/^(table|td|th)$/.test(ud(e))}function yd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var bd=/transform|translate|scale|rotate|perspective|filter/,xd=/paint|layout|strict|content/,Sd=e=>!!e&&e!==`none`,Cd;function wd(e){let t=md(e)?Od(e):e;return Sd(t.transform)||Sd(t.translate)||Sd(t.scale)||Sd(t.rotate)||Sd(t.perspective)||!Ed()&&(Sd(t.backdropFilter)||Sd(t.filter))||bd.test(t.willChange||``)||xd.test(t.contain||``)}function Td(e){let t=Ad(e);for(;hd(t)&&!Dd(t);){if(wd(t))return t;if(yd(t))return null;t=Ad(t)}return null}function Ed(){return Cd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Cd}function Dd(e){return/^(html|body|#document)$/.test(ud(e))}function Od(e){return dd(e).getComputedStyle(e)}function kd(e){return md(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ad(e){if(ud(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||gd(e)&&e.host||fd(e);return gd(t)?t.host:t}function jd(e){let t=Ad(e);return Dd(t)?(e.ownerDocument||e).body:hd(t)&&_d(t)?t:jd(t)}function Md(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=jd(e),i=r===e.ownerDocument?.body,a=dd(r);if(i){let e=Nd(a);return t.concat(a,a.visualViewport||[],_d(r)?r:[],e&&n?Md(e):[])}else return t.concat(r,Md(r,[],n))}function Nd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Pd=T.createContext(void 0);function Fd(e=!1){let t=T.useContext(Pd);if(t===void 0&&!e)throw Error(Ou(16));return t}function Id(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:T.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Ld(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=T.useRef(null),o=Fd(!0)!==void 0,s=X(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=Id({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=T.useCallback(()=>{let e=a.current;Rd(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return Z(l,[l]),{getButtonProps:T.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return Lu({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Gu(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(Gu(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:X(e=>{a.current=e,l()})}}function Rd(e){return hd(e)&&e.tagName===`BUTTON`}var zd=T.createContext({invalid:void 0,name:void 0,validityData:{state:Tu,errors:[],error:``,value:``,initialValue:null},setValidityData:ou,disabled:void 0,touched:!1,setTouched:ou,dirty:!1,setDirty:ou,filled:!1,setFilled:ou,focused:!1,setFocused:ou,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=cu)=>e,getInputValidationProps:(e=cu)=>e,inputRef:{current:null},commit:async()=>{}}});function Bd(e=!0){let t=T.useContext(zd);if(t.setValidityData===ou&&!e)throw Error(Ou(28));return t}var Vd=T.createContext({disabled:!1});function Hd(){return T.useContext(Vd)}function Ud(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var Wd=T.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:ou,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Gd(){return T.useContext(Wd)}var Kd=a(v());function qd(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=Gd(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=Bd(),f=X(e.getValue);Z(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),Z(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:Ud(u,c),validate(){let e=n;e===void 0&&(e=f()),l.current=!0,Kd.flushSync(()=>o(e))}})},[o,a,t,s,f,r,c,l,i,u,n]),Z(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var Jd=T.createContext({controlId:void 0,setControlId:ou,labelId:void 0,setLabelId:ou,messageIds:[],setMessageIds:ou,getDescriptionProps:e=>e});function Yd(){return T.useContext(Jd)}var Xd=T.createContext(void 0);function Zd(e=!0){let t=T.useContext(Xd);if(t===void 0&&!e)throw Error(Ou(3));return t}var Qd=T.createContext(void 0);function $d(){let e=T.useContext(Qd);if(e===void 0)throw Error(Ou(14));return e}var ef=`none`,tf=`trigger-press`,nf=`trigger-hover`,rf=`trigger-focus`,af=`outside-press`,of=`item-press`,sf=`close-press`,cf=`track-press`,lf=`input-change`,uf=`focus-out`,df=`escape-key`,ff=`list-navigation`,pf=`keyboard`,mf=`drag`,hf=`cancel-open`,gf=`sibling-open`,_f=`disabled`,vf=`imperative-action`;function yf(e,t,n,r){let i=!1,a=!1,o=r??cu;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function bf(e,t,n){let r=n??cu;return{reason:e,event:t??new Event(`base-ui`),...r}}function xf(e,t){let n=T.useRef(e),r=X(t);Z(()=>{n.current!==e&&r(n.current)},[e,r]),Z(()=>{n.current=e},[e])}var Sf=`data-parent`,Cf=T.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,disabled:a=!1,id:o,indeterminate:s=!1,inputRef:c,name:l,onCheckedChange:u,parent:d=!1,readOnly:f=!1,render:p,required:m=!1,uncheckedValue:h,value:g,nativeButton:_=!1,...v}=e,{clearErrors:y}=Gd(),{disabled:b,name:x,setDirty:S,setFilled:C,setFocused:w,setTouched:E,state:D,validationMode:O,validityData:k,shouldValidateOnChange:A,validation:j}=Bd(),M=Hd(),{labelId:N,controlId:P,setControlId:F,getDescriptionProps:I}=Yd(),L=Zd(),R=L?.parent,z=R&&L.allValues,B=b||M.disabled||L?.disabled||a,ee=x??l,V=g??ee,H=cd(),te=cd(),U=P;z?U=d?te:`${R.id}-${V}`:o&&(U=o);let W={};z&&(d?W=L.parent.getParentProps():V&&(W=L.parent.getChildProps(V)));let ne=X(u),{checked:re=n,indeterminate:ie=s,onCheckedChange:ae,...oe}=W,se=L?.value,ce=L?.setValue,le=L?.defaultValue,ue=T.useRef(null),{getButtonProps:de,buttonRef:fe}=Ld({disabled:B,native:_}),pe=L?.validation??j,[me,he]=lu({controlled:V&&se&&!d?se.includes(V):re,default:V&&le&&!d?le.includes(V):i,name:`Checkbox`,state:`checked`});Z(()=>{if(F!==ou)return F(U),()=>{F(void 0)}},[U,L,F,d]),qd({enabled:!L,id:H,commit:pe.commit,value:me,controlRef:ue,name:ee,getValue:()=>me});let ge=T.useRef(null),_e=gu(c,ge,pe.inputRef);Z(()=>{ge.current&&(ge.current.indeterminate=ie,me&&C(!0))},[me,ie,C]),xf(me,()=>{L&&!d||(y(ee),C(me),S(me!==k.initialValue),A()?pe.commit(me):pe.commit(me,!0))});let ve=Lu({checked:me,disabled:B,name:d?void 0:ee,id:U??void 0,required:m,ref:_e,style:Su,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=yf(ef,e.nativeEvent);if(ae?.(t,n),ne(t,n),!n.isCanceled&&(he(t),V&&se&&ce&&!d)){let e=t?[...se,V]:se.filter(e=>e!==V);ce(e,n)}},onFocus(){ue.current?.focus()}},g===void 0?cu:{value:(L?me&&g:g)||``},I,L?pe.getValidationProps:pe.getInputValidationProps),ye=z?!!re:me,be=z&&ie||s;T.useEffect(()=>{R&&V&&R.disabledStatesRef.current.set(V,B)},[R,B,V]);let xe=T.useMemo(()=>({...D,checked:ye,disabled:B,readOnly:f,required:m,indeterminate:be}),[D,ye,B,f,m,be]),Se=Du(xe),Ce=$u(`span`,e,{state:xe,ref:[fe,ue,t,L?.registerControlRef],props:[{id:H,role:`checkbox`,"aria-checked":ie?`mixed`:me,"aria-readonly":f||void 0,"aria-required":m||void 0,"aria-labelledby":N,[Sf]:d?``:void 0,onFocus(){w(!0)},onBlur(){let e=ge.current;e&&(E(!0),w(!1),O===`onBlur`&&pe.commit(L?se:e.checked))},onClick(e){f||B||(e.preventDefault(),ge.current?.click())}},I,pe.getValidationProps,v,oe,de],stateAttributesMapping:Se});return(0,J.jsxs)(Qd.Provider,{value:xe,children:[Ce,!me&&!L&&ee&&!d&&h!==void 0&&(0,J.jsx)(`input`,{type:`hidden`,name:ee,value:h}),(0,J.jsx)(`input`,{...ve})]})});function wf(e){let t=du(Tf,e).current;return t.next=e,Z(t.effect),t}function Tf(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Ef=[];function Df(e){T.useEffect(e,Ef)}var Of=null;globalThis.requestAnimationFrame;var kf=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Af=class e{static create(){return new e}static request(e){return kf.request(e)}static cancel(e){return kf.cancel(e)}currentId=Of;request(e){this.cancel(),this.currentId=kf.request(()=>{this.currentId=Of,e()})}cancel=()=>{this.currentId!==Of&&(kf.cancel(this.currentId),this.currentId=Of)};disposeEffect=()=>this.cancel};function jf(){let e=du(Af.create).current;return Df(e.disposeEffect),e}function Mf(e){return e==null?e:`current`in e?e.current:e}function Nf(e,t=!1,n=!0){let r=jf();return X((i,a=null)=>{r.cancel();let o=Mf(e);o!=null&&(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED?i():r.request(()=>{function e(){o&&Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{a!=null&&a.aborted||Kd.flushSync(i)}).catch(()=>{if(n){if(a!=null&&a.aborted)return;Kd.flushSync(i)}else o.getAnimations().length>0&&o.getAnimations().some(e=>e.pending||e.playState!==`finished`)&&e()})}t?r.request(e):e()}))})}function Pf(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=wf(n),o=X(i),s=Nf(r,n);T.useEffect(()=>{t&&s(()=>{n===a.current&&o()})},[t,n,o,s,a])}function Ff(e,t=!1,n=!1){let[r,i]=T.useState(e&&t?`idle`:void 0),[a,o]=T.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Z(()=>{if(!e&&a&&r!==`ending`&&n){let e=Af.request(()=>{i(`ending`)});return()=>{Af.cancel(e)}}},[e,a,r,n]),Z(()=>{if(!e||t)return;let n=Af.request(()=>{Kd.flushSync(()=>{i(void 0)})});return()=>{Af.cancel(n)}},[t,e]),Z(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Af.request(()=>{i(`idle`)});return()=>{Af.cancel(n)}},[t,e,a,i,r]),T.useMemo(()=>({mounted:a,setMounted:o,transitionStatus:r}),[a,r])}var If=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Lf={[If.startingStyle]:``},Rf={[If.endingStyle]:``},zf={transitionStatus(e){return e===`starting`?Lf:e===`ending`?Rf:null}},Bf=T.forwardRef(function(e,t){let{render:n,className:r,keepMounted:i=!1,...a}=e,o=$d(),s=o.checked||o.indeterminate,{transitionStatus:c,setMounted:l}=Ff(s),u=T.useRef(null),d=T.useMemo(()=>({...o,transitionStatus:c}),[o,c]);Pf({open:s,ref:u,onComplete(){s||l(!1)}});let f=Du(o),p=T.useMemo(()=>({...f,...zf,...Eu}),[f]),m=i||s,h=$u(`span`,e,{enabled:m,ref:[t,u],state:d,stateAttributesMapping:p,props:a});return m?h:null});function Vf({className:e,disabled:t=!1,...n}){return(0,J.jsx)(Cf,{disabled:t,className:q(`inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-border bg-transparent`,`transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`,`data-[checked]:border-primary data-[checked]:bg-primary data-[checked]:text-primary-foreground`,`data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:(0,J.jsx)(Bf,{className:`flex items-center justify-center text-current`,children:(0,J.jsx)(Va,{className:`h-3 w-3`,strokeWidth:3,"aria-hidden":!0})})})}function Hf({onAdded:e,onClose:t}){let[n,r]=(0,T.useState)(``),[i,a]=(0,T.useState)(!1),{busy:o,error:s,reset:c,run:l}=iu(),[u,d]=(0,T.useState)(!1),[f,p]=(0,T.useState)(null),m=(0,T.useRef)(null);(0,T.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return()=>e?.focus()},[]),(0,T.useEffect)(()=>{if(!f)return;let e=setTimeout(t,2500);return()=>clearTimeout(e)},[f]);let h=e=>{e.preventDefault(),!(!n.trim()||o)&&(c(),d(!0))},g=async()=>{if(o)return;let t=await l(()=>Sa(n.trim(),i),`Failed to add the project.`);t?.ok?(d(!1),p({added:t.added,alreadyActivated:t.alreadyActivated}),e()):d(!1)},_=e=>{if(e.key===`Escape`){e.preventDefault(),t();return}if(e.key!==`Tab`||!m.current)return;let n=[...m.current.querySelectorAll(`button, input, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`)),r=n[0],i=n[n.length-1];!r||!i||(e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()))},v=f&&[`Added ${f.added} project${f.added===1?``:`s`}`,f.alreadyActivated>0?`${f.alreadyActivated} already added`:null].filter(Boolean).join(` · `);return(0,J.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center bg-black/40 pt-24`,onKeyDown:_,children:[(0,J.jsx)(`div`,{className:`absolute inset-0`,onClick:t}),(0,J.jsx)(`div`,{ref:m,role:`dialog`,"aria-modal":`true`,"aria-label":`Add project`,className:`relative w-96 max-w-[90vw] rounded-lg border border-border bg-background p-4 shadow-lg`,children:f?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{role:`status`,className:`mb-3 text-sm font-medium`,children:v}),(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(Y,{type:`button`,size:`sm`,autoFocus:!0,onClick:t,children:`Done`})})]}):u?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Do you trust this repository?`}),(0,J.jsx)(`p`,{className:`mb-2 break-all text-xs text-muted-foreground`,children:(0,J.jsx)(`code`,{className:`rounded bg-muted px-1`,children:n.trim()})}),(0,J.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:`Adding it lets the agent read its files. Hidden instructions in an untrusted repo can hijack the agent (prompt injection), so only add repos you trust.`}),s&&(0,J.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:s}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:()=>d(!1),children:`Back`}),(0,J.jsx)(Y,{type:`button`,size:`sm`,disabled:o,onClick:()=>void g(),children:o?`Adding…`:`I trust it, add it`})]})]}):(0,J.jsxs)(`form`,{onSubmit:h,children:[(0,J.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Add project`}),(0,J.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`/absolute/path/to/repo`,"aria-label":`Repository path`,autoFocus:!0,disabled:o,className:`mb-2 w-full rounded-md border border-border bg-transparent px-2 py-1 text-sm outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`}),(0,J.jsxs)(`label`,{className:`mb-2 flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(Vf,{checked:i,onCheckedChange:a,disabled:o}),`It's a folder of repos`]}),s&&(0,J.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:s}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:t,children:`Cancel`}),(0,J.jsx)(Y,{type:`submit`,size:`sm`,disabled:o||!n.trim(),children:`Add`})]})]})})]})}var Uf=T.createContext(void 0);function Wf(e){let t=T.useContext(Uf);if(t===void 0&&!e)throw Error(Ou(33));return t}var Gf=T.createContext(void 0);function Kf(e){let t=T.useContext(Gf);if(t===void 0&&!e)throw Error(Ou(36));return t}var qf=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=If.startingStyle]=`startingStyle`,e[e.endingStyle=If.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e}({}),Jf=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Yf={[Jf.popupOpen]:``},Xf={[Jf.popupOpen]:``,[Jf.pressed]:``},Zf={[qf.open]:``},Qf={[qf.closed]:``},$f={[qf.anchorHidden]:``},ep={open(e){return e?Yf:null}},tp={open(e){return e?Xf:null}},np={open(e){return e?Zf:Qf},anchorHidden(e){return e?$f:null}},rp=T.createContext(void 0);function ip(e=!0){let t=T.useContext(rp);if(t===void 0&&!e)throw Error(Ou(25));return t}var ap=T.createContext(void 0);function op(){let e=T.useContext(ap);if(e===void 0)throw Error(Ou(30));return e}var sp={type:`regular-item`};function cp(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:o,itemMetadata:s,nodeId:c}=e,l=T.useRef(null),u=ip(!0),d=u!==void 0,{events:f}=a.useState(`floatingTreeRoot`),{getButtonProps:p,buttonRef:m}=Ld({disabled:n,focusableWhenDisabled:!0,native:o}),h=T.useCallback(e=>Lu({id:i,role:`menuitem`,tabIndex:r?0:-1,onMouseMove(e){c&&f.emit(`itemhover`,{nodeId:c,target:e.currentTarget})},onMouseEnter(){s.type===`submenu-trigger`&&s.setActive()},onKeyUp(e){e.key===` `&&a.context.typingRef.current&&e.preventBaseUIHandler()},onClick(e){t&&f.emit(`close`,{domEvent:e,reason:of})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1)return}l.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&s.type===`regular-item`&&l.current.click()}},e,p),[i,r,p,t,f,a,d,u,s,c]),g=gu(l,m);return T.useMemo(()=>({getItemProps:h,itemRef:g}),[h,g])}var lp=T.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function up(){return T.useContext(lp)}var dp=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function fp(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=up(),f=T.useRef(-1),[p,m]=T.useState(a??(i===dp.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=T.useRef(null),g=T.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Z(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Z(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),T.useMemo(()=>({ref:g,index:p}),[p,g])}var pp=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),mp={checked(e){return e?{[pp.checked]:``}:{[pp.unchecked]:``}},...zf},hp=T.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,...f}=e,p=fp({label:a}),m=Wf(!0),h=cd(i),{store:g}=Kf(),_=g.useState(`isActive`,p.index),v=g.useState(`itemProps`),[y,b]=lu({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:x,itemRef:S}=cp({closeOnClick:c,disabled:s,highlighted:_,id:h,store:g,nativeButton:o,nodeId:m?.nodeId,itemMetadata:sp}),C=T.useMemo(()=>({disabled:s,highlighted:_,checked:y}),[s,_,y]),w=$u(`div`,e,{state:C,stateAttributesMapping:mp,props:[v,{role:`menuitemcheckbox`,"aria-checked":y,onClick:X(e=>{let t={...yf(of,e.nativeEvent),preventUnmountOnClose:()=>{}};d?.(!y,t),!t.isCanceled&&b(e=>!e)})},f,x],ref:[S,t,p.ref]});return(0,J.jsx)(ap.Provider,{value:C,children:w})}),gp=T.forwardRef(function(e,t){let{render:n,className:r,keepMounted:i=!1,...a}=e,o=op(),s=T.useRef(null),{transitionStatus:c,setMounted:l}=Ff(o.checked);return Pf({open:o.checked,ref:s,onComplete(){o.checked||l(!1)}}),$u(`span`,e,{state:T.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:c}),[o.checked,o.disabled,o.highlighted,c]),ref:[t,s],stateAttributesMapping:mp,props:{"aria-hidden":!0,...a},enabled:i||o.checked})}),_p=T.createContext(void 0);function vp(){let e=T.useContext(_p);if(e===void 0)throw Error(Ou(31));return e}var yp=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,[a,o]=T.useState(void 0),s=T.useMemo(()=>({setLabelId:o}),[o]),c=$u(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":a,...i}});return(0,J.jsx)(_p.Provider,{value:s,children:c})}),bp=T.forwardRef(function(e,t){let{className:n,render:r,id:i,...a}=e,o=cd(i),{setLabelId:s}=vp();return Z(()=>(s(o),()=>{s(void 0)}),[s,o]),$u(`div`,e,{ref:t,props:{id:o,role:`presentation`,...a}})}),xp=T.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,...l}=e,u=fp({label:a}),d=Wf(!0),f=cd(i),{store:p}=Kf(),m=p.useState(`isActive`,u.index),h=p.useState(`itemProps`),{getItemProps:g,itemRef:_}=cp({closeOnClick:c,disabled:s,highlighted:m,id:f,store:p,nativeButton:o,nodeId:d?.nodeId,itemMetadata:sp});return $u(`div`,e,{state:T.useMemo(()=>({disabled:s,highlighted:m}),[s,m]),props:[h,l,g],ref:[_,t,u.ref]})}),Sp=0,Cp=class e{static create(){return new e}currentId=Sp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Sp,t()},e)}isStarted(){return this.currentId!==Sp}clear=()=>{this.currentId!==Sp&&(clearTimeout(this.currentId),this.currentId=Sp)};disposeEffect=()=>this.clear};function wp(){let e=du(Cp.create).current;return Df(e.disposeEffect),e}var Tp=typeof navigator<`u`,Ep=Fp(),Dp=Lp(),Op=Ip(),kp=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),Ap=Ep.platform===`MacIntel`&&Ep.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(Ep.platform);Tp&&/firefox/i.test(Op);var jp=Tp&&/apple/i.test(navigator.vendor);Tp&&/Edg/i.test(Op);var Mp=Tp&&/android/i.test(Dp)||/android/i.test(Op),Np=Tp&&Dp.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,Pp=Op.includes(`jsdom/`);function Fp(){if(!Tp)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function Ip(){if(!Tp)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Lp(){if(!Tp)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var Rp=`data-base-ui-focusable`,zp=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Bp=`ArrowLeft`,Vp=`ArrowRight`,Hp=`ArrowUp`,Up=`ArrowDown`;function Wp(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Gp(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&gd(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Kp(e){return`composedPath`in e?e.composedPath()[0]:e.target}function qp(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Jp(e){return e.matches(`html,body`)}function Yp(e){return e?.ownerDocument||document}function Xp(e){return hd(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Zp(e){return e?e.getAttribute(`role`)===`combobox`&&Xp(e):!1}function Qp(e){if(!e||Pp)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function $p(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function em(e,t,n=!0){return e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...em(e,t.id,n)])}function tm(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function nm(e){e.preventDefault(),e.stopPropagation()}function rm(e){return`nativeEvent`in e}function im(e){return e.mozInputSource===0&&e.isTrusted?!0:Mp&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function am(e){return Pp?!1:!Mp&&e.width===0&&e.height===0||Mp&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function om(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function sm(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var cm=[`top`,`right`,`bottom`,`left`],lm=Math.min,um=Math.max,dm=Math.round,fm=Math.floor,pm=e=>({x:e,y:e}),mm={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function hm(e,t,n){return um(e,lm(t,n))}function gm(e,t){return typeof e==`function`?e(t):e}function _m(e){return e.split(`-`)[0]}function vm(e){return e.split(`-`)[1]}function ym(e){return e===`x`?`y`:`x`}function bm(e){return e===`y`?`height`:`width`}function xm(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Sm(e){return ym(xm(e))}function Cm(e,t,n){n===void 0&&(n=!1);let r=vm(e),i=Sm(e),a=bm(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Mm(o)),[o,Mm(o)]}function wm(e){let t=Mm(e);return[Tm(e),t,Tm(t)]}function Tm(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Em=[`left`,`right`],Dm=[`right`,`left`],Om=[`top`,`bottom`],km=[`bottom`,`top`];function Am(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Dm:Em:t?Em:Dm;case`left`:case`right`:return t?Om:km;default:return[]}}function jm(e,t,n,r){let i=vm(e),a=Am(_m(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Tm)))),a}function Mm(e){let t=_m(e);return mm[t]+e.slice(t.length)}function Nm(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Pm(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Nm(e)}function Fm(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Im(e,t,n){return Math.floor(e/t)!==n}function Lm(e,t){return t<0||t>=e.current.length}function Rm(e,t){return Bm(e,{disabledIndices:t})}function zm(e,t){return Bm(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Bm(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&Gm(e,a,r));return a}function Vm(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}){let d=l,f=[],p={},m=!1;{let t=null,n=-1;e.current.forEach((e,r)=>{if(e==null)return;let i=e.closest(`[role="row"]`);i&&(m=!0),(i!==t||n===-1)&&(t=i,n+=1,f[n]=[]),f[n].push(r),p[r]=n})}let h=m&&f.length>0&&f.some(e=>e.length!==a);function g(t){if(!h||l===-1)return;let n=p[l];if(n==null)return;let i=f[n].indexOf(l),a=t===`up`?n-1:n+1;r&&(a<0?a=f.length-1:a>=f.length&&(a=0));let s=new Set;for(;a>=0&&a<f.length&&!s.has(a);){s.add(a);let n=f[a];if(n.length===0){a=t===`up`?a-1:a+1;continue}let c=Math.min(i,n.length-1);for(let t=c;t>=0;--t){let r=n[t];if(!Gm(e,r,o))return r}a=t===`up`?a-1:a+1,r&&(a<0?a=f.length-1:a>=f.length&&(a=0))}}if(t.key===`ArrowUp`){let n=g(`up`);if(n!==void 0)u&&nm(t),d=n;else{if(u&&nm(t),l===-1)d=c;else if(d=Bm(e,{startingIndex:d,amount:a,decrement:!0,disabledIndices:o}),r&&(l-a<s||d<0)){let e=l%a,t=c%a,n=c-(t-e);d=t===e?c:t>e?n:n-a}Lm(e,d)&&(d=l)}}if(t.key===`ArrowDown`){let n=g(`down`);n===void 0?(u&&nm(t),l===-1?d=s:(d=Bm(e,{startingIndex:l,amount:a,disabledIndices:o}),r&&l+a>c&&(d=Bm(e,{startingIndex:l%a-a,amount:a,disabledIndices:o}))),Lm(e,d)&&(d=l)):(u&&nm(t),d=n)}if(n===`both`){let n=fm(l/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(u&&nm(t),l%a===a-1?r&&(d=Bm(e,{startingIndex:l-l%a-1,disabledIndices:o})):(d=Bm(e,{startingIndex:l,disabledIndices:o}),r&&Im(d,a,n)&&(d=Bm(e,{startingIndex:l-l%a-1,disabledIndices:o}))),Im(d,a,n)&&(d=l)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(u&&nm(t),l%a===0?r&&(d=Bm(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o})):(d=Bm(e,{startingIndex:l,decrement:!0,disabledIndices:o}),r&&Im(d,a,n)&&(d=Bm(e,{startingIndex:l+(a-l%a),decrement:!0,disabledIndices:o}))),Im(d,a,n)&&(d=l));let s=fm(c/a)===n;Lm(e,d)&&(d=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?c:Bm(e,{startingIndex:l-l%a-1,disabledIndices:o}):l)}return d}function Hm(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Um(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function Wm(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Gm(e,t,n){if(typeof n==`function`)return n(t);if(n)return n.includes(t);let r=e.current[t];return r?r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`:!1}var Km=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`area[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),qm=typeof Element>`u`,Jm=qm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ym=!qm&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},Xm=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):Xm(e.parentNode))},Zm=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},Qm=function(e,t,n){if(Xm(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Km));return t&&Jm.call(e,Km)&&r.unshift(e),r=r.filter(n),r},$m=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!Xm(a,!1))if(a.tagName===`SLOT`){var o=a.assignedElements(),s=$m(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{Jm.call(a,Km)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!Xm(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=$m(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},eh=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},th=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Zm(e))&&!eh(e)?0:e.tabIndex},nh=function(e,t){var n=th(e);return n<0&&t&&!eh(e)?0:n},rh=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ih=function(e){return e.tagName===`INPUT`},ah=function(e){return ih(e)&&e.type===`hidden`},oh=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},sh=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},ch=function(e){if(!e.name)return!0;var t=e.form||Ym(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=sh(r,e.form);return!i||i===e},lh=function(e){return ih(e)&&e.type===`radio`},uh=function(e){return lh(e)&&!ch(e)},dh=function(e){var t=e&&Ym(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=Ym(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},fh=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},ph=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var i=getComputedStyle(e).visibility;if(i===`hidden`||i===`collapse`)return!0;var a=Jm.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(Jm.call(a,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var o=e;e;){var s=e.parentElement,c=Ym(e);if(s&&!s.shadowRoot&&r(s)===!0)return fh(e);e=e.assignedSlot?e.assignedSlot:!s&&c!==e.ownerDocument?c.host:s}e=o}if(dh(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return fh(e);return!1},mh=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return Jm.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},hh=function(e,t){return!(t.disabled||ah(t)||ph(t,e)||oh(t)||mh(t))},gh=function(e,t){return!(uh(t)||th(t)<0||!hh(e,t))},_h=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},vh=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=nh(a,i),s=i?vh(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(rh).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},yh=function(e,t){return t||={},vh(t.getShadowRoot?$m([e],t.includeContainer,{filter:gh.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:_h}):Qm(e,t.includeContainer,gh.bind(null,t)))},bh=function(e,t){return t||={},t.getShadowRoot?$m([e],t.includeContainer,{filter:hh.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Qm(e,t.includeContainer,hh.bind(null,t))},xh=function(e,t){if(t||={},!e)throw Error(`No node provided`);return Jm.call(e,Km)!==!1&&gh(t,e)},Sh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function Ch(e,t){let n=yh(e,Sh()),r=n.length;if(r===0)return;let i=Wp(Yp(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function wh(e){return Ch(Yp(e).body,1)||e}function Th(e){return Ch(Yp(e).body,-1)||e}function Eh(e,t){if(!e)return null;let n=yh(Yp(e).body,Sh()),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Dh(e){return Eh(e,1)}function Oh(e){return Eh(e,-1)}function kh(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Gp(n,r)}function Ah(e){yh(e,Sh()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function jh(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Mh(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Nh=class{nodesRef={current:[]};events=Mh();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Ph=T.createContext(null),Fh=T.createContext(null),Ih=()=>T.useContext(Ph)?.id||null,Lh=e=>{let t=T.useContext(Fh);return e??t};function Rh(e){let t=sd(),n=Lh(e),r=Ih();return Z(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function zh(e){let{children:t,id:n}=e,r=Ih();return(0,J.jsx)(Ph.Provider,{value:T.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Bh(e){let{children:t,externalTree:n}=e,r=du(()=>n??new Nh).current;return(0,J.jsx)(Fh.Provider,{value:r,children:t})}function Vh(e){return`data-base-ui-${e}`}var Hh=Vh(`safe-polygon`),Uh=`button,[role="button"],select,[tabindex]:not([tabindex="-1"]),${zp}`;function Wh(e){return e?!!e.closest(Uh):!1}function Gh(e,t,n){if(n&&!om(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function Kh(e){return typeof e==`function`?e():e}function qh(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o,events:s}=n.context,{enabled:c=!0,delay:l=0,handleClose:u=null,mouseOnly:d=!1,restMs:f=0,move:p=!0,triggerElement:m=null,externalTree:h}=t,g=Lh(h),_=Ih(),v=wf(u),y=wf(l),b=wf(f),x=T.useRef(void 0),S=T.useRef(!1),C=wp(),w=T.useRef(void 0),E=wp(),D=T.useRef(!0),O=T.useRef(!1),k=T.useRef(()=>{}),A=T.useRef(!1),j=X(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),M=X(()=>S.current?!0:o.current.openEvent?[`click`,`mousedown`].includes(o.current.openEvent.type):!1);T.useEffect(()=>{if(!c)return;function e(e){e.open||(C.clear(),E.clear(),D.current=!0,A.current=!1)}return s.on(`openchange`,e),()=>{s.off(`openchange`,e)}},[c,s,C,E]),T.useEffect(()=>{if(!c||!v.current||!r)return;function e(e){M()||j()&&n.setOpen(!1,yf(nf,e,e.currentTarget??void 0))}let t=Yp(i).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[i,r,n,c,v,j,M]);let N=T.useCallback((e,t=!0)=>{let r=Gh(y.current,`close`,x.current);r&&!w.current?C.start(r,()=>n.setOpen(!1,yf(nf,e))):t&&(C.clear(),n.setOpen(!1,yf(nf,e)))},[y,n,C]),P=X(()=>{k.current(),w.current=void 0}),F=X(()=>{if(O.current){let e=Yp(i).body;e.style.pointerEvents=``,e.removeAttribute(Hh),O.current=!1}}),I=X(e=>{if(!Wh(Kp(e))){S.current=!1;return}S.current=!0});T.useEffect(()=>{if(!c)return;function e(e){if(C.clear(),D.current=!1,d&&!om(x.current)||Kh(b.current)>0&&!Gh(y.current,`open`))return;let t=Gh(y.current,`open`,x.current),i=e.currentTarget??void 0,a=n.select(`domReferenceElement`),o=a&&i&&!Gp(a,i);t?C.start(t,()=>{n.select(`open`)||n.setOpen(!0,yf(nf,e,i))}):(!r||o)&&n.setOpen(!0,yf(nf,e,i))}function t(e){if(M()){F();return}k.current();let t=Yp(i);E.clear(),A.current=!1;let a=n.context.triggerElements;if(!(e.relatedTarget&&a.hasElement(e.relatedTarget))){if(v.current&&o.current.floatingContext){r||C.clear(),w.current=v.current({...o.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){F(),P(),M()||N(e,!0)}});let n=w.current;t.addEventListener(`mousemove`,n),k.current=()=>{t.removeEventListener(`mousemove`,n)};return}(x.current!==`touch`||!Gp(i,e.relatedTarget))&&N(e)}}function s(e){if(M()||!o.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||v.current?.({...o.current.floatingContext,tree:g,x:e.clientX,y:e.clientY,onClose(){F(),P(),M()||N(e)}})(e)}function l(){C.clear(),F()}function u(e){M()||N(e,!1)}let f=m??a;if(md(f)){let n=i;return r&&f.addEventListener(`mouseleave`,s),p&&f.addEventListener(`mousemove`,e,{once:!0}),f.addEventListener(`mouseenter`,e),f.addEventListener(`mouseleave`,t),n&&(n.addEventListener(`mouseleave`,s),n.addEventListener(`mouseenter`,l),n.addEventListener(`mouseleave`,u),n.addEventListener(`pointerdown`,I,!0)),()=>{r&&f.removeEventListener(`mouseleave`,s),p&&f.removeEventListener(`mousemove`,e),f.removeEventListener(`mouseenter`,e),f.removeEventListener(`mouseleave`,t),n&&(n.removeEventListener(`mouseleave`,s),n.removeEventListener(`mouseenter`,l),n.removeEventListener(`mouseleave`,u),n.removeEventListener(`pointerdown`,I,!0))}}},[c,d,p,a,i,m,n,N,P,F,r,g,y,v,o,M,b,C,E,I]),Z(()=>{if(c&&r&&v.current?.__options?.blockPointerEvents&&j()){O.current=!0;let e=i;if(md(a)&&e){let t=Yp(i).body;t.setAttribute(Hh,``);let n=a,r=g?.nodesRef.current.find(e=>e.id===_)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),t.style.pointerEvents=`none`,n.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{t.style.pointerEvents=``,n.style.pointerEvents=``,e.style.pointerEvents=``}}}},[c,r,_,g,v,j,a,i]),Z(()=>{r||(x.current=void 0,A.current=!1,S.current=!1,P(),F())},[r,P,F]),T.useEffect(()=>()=>{P(),C.clear(),E.clear(),S.current=!1},[c,a,P,C,E]),T.useEffect(()=>F,[F]);let L=T.useMemo(()=>{function e(e){x.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`)&&!Gp(n.select(`domReferenceElement`),e.target);function a(){!D.current&&(!n.select(`open`)||i)&&n.setOpen(!0,yf(nf,t,r))}d&&!om(x.current)||n.select(`open`)&&!i||Kh(b.current)===0||!i&&A.current&&e.movementX**2+e.movementY**2<2||(E.clear(),x.current===`touch`||i?a():(A.current=!0,E.start(Kh(b.current),a)))}}},[d,n,b,E]);return T.useMemo(()=>c?{reference:L}:{},[c,L])}var Jh=T.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Cp,currentIdRef:{current:null},currentContextRef:{current:null}});function Yh(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=T.useRef(n),a=T.useRef(n),o=T.useRef(null),s=T.useRef(null),c=wp();return(0,J.jsx)(Jh.Provider,{value:T.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Xh(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{enabled:i=!0,open:a}=t,{currentIdRef:o,delayRef:s,timeoutMs:c,initialDelayRef:l,currentContextRef:u,hasProvider:d,timeout:f}=T.useContext(Jh),[p,m]=T.useState(!1);return Z(()=>{function e(){m(!1),u.current?.setIsInstantPhase(!1),o.current=null,u.current=null,s.current=l.current}if(i&&o.current&&!a&&o.current===r){if(m(!1),c)return f.start(c,e),()=>{f.clear()};e()}},[i,a,r,o,s,c,l,u,f]),Z(()=>{if(!i||!a)return;let e=u.current,t=o.current;u.current={onOpenChange:n.setOpen,setIsInstantPhase:m},o.current=r,s.current={open:0,close:Gh(l.current,`close`)},t!==null&&t!==r?(f.clear(),m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,yf(ef))):(m(!1),e?.setIsInstantPhase(!1))},[i,a,r,n,o,s,c,l,u,f]),Z(()=>()=>{u.current=null},[u]),T.useMemo(()=>({hasProvider:d,delayRef:s,isInstantPhase:p}),[d,s,p])}function Zh(e){return e?.ownerDocument||document}var Qh=T.forwardRef(function(e,t){let[n,r]=T.useState();Z(()=>{jp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,J.jsx)(`span`,{...e,ref:t,style:Su,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),$h=0;function eg(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame($h);let a=()=>e?.focus({preventScroll:n});i?a():$h=requestAnimationFrame(a)}var tg={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function ng(e){return e===`inert`?tg.inert:e===`aria-hidden`?tg[`aria-hidden`]:tg.none}var rg=new WeakSet,ig={},ag=0,og=e=>e&&(e.host||og(e.parentNode)),sg=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=og(t);return e.contains(n)?n:null}).filter(e=>e!=null);function cg(e,t,n,r){let i=`data-base-ui-inert`,a=r?`inert`:n?`aria-hidden`:null,o=sg(t,e),s=new Set,c=new Set(o),l=[];ig[i]||(ig[i]=new WeakMap);let u=ig[i];o.forEach(d),f(t),s.clear();function d(e){!e||s.has(e)||(s.add(e),e.parentNode&&d(e.parentNode))}function f(e){!e||c.has(e)||[].forEach.call(e.children,e=>{if(ud(e)!==`script`)if(s.has(e))f(e);else{let t=a?e.getAttribute(a):null,n=t!==null&&t!==`false`,r=ng(a),o=(r.get(e)||0)+1,s=(u.get(e)||0)+1;r.set(e,o),u.set(e,s),l.push(e),o===1&&n&&rg.add(e),s===1&&e.setAttribute(i,``),!n&&a&&e.setAttribute(a,a===`inert`?``:`true`)}})}return ag+=1,()=>{l.forEach(e=>{let t=ng(a),n=(t.get(e)||0)-1,r=(u.get(e)||0)-1;t.set(e,n),u.set(e,r),n||(!rg.has(e)&&a&&e.removeAttribute(a),rg.delete(e)),r||e.removeAttribute(i)}),--ag,ag||(tg.inert=new WeakMap,tg[`aria-hidden`]=new WeakMap,tg.none=new WeakMap,rg=new WeakSet,ig={})}}function lg(e,t=!1,n=!1){let r=Yp(e[0]).body;return cg(e.concat(Array.from(r.querySelectorAll(`[aria-live]`))),r,t,n)}var ug=T.createContext(null),dg=()=>T.useContext(ug),fg=Vh(`portal`);function pg(e={}){let{ref:t,container:n,componentProps:r=cu,elementProps:i,elementState:a}=e,o=sd(),s=dg()?.portalNode,[c,l]=T.useState(null),[u,d]=T.useState(null),f=T.useRef(null);Z(()=>{if(n===null){f.current&&(f.current=null,d(null),l(null));return}if(o==null)return;let e=(n&&(pd(n)?n:n.current))??s??document.body;if(e==null){f.current&&(f.current=null,d(null),l(null));return}f.current!==e&&(f.current=e,d(null),l(e))},[n,s,o]);let p=$u(`div`,r,{ref:[t,d],state:a,props:[{id:o,[fg]:``},i]});return{portalNode:u,portalSubtree:c&&p?Kd.createPortal(p,c):null}}var mg=T.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,...s}=e,{portalNode:c,portalSubtree:l}=pg({container:r,ref:t,componentProps:e,elementProps:s}),u=T.useRef(null),d=T.useRef(null),f=T.useRef(null),p=T.useRef(null),[m,h]=T.useState(null),g=m?.modal,_=m?.open,v=typeof o==`boolean`?o:!!m&&!m.modal&&m.open&&!!c;T.useEffect(()=>{if(!c||g)return;function e(e){c&&kh(e)&&(e.type===`focusin`?jh:Ah)(c)}return c.addEventListener(`focusin`,e,!0),c.addEventListener(`focusout`,e,!0),()=>{c.removeEventListener(`focusin`,e,!0),c.removeEventListener(`focusout`,e,!0)}},[c,g]),T.useEffect(()=>{!c||_||jh(c)},[_,c]);let y=T.useMemo(()=>({beforeOutsideRef:u,afterOutsideRef:d,beforeInsideRef:f,afterInsideRef:p,portalNode:c,setFocusManagerState:h}),[c]);return(0,J.jsxs)(T.Fragment,{children:[l,(0,J.jsxs)(ug.Provider,{value:y,children:[v&&c&&(0,J.jsx)(Qh,{"data-type":`outside`,ref:u,onFocus:e=>{kh(e,c)?f.current?.focus():Th(m?m.domReference:null)?.focus()}}),v&&c&&(0,J.jsx)(`span`,{"aria-owns":c.id,style:Qu}),c&&Kd.createPortal(n,c),v&&c&&(0,J.jsx)(Qh,{"data-type":`outside`,ref:d,onFocus:e=>{kh(e,c)?p.current?.focus():(wh(m?m.domReference:null)?.focus(),m?.closeOnFocusOut&&m?.onOpenChange(!1,yf(`focus-out`,e.nativeEvent)))}})]})]})});function hg(e,t){let n=dd(e.target);return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var gg=20,_g=[];function vg(){_g=_g.filter(e=>e.isConnected)}function yg(e){vg(),e&&ud(e)!==`body`&&(_g.push(e),_g.length>gg&&(_g=_g.slice(-20)))}function bg(){return vg(),_g[_g.length-1]}function xg(e){if(!e)return null;let t=Sh();return xh(e,t)?e:yh(e,t)[0]||e}function Sg(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():Od(e).display!==`none`}function Cg(e,t){if(!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=Sh(),r=bh(e,n).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return xh(e,n)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),i=e.getAttribute(`tabindex`);t.current.includes(`floating`)||r.length===0?i!==`0`&&e.setAttribute(`tabindex`,`0`):(i!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function wg(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,getInsideElements:d=()=>[],nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h}=e,g=`rootStore`in t?t.rootStore:t,_=g.useState(`open`),v=g.useState(`domReferenceElement`),y=g.useState(`floatingElement`),{events:b,dataRef:x}=g.context,S=X(()=>x.current.floatingContext?.nodeId),C=X(d),w=a===!1,E=Zp(v)&&w,D=wf(i),O=wf(a),k=wf(o),A=wf(u),j=Lh(h),M=dg(),N=T.useRef(null),P=T.useRef(null),F=T.useRef(!1),I=T.useRef(!1),L=T.useRef(!1),R=T.useRef(-1),z=T.useRef(``),B=T.useRef(``),ee=wp(),V=wp(),H=jf(),te=M!=null,U=$p(y),W=X((e=U)=>e?yh(e,Sh()):[]),ne=X(e=>{let t=W(e);return D.current.map(()=>t).filter(Boolean).flat()});T.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Gp(U,Wp(Yp(U)))&&W().length===0&&!E&&nm(e)}let t=Yp(U);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,v,U,c,D,E,W,ne]),T.useEffect(()=>{if(r||!y)return;function e(e){let t=Kp(e),n=W().indexOf(t);n!==-1&&(R.current=n)}return y.addEventListener(`focusin`,e),()=>{y.removeEventListener(`focusin`,e)}},[r,y,W]),T.useEffect(()=>{if(r||!_)return;let e=Yp(U);function t(){L.current=!1}function n(e){let t=Kp(e),n=Gp(y,t)||Gp(v,t)||Gp(M?.portalNode,t);L.current=!n,B.current=e.pointerType||`keyboard`}function i(){B.current=`keyboard`}return e.addEventListener(`pointerdown`,n,!0),e.addEventListener(`pointerup`,t,!0),e.addEventListener(`pointercancel`,t,!0),e.addEventListener(`keydown`,i,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),e.removeEventListener(`pointerup`,t,!0),e.removeEventListener(`pointercancel`,t,!0),e.removeEventListener(`keydown`,i,!0)}},[r,y,v,U,_,M]),T.useEffect(()=>{if(r||!l)return;function e(){I.current=!0,V.start(0,()=>{I.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=Kp(e);queueMicrotask(()=>{let i=S(),a=g.context.triggerElements,o=!(Gp(v,t)||Gp(y,t)||Gp(t,y)||Gp(M?.portalNode,t)||t!=null&&a.hasElement(t)||a.hasMatchingElement(e=>Gp(e,t))||t?.hasAttribute(Vh(`focus-guard`))||j&&(em(j.nodesRef.current,i).find(e=>Gp(e.context?.elements.floating,t)||Gp(e.context?.elements.domReference,t))||tm(j.nodesRef.current,i).find(e=>[e.context?.elements.floating,$p(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===v&&U&&Cg(U,D),s&&n!==v&&!Sg(r)&&Wp(Yp(U))===Yp(U).body){if(hd(U)&&(U.focus(),s===`popup`)){H.request(()=>{U.focus()});return}let e=R.current,t=W(),n=t[e]||t[t.length-1]||U;hd(n)&&n.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(E||!c)&&t&&o&&!I.current&&(E||t!==bg())&&(F.current=!0,g.setOpen(!1,yf(uf,e)))})}function n(){L.current||(x.current.insideReactTree=!0,ee.start(0,()=>{x.current.insideReactTree=!1}))}let i=hd(v)?v:null,a=[];if(!(!y&&!i))return i&&(i.addEventListener(`focusout`,t),i.addEventListener(`pointerdown`,e),a.push(()=>{i.removeEventListener(`focusout`,t),i.removeEventListener(`pointerdown`,e)})),y&&(y.addEventListener(`focusout`,t),M&&(y.addEventListener(`focusout`,n,!0),a.push(()=>{y.removeEventListener(`focusout`,n,!0)})),a.push(()=>{y.removeEventListener(`focusout`,t)})),()=>{a.forEach(e=>{e()})}},[r,v,y,U,c,j,M,g,l,s,W,E,S,D,x,ee,V,H]);let re=T.useRef(null),ie=T.useRef(null),ae=gu(re,m,M?.beforeInsideRef),oe=gu(ie,M?.afterInsideRef);T.useEffect(()=>{if(r||!y||!_)return;let e=Array.from(M?.portalNode?.querySelectorAll(`[${Vh(`portal`)}]`)||[]),t=(j?tm(j.nodesRef.current,S()):[]).find(e=>Zp(e.context?.elements.domReference||null))?.context?.elements.domReference,n=lg([y,t,...e,...C(),N.current,P.current,re.current,ie.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,Mf(p),Mf(f),E?v:null].filter(e=>e!=null),c||E);return()=>{n()}},[_,r,v,y,c,D,M,E,j,S,C,f,p]),Z(()=>{if(!_||r||!hd(U))return;let e=Wp(Yp(U));queueMicrotask(()=>{let t=ne(U),n=O.current,r=typeof n==`function`?n(A.current||``):n;if(r===void 0||r===!1)return;let i;i=r===!0||r===null?t[0]||U:Mf(r),i=i||t[0]||U,!Gp(U,e)&&eg(i,{preventScroll:i===U})})},[r,_,U,w,ne,O,A]),Z(()=>{if(r||!U)return;let e=Yp(U);yg(Wp(e));function t(e){if(e.open||(z.current=hg(e.nativeEvent,B.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(F.current=!0),e.reason===`outside-press`)if(e.nested)F.current=!1;else if(im(e.nativeEvent)||am(e.nativeEvent))F.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?F.current=!1:F.current=!0}}b.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,Su),te&&v&&v.insertAdjacentElement(`afterend`,n);function i(){let e=k.current,t=typeof e==`function`?e(z.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=v||bg();return e&&e.isConnected?e:n}let r=v||bg()||n;return Mf(t)||r}return()=>{b.off(`openchange`,t);let r=Wp(e),a=Gp(y,r)||j&&em(j.nodesRef.current,S(),!1).some(e=>Gp(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=xg(o),i=typeof k.current!=`boolean`;k.current&&!F.current&&hd(t)&&(!(!i&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,y,U,k,x,b,j,te,v,S]),T.useEffect(()=>{queueMicrotask(()=>{F.current=!1})},[r]),T.useEffect(()=>{if(r||!_)return;function e(e){Kp(e)?.closest(`[data-base-ui-click-trigger]`)&&(I.current=!0)}let t=Yp(U);return t.addEventListener(`pointerdown`,e,!0),()=>{t.removeEventListener(`pointerdown`,e,!0)}},[r,_,U]),Z(()=>{if(!r&&M)return M.setFocusManagerState({modal:c,closeOnFocusOut:l,open:_,onOpenChange:g.setOpen,domReference:v}),()=>{M.setFocusManagerState(null)}},[r,M,c,_,g,l,v]),Z(()=>{if(!(r||!U))return Cg(U,D),()=>{queueMicrotask(vg)}},[r,U,D]);let se=!r&&(!c||!E)&&(te||c);return(0,J.jsxs)(T.Fragment,{children:[se&&(0,J.jsx)(Qh,{"data-type":`inside`,ref:ae,onFocus:e=>{if(c){let e=ne();eg(e[e.length-1])}else M?.portalNode&&(F.current=!1,kh(e,M.portalNode)?wh(v)?.focus():Mf(p??M.beforeOutsideRef)?.focus())}}),n,se&&(0,J.jsx)(Qh,{"data-type":`inside`,ref:oe,onFocus:e=>{c?eg(ne()[0]):M?.portalNode&&(l&&(F.current=!0),kh(e,M.portalNode)?Th(v)?.focus():Mf(f??M.afterOutsideRef)?.focus())}})]})}function Tg(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,u=T.useRef(void 0),d=jf(),f=wp(),p=T.useMemo(()=>({onPointerDown(e){u.current=e.pointerType},onMouseDown(e){let t=u.current,i=e.nativeEvent,p=n.select(`open`);if(e.button!==0||a===`click`||om(t,!0)&&s)return;let m=r.current.openEvent,h=m?.type,g=n.select(`domReferenceElement`)!==e.currentTarget,_=p&&g||!(p&&o&&(!(m&&c)||h===`click`||h===`mousedown`));if(Xp(i.target)){let e=yf(tf,i,i.target);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e);return}let v=e.currentTarget;d.request(()=>{let e=yf(tf,i,v);_&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(_,e)})},onClick(e){if(a===`mousedown-only`)return;let t=u.current;if(a===`mousedown`&&t){u.current=void 0;return}if(om(t,!0)&&s)return;let i=n.select(`open`),d=r.current.openEvent,p=n.select(`domReferenceElement`)!==e.currentTarget,m=i&&p||!(i&&o&&(!(d&&c)||sm(d))),h=yf(tf,e.nativeEvent,e.currentTarget);m&&t===`touch`&&l>0?f.start(l,()=>{n.setOpen(!0,h)}):n.setOpen(m,h)},onKeyDown(){u.current=void 0}}),[r,a,s,n,c,o,d,f,l]);return T.useMemo(()=>i?{reference:p}:cu,[i,p])}function Eg(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Dg(e){return e!=null&&e.clientX!=null}function Og(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`,x:l=null,y:u=null}=t,d=T.useRef(!1),f=T.useRef(null),[p,m]=T.useState(),[h,g]=T.useState([]),_=X((e,t)=>{d.current||o.current.openEvent&&!Dg(o.current.openEvent)||n.set(`positionReference`,Eg(a,{x:e,y:t,axis:c,dataRef:o,pointerType:p}))}),v=X(e=>{l!=null||u!=null||(r?f.current||g([]):_(e.clientX,e.clientY))}),y=om(p)?i:r,b=T.useCallback(()=>{if(!y||!s||l!=null||u!=null)return;let e=dd(i);function t(n){let r=Kp(n);Gp(i,r)?(e.removeEventListener(`mousemove`,t),f.current=null):_(n.clientX,n.clientY)}if(!o.current.openEvent||Dg(o.current.openEvent)){e.addEventListener(`mousemove`,t);let n=()=>{e.removeEventListener(`mousemove`,t),f.current=null};return f.current=n,n}n.set(`positionReference`,a)},[y,s,l,u,i,o,a,n,_]);T.useEffect(()=>b(),[b,h]),T.useEffect(()=>{s&&!i&&(d.current=!1)},[s,i]),T.useEffect(()=>{!s&&r&&(d.current=!0)},[s,r]),Z(()=>{s&&(l!=null||u!=null)&&(d.current=!1,_(l,u))},[s,l,u,_]);let x=T.useMemo(()=>{function e(e){m(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return T.useMemo(()=>s?{reference:x}:{},[s,x])}function kg(e,t,n){let{reference:r,floating:i}=e,a=xm(t),o=Sm(t),s=bm(o),c=_m(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=vm(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ag(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=gm(t,e),p=Pm(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Fm(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Fm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var jg=50,Mg=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ag},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=kg(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<jg&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=kg(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ng=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=gm(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=_m(r),_=xm(o),v=_m(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Mm(o)]:wm(o)),x=p!==`none`;!d&&x&&b.push(...jm(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Cm(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==xm(t))||T.every(e=>xm(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=xm(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Pg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Fg(e){return cm.some(t=>e[t]>=0)}var Ig=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=gm(e,t);switch(i){case`referenceHidden`:{let e=Pg(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Fg(e)}}}case`escaped`:{let e=Pg(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Fg(e)}}}default:return{}}}}},Lg=new Set([`left`,`top`]);async function Rg(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_m(n),s=vm(n),c=xm(n)===`y`,l=Lg.has(o)?-1:1,u=a&&c?-1:1,d=gm(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var zg=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Rg(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Bg=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=gm(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=xm(i),p=ym(f),m=u[p],h=u[f],g=(e,t)=>hm(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Vg=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=gm(e,t),u={x:n,y:r},d=xm(i),f=ym(d),p=u[f],m=u[d],h=gm(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Lg.has(_m(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Hg=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=gm(e,t),c=await i.detectOverflow(t,s),l=_m(n),u=vm(n),d=xm(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=lm(p-c[m],g),y=lm(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*um(c.left,c.right):S=p-2*um(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ug(e){let t=Od(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=hd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=dm(n)!==a||dm(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Wg(e){return md(e)?e:e.contextElement}function Gg(e){let t=Wg(e);if(!hd(t))return pm(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ug(t),o=(a?dm(n.width):n.width)/r,s=(a?dm(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Kg=pm(0);function qg(e){let t=dd(e);return!Ed()||!t.visualViewport?Kg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jg(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===dd(e)}function Yg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Wg(e),o=pm(1);t&&(r?md(r)&&(o=Gg(r)):o=Gg(e));let s=Jg(a,n,r)?qg(a):pm(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=dd(a),t=md(r)?dd(r):r,n=e,i=Nd(n);for(;i&&t!==n;){let e=Gg(i),t=i.getBoundingClientRect(),r=Od(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=dd(i),i=Nd(n)}}return Fm({width:u,height:d,x:c,y:l})}function Xg(e,t){let n=kd(e).scrollLeft;return t?t.left+n:Yg(fd(e)).left+n}function Zg(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Xg(e,n),y:n.top+t.scrollTop}}function Qg(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=fd(r),s=t?yd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=pm(1),u=pm(0),d=hd(r);if((d||!a)&&((ud(r)!==`body`||_d(o))&&(c=kd(r)),d)){let e=Yg(r);l=Gg(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Zg(o,c):pm(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function $g(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function e_(e){let t=kd(e),n=e.ownerDocument.body,r=um(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=um(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Xg(e),o=-t.scrollTop;return Od(n).direction===`rtl`&&(a+=um(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var t_=25;function n_(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=dd(e),a=fd(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ed()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Xg(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=t_&&(s-=o)}return{width:s,height:c,x:l,y:u}}function r_(e,t){let n=Yg(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Gg(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function i_(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=n_(e,n,t);else if(t===`document`)r=e_(fd(e));else if(md(t))r=r_(t,n);else{let n=qg(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Fm(r)}function a_(e,t){let n=t.get(e);if(n)return n;let r=Md(e,[],!1).filter(e=>md(e)&&ud(e)!==`body`),i=null,a=Od(e).position===`fixed`,o=a?Ad(e):e;for(;md(o)&&!Dd(o);){let e=Od(o),t=wd(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Ad(o)}return t.set(e,r),r}function o_(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?yd(t)?[]:a_(t,this._c):[].concat(n),r],o=i_(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=i_(t,a[e],i);s=um(n.top,s),c=lm(n.right,c),l=lm(n.bottom,l),u=um(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function s_(e){let{width:t,height:n}=Ug(e);return{width:t,height:n}}function c_(e,t,n){let r=hd(t),i=fd(t),a=n===`fixed`,o=Yg(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=pm(0);if((r||!a)&&((ud(t)!==`body`||_d(i))&&(s=kd(t)),r)){let e=Yg(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Xg(i));let l=i&&!r&&!a?Zg(i,s):pm(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function l_(e){return Od(e).position===`static`}function u_(e,t){if(!hd(e)||Od(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return fd(e)===n&&(n=n.ownerDocument.body),n}function d_(e,t){let n=dd(e);if(yd(e))return n;if(!hd(e)){let t=Ad(e);for(;t&&!Dd(t);){if(md(t)&&!l_(t))return t;t=Ad(t)}return n}let r=u_(e,t);for(;r&&vd(r)&&l_(r);)r=u_(r,t);return r&&Dd(r)&&l_(r)&&!wd(r)?n:r||Td(e)||n}var eee=async function(e){let t=this.getOffsetParent||d_,n=this.getDimensions,r=await n(e.floating);return{reference:c_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function f_(e){return Od(e).direction===`rtl`}var p_={convertOffsetParentRelativeRectToViewportRelativeRect:Qg,getDocumentElement:fd,getClippingRect:o_,getOffsetParent:d_,getElementRects:eee,getClientRects:$g,getDimensions:s_,getScale:Gg,isElement:md,isRTL:f_};function m_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function h_(e,t,n){let r=null,i,a=fd(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=fm(d),h=fm(a.clientWidth-(u+f)),g=fm(a.clientHeight-(d+p)),_=fm(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:um(0,lm(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!m_(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=dd(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function g_(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Wg(e),u=i||a?[...l?Md(l):[],...t?Md(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?h_(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Yg(e):null;c&&g();function g(){let t=Yg(e);h&&!m_(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var __=zg,v_=Bg,y_=Ng,b_=Hg,x_=Ig,S_=Vg,C_=(e,t,n)=>{let r=new Map,i=n??{},a={...p_,...i.platform,_c:r};return Mg(e,t,{...i,platform:a})},w_=typeof document<`u`?T.useLayoutEffect:function(){};function T_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!T_(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!T_(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function E_(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function D_(e,t){let n=E_(e);return Math.round(t*n)/n}function O_(e){let t=T.useRef(e);return w_(()=>{t.current=e}),t}function k_(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=T.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=T.useState(r);T_(f,r)||p(r);let[m,h]=T.useState(null),[g,_]=T.useState(null),v=T.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=T.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=T.useRef(null),C=T.useRef(null),w=T.useRef(u),E=c!=null,D=O_(c),O=O_(i),k=O_(l),A=T.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),C_(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!T_(w.current,t)&&(w.current=t,Kd.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);w_(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=T.useRef(!1);w_(()=>(j.current=!0,()=>{j.current=!1}),[]),w_(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,A);A()}},[b,x,A,D,E]);let M=T.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=T.useMemo(()=>({reference:b,floating:x}),[b,x]),P=T.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=D_(N.floating,u.x),r=D_(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...E_(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return T.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var A_=(e,t)=>{let n=__(e);return{name:n.name,fn:n.fn,options:[e,t]}},j_=(e,t)=>{let n=v_(e);return{name:n.name,fn:n.fn,options:[e,t]}},M_=(e,t)=>({fn:S_(e).fn,options:[e,t]}),N_=(e,t)=>{let n=y_(e);return{name:n.name,fn:n.fn,options:[e,t]}},P_=(e,t)=>{let n=b_(e);return{name:n.name,fn:n.fn,options:[e,t]}},F_=(e,t)=>{let n=x_(e);return{name:n.name,fn:n.fn,options:[e,t]}},I_={intentional:`onClick`,sloppy:`onPointerDown`};function L_(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function R_(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`referenceElement`),o=n.useState(`domReferenceElement`),{onOpenChange:s,dataRef:c}=n.context,{enabled:l=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:f=`sloppy`,referencePress:p=!1,referencePressEvent:m=`sloppy`,ancestorScroll:h=!1,bubbles:g,externalTree:_}=t,v=Lh(_),y=X(typeof d==`function`?d:()=>!1),b=typeof d==`function`?y:d,x=T.useRef(!1),{escapeKey:S,outsidePress:C}=L_(g),w=T.useRef(null),E=wp(),D=wp(),O=X(()=>{D.clear(),c.current.insideReactTree=!1}),k=T.useRef(!1),A=T.useRef(``),j=X(e=>{A.current=e.pointerType}),M=X(()=>{let e=A.current,t=e===`pen`||!e?`mouse`:e,n=typeof f==`function`?f():f;return typeof n==`string`?n:n[t]}),N=X(e=>{if(!r||!l||!u||e.key!==`Escape`||k.current)return;let t=c.current.floatingContext?.nodeId,i=v?em(v.nodesRef.current,t):[];if(!S&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let a=yf(df,rm(e)?e.nativeEvent:e);n.setOpen(!1,a),!S&&!a.isPropagationAllowed&&e.stopPropagation()}),P=X(e=>{let t=M();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}),F=X(()=>{c.current.insideReactTree=!0,D.start(0,O)}),I=X((e,t=!1)=>{if(P(e)){O();return}if(c.current.insideReactTree){O();return}if(M()===`intentional`&&t||typeof b==`function`&&!b(e))return;let r=Kp(e),i=`[${Vh(`inert`)}]`,a=Yp(n.select(`floatingElement`)).querySelectorAll(i),o=n.context.triggerElements;if(r&&(o.hasElement(r)||o.hasMatchingElement(e=>Gp(e,r))))return;let s=md(r)?r:null;for(;s&&!Dd(s);){let e=Ad(s);if(Dd(e)||!md(e))break;s=e}if(a.length&&md(r)&&!Jp(r)&&!Gp(r,n.select(`floatingElement`))&&Array.from(a).every(e=>!Gp(s,e)))return;if(hd(r)&&!(`touches`in e)){let t=Dd(r),n=Od(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}let l=c.current.floatingContext?.nodeId,u=v&&em(v.nodesRef.current,l).some(t=>qp(e,t.context?.elements.floating));if(qp(e,n.select(`floatingElement`))||qp(e,n.select(`domReferenceElement`))||u)return;let d=v?em(v.nodesRef.current,l):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,yf(af,e)),O()}),L=X(e=>{M()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!l||qp(e,n.select(`floatingElement`))||qp(e,n.select(`domReferenceElement`))||I(e)}),R=X(e=>{if(M()!==`sloppy`||!n.select(`open`)||!l||qp(e,n.select(`floatingElement`))||qp(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(w.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{w.current&&(w.current.dismissOnTouchEnd=!1,w.current.dismissOnMouseDown=!1)}))}),z=X(e=>{let t=Kp(e);function n(){R(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),B=X(e=>{let t=x.current;if(x.current=!1,E.clear(),e.type===`mousedown`&&w.current&&!w.current.dismissOnMouseDown)return;let n=Kp(e);function r(){e.type===`pointerdown`?L(e):I(e,t),n?.removeEventListener(e.type,r)}n?.addEventListener(e.type,r)}),ee=X(e=>{if(M()!==`sloppy`||!w.current||qp(e,n.select(`floatingElement`))||qp(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-w.current.startX),i=Math.abs(t.clientY-w.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(w.current.dismissOnTouchEnd=!0),a>10&&(I(e),E.clear(),w.current=null)}),V=X(e=>{let t=Kp(e);function n(){ee(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)}),H=X(e=>{M()!==`sloppy`||!w.current||qp(e,n.select(`floatingElement`))||qp(e,n.select(`domReferenceElement`))||(w.current.dismissOnTouchEnd&&I(e),E.clear(),w.current=null)}),te=X(e=>{let t=Kp(e);function n(){H(e),t?.removeEventListener(e.type,n)}t?.addEventListener(e.type,n)});T.useEffect(()=>{if(!r||!l)return;c.current.__escapeKeyBubbles=S,c.current.__outsidePressBubbles=C;let e=new Cp;function t(e){n.setOpen(!1,yf(ef,e))}function s(){e.clear(),k.current=!0}function d(){e.start(Ed()?5:0,()=>{k.current=!1})}let f=Yp(i);f.addEventListener(`pointerdown`,j,!0),u&&(f.addEventListener(`keydown`,N),f.addEventListener(`compositionstart`,s),f.addEventListener(`compositionend`,d)),b&&(f.addEventListener(`click`,B,!0),f.addEventListener(`pointerdown`,B,!0),f.addEventListener(`touchstart`,z,!0),f.addEventListener(`touchmove`,V,!0),f.addEventListener(`touchend`,te,!0),f.addEventListener(`mousedown`,B,!0));let p=[];return h&&(md(o)&&(p=Md(o)),md(i)&&(p=p.concat(Md(i))),!md(a)&&a&&a.contextElement&&(p=p.concat(Md(a.contextElement)))),p=p.filter(e=>e!==f.defaultView?.visualViewport),p.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{f.removeEventListener(`pointerdown`,j,!0),u&&(f.removeEventListener(`keydown`,N),f.removeEventListener(`compositionstart`,s),f.removeEventListener(`compositionend`,d)),b&&(f.removeEventListener(`click`,B,!0),f.removeEventListener(`pointerdown`,B,!0),f.removeEventListener(`touchstart`,z,!0),f.removeEventListener(`touchmove`,V,!0),f.removeEventListener(`touchend`,te,!0),f.removeEventListener(`mousedown`,B,!0)),p.forEach(e=>{e.removeEventListener(`scroll`,t)}),e.clear()}},[c,i,a,o,u,b,r,s,h,l,S,C,N,I,B,L,z,V,te,j,n]),T.useEffect(O,[b,O]);let U=T.useMemo(()=>({onKeyDown:N,...p&&{[I_[m]]:e=>{n.setOpen(!1,yf(`trigger-press`,e.nativeEvent))},...m!==`intentional`&&{onClick(e){n.setOpen(!1,yf(`trigger-press`,e.nativeEvent))}}}}),[N,n,p,m]),W=X(e=>{let t=Kp(e.nativeEvent);!Gp(n.select(`floatingElement`),t)||e.button!==0||(x.current=!0)}),ne=T.useMemo(()=>({onKeyDown:N,onPointerDown:W,onMouseDown:W,onMouseUp:W,onClickCapture:F,onMouseDownCapture:F,onPointerDownCapture:F,onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[N,W,F]);return T.useMemo(()=>l?{reference:U,floating:ne,trigger:U}:{},[l,U,ne])}var z_=Symbol(`NOT_FOUND`);function B_(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function V_(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var H_=e=>Array.isArray(e)?e:[e];function U_(e){let t=Array.isArray(e[0])?e[0]:e;return V_(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function W_(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function G_(e){let t;return{get(n){return t&&e(t.key,n)?t.value:z_},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function K_(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return z_}function i(t,i){r(t)===z_&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var q_=(e,t)=>e===t;function J_(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Y_(e,t){let{equalityCheck:n=q_,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=J_(n),o=0,s=r<=1?G_(a):K_(r,a);function c(){let t=s.get(arguments);if(t===z_){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var X_=class{constructor(e){this.value=e}deref(){return this.value}},Z_=typeof WeakRef>`u`?X_:WeakRef,Q_=0,$_=1;function ev(){return{s:Q_,v:void 0,o:null,p:null}}function tv(e){return e instanceof Z_?e.deref():e}function nv(e,t={}){let n=ev(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=ev(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=ev(),e.set(n,t)):t=r}}let s=t,c;if(t.s===$_)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=tv(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Z_(c):c}return s.s=$_,s.v=c,c}return o.clearCache=()=>{n=ev(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function rv(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),B_(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=nv,argsMemoizeOptions:u=[]}={...n,...a},d=H_(c),f=H_(u),p=U_(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=W_(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}rv({memoize:Y_,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});var iv=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(Ou(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},av=f((e=>{var t=g();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),ov=f(((e,t)=>{t.exports=av()})),sv=f((e=>{var t=g(),n=ov();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),cv=f(((e,t)=>{t.exports=sv()})),lv=ov(),uv=cv(),dv=Au(19)?pv:mv;function fv(e,t,n,r,i){return dv(e,t,n,r,i)}function pv(e,t,n,r,i){let a=T.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,lv.useSyncExternalStore)(e.subscribe,a,a)}function mv(e,t,n,r,i){return(0,uv.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var hv=class e{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){e.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||e.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){let t={...this.state};e.prototype.setState.call(this,t)}},gv=class extends hv{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}controlledValues=new Map;useSyncedValue(e,t){T.useDebugValue(e),Z(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){Z(()=>(this.state[e]!==t&&this.set(e,t),()=>{this.set(e,void 0)}),[e,t])}useSyncedValues(e){Z(()=>{this.update(e)},Object.values(e))}useControlledProp(e,t,n){T.useDebugValue(e);let r=t!==void 0;this.controlledValues.has(e)||(this.controlledValues.set(e,r),!r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})),Z(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n,r])}set(e,t){this.controlledValues.get(e)!==!0&&super.set(e,t)}update(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.update(t)}setState(e){let t={...e};for(let e in t)if(Object.hasOwn(t,e)&&this.controlledValues.get(e)===!0){delete t[e];continue}super.setState({...this.state,...t})}select=(e,t,n,r)=>{let i=this.selectors[e];return i(this.state,t,n,r)};useState=(e,t,n,r)=>{T.useDebugValue(e);let i=this.selectors[e];return fv(this,i,t,n,r)};useContextCallback(e,t){T.useDebugValue(e);let n=X(t??ou);this.context[e]=n}useStateSetter(e){let t=T.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},_v={open:iv(e=>e.open),domReferenceElement:iv(e=>e.domReferenceElement),referenceElement:iv(e=>e.positionReference??e.referenceElement),floatingElement:iv(e=>e.floatingElement),floatingId:iv(e=>e.floatingId)},vv=class extends gv{constructor(e){let{nested:t,noEmit:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Mh(),nested:t,noEmit:n,triggerElements:i},_v)}setOpen=(e,t)=>{if((!e||!this.state.open||sm(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}this.context.onOpenChange?.(e,t)}};function yv(e,t){let n=T.useRef(null);return T.useCallback(r=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null))return n.current=e,t.context.triggerElements.add(e,r),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function bv(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=yv(e,n),o=X(t=>{let i=a(t);return t!==null&&n.select(`open`)&&n.select(`activeTriggerId`)==null&&n.update({activeTriggerId:e,activeTriggerElement:t,...r}),i});return Z(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function xv(e){let t=e.useState(`open`);Z(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function Sv(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Ff(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=X(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Pf({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var Cv=class{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elements.delete(n),this.elements.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(let t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}};function wv(){return new vv({open:!1,floatingElement:null,referenceElement:null,triggerElements:new Cv,floatingId:``,nested:!1,noEmit:!1,onOpenChange:void 0})}function Tv(){return{open:!1,mounted:!1,transitionStatus:`idle`,floatingRootContext:wv(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:cu,inactiveTriggerProps:cu,popupProps:cu}}var Ev={open:iv(e=>e.open),mounted:iv(e=>e.mounted),transitionStatus:iv(e=>e.transitionStatus),floatingRootContext:iv(e=>e.floatingRootContext),preventUnmountingOnClose:iv(e=>e.preventUnmountingOnClose),payload:iv(e=>e.payload),activeTriggerId:iv(e=>e.activeTriggerId),activeTriggerElement:iv(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:iv((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:iv((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:iv((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:iv((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:iv(e=>e.popupProps),popupElement:iv(e=>e.popupElement),positionerElement:iv(e=>e.positionerElement)};function Dv(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=sd(),a=Ih()!=null,o=du(()=>new vv({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new Cv,floatingId:i,nested:a,noEmit:e.noEmit||!1})).current;return Z(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=md(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o.context.noEmit=e.noEmit||!1,o}function Ov(e={}){let{nodeId:t,externalTree:n}=e,r=Dv(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=T.useState(null),c=T.useRef(null),l=Lh(n);Z(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=k_({...e,elements:{...a,...o&&{reference:o}}}),d=T.useCallback(e=>{let t=md(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=T.useState(null),[m,h]=T.useState(null);i.useSyncedValue(`referenceElement`,f),i.useSyncedValue(`domReferenceElement`,md(f)?f:null),i.useSyncedValue(`floatingElement`,m);let g=T.useCallback(e=>{(md(e)||e===null)&&(c.current=e,p(e)),(md(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!md(e))&&u.refs.setReference(e)},[u.refs,p]),_=T.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),v=T.useMemo(()=>({...u.refs,setReference:g,setFloating:_,setPositionReference:d,domReference:c}),[u.refs,g,_,d]),y=T.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),b=i.useState(`open`),x=i.useState(`floatingId`),S=T.useMemo(()=>({...u,dataRef:i.context.dataRef,open:b,onOpenChange:i.setOpen,events:i.context.events,floatingId:x,refs:v,elements:y,nodeId:t,rootStore:i}),[u,v,y,t,i,b,x]);return Z(()=>{i.context.dataRef.current.floatingContext=S;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=S)}),T.useMemo(()=>({...u,context:S,refs:v,elements:y,rootStore:i}),[u,v,y,S,i])}function kv(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=e,a=sd(),o=Ih()!=null,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(r?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=du(()=>new vv({open:s,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:i,floatingId:a,nested:o,noEmit:n})).current;return Z(()=>{let e={open:s,floatingId:a,referenceElement:c,floatingElement:l};md(c)&&(e.domReferenceElement=c),d.update(e)},[s,a,c,l,d]),d.context.onOpenChange=i,d.context.nested=o,d.context.noEmit=n,d}var Av=Np&&jp;function jv(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,visibleOnly:o=!0}=t,s=T.useRef(!1),c=wp(),l=T.useRef(!0);T.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=dd(e);function r(){!n.select(`open`)&&hd(e)&&e===Wp(Yp(e))&&(s.current=!0)}function i(){l.current=!0}function o(){l.current=!1}return t.addEventListener(`blur`,r),Av&&(t.addEventListener(`keydown`,i,!0),t.addEventListener(`pointerdown`,o,!0)),()=>{t.removeEventListener(`blur`,r),Av&&(t.removeEventListener(`keydown`,i,!0),t.removeEventListener(`pointerdown`,o,!0))}},[n,a]),T.useEffect(()=>{if(!a)return;function e(e){(e.reason===`trigger-press`||e.reason===`escape-key`)&&(s.current=!0)}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a]);let u=T.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;let t=Kp(e.nativeEvent);if(o&&md(t)){if(Av&&!e.relatedTarget){if(!l.current&&!Xp(t))return}else if(!Qp(t))return}n.setOpen(!0,yf(rf,e.nativeEvent,e.currentTarget))},onBlur(e){s.current=!1;let t=e.relatedTarget,r=e.nativeEvent,a=md(t)&&t.hasAttribute(Vh(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;c.start(0,()=>{let o=n.select(`domReferenceElement`),s=Wp(o?o.ownerDocument:document);!t&&s===o||Gp(i.current.floatingContext?.refs.floating.current,s)||Gp(o,s)||a||n.context.triggerElements.hasElement(e.relatedTarget)||n.setOpen(!1,yf(rf,r))})}}),[i,n,o,c]);return T.useMemo(()=>a?{reference:u,trigger:u}:{},[a,u])}var Mv=Vh(`safe-polygon`),Nv=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${zp}`;function Pv(e){return e?!!e.closest(Nv):!1}function Fv(e){let t=T.useRef(void 0),n=T.useRef(!1),r=T.useRef(void 0),i=T.useRef(!0),a=T.useRef(!1),o=T.useRef(()=>{}),s=T.useRef(!1),c=wp(),l=wp(),u=T.useRef(void 0);return T.useMemo(()=>{let d=e.context.dataRef.current;return d.hoverInteractionState||={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:o,restTimeoutPendingRef:s,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:u},d.hoverInteractionState},[e,t,n,r,i,a,o,s,c,l,u])}var Iv=new Set([`click`,`mousedown`]);function Lv(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:f,performedPointerEventsMutationRef:p,unbindMouseMoveRef:m,restTimeoutPendingRef:h,openChangeTimeout:g,handleCloseOptionsRef:_}=Fv(n),v=Lh(l),y=Ih(),b=X(()=>d.current?!0:o.current.openEvent?Iv.has(o.current.openEvent.type):!1),x=X(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),S=T.useCallback((e,t=!0)=>{let r=Rv(c,u.current);r&&!f.current?g.start(r,()=>n.setOpen(!1,yf(nf,e))):t&&(g.clear(),n.setOpen(!1,yf(nf,e)))},[c,f,n,u,g]),C=X(()=>{m.current(),f.current=void 0}),w=X(()=>{if(p.current){let e=Yp(i).body;e.style.pointerEvents=``,e.removeAttribute(Mv),p.current=!1}}),E=X(e=>{if(!Pv(Kp(e))){d.current=!1;return}d.current=!0});Z(()=>{r||(u.current=void 0,h.current=!1,d.current=!1,C(),w())},[r,u,h,d,C,w]),T.useEffect(()=>()=>{C()},[C]),T.useEffect(()=>w,[w]),Z(()=>{if(s&&r&&_.current?.blockPointerEvents&&x()&&md(a)&&i){p.current=!0;let e=Yp(i).body;e.setAttribute(Mv,``);let t=a,n=i,r=v?.nodesRef.current.find(e=>e.id===y)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),e.style.pointerEvents=`none`,t.style.pointerEvents=`auto`,n.style.pointerEvents=`auto`,()=>{e.style.pointerEvents=``,t.style.pointerEvents=``,n.style.pointerEvents=``}}},[s,r,a,i,_,x,v,y,p]),T.useEffect(()=>{if(!s)return;function e(e){if(b()||!o.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||(w(),C(),b()||S(e))}function t(e){g.clear(),w(),f.current?.(e),C()}function r(e){b()||S(e,!1)}let a=i;return a&&(a.addEventListener(`mouseleave`,e),a.addEventListener(`mouseenter`,t),a.addEventListener(`mouseleave`,r),a.addEventListener(`pointerdown`,E,!0)),()=>{a&&(a.removeEventListener(`mouseleave`,e),a.removeEventListener(`mouseenter`,t),a.removeEventListener(`mouseleave`,r),a.removeEventListener(`pointerdown`,E,!0))}})}function Rv(e,t){return t&&!om(t)?0:typeof e==`function`?e():e}function zv(e){return typeof e==`function`?e():e}var Bv={current:null};function Vv(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=Bv,externalTree:f,isActiveTrigger:p=!0}=t,m=Lh(f),{pointerTypeRef:h,interactedInsideRef:g,handlerRef:_,blockMouseMoveRef:v,performedPointerEventsMutationRef:y,unbindMouseMoveRef:b,restTimeoutPendingRef:x,openChangeTimeout:S,restTimeout:C,handleCloseOptionsRef:w}=Fv(n),E=wf(s),D=wf(o),O=wf(l);p&&(w.current=E.current?.__options);let k=X(()=>g.current?!0:r.current.openEvent?[`click`,`mousedown`].includes(r.current.openEvent.type):!1),A=T.useCallback((e,t=!0)=>{let r=Gh(D.current,`close`,h.current);r&&!_.current?S.start(r,()=>n.setOpen(!1,yf(nf,e))):t&&(S.clear(),n.setOpen(!1,yf(nf,e)))},[D,_,n,h,S]),j=X(()=>{b.current(),_.current=void 0}),M=X(()=>{if(y.current){let e=Yp(n.select(`domReferenceElement`)).body;e.style.pointerEvents=``,e.removeAttribute(Mv),y.current=!1}});T.useEffect(()=>{if(!a)return;function e(e){e.open||(S.clear(),C.clear(),v.current=!0,x.current=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,S,C,v,x]);let N=X(e=>{if(k()||!r.current.floatingContext)return;let t=n.context.triggerElements;e.relatedTarget&&t.hasElement(e.relatedTarget)||E.current?.({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){M(),j(),k()||A(e)}})(e)});return T.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!md(e))return;function t(e){if(S.clear(),v.current=!1,c&&!om(h.current)||zv(O.current)>0&&!Gh(D.current,`open`))return;let t=Gh(D.current,`open`,h.current),r=n.select(`domReferenceElement`),i=n.context.triggerElements,a=(i.hasElement(e.target)||i.hasMatchingElement(t=>Gp(t,e.target)))&&(!r||!Gp(r,e.target)),o=e.currentTarget??null;t?S.start(t,()=>{n.select(`open`)||n.setOpen(!0,yf(nf,e,o))}):(!n.select(`open`)||a)&&n.setOpen(!0,yf(nf,e,o))}function i(e){if(k()){M();return}b.current();let t=Yp(n.select(`domReferenceElement`));C.clear(),x.current=!1;let i=n.context.triggerElements;if(!(e.relatedTarget&&i.hasElement(e.relatedTarget))){if(E.current&&r.current.floatingContext){n.select(`open`)||S.clear(),_.current=E.current({...r.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){M(),j(),k()||A(e,!0)}});let i=_.current;i(e),t.addEventListener(`mousemove`,i),b.current=()=>{t.removeEventListener(`mousemove`,i)};return}(h.current!==`touch`||!Gp(n.select(`floatingElement`),e.relatedTarget))&&A(e)}}function o(e){N(e)}return n.select(`open`)&&e.addEventListener(`mouseleave`,o),u&&e.addEventListener(`mousemove`,t,{once:!0}),e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,i),()=>{e.removeEventListener(`mouseleave`,o),u&&e.removeEventListener(`mousemove`,t),e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,i)}},[j,M,v,r,D,A,n,a,E,N,p,k,c,u,h,O,C,x,S,d,m,b,_]),T.useMemo(()=>{function e(e){h.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.context.triggerElements,o=n.select(`open`),s=(a.hasElement(e.target)||a.hasMatchingElement(t=>Gp(t,e.target)))&&(!i||!Gp(i,e.target));if(c&&!om(h.current)||o&&!s||zv(O.current)===0||!s&&x.current&&e.movementX**2+e.movementY**2<2)return;C.clear();function l(){!v.current&&(!o||s)&&n.setOpen(!0,yf(nf,t,r))}h.current===`touch`?Kd.flushSync(()=>{l()}):s&&o?l():(x.current=!0,C.start(zv(O.current),l))}}},[v,c,n,h,O,C,x])}function Hv(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=T.useCallback(t=>Uv(t,e,`reference`),t),o=T.useCallback(t=>Uv(t,e,`floating`),n),s=T.useCallback(t=>Uv(t,e,`item`),r),c=T.useCallback(t=>Uv(t,e,`trigger`),i);return T.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function Uv(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[Rp]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&Wv(a,s,i,r)}return Wv(a,e,i,r),a}function Wv(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var Gv=`Escape`;function Kv(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function qv(e,t){return Kv(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Jv(e,t,n){return Kv(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Yv(e,t,n){return Kv(t,n?e===Bp:e===Vp,e===Up)}function Xv(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Gv:Kv(t,n?e===Vp:e===Bp,e===Hp)}function Zv(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:b=void 0,orientation:x=`vertical`,parentOrientation:S,cols:C=1,scrollItemIntoView:w=!0,itemSizes:E,dense:D=!1,id:O,resetOnPointerLeave:k=!0,externalTree:A}=t,j=wf($p(i)),M=Ih(),N=Lh(A);Z(()=>{o.current.orientation=x},[o,x]);let P=Zp(a),F=T.useRef(_),I=T.useRef(d??-1),L=T.useRef(null),R=T.useRef(!0),z=X(e=>{l(I.current===-1?null:I.current,e)}),B=T.useRef(z),ee=T.useRef(!!i),V=T.useRef(r),H=T.useRef(!1),te=T.useRef(!1),U=wf(b),W=wf(r),ne=wf(w),re=wf(d),ie=wf(k),ae=X(()=>{function e(e){g?N?.events.emit(`virtualfocus`,e):eg(e,{sync:H.current,preventScroll:!0})}let t=s.current[I.current],n=te.current;t&&e(t),(H.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[I.current]||t;if(!r)return;t||e(r);let i=ne.current;i&&se&&(n||!R.current)&&r.scrollIntoView?.(typeof i==`boolean`?{block:`nearest`,inline:`nearest`}:i)})});Z(()=>{u&&(r&&i?(I.current=d??-1,F.current&&d!=null&&(te.current=!0,z())):ee.current&&(I.current=-1,B.current()))},[u,r,i,d,z]),Z(()=>{if(u){if(!r){H.current=!1;return}if(i)if(c==null){if(H.current=!1,re.current!=null)return;if(ee.current&&(I.current=-1,ae()),(!V.current||!ee.current)&&F.current&&(L.current!=null||F.current===!0&&L.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(I.current=L.current==null||Jv(L.current,x,h)||m?Rm(s):zm(s),L.current=null,z())};t()}}else Lm(s,c)||(I.current=c,ae(),te.current=!1)}},[u,r,i,c,re,m,s,x,h,z,ae,U]),Z(()=>{if(!u||i||!N||g||!ee.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=Wp(Yp(i)),r=e.some(e=>e.context&&Gp(e.context.elements.floating,n));t&&!r&&R.current&&t.focus({preventScroll:!0})},[u,i,N,M,g]),Z(()=>{B.current=z,V.current=r,ee.current=!!i}),Z(()=>{r||(L.current=null,F.current=_)},[r,_]);let oe=c!=null,se=T.useMemo(()=>{function e(e){if(!W.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&I.current!==t&&(I.current=t,z(e))}return{onFocus(t){H.current=!0,e(t)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(t){H.current=!0,te.current=!1,v&&e(t)},onPointerLeave(e){if(!W.current||!R.current||e.pointerType===`touch`)return;H.current=!0;let t=e.relatedTarget;!v||s.current.includes(t)||ie.current&&(I.current=-1,z(e),g||j.current?.focus({preventScroll:!0}))}}},[W,j,v,s,z,ie,g]),ce=T.useCallback(()=>S??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation,[M,N,S]),le=X(e=>{if(R.current=!1,H.current=!0,e.which===229||!W.current&&e.currentTarget===j.current)return;if(m&&Xv(e.key,x,h,C)){qv(e.key,ce())||nm(e),n.setOpen(!1,yf(ff,e.nativeEvent)),hd(a)&&(g?N?.events.emit(`virtualfocus`,a):a.focus());return}let t=I.current,i=Rm(s,b),o=zm(s,b);if(P||(e.key===`Home`&&(nm(e),I.current=i,z(e)),e.key===`End`&&(nm(e),I.current=o,z(e))),C>1){let t=E||Array.from({length:s.current.length},()=>({width:1,height:1})),n=Hm(t,C,D),r=n.findIndex(e=>e!=null&&!Gm(s,e,b)),a=n.reduce((e,t,n)=>t!=null&&!Gm(s,t,b)?n:e,-1),c=n[Vm({current:n.map(e=>e==null?null:s.current[e])},{event:e,orientation:x,loopFocus:p,rtl:h,cols:C,disabledIndices:Wm([...(typeof b==`function`?null:b)||s.current.map((e,t)=>Gm(s,t,b)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:Um(I.current>o?i:I.current,t,n,C,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(I.current=c,z(e)),x===`both`)return}if(qv(e.key,x)){if(nm(e),r&&!g&&Wp(e.currentTarget.ownerDocument)===e.currentTarget){I.current=Jv(e.key,x,h)?i:o,z(e);return}Jv(e.key,x,h)?p?t>=o?f&&t!==s.current.length?I.current=-1:(H.current=!1,I.current=i):I.current=Bm(s,{startingIndex:t,disabledIndices:b}):I.current=Math.min(o,Bm(s,{startingIndex:t,disabledIndices:b})):p?t<=i?f&&t!==-1?I.current=s.current.length:(H.current=!1,I.current=o):I.current=Bm(s,{startingIndex:t,decrement:!0,disabledIndices:b}):I.current=Math.max(i,Bm(s,{startingIndex:t,decrement:!0,disabledIndices:b})),Lm(s,I.current)&&(I.current=-1),z(e)}}),ue=T.useMemo(()=>g&&r&&oe&&{"aria-activedescendant":`${O}-${c}`},[g,r,oe,O,c]),de=T.useMemo(()=>({"aria-orientation":x===`both`?void 0:x,...P?{}:ue,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=Kp(e.nativeEvent);if(t&&!Gp(j.current,t))return;nm(e),n.setOpen(!1,yf(uf,e.nativeEvent)),hd(a)&&a.focus();return}le(e)},onPointerMove(){R.current=!0}}),[ue,le,j,x,P,n,r,g,a]),fe=T.useMemo(()=>{function e(e){_===`auto`&&im(e.nativeEvent)&&(F.current=!g)}function t(e){F.current=_,_===`auto`&&am(e.nativeEvent)&&(F.current=!0)}return{onKeyDown(e){let t=n.select(`open`);R.current=!1;let r=e.key.startsWith(`Arrow`),i=Yv(e.key,ce(),h),a=qv(e.key,x),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return le(e);if(!(!t&&!y&&r)){if(o){let t=qv(e.key,ce());L.current=m&&t?null:e.key}if(m){i&&(nm(e),t?(I.current=Rm(s,U.current),z(e)):n.setOpen(!0,yf(ff,e.nativeEvent,e.currentTarget)));return}a&&(re.current!=null&&(I.current=re.current),nm(e),!t&&y?n.setOpen(!0,yf(ff,e.nativeEvent,e.currentTarget)):le(e),t&&z(e))}},onFocus(e){n.select(`open`)&&!g&&(I.current=-1,z(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[le,U,_,s,m,z,n,y,x,ce,h,re,g]),pe=T.useMemo(()=>({...ue,...fe}),[ue,fe]);return T.useMemo(()=>u?{reference:pe,floating:de,item:se,trigger:fe}:{},[u,pe,de,fe,se])}var Qv=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function $v(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{enabled:s=!0,role:c=`dialog`}=t,l=sd(),u=a?.id||l,d=T.useMemo(()=>$p(o)?.id||i,[o,i]),f=Qv.get(c)??c,p=Ih()!=null,m=T.useMemo(()=>f===`tooltip`||c===`label`?cu:{"aria-haspopup":f===`alertdialog`?`dialog`:f,"aria-expanded":`false`,...f===`listbox`&&{role:`combobox`},...f===`menu`&&p&&{role:`menuitem`},...c===`select`&&{"aria-autocomplete":`none`},...c===`combobox`&&{"aria-autocomplete":`list`}},[f,p,c]),h=T.useMemo(()=>f===`tooltip`||c===`label`?{[`aria-${c===`label`?`labelledby`:`describedby`}`]:r?d:void 0}:{...m,"aria-expanded":r?`true`:`false`,"aria-controls":r?d:void 0,...f===`menu`&&{id:u}},[f,d,r,u,c,m]),g=T.useMemo(()=>{let e={id:d,...f&&{role:f}};return f===`tooltip`||c===`label`?e:{...e,...f===`menu`&&{"aria-labelledby":u}}},[f,d,u,c]),_=T.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${d}-fui-option`}};switch(c){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[d,c]);return T.useMemo(()=>s?{reference:h,floating:g,item:_,trigger:m}:{},[s,h,g,m,_])}function ey(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.context.dataRef,{listRef:a,activeIndex:o,onMatch:s,onTypingChange:c,enabled:l=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:f=su,selectedIndex:p=null}=t,m=wp(),h=T.useRef(``),g=T.useRef(p??o??-1),_=T.useRef(null);Z(()=>{r&&(m.clear(),_.current=null,h.current=``)},[r,m]),Z(()=>{r&&h.current===``&&(g.current=p??o??-1)},[r,p,o]);let v=X(e=>{e?i.current.typing||(i.current.typing=e,c?.(e)):i.current.typing&&(i.current.typing=e,c?.(e))}),y=X(e=>{function t(e,t,n){let r=u?u(t,n):t.find(e=>e?.toLocaleLowerCase().indexOf(n.toLocaleLowerCase())===0);return r?e.indexOf(r):-1}let n=a.current;if(h.current.length>0&&h.current[0]!==` `&&(t(n,n,h.current)===-1?v(!1):e.key===` `&&nm(e)),n==null||f.includes(e.key)||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;r&&e.key!==` `&&(nm(e),v(!0)),n.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(d,()=>{h.current=``,g.current=_.current,v(!1)});let i=g.current,o=t(n,[...n.slice((i||0)+1),...n.slice(0,(i||0)+1)],h.current);o===-1?e.key!==` `&&(h.current=``,v(!1)):(s?.(o),_.current=o)}),b=T.useMemo(()=>({onKeyDown:y}),[y]),x=T.useMemo(()=>({onKeyDown:y,onKeyUp(e){e.key===` `&&v(!1)}}),[y,v]);return T.useMemo(()=>l?{reference:b,floating:x}:{},[l,b,x])}function ty(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function ny(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function ry(e={}){let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i=new Cp,a=!1,o=null,s=null,c=typeof performance<`u`?performance.now():0;function l(e,t){let n=performance.now(),r=n-c;if(o===null||s===null||r===0)return o=e,s=t,c=n,null;let i=e-o,a=t-s,l=Math.sqrt(i*i+a*a)/r;return o=e,s=t,c=n,l}let u=({x:e,y:n,placement:o,elements:s,onClose:c,nodeId:u,tree:d})=>function(f){function p(){i.clear(),c()}if(i.clear(),!s.domReference||!s.floating||o==null||e==null||n==null)return;let{clientX:m,clientY:h}=f,g=[m,h],_=Kp(f),v=f.type===`mouseleave`,y=Gp(s.floating,_),b=Gp(s.domReference,_),x=s.domReference.getBoundingClientRect(),S=s.floating.getBoundingClientRect(),C=o.split(`-`)[0],w=e>S.right-S.width/2,T=n>S.bottom-S.height/2,E=ny(g,x),D=S.width>x.width,O=S.height>x.height,k=(D?x:S).left,A=(D?x:S).right,j=(O?x:S).top,M=(O?x:S).bottom;if(y&&(a=!0,!v))return;if(b&&(a=!1),b&&!v){a=!0;return}if(v&&md(f.relatedTarget)&&Gp(s.floating,f.relatedTarget)||d&&em(d.nodesRef.current,u).some(({context:e})=>e?.open))return;if(C===`top`&&n>=x.bottom-1||C===`bottom`&&n<=x.top+1||C===`left`&&e>=x.right-1||C===`right`&&e<=x.left+1)return p();let N=[];switch(C){case`top`:N=[[k,x.top+1],[k,S.bottom-1],[A,S.bottom-1],[A,x.top+1]];break;case`bottom`:N=[[k,S.top+1],[k,x.bottom-1],[A,x.bottom-1],[A,S.top+1]];break;case`left`:N=[[S.right-1,M],[S.right-1,j],[x.left+1,j],[x.left+1,M]];break;case`right`:N=[[x.right-1,M],[x.right-1,j],[S.left+1,j],[S.left+1,M]];break;default:}function P([e,n]){switch(C){case`top`:return[[D?e+t/2:w?e+t*4:e-t*4,n+t+1],[D?e-t/2:w?e+t*4:e-t*4,n+t+1],[S.left,w||D?S.bottom-t:S.top],[S.right,w?D?S.bottom-t:S.top:S.bottom-t]];case`bottom`:return[[D?e+t/2:w?e+t*4:e-t*4,n-t],[D?e-t/2:w?e+t*4:e-t*4,n-t],[S.left,w||D?S.top+t:S.bottom],[S.right,w?D?S.top+t:S.bottom:S.top+t]];case`left`:{let r=[e+t+1,O?n+t/2:T?n+t*4:n-t*4],i=[e+t+1,O?n-t/2:T?n+t*4:n-t*4];return[[T||O?S.right-t:S.left,S.top],[T?O?S.right-t:S.left:S.right-t,S.bottom],r,i]}case`right`:return[[e-t,O?n+t/2:T?n+t*4:n-t*4],[e-t,O?n-t/2:T?n+t*4:n-t*4],[T||O?S.left+t:S.right,S.top],[T?O?S.left+t:S.right:S.left+t,S.bottom]];default:return[]}}if(!ty([m,h],N)){if(a&&!E)return p();if(!v&&r){let e=l(f.clientX,f.clientY);if(e!==null&&e<.1)return p()}ty([m,h],P([e,n]))?!a&&r&&i.start(40,p):p()}};return u.__options={blockPointerEvents:n},u}var iy=T.createContext(void 0);function ay(e){let t=T.useContext(iy);if(t===void 0&&!e)throw Error(Ou(69));return t}var oy=`ArrowUp`,sy=`ArrowDown`,cy=`ArrowLeft`,ly=`ArrowRight`,uy=`Home`,dy=new Set([cy,ly]),fy=new Set([oy,sy]);[...new Set([...dy,...fy])];var py=new Set([oy,sy,cy,ly,uy,`End`]);function my(e){return e===`starting`?Ju:cu}var hy={...np,...zf},gy=T.forwardRef(function(e,t){let{render:n,className:r,finalFocus:i,...a}=e,{store:o}=Kf(),{side:s,align:c}=Wf(),l=ay(!0)!=null,u=o.useState(`open`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`mounted`),m=o.useState(`instantType`),h=o.useState(`activeTriggerElement`),g=o.useState(`parent`),_=o.useState(`lastOpenChangeReason`),v=o.useState(`rootId`),y=o.useState(`floatingRootContext`),b=o.useState(`floatingTreeRoot`),x=o.useState(`closeDelay`),S=o.useState(`activeTriggerElement`);Pf({open:u,ref:o.context.popupRef,onComplete(){u&&o.context.onOpenChangeComplete?.(!0)}}),T.useEffect(()=>{function e(e){o.setOpen(!1,yf(e.reason,e.domEvent))}return b.events.on(`close`,e),()=>{b.events.off(`close`,e)}},[b.events,o]);let C=o.useState(`hoverEnabled`),w=o.useState(`disabled`);Lv(y,{enabled:C&&!w&&g.type!==`context-menu`&&g.type!==`menubar`,closeDelay:x});let E=$u(`div`,e,{state:T.useMemo(()=>({transitionStatus:d,side:s,align:c,open:u,nested:g.type===`menu`,instant:m}),[d,s,c,u,g.type,m]),ref:[t,o.context.popupRef],stateAttributesMapping:hy,props:[f,{onKeyDown(e){l&&py.has(e.key)&&e.stopPropagation()}},my(d),a,{"data-rootownerid":v}]}),D=g.type===void 0||g.type===`context-menu`;return(h||g.type===`menubar`&&_!==`outside-press`)&&(D=!0),(0,J.jsx)(wg,{context:y,modal:!1,disabled:!p,returnFocus:i===void 0?D:i,initialFocus:g.type!==`menu`,restoreFocus:!0,externalTree:g.type===`menubar`?void 0:b,previousFocusableElement:S,nextFocusableElement:g.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:g.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:E})}),_y=T.createContext(void 0);function vy(){let e=T.useContext(_y);if(e===void 0)throw Error(Ou(32));return e}var yy=T.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Kf();return i.useState(`mounted`)||n?(0,J.jsx)(_y.Provider,{value:n,children:(0,J.jsx)(mg,{ref:t,...r})}):null});function by(e){return Au(19)?e:e?`true`:void 0}var xy=T.createContext(void 0);function Sy(){return T.useContext(xy)?.direction??`ltr`}var Cy=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=gm(e,t)||{};if(l==null)return{};let f=Pm(u),p={x:n,y:r},m=Sm(i),h=bm(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=hm(k,j,A),N=!c.arrow&&vm(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),wy=(e,t)=>({...Cy(e),options:[e,t]}),Ty={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await F_().fn(e)).data?.referenceHidden||a}}}},Ey={sideX:`left`,sideY:`top`},Dy={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=dd(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Ey};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Zh(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=_m(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Ey.sideX,g=f===`top`?`bottom`:Ey.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Oy(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function ky(e,t,n){let{rects:r,placement:i}=e;return{side:Oy(t,_m(i),n),align:vm(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ay(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:b}=e,[x,S]=T.useState(null);!m&&x!==null&&S(null);let C=h.side||`flip`,w=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=X(D),k=D?O:t,A=wf(t),j=Sy()===`rtl`,M=x||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":j?`left`:`right`,"inline-start":j?`right`:`left`}[r],N=a===`center`?M:`${M}-${a}`,P=c,F=+(r===`bottom`),I=+(r===`top`),L=+(r===`right`),R=+(r===`left`);typeof P==`number`?P={top:P+F,right:P+R,bottom:P+I,left:P+L}:P&&={top:(P.top||0)+F,right:(P.right||0)+R,bottom:(P.bottom||0)+I,left:(P.left||0)+L};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:P},B=T.useRef(null),ee=wf(i),V=wf(o),H=[A_(e=>{let t=ky(e,r,j),n=typeof ee.current==`function`?ee.current(t):ee.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,j,r])],te=w===`none`&&C!==`shift`,U=!te&&(l||g||C===`shift`),W=C===`none`?null:N_({...z,padding:{top:P.top+1,right:P.right+1,bottom:P.bottom+1,left:P.left+1},mainAxis:!g&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:E}),ne=te?null:j_(e=>{let t=Zh(e.elements.floating).documentElement;return{...z,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:w!==`none`,crossAxis:U,limiter:l||g?void 0:M_(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=xm(_m(e.placement)),i=r===`y`?t:n,a=r===`y`?P.left+P.right:P.top+P.bottom;return{offset:i/2+a/2}})}},[z,l,g,P,w]);C===`shift`||w===`shift`||a===`center`?H.push(ne,W):H.push(W,ne),H.push(P_({...z,apply({elements:{floating:e},rects:{reference:t},availableWidth:n,availableHeight:r}){Object.entries({"--available-width":`${n}px`,"--available-height":`${r}px`,"--anchor-width":`${t.width}px`,"--anchor-height":`${t.height}px`}).forEach(([t,n])=>{e.style.setProperty(t,n)})}}),wy(()=>({element:B.current||document.createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=_m(a),l=xm(c),u=B.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(ky(e,r,j)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,U&&l===`y`&&b?S:x),{}}},Ty,v),Z(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[m,p]);let re=T.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ie,elements:ae,x:oe,y:se,middlewareData:ce,update:le,placement:ue,context:de,isPositioned:fe,floatingStyles:pe}=Ov({rootContext:p,placement:N,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>g_(...e,re),nodeId:_,externalTree:b}),{sideX:me,sideY:he}=ce.adaptiveOrigin||Ey,ge=fe?n:`fixed`,_e=T.useMemo(()=>v?{position:ge,[me]:oe,[he]:se}:{position:ge,...pe},[v,ge,me,oe,he,se,pe]),ve=T.useRef(null);Z(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(jy(t)?t.current:t)||null;n!==ve.current&&(ie.setPositionReference(n),ve.current=n)},[m,ie,k,A]),T.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&jy(e)&&e.current!==ve.current&&(ie.setPositionReference(e.current),ve.current=e.current)},[m,ie,k,A]),T.useEffect(()=>{if(f&&m&&ae.domReference&&ae.floating)return g_(ae.domReference,ae.floating,le,re)},[f,m,ae,le,re]);let ye=_m(ue),be=Oy(r,ye,j),xe=vm(ue)||`center`,Se=!!ce.hide?.referenceHidden;Z(()=>{y&&m&&fe&&S(ye)},[y,m,fe,ye]);let Ce=T.useMemo(()=>({position:`absolute`,top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),we=ce.arrow?.centerOffset!==0;return T.useMemo(()=>({positionerStyles:_e,arrowStyles:Ce,arrowRef:B,arrowUncentered:we,side:be,align:xe,physicalSide:ye,anchorHidden:Se,refs:ie,context:de,isPositioned:fe,update:le}),[_e,Ce,B,we,be,xe,ye,Se,ie,de,fe,le])}function jy(e){return e!=null&&`current`in e}function My(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=X(i),o=T.useRef(0),s=du(Py).current,c=du(Ny).current,[l,u]=T.useState(0),d=T.useRef(l),f=X((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=X(e=>{c.delete(e),d.current+=1,u(d.current)}),m=T.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Fy).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Z(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Z(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Z(()=>()=>{n.current=[]},[n]),Z(()=>()=>{r&&(r.current=[])},[r]);let h=X(e=>(s.add(e),()=>{s.delete(e)}));Z(()=>{s.forEach(e=>e(m))},[s,m]);let g=T.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,J.jsx)(lp.Provider,{value:g,children:t})}function Ny(){return new Map}function Py(){return new Set}function Fy(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var Iy=T.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n?.getBoundingClientRect();i=`polygon(
      0% 0%,
      100% 0%,
      100% 100%,
      0% 100%,
      0% 0%,
      ${e.left}px ${e.top}px,
      ${e.left}px ${e.bottom}px,
      ${e.right}px ${e.bottom}px,
      ${e.right}px ${e.top}px,
      ${e.left}px ${e.top}px
    )`}return(0,J.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Ly=T.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Xu,...g}=e,{store:_}=Kf(),v=vy(),y=ip(!0),b=_.useState(`parent`),x=_.useState(`floatingRootContext`),S=_.useState(`floatingTreeRoot`),C=_.useState(`mounted`),w=_.useState(`open`),E=_.useState(`modal`),D=_.useState(`activeTriggerElement`),O=_.useState(`lastOpenChangeReason`),k=_.useState(`floatingNodeId`),A=_.useState(`floatingParentNodeId`),j=n,M=c,N=l,P=s;b.type===`context-menu`&&(j=n??b.context?.anchor,P??=`start`,!o&&P!==`center`&&(N=e.alignOffset??2,M=e.sideOffset??-5));let F=o,I=P;b.type===`menu`?(F??=`inline-end`,I??=`start`):b.type===`menubar`&&(F??=`bottom`,I??=`start`);let L=b.type===`context-menu`,R=Ay({anchor:j,floatingRootContext:x,positionMethod:y?`fixed`:r,mounted:C,side:F,sideOffset:M,align:I,alignOffset:N,arrowPadding:L?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:k,keepMounted:v,disableAnchorTracking:m,collisionAvoidance:h,shiftCrossAxis:L,externalTree:S}),z=T.useMemo(()=>{let e={};return w||(e.pointerEvents=`none`),{role:`presentation`,hidden:!C,style:{...R.positionerStyles,...e}}},[w,C,R.positionerStyles]);T.useEffect(()=>{function e(e){e.open?(e.parentNodeId===k&&_.set(`hoverEnabled`,!1),e.nodeId!==k&&e.parentNodeId===_.select(`floatingParentNodeId`)&&_.setOpen(!1,yf(gf))):e.parentNodeId===k&&e.reason!==`sibling-open`&&_.set(`hoverEnabled`,!0)}return S.events.on(`menuopenchange`,e),()=>{S.events.off(`menuopenchange`,e)}},[_,S.events,k]),T.useEffect(()=>{if(_.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==_.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;_.setOpen(!1,yf(t))}return S.events.on(`menuopenchange`,e),()=>{S.events.off(`menuopenchange`,e)}},[S.events,_]),T.useEffect(()=>{function e(e){!w||e.nodeId!==_.select(`floatingParentNodeId`)||e.target&&D&&D!==e.target&&_.setOpen(!1,yf(gf))}return S.events.on(`itemhover`,e),()=>{S.events.off(`itemhover`,e)}},[S.events,w,D,_]),T.useEffect(()=>{let e={open:w,nodeId:k,parentNodeId:A,reason:_.select(`lastOpenChangeReason`)};S.events.emit(`menuopenchange`,e)},[S.events,w,_,k,A]);let B=T.useMemo(()=>({open:w,side:R.side,align:R.align,anchorHidden:R.anchorHidden,nested:b.type===`menu`}),[w,R.side,R.align,R.anchorHidden,b.type]),ee=T.useMemo(()=>({side:R.side,align:R.align,arrowRef:R.arrowRef,arrowUncentered:R.arrowUncentered,arrowStyles:R.arrowStyles,nodeId:R.context.nodeId}),[R.side,R.align,R.arrowRef,R.arrowUncentered,R.arrowStyles,R.context.nodeId]),V=$u(`div`,e,{state:B,stateAttributesMapping:np,ref:[t,_.useStateSetter(`positionerElement`)],props:[z,g]}),H=C&&b.type!==`menu`&&(b.type!==`menubar`&&E&&O!==`trigger-hover`||b.type===`menubar`&&b.context.modal),te=null;return b.type===`menubar`?te=b.context.contentElement:b.type===void 0&&(te=D),(0,J.jsxs)(Uf.Provider,{value:ee,children:[H&&(0,J.jsx)(Iy,{ref:b.type===`context-menu`||b.type===`nested-context-menu`?b.context.internalBackdropRef:null,inert:by(!w),cutout:te}),(0,J.jsx)(zh,{id:k,children:(0,J.jsx)(My,{elementsRef:_.context.itemDomElements,labelsRef:_.context.itemLabels,children:V})})]})}),Ry={},zy={},By=``;function Vy(e){if(typeof document>`u`)return!1;let t=Zh(e);return dd(t).innerWidth-t.documentElement.clientWidth>0}function Hy(e){let t=Zh(e),n=t.documentElement,r=t.body,i=_d(n)?n:r,a=i.style.overflow;return i.style.overflow=`hidden`,()=>{i.style.overflow=a}}function Uy(e){let t=Zh(e),n=t.documentElement,r=t.body,i=dd(n),a=0,o=0,s=Af.create(),c=typeof CSS<`u`&&CSS.supports?.(`scrollbar-gutter`,`stable`);if(kp&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let e=i.getComputedStyle(n),t=i.getComputedStyle(r),s=(e.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Ry={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},By=n.style.scrollBehavior,zy={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let l=n.scrollHeight>n.clientHeight,u=n.scrollWidth>n.clientWidth,d=e.overflowY===`scroll`||t.overflowY===`scroll`,f=e.overflowX===`scroll`||t.overflowX===`scroll`,p=Math.max(0,i.innerWidth-n.clientWidth),m=Math.max(0,i.innerHeight-n.clientHeight),h=parseFloat(t.marginTop)+parseFloat(t.marginBottom),g=parseFloat(t.marginLeft)+parseFloat(t.marginRight),_=_d(n)?n:r;if(c){n.style.scrollbarGutter=s,_.style.overflowY=`hidden`,_.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:s,overflowY:`hidden`,overflowX:`hidden`}),(l||d)&&(n.style.overflowY=`scroll`),(u||f)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:h||m?`calc(100dvh - ${h+m}px)`:`100dvh`,width:g||p?`calc(100vw - ${g+p}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Ry),Object.assign(r.style,zy),c||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=By)}function d(){u(),s.request(l)}return l(),i.addEventListener(`resize`,d),()=>{s.cancel(),u(),typeof i.removeEventListener==`function`&&i.removeEventListener(`resize`,d)}}var Wy=new class{lockCount=0;restore=null;timeoutLock=Cp.create();timeoutUnlock=Cp.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Zh(e).documentElement,n=dd(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=ou;return}let r=Ap||!Vy(e);this.restore=r?Hy(e):Uy(e)}};function Gy(e=!0,t=null){Z(()=>{if(e)return Wy.acquire(t)},[e,t])}var Ky=T.createContext(null);function qy(e){let t=T.useContext(Ky);if(t===null&&!e)throw Error(Ou(5));return t}function Jy(e){let t=T.useRef(``),n=T.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:T.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n&&e(n,n.pointerType),e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Yy(e){let[t,n]=T.useState(null),r=X((t,r)=>{e||n(r)}),i=T.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:o}=Jy(r);return T.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:a,onPointerDown:o}}),[t,i,a,o])}var Xy={...Ev,disabled:iv(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:iv(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),allowMouseEnter:iv(e=>e.parent.type===`menu`?e.parent.store.select(`allowMouseEnter`):e.allowMouseEnter),stickIfOpen:iv(e=>e.stickIfOpen),parent:iv(e=>e.parent),rootId:iv(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:iv(e=>e.activeIndex),isActive:iv((e,t)=>e.activeIndex===t),hoverEnabled:iv(e=>e.hoverEnabled),instantType:iv(e=>e.instantType),lastOpenChangeReason:iv(e=>e.openChangeReason),floatingTreeRoot:iv(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:iv(e=>e.floatingNodeId),floatingParentNodeId:iv(e=>e.floatingParentNodeId),itemProps:iv(e=>e.itemProps),closeDelay:iv(e=>e.closeDelay),keyboardEventRelay:iv(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},Zy=class e extends gv{constructor(e){super({...Qy(),...e},{positionerRef:T.createRef(),popupRef:T.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:T.createRef(),beforeContentFocusGuardRef:T.createRef(),onOpenChangeComplete:void 0,triggerElements:new Cv},Xy),this.observe(iv(e=>e.allowMouseEnter),(e,t)=>{this.state.parent.type===`menu`&&e!==t&&this.state.parent.store.set(`allowMouseEnter`,e)}),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){this.unsubscribeParentListener=e.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){return du(()=>t??new e(n)).current}unsubscribeParentListener=null};function Qy(){return{...Tv(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Nh,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:cu,keyboardEventRelay:void 0,closeDelay:0}}var $y=T.createContext(void 0);function eb(){return T.useContext($y)}function tb(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!0,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=ip(!0),_=Kf(!0),v=qy(!0),y=eb(),b=T.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=Zy.useStore(f?.store,{parent:b}),S=x.useState(`floatingTreeRoot`),C=Rh(S),w=Ih();Z(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:C,floatingParentNodeId:w}):_&&x.update({floatingNodeId:C,floatingParentNodeId:w})},[g,_,C,w,x]),x.useControlledProp(`open`,n,a),x.useControlledProp(`activeTriggerId`,p,m),x.useContextCallback(`onOpenChangeComplete`,i);let E=x.useState(`open`),D=x.useState(`activeTriggerElement`),O=x.useState(`positionerElement`),k=x.useState(`hoverEnabled`),A=x.useState(`modal`),j=x.useState(`disabled`),M=x.useState(`lastOpenChangeReason`),N=x.useState(`parent`),P=x.useState(`activeIndex`),F=x.useState(`payload`),I=x.useState(`floatingParentNodeId`),L=T.useRef(null),R=I!=null,z;x.useSyncedValues({disabled:o,modal:N.type===void 0?s:void 0,rootId:sd()});let{openMethod:B,triggerProps:ee,reset:V}=Yy(E);xv(x);let{forceUnmount:H}=Sv(E,x,()=>{x.update({allowMouseEnter:!1,stickIfOpen:!0}),V()}),te=T.useRef(N.type!==`context-menu`),U=wp();T.useEffect(()=>{if(E||(L.current=null),N.type===`context-menu`){if(!E){U.clear(),te.current=!1;return}U.start(500,()=>{te.current=!0})}},[U,E,N.type]),Gy(E&&A&&M!==`trigger-hover`&&B!==`touch`,O),Z(()=>{!E&&!k&&x.set(`hoverEnabled`,!0)},[E,k,x]);let W=T.useRef(!0),ne=wp(),re=X((e,t)=>{let n=t.reason;if(E===e&&t.trigger===D||(t.preventUnmountOnClose=()=>{x.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=D??void 0),r?.(e,t),t.isCanceled))return;let i={open:e,nativeEvent:t.event,reason:t.reason,nested:R};z?.emit(`openchange`,i);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!W.current)return;if(!e&&P!==null){let e=x.context.itemDomElements.current[P];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(W.current=!1,ne.start(300,()=>{W.current=!0})):(W.current=!0,ne.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null);function c(){let r={open:e,openChangeReason:n};L.current=t.event??null;let i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),x.update(r)}n===`trigger-hover`?Kd.flushSync(c):c(),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):o||s?x.set(`instantType`,o?`click`:`dismiss`):x.set(`instantType`,void 0)}),ie=T.useCallback(e=>{let t=yf(e);return t.preventUnmountOnClose=()=>{x.set(`preventUnmountingOnClose`,!0)},t},[x]),ae=T.useCallback(()=>{x.setOpen(!1,ie(vf))},[x,ie]);T.useImperativeHandle(u,()=>({unmount:H,close:ae}),[H,ae]);let oe;N.type===`context-menu`&&(oe=N.context),T.useImperativeHandle(oe?.positionerRef,()=>O,[O]),T.useImperativeHandle(oe?.actionsRef,()=>({setOpen:re}),[re]);let se=kv({popupStore:x,onOpenChange:re});z=se.context.events,T.useEffect(()=>{let e=({open:e,eventDetails:t})=>re(e,t);return z.on(`setOpen`,e),()=>{z?.off(`setOpen`,e)}},[z,re]);let ce=R_(se,{enabled:!j,bubbles:d&&N.type===`menu`,outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`||te.current},externalTree:R?S:void 0}),le=$v(se,{role:`menu`}),ue=Sy(),de=T.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),fe=Zv(se,{enabled:!j,listRef:x.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:ue===`rtl`,disabledIndices:su,onNavigate:de,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:R?S:void 0,focusItemOnHover:h}),pe=T.useCallback(e=>{x.context.typingRef.current=e},[x]),{getReferenceProps:me,getFloatingProps:he,getItemProps:ge,getTriggerProps:_e}=Hv([ce,le,fe,ey(se,{listRef:x.context.itemLabels,activeIndex:P,resetMs:500,onMatch:e=>{E&&e!==P&&x.set(`activeIndex`,e)},onTypingChange:pe})]),ve=T.useMemo(()=>{let e=Lu(me(),{onMouseEnter(){x.set(`hoverEnabled`,!0)},onMouseMove(){x.set(`allowMouseEnter`,!0)}},ee);return delete e.role,e},[me,x,ee]),ye=T.useMemo(()=>{let e=_e();if(!e)return e;let{role:t,"aria-controls":n,...r}=e;return r},[_e]),be=jf(),xe=T.useMemo(()=>he({onMouseEnter(){N.type===`menu`&&be.request(()=>x.set(`hoverEnabled`,!1))},onMouseMove(){x.set(`allowMouseEnter`,!0)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}}),[he,N.type,be,x]),Se=T.useMemo(()=>ge(),[ge]);x.useSyncedValues({floatingRootContext:se,activeTriggerProps:ve,inactiveTriggerProps:ye,popupProps:xe,itemProps:Se});let Ce=T.useMemo(()=>({store:x,parent:b}),[x,b]),we=(0,J.jsx)(Gf.Provider,{value:Ce,children:typeof t==`function`?t({payload:F}):t});return N.type===void 0||N.type===`context-menu`?(0,J.jsx)(Bh,{externalTree:S,children:we}):we}function nb(e){let{closeParentOnEsc:t=!1}=e,n=Kf().store,r=T.useMemo(()=>({parentMenu:n}),[n]);return(0,J.jsx)($y.Provider,{value:r,children:(0,J.jsx)(tb,{...e,closeParentOnEsc:t})})}function rb(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,`::before`),r=window.getComputedStyle(e,`::after`);if(!(n.content!==`none`||r.content!==`none`))return t;let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,s=parseFloat(r.height)||0,c=Math.max(t.width,i,o),l=Math.max(t.height,a,s),u=c-t.width,d=l-t.height;return{left:t.left-u/2,right:t.right+u/2,top:t.top-d/2,bottom:t.bottom+d/2}}function ib(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Fd(),{ref:i,index:a}=fp(e),o=n===a,s=T.useRef(null),c=gu(i,s);return{compositeProps:T.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}function ab(e){let{render:t,className:n,state:r=cu,props:i=su,refs:a=su,metadata:o,stateAttributesMapping:s,tag:c=`div`,...l}=e,{compositeProps:u,compositeRef:d}=ib({metadata:o});return $u(c,e,{state:r,ref:[...a,d],props:[u,...i,l],stateAttributesMapping:s})}function ob(e){if(hd(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!Dd(e))return ob(Ad(e))}function sb(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=T.useRef(!1);return T.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Zh(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:cu,[t,n,r])}var cb=2,lb=T.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,openOnHover:s,delay:c=100,closeDelay:l=0,handle:u,payload:d,...f}=e,p=Kf(!0),m=u?.store??p?.store;if(!m)throw Error(Ou(85));let h=cd(o),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),v=m.useState(`isOpenedByTrigger`,h),y=T.useRef(null),b=db(),x=Fd(!0),S=Lh(),C=T.useMemo(()=>S??new Nh,[S]),{registerTrigger:w,isMountedByThisTrigger:E}=bv(h,y,m,{payload:d,closeDelay:l,parent:b,floatingTreeRoot:C,floatingNodeId:Rh(C),floatingParentNodeId:Ih(),keyboardEventRelay:x?.relayKeyboardEvent}),D=m.useState(`disabled`),O=i||D||b.type===`menubar`&&b.context.disabled,{getButtonProps:k,buttonRef:A}=Ld({disabled:O,native:a});T.useEffect(()=>{!v&&b.type===void 0&&(m.context.allowMouseUpTriggerRef.current=!1)},[m,v,b.type]);let j=T.useRef(null),M=wp(),N=X(e=>{if(!j.current)return;M.clear(),m.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(Gp(j.current,t)||Gp(m.select(`positionerElement`),t)||t===j.current||t!=null&&ob(t)===m.select(`rootId`))return;let n=rb(j.current);e.clientX>=n.left-cb&&e.clientX<=n.right+cb&&e.clientY>=n.top-cb&&e.clientY<=n.bottom+cb||C.events.emit(`close`,{domEvent:e,reason:hf})});T.useEffect(()=>{v&&m.select(`lastOpenChangeReason`)===`trigger-hover`&&Zh(j.current).addEventListener(`mouseup`,N,{once:!0})},[v,N,m]);let P=b.type===`menubar`&&b.context.hasSubmenuOpen,F=Vv(_,{enabled:(s??P??!1)&&!O&&b.type!==`context-menu`&&(b.type!==`menubar`||P&&!E),handleClose:ry({blockPointerEvents:b.type!==`menubar`}),mouseOnly:!0,move:!1,restMs:b.type===void 0?c:void 0,delay:{close:l},triggerElementRef:y,externalTree:C,isActiveTrigger:g}),I=ub(v,m.select(`lastOpenChangeReason`)),L=Tg(_,{enabled:!O&&b.type!==`context-menu`,event:v&&b.type===`menubar`?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0&&I}),R=jv(_,{enabled:!O&&(b.type!==`menubar`&&v||P)}),z=sb({open:v,enabled:b.type===`menubar`,mouseDownAction:`open`}),B=Hv([L,R]),ee=b.type===`menubar`,V=T.useMemo(()=>({disabled:O,open:v}),[O,v]),H=m.useState(`triggerProps`,E),te=[j,t,A,w,y],U=[B.getReferenceProps(),F??cu,H,{"aria-haspopup":`menu`,id:h,onMouseDown:e=>{m.select(`open`)||(M.start(200,()=>{m.context.allowMouseUpTriggerRef.current=!0}),Zh(e.currentTarget).addEventListener(`mouseup`,N,{once:!0}))}},ee?{role:`menuitem`}:{},z,f,k],W=T.useRef(null),ne=X(e=>{Kd.flushSync(()=>{m.setOpen(!1,yf(uf,e.nativeEvent,e.currentTarget))}),Oh(W.current)?.focus()}),re=X(e=>{let t=m.select(`positionerElement`);if(t&&kh(e,t))m.context.beforeContentFocusGuardRef.current?.focus();else{Kd.flushSync(()=>{m.setOpen(!1,yf(uf,e.nativeEvent,e.currentTarget))});let n=Dh(y.current);for(;n!==null&&Gp(t,n)||n?.hasAttribute(`aria-hidden`);){let e=n;if(n=wh(n),n===e)break}n?.focus()}}),ie=$u(`button`,e,{enabled:!ee,stateAttributesMapping:tp,state:V,ref:te,props:U});return ee?(0,J.jsx)(ab,{tag:`button`,render:n,className:r,state:V,refs:te,props:U,stateAttributesMapping:tp}):v?(0,J.jsxs)(T.Fragment,{children:[(0,J.jsx)(Qh,{ref:W,onFocus:ne},`${h}-pre-focus-guard`),(0,J.jsx)(T.Fragment,{children:ie},h),(0,J.jsx)(Qh,{ref:m.context.triggerFocusTargetRef,onFocus:re},`${h}-post-focus-guard`)]}):(0,J.jsx)(T.Fragment,{children:ie},h)});function ub(e,t){let n=wp(),[r,i]=T.useState(!1);return Z(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function db(){let e=ip(!0),t=Kf(!0),n=qy(!0);return T.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var fb=T.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,...a}=e;return $u(`div`,e,{state:T.useMemo(()=>({orientation:i}),[i]),ref:t,props:[{role:`separator`,"aria-orientation":i},a]})}),pb=T.forwardRef(function(e,t){let{render:n,className:r,label:i,id:a,nativeButton:o=!1,openOnHover:s=!0,delay:c=100,closeDelay:l=0,disabled:u=!1,...d}=e,f=fp(),p=Wf(),{store:m}=Kf(),h=cd(a),g=m.useState(`open`),_=m.useState(`floatingRootContext`),v=m.useState(`floatingTreeRoot`),y=yv(h,m),b=T.useCallback(e=>{let t=y(e);return e!==null&&m.select(`open`)&&m.select(`activeTriggerId`)==null&&m.update({activeTriggerId:h,activeTriggerElement:e,closeDelay:l}),t},[y,l,m,h]),x=T.useRef(null),S=T.useCallback(e=>{x.current=e,m.set(`activeTriggerElement`,e)},[m]),C=eb();if(!C?.parentMenu)throw Error(Ou(37));m.useSyncedValue(`closeDelay`,l);let w=C.parentMenu,E=w.useState(`itemProps`),D=w.useState(`isActive`,f.index),O=T.useMemo(()=>({type:`submenu-trigger`,setActive:()=>w.set(`activeIndex`,f.index)}),[w,f.index]),k=m.useState(`disabled`),A=u||k,{getItemProps:j,itemRef:M}=cp({closeOnClick:!1,disabled:A,highlighted:D,id:h,store:m,nativeButton:o,itemMetadata:O,nodeId:p?.nodeId}),N=m.useState(`hoverEnabled`),P=m.useState(`allowMouseEnter`),F=Vv(_,{enabled:N&&s&&!A,handleClose:ry({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:P?c:void 0,delay:{open:P?c:10**10,close:l},triggerElementRef:x,externalTree:v}),I=Hv([Tg(_,{enabled:!A,event:`mousedown`,toggle:!s,ignoreMouse:s,stickIfOpen:!1})]),L=m.useState(`triggerProps`,!0);return delete L.id,$u(`div`,e,{state:T.useMemo(()=>({disabled:A,highlighted:D,open:g}),[A,D,g]),stateAttributesMapping:ep,props:[I.getReferenceProps(),F,L,E,{tabIndex:g||D?0:-1,onBlur(){D&&w.set(`activeIndex`,null)}},d,j],ref:[t,f.ref,M,b,S]})}),mb=T.createContext(void 0);function hb(){let e=T.useContext(mb);if(e===void 0)throw Error(Ou(53));return e}var gb=function(e){return e.scrollAreaCornerHeight=`--scroll-area-corner-height`,e.scrollAreaCornerWidth=`--scroll-area-corner-width`,e}({});function _b(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=n===`x`?`Inline`:`Block`;return n===`x`&&t===`margin`?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}var vb=function(e){return e.orientation=`data-orientation`,e.hovering=`data-hovering`,e.scrolling=`data-scrolling`,e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),yb=`base-ui-disable-scrollbar`,bb={className:yb,element:(0,J.jsx)(`style`,{href:yb,precedence:`base-ui:low`,children:`.${yb}{scrollbar-width:none}.${yb}::-webkit-scrollbar{display:none}`})},xb=function(e){return e.hasOverflowX=`data-has-overflow-x`,e.hasOverflowY=`data-has-overflow-y`,e.overflowXStart=`data-overflow-x-start`,e.overflowXEnd=`data-overflow-x-end`,e.overflowYStart=`data-overflow-y-start`,e.overflowYEnd=`data-overflow-y-end`,e}({}),Sb={hasOverflowX:e=>e?{[xb.hasOverflowX]:``}:null,hasOverflowY:e=>e?{[xb.hasOverflowY]:``}:null,overflowXStart:e=>e?{[xb.overflowXStart]:``}:null,overflowXEnd:e=>e?{[xb.overflowXEnd]:``}:null,overflowYStart:e=>e?{[xb.overflowYStart]:``}:null,overflowYEnd:e=>e?{[xb.overflowYEnd]:``}:null,cornerHidden:()=>null},Cb={width:0,height:0},wb={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Tb=T.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,...a}=e,[o,s]=T.useState(!1),[c,l]=T.useState(!1),[u,d]=T.useState(!1),[f,p]=T.useState(Cb),[m,h]=T.useState(Cb),[g,_]=T.useState(!1),[v,y]=T.useState(wb),b=cd(),x=T.useRef(null),S=T.useRef(null),C=T.useRef(null),w=T.useRef(null),E=T.useRef(null),D=T.useRef(null),O=T.useRef(null),k=T.useRef(!1),A=T.useRef(0),j=T.useRef(0),M=T.useRef(0),N=T.useRef(0),P=T.useRef(`vertical`),F=wp(),I=wp(),L=T.useRef({x:0,y:0}),[R,z]=T.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),B=Eb(i),ee=X(e=>{let t=e.x-L.current.x,n=e.y-L.current.y;L.current=e,n!==0&&(d(!0),F.start(500,()=>{d(!1)})),t!==0&&(l(!0),I.start(500,()=>{l(!1)}))}),V=X(e=>{e.button===0&&(k.current=!0,A.current=e.clientY,j.current=e.clientX,P.current=e.currentTarget.getAttribute(vb.orientation),S.current&&(M.current=S.current.scrollTop,N.current=S.current.scrollLeft),E.current&&P.current===`vertical`&&E.current.setPointerCapture(e.pointerId),D.current&&P.current===`horizontal`&&D.current.setPointerCapture(e.pointerId))}),H=X(e=>{if(!k.current)return;let t=e.clientY-A.current,n=e.clientX-j.current;if(S.current){let r=S.current.scrollHeight,i=S.current.clientHeight,a=S.current.scrollWidth,o=S.current.clientWidth;if(E.current&&C.current&&P.current===`vertical`){let n=_b(C.current,`padding`,`y`),a=_b(E.current,`margin`,`y`),o=E.current.offsetHeight,s=t/(C.current.offsetHeight-o-n-a);S.current.scrollTop=M.current+s*(r-i),e.preventDefault(),d(!0),F.start(500,()=>{d(!1)})}if(D.current&&w.current&&P.current===`horizontal`){let t=_b(w.current,`padding`,`x`),r=_b(D.current,`margin`,`x`),i=D.current.offsetWidth,s=n/(w.current.offsetWidth-i-t-r);S.current.scrollLeft=N.current+s*(a-o),e.preventDefault(),l(!0),I.start(500,()=>{l(!1)})}}}),te=X(e=>{k.current=!1,E.current&&P.current===`vertical`&&E.current.releasePointerCapture(e.pointerId),D.current&&P.current===`horizontal`&&D.current.releasePointerCapture(e.pointerId)});function U(e){let t=e.pointerType===`touch`;if(_(t),!t){let t=Gp(x.current,e.target);s(t)}}let W=T.useMemo(()=>({hasOverflowX:!R.scrollbarXHidden,hasOverflowY:!R.scrollbarYHidden,overflowXStart:v.xStart,overflowXEnd:v.xEnd,overflowYStart:v.yStart,overflowYEnd:v.yEnd,cornerHidden:R.cornerHidden}),[R.scrollbarXHidden,R.scrollbarYHidden,R.cornerHidden,v]),ne={role:`presentation`,onPointerEnter:U,onPointerMove:U,onPointerDown({pointerType:e}){_(e===`touch`)},onPointerLeave(){s(!1)},style:{position:`relative`,[gb.scrollAreaCornerHeight]:`${f.height}px`,[gb.scrollAreaCornerWidth]:`${f.width}px`}},re=$u(`div`,e,{state:W,ref:[t,x],props:[ne,a],stateAttributesMapping:Sb}),ie=T.useMemo(()=>({handlePointerDown:V,handlePointerMove:H,handlePointerUp:te,handleScroll:ee,cornerSize:f,setCornerSize:p,thumbSize:m,setThumbSize:h,touchModality:g,cornerRef:O,scrollingX:c,setScrollingX:l,scrollingY:u,setScrollingY:d,hovering:o,setHovering:s,viewportRef:S,rootRef:x,scrollbarYRef:C,scrollbarXRef:w,thumbYRef:E,thumbXRef:D,rootId:b,hiddenState:R,setHiddenState:z,overflowEdges:v,setOverflowEdges:y,viewportState:W,overflowEdgeThreshold:B}),[V,H,te,ee,f,m,g,O,c,l,u,d,o,s,S,x,C,w,E,D,b,R,v,W,B]);return(0,J.jsxs)(mb.Provider,{value:ie,children:[bb.element,re]})});function Eb(e){if(typeof e==`number`){let t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}var Db=T.createContext(void 0);function Ob(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function kb(e,t){if(typeof IntersectionObserver>`u`)return()=>{};let n=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}var Ab=function(e){return e.scrollAreaOverflowXStart=`--scroll-area-overflow-x-start`,e.scrollAreaOverflowXEnd=`--scroll-area-overflow-x-end`,e.scrollAreaOverflowYStart=`--scroll-area-overflow-y-start`,e.scrollAreaOverflowYEnd=`--scroll-area-overflow-y-end`,e}({}),jb=!1;function Mb(){jb||kp||(typeof CSS<`u`&&`registerProperty`in CSS&&[Ab.scrollAreaOverflowXStart,Ab.scrollAreaOverflowXEnd,Ab.scrollAreaOverflowYStart,Ab.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),jb=!0)}var Nb=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{viewportRef:a,scrollbarYRef:o,scrollbarXRef:s,thumbYRef:c,thumbXRef:l,cornerRef:u,setCornerSize:d,setThumbSize:f,rootId:p,setHiddenState:m,hiddenState:h,handleScroll:g,setHovering:_,setOverflowEdges:v,overflowEdges:y,overflowEdgeThreshold:b}=hb(),x=Sy(),S=T.useRef(!0),C=wp(),w=wp();function E(){let e=a.current,t=o.current,n=s.current,r=c.current,i=l.current,p=u.current;if(!e)return;let h=e.scrollHeight,g=e.scrollWidth,_=e.clientHeight,y=e.clientWidth,S=e.scrollTop,C=e.scrollLeft;if(h===0||g===0)return;let w=_>=h,T=y>=g,E=y/g,D=_/h,O=Math.max(0,g-y),k=Math.max(0,h-_),A=0,j=0;T||(A=Ob(x===`rtl`?-C:C,0,O),j=O-A);let M=w?0:Ob(S,0,k),N=w?0:k-M,P=T?0:y,F=w?0:_,I=_b(n,`padding`,`x`),L=_b(t,`padding`,`y`),R=_b(i,`margin`,`x`),z=_b(r,`margin`,`y`),B=P-I-R,ee=F-L-z,V=n?Math.min(n.offsetWidth,B):B,H=t?Math.min(t.offsetHeight,ee):ee,te=Math.max(16,V*E),U=Math.max(16,H*D);if(f(e=>e.height===U&&e.width===te?e:{width:te,height:U}),t&&r){let e=t.offsetHeight-U-L-z,n=h-_,i=n===0?0:S/n,a=Math.min(e,Math.max(0,i*e));r.style.transform=`translate3d(0,${a}px,0)`}if(n&&i){let e=n.offsetWidth-te-I-R,t=g-y,r=t===0?0:C/t,a=x===`rtl`?Ob(r*e,-e,0):Ob(r*e,0,e);i.style.transform=`translate3d(${a}px,0,0)`}let W=Ob(A,0,O),ne=Ob(j,0,O),re=Ob(M,0,k),ie=Ob(N,0,k),ae=[[Ab.scrollAreaOverflowXStart,W],[Ab.scrollAreaOverflowXEnd,ne],[Ab.scrollAreaOverflowYStart,re],[Ab.scrollAreaOverflowYEnd,ie]];for(let[t,n]of ae)e.style.setProperty(t,`${n}px`);if(p){if(T||w)d({width:0,height:0});else if(!T&&!w){let e=t?.offsetWidth||0,r=n?.offsetHeight||0;d({width:e,height:r})}}m(e=>{let t=w||T;return e.scrollbarYHidden===w&&e.scrollbarXHidden===T&&e.cornerHidden===t?e:{scrollbarYHidden:w,scrollbarXHidden:T,cornerHidden:t}});let oe={xStart:!T&&W>b.xStart,xEnd:!T&&ne>b.xEnd,yStart:!w&&re>b.yStart,yEnd:!w&&ie>b.yEnd};v(e=>e.xStart===oe.xStart&&e.xEnd===oe.xEnd&&e.yStart===oe.yStart&&e.yEnd===oe.yEnd?e:oe)}let D=X(()=>{Kd.flushSync(E)});Z(()=>{if(a.current)return Mb(),kb(a.current,D)},[D,a]),Z(()=>{queueMicrotask(D)},[D,h,x]),Z(()=>{a.current?.matches(`:hover`)&&_(!0)},[a,_]),T.useEffect(()=>{let e=a.current;if(typeof ResizeObserver>`u`||!e)return;let t=new ResizeObserver(D);return t.observe(e),w.start(0,()=>{Promise.all(e.getAnimations({subtree:!0}).map(e=>e.finished)).then(D).catch(()=>{})}),()=>{t.disconnect(),w.clear()}},[D,a,w]);function O(){S.current=!1}let k={role:`presentation`,...p&&{"data-id":`${p}-viewport`},...(!h.scrollbarXHidden||!h.scrollbarYHidden)&&{tabIndex:0},className:bb.className,style:{overflow:`scroll`},onScroll(){a.current&&(D(),S.current||g({x:a.current.scrollLeft,y:a.current.scrollTop}),C.start(100,()=>{S.current=!0}))},onWheel:O,onTouchMove:O,onPointerMove:O,onPointerEnter:O,onKeyDown:O},A=T.useMemo(()=>({hasOverflowX:!h.scrollbarXHidden,hasOverflowY:!h.scrollbarYHidden,overflowXStart:y.xStart,overflowXEnd:y.xEnd,overflowYStart:y.yStart,overflowYEnd:y.yEnd,cornerHidden:h.cornerHidden}),[h.scrollbarXHidden,h.scrollbarYHidden,h.cornerHidden,y]),j=$u(`div`,e,{ref:[t,a],state:A,props:[k,i],stateAttributesMapping:Sb}),M=T.useMemo(()=>({computeThumbPosition:D}),[D]);return(0,J.jsx)(Db.Provider,{value:M,children:j})}),Pb=T.createContext(void 0);function Fb(){let e=T.useContext(Pb);if(e===void 0)throw Error(Ou(54));return e}var Ib=function(e){return e.scrollAreaThumbHeight=`--scroll-area-thumb-height`,e.scrollAreaThumbWidth=`--scroll-area-thumb-width`,e}({}),Lb=T.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,...o}=e,{hovering:s,scrollingX:c,scrollingY:l,hiddenState:u,overflowEdges:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,rootId:y,thumbSize:b}=hb(),x=T.useMemo(()=>({hovering:s,scrolling:{horizontal:c,vertical:l}[i],orientation:i,hasOverflowX:!u.scrollbarXHidden,hasOverflowY:!u.scrollbarYHidden,overflowXStart:d.xStart,overflowXEnd:d.xEnd,overflowYStart:d.yStart,overflowYEnd:d.yEnd,cornerHidden:u.cornerHidden}),[s,c,l,i,u,d]),S=Sy();T.useEffect(()=>{let e=m.current,t=i===`vertical`?f.current:p.current;if(!t)return;function n(n){if(!(!e||!t||n.ctrlKey)){if(n.preventDefault(),i===`vertical`){if(e.scrollTop===0&&n.deltaY<0)return}else if(e.scrollLeft===0&&n.deltaX<0)return;if(i===`vertical`){if(e.scrollTop===e.scrollHeight-e.clientHeight&&n.deltaY>0)return}else if(e.scrollLeft===e.scrollWidth-e.clientWidth&&n.deltaX>0)return;i===`vertical`?e.scrollTop+=n.deltaY:e.scrollLeft+=n.deltaX}}return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}},[i,p,f,m]);let C={...y&&{"data-id":`${y}-scrollbar`},onPointerDown(e){if(e.button===0&&e.currentTarget===e.target&&m.current){if(h.current&&f.current&&i===`vertical`){let t=_b(h.current,`margin`,`y`),n=_b(f.current,`padding`,`y`),r=h.current.offsetHeight,i=f.current.getBoundingClientRect(),a=e.clientY-i.top-r/2-n+t/2,o=m.current.scrollHeight,s=m.current.clientHeight,c=a/(f.current.offsetHeight-r-n-t)*(o-s);m.current.scrollTop=c}if(g.current&&p.current&&i===`horizontal`){let t=_b(g.current,`margin`,`x`),n=_b(p.current,`padding`,`x`),r=g.current.offsetWidth,i=p.current.getBoundingClientRect(),a=e.clientX-i.left-r/2-n+t/2,o=m.current.scrollWidth,s=m.current.clientWidth,c=a/(p.current.offsetWidth-r-n-t),l;S===`rtl`?(l=(1-c)*(o-s),m.current.scrollLeft<=0&&(l=-l)):l=c*(o-s),m.current.scrollLeft=l}_(e)}},onPointerUp:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,...i===`vertical`&&{top:0,bottom:`var(${gb.scrollAreaCornerHeight})`,insetInlineEnd:0,[Ib.scrollAreaThumbHeight]:`${b.height}px`},...i===`horizontal`&&{insetInlineStart:0,insetInlineEnd:`var(${gb.scrollAreaCornerWidth})`,bottom:0,[Ib.scrollAreaThumbWidth]:`${b.width}px`}}},w=$u(`div`,e,{ref:[t,i===`vertical`?f:p],state:x,props:[C,o],stateAttributesMapping:Sb}),E=T.useMemo(()=>({orientation:i}),[i]),D=i===`vertical`?u.scrollbarYHidden:u.scrollbarXHidden;return a||!D?(0,J.jsx)(Pb.Provider,{value:E,children:w}):null}),Rb=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{thumbYRef:a,thumbXRef:o,handlePointerDown:s,handlePointerMove:c,handlePointerUp:l,setScrollingX:u,setScrollingY:d}=hb(),{orientation:f}=Fb(),p=T.useMemo(()=>({orientation:f}),[f]);return $u(`div`,e,{ref:[t,f===`vertical`?a:o],state:p,props:[{onPointerDown:s,onPointerMove:c,onPointerUp(e){f===`vertical`&&d(!1),f===`horizontal`&&u(!1),l(e)},style:{...f===`vertical`&&{height:`var(${Ib.scrollAreaThumbHeight})`},...f===`horizontal`&&{width:`var(${Ib.scrollAreaThumbWidth})`}}},i]})}),zb=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{cornerRef:a,cornerSize:o,hiddenState:s}=hb(),c=$u(`div`,e,{ref:[t,a],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},i]});return s.cornerHidden?null:c});function Bb({className:e,children:t,viewportRef:n,viewportClassName:r,...i}){return(0,J.jsxs)(Tb,{"data-slot":`scroll-area`,className:q(`relative`,e),...i,children:[(0,J.jsx)(Nb,{ref:n,"data-slot":`scroll-area-viewport`,className:q(`w-full rounded-[inherit] outline-none`,r??`h-full`),children:t}),(0,J.jsx)(Vb,{}),(0,J.jsx)(zb,{})]})}function Vb({className:e,...t}){return(0,J.jsx)(Lb,{"data-slot":`scroll-area-scrollbar`,orientation:`vertical`,className:q(`flex h-full w-2.5 touch-none select-none border-l border-l-transparent p-px`,e),...t,children:(0,J.jsx)(Rb,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground/70`})})}var Hb=`min-w-[13rem] rounded-md border border-[var(--color-border)] bg-[var(--color-card)] text-[var(--color-card-foreground)] shadow-md outline-none`;function Ub({children:e}){return(0,J.jsx)(Bb,{viewportClassName:`max-h-[var(--available-height)]`,children:(0,J.jsx)(`div`,{className:`p-1`,children:e})})}var Wb=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-[var(--color-accent)] data-[highlighted]:text-[var(--color-accent-foreground)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,Gb=tb,Kb=yp,qb=nb,Jb=`data-[popup-open]:bg-[var(--color-accent)] data-[popup-open]:text-[var(--color-accent-foreground)]`;function Yb({className:e,...t}){return(0,J.jsx)(lb,{className:typeof e==`function`?e:q(Jb,e),...t})}function Xb({className:e,sideOffset:t=6,align:n=`start`,children:r,...i}){return(0,J.jsx)(yy,{children:(0,J.jsx)(Ly,{sideOffset:t,align:n,className:`z-50 outline-none`,children:(0,J.jsx)(gy,{className:q(Hb,e),...i,children:(0,J.jsx)(Ub,{children:r})})})})}function Zb({className:e,...t}){return(0,J.jsx)(xp,{className:q(Wb,e),...t})}function Qb({className:e,children:t,closeOnClick:n=!1,...r}){return(0,J.jsxs)(hp,{className:q(Wb,e),closeOnClick:n,...r,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex h-3.5 w-3.5 shrink-0 items-center justify-center`,children:(0,J.jsx)(gp,{children:(0,J.jsx)(Va,{className:`h-3.5 w-3.5`})})}),t]})}function $b({className:e,children:t,...n}){return(0,J.jsxs)(pb,{className:q(Wb,`data-[popup-open]:bg-[var(--color-accent)]`,e),...n,children:[t,(0,J.jsx)(Ua,{className:`ml-auto h-3.5 w-3.5 shrink-0 opacity-70`})]})}function ex({className:e,children:t,...n}){return(0,J.jsx)(yy,{children:(0,J.jsx)(Ly,{side:`right`,align:`start`,sideOffset:2,className:`z-50 outline-none`,children:(0,J.jsx)(gy,{className:q(Hb,e),...n,children:(0,J.jsx)(Ub,{children:t})})})})}function tx({className:e,...t}){return(0,J.jsx)(fb,{className:q(`-mx-1 my-1 h-px bg-[var(--color-border)]`,e),...t})}function nx({className:e,...t}){return(0,J.jsx)(bp,{className:q(`px-2 py-1.5 text-xs font-semibold text-[var(--color-muted-foreground)]`,e),...t})}var rx=T.createContext(void 0);function ix(e){let t=T.useContext(rx);if(t===void 0&&!e)throw Error(Ou(72));return t}var ax={...Ev,disabled:iv(e=>e.disabled),instantType:iv(e=>e.instantType),isInstantPhase:iv(e=>e.isInstantPhase),trackCursorAxis:iv(e=>e.trackCursorAxis),disableHoverablePopup:iv(e=>e.disableHoverablePopup),lastOpenChangeReason:iv(e=>e.openChangeReason),closeDelay:iv(e=>e.closeDelay)},ox=class e extends gv{constructor(e){super({...sx(),...e},{popupRef:T.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Cv},ax)}setOpen=(e,t)=>{let n=t.reason,r=n===nf,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?Kd.flushSync(o):o()};static useStore(t,n){let r=du(()=>t??new e(n)).current,i=kv({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}};function sx(){return{...Tv(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function cx(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=ox.useStore(l?.store,{open:r??n,activeTriggerId:u===void 0?d:u});p.useControlledProp(`open`,r,n),p.useControlledProp(`activeTriggerId`,u,d),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=p.useState(`activeTriggerId`),g=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});let _=!t&&m;Z(()=>{m&&t&&p.setOpen(!1,yf(_f))},[m,t,p]),p.useSyncedValue(`disabled`,t),xv(p);let{forceUnmount:v,transitionStatus:y}=Sv(_,p),b=p.useState(`isInstantPhase`),x=p.useState(`instantType`),S=p.useState(`lastOpenChangeReason`),C=T.useRef(null);Z(()=>{y===`ending`&&S===`none`||y!==`ending`&&b?(x!==`delay`&&(C.current=x),p.set(`instantType`,`delay`)):C.current!==null&&(p.set(`instantType`,C.current),C.current=null)},[y,b,S,x,p]),Z(()=>{_&&(h??p.set(`payload`,void 0))},[p,h,_]);let w=T.useCallback(()=>{p.setOpen(!1,lx(p,vf))},[p]);T.useImperativeHandle(o,()=>({unmount:v,close:w}),[v,w]);let E=p.useState(`floatingRootContext`),{getReferenceProps:D,getFloatingProps:O,getTriggerProps:k}=Hv([jv(E,{enabled:!t}),R_(E,{enabled:!t,referencePress:!0}),Og(E,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),A=T.useMemo(()=>D(),[D]),j=T.useMemo(()=>k(),[k]),M=T.useMemo(()=>O(),[O]);return p.useSyncedValues({floatingRootContext:E,activeTriggerProps:A,inactiveTriggerProps:j,popupProps:M}),(0,J.jsx)(rx.Provider,{value:p,children:typeof f==`function`?f({payload:g}):f})}function lx(e,t){let n=yf(t);return n.preventUnmountOnClose=()=>{e.set(`preventUnmountingOnClose`,!0)},n}var ux=T.createContext(void 0);function dx(){return T.useContext(ux)}var fx=T.forwardRef(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeDelay:c,id:l,...u}=e,d=ix(!0),f=i?.store??d;if(!f)throw Error(Ou(82));let p=cd(l),m=f.useState(`isTriggerActive`,p),h=f.useState(`floatingRootContext`),g=f.useState(`isOpenedByTrigger`,p),_=T.useRef(null),v=s??600,y=c??0,{registerTrigger:b,isMountedByThisTrigger:x}=bv(p,_,f,{payload:a,closeDelay:y}),S=dx(),{delayRef:C,isInstantPhase:w,hasProvider:E}=Xh(h,{open:g});f.useSyncedValue(`isInstantPhase`,w);let D=f.useState(`disabled`),O=o??D,k=f.useState(`trackCursorAxis`),A=f.useState(`disableHoverablePopup`),j=Vv(h,{enabled:!O,mouseOnly:!0,move:!1,handleClose:!A&&k!==`both`?ry():null,restMs(){let e=S?.delay,t=typeof C.current==`object`?C.current.open:void 0,n=v;return E&&(n=t===0?0:s??e??v),n},delay(){let e=typeof C.current==`object`?C.current.close:void 0,t=y;return c==null&&E&&(t=e),{close:t}},triggerElementRef:_,isActiveTrigger:m}),M=T.useMemo(()=>({open:g}),[g]),N=f.useState(`triggerProps`,x);return $u(`button`,e,{state:M,ref:[t,b,_],props:[j,N,{id:p},u],stateAttributesMapping:ep})}),px=T.createContext(void 0);function mx(){let e=T.useContext(px);if(e===void 0)throw Error(Ou(70));return e}var hx=T.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,...o}=e,{portalNode:s,portalSubtree:c}=pg({container:r,ref:t,componentProps:e,elementProps:o});return!c&&!s?null:(0,J.jsxs)(T.Fragment,{children:[c,s&&Kd.createPortal(n,s)]})}),gx=T.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return ix().useState(`mounted`)||n?(0,J.jsx)(px.Provider,{value:n,children:(0,J.jsx)(hx,{ref:t,...r})}):null}),_x=T.createContext(void 0);function vx(){let e=T.useContext(_x);if(e===void 0)throw Error(Ou(71));return e}var yx=T.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Zu,...g}=e,_=ix(),v=mx(),y=_.useState(`open`),b=_.useState(`mounted`),x=_.useState(`trackCursorAxis`),S=_.useState(`disableHoverablePopup`),C=_.useState(`floatingRootContext`),w=_.useState(`instantType`),E=_.useState(`transitionStatus`),D=Ay({anchor:i,positionMethod:a,floatingRootContext:C,mounted:b,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:Dy}),O=T.useMemo(()=>{let e={};return(!y||x===`both`||S)&&(e.pointerEvents=`none`),{role:`presentation`,hidden:!b,style:{...D.positionerStyles,...e}}},[y,x,S,b,D.positionerStyles]),k=T.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:x===`none`?w:`tracking-cursor`}),[y,D.side,D.align,D.anchorHidden,x,w]),A=T.useMemo(()=>({...k,arrowRef:D.arrowRef,arrowStyles:D.arrowStyles,arrowUncentered:D.arrowUncentered}),[k,D.arrowRef,D.arrowStyles,D.arrowUncentered]),j=$u(`div`,e,{state:k,props:[O,my(E),g],ref:[t,_.useStateSetter(`positionerElement`)],stateAttributesMapping:np});return(0,J.jsx)(_x.Provider,{value:A,children:j})});function bx(e){let t=Od(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=hd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(dm(n)!==a||dm(r)!==o)&&(n=a,r=o),{width:n,height:r}}var xx=typeof ResizeObserver<`u`,Sx=()=>!0;function Cx(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=Sx,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=T.useRef(!0),d=Nf(t,!0,!1),f=jf(),p=T.useRef(null),m=X(o),h=X(s),g=T.useMemo(()=>{let e=c===`top`,t=c===`left`;return l===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:cu},[c,l]);Z(()=>{if(!i||!a()||!xx){u.current=!0,p.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([e,n])=>{t.style.setProperty(e,n)});let e=new ResizeObserver(e=>{let t=e[0];t&&(p.current===null?p.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)}:(p.current.width=Math.ceil(t.borderBoxSize[0].inlineSize),p.current.height=Math.ceil(t.borderBoxSize[0].blockSize)))});e.observe(t),t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`);let r=wx(t,`position`,`static`),o=wx(t,`transform`,`none`),s=wx(t,`scale`,`1`),c=wx(n,`--available-width`,`max-content`),l=wx(n,`--available-height`,`max-content`);if(m?.(),u.current||p.current===null){n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let i=bx(t);return n.style.setProperty(`--positioner-width`,`${i.width}px`),n.style.setProperty(`--positioner-height`,`${i.height}px`),r(),o(),s(),c(),l(),h?.(null,i),u.current=!1,()=>{e.disconnect()}}t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`),n.style.setProperty(`--positioner-width`,`max-content`),n.style.setProperty(`--positioner-height`,`max-content`);let _=bx(t);t.style.setProperty(`--popup-width`,`${p.current.width}px`),t.style.setProperty(`--popup-height`,`${p.current.height}px`),r(),o(),c(),l(),h?.(p.current,_),n.style.setProperty(`--positioner-width`,`${_.width}px`),n.style.setProperty(`--positioner-height`,`${_.height}px`);let v=new AbortController;return f.request(()=>{t.style.setProperty(`--popup-width`,`${_.width}px`),t.style.setProperty(`--popup-height`,`${_.height}px`),d(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},v.signal)}),()=>{e.disconnect(),v.abort(),f.cancel()}},[r,t,n,d,f,a,i,m,h,g])}function wx(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}var Tx={...np,...zf},Ex=T.forwardRef(function(e,t){let{className:n,render:r,...i}=e,a=ix(),{side:o,align:s}=vx(),c=a.useState(`open`),l=a.useState(`mounted`),u=a.useState(`instantType`),d=a.useState(`transitionStatus`),f=a.useState(`popupProps`),p=a.useState(`payload`),m=a.useState(`popupElement`),h=a.useState(`positionerElement`),g=a.useState(`floatingRootContext`),_=Sy();Pf({open:c,ref:a.context.popupRef,onComplete(){c&&a.context.onOpenChangeComplete?.(!0)}});function v(){g.context.events.emit(`measure-layout`)}function y(e,t){g.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}Cx({popupElement:m,positionerElement:h,mounted:l,content:p,enabled:()=>a.context.triggerElements.size>1,onMeasureLayout:v,onMeasureLayoutComplete:y,side:o,direction:_});let b=a.useState(`disabled`),x=a.useState(`closeDelay`);return Lv(g,{enabled:!b,closeDelay:x}),$u(`div`,e,{state:T.useMemo(()=>({open:c,side:o,align:s,instant:u,transitionStatus:d}),[c,o,s,u,d]),ref:[t,a.context.popupRef,a.useStateSetter(`popupElement`)],props:[f,my(d),i],stateAttributesMapping:Tx})}),Dx=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=T.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=T.useMemo(()=>({open:t,close:n}),[t,n]);return(0,J.jsx)(ux.Provider,{value:i,children:(0,J.jsx)(Yh,{delay:a,timeoutMs:r,children:e.children})})},Q=cx;function Ox(e){return(0,J.jsx)(fx,{delay:0,...e})}function kx({className:e,sideOffset:t=6,side:n,align:r,children:i,...a}){return(0,J.jsx)(gx,{children:(0,J.jsx)(yx,{sideOffset:t,...n?{side:n}:{},...r?{align:r}:{},children:(0,J.jsx)(Ex,{role:`tooltip`,className:q(`z-50 rounded-md border border-border bg-card px-2 py-1 text-xs text-card-foreground shadow-md`,e),...a,children:i})})})}function Ax(e){return $u(e.defaultTagName??`div`,e,e)}function jx({className:e,type:t,...n}){return(0,J.jsx)(`input`,{type:t,"data-slot":`input`,className:q(`flex h-9 w-full min-w-0 rounded-md border border-border bg-transparent px-3 py-1 text-sm shadow-sm outline-none transition-colors`,`placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`,`disabled:cursor-not-allowed disabled:opacity-50`,e),...n})}function Mx({className:e,orientation:t=`horizontal`,...n}){return(0,J.jsx)(fb,{orientation:t,"data-slot":`separator`,className:q(`shrink-0 bg-border`,t===`horizontal`?`h-px w-full`:`h-full w-px`,e),...n})}var Nx=T.createContext(void 0);function Px(e){let t=T.useContext(Nx);if(e===!1&&t===void 0)throw Error(Ou(27));return t}var Fx={...np,...zf},Ix=T.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...a}=e,{store:o}=Px(),s=o.useState(`open`),c=o.useState(`nested`),l=o.useState(`mounted`),u=o.useState(`transitionStatus`);return $u(`div`,e,{state:T.useMemo(()=>({open:s,transitionStatus:u}),[s,u]),ref:[o.context.backdropRef,t],stateAttributesMapping:Fx,props:[{role:`presentation`,hidden:!l,style:{userSelect:`none`,WebkitUserSelect:`none`}},a],enabled:i||!c})}),Lx=T.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,...o}=e,{store:s}=Px(),c=s.useState(`open`);function l(e){c&&s.setOpen(!1,yf(sf,e.nativeEvent))}let{getButtonProps:u,buttonRef:d}=Ld({disabled:i,native:a});return $u(`button`,e,{state:T.useMemo(()=>({disabled:i}),[i]),ref:[t,d],props:[{onClick:l},o,u]})}),Rx=T.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=Px(),s=cd(i);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),$u(`p`,e,{ref:t,props:[{id:s},a]})}),zx=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Bx=function(e){return e[e.open=qf.open]=`open`,e[e.closed=qf.closed]=`closed`,e[e.startingStyle=qf.startingStyle]=`startingStyle`,e[e.endingStyle=qf.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Vx=T.createContext(void 0);function Hx(){let e=T.useContext(Vx);if(e===void 0)throw Error(Ou(26));return e}var Ux={...np,...zf,nestedDialogOpen(e){return e?{[Bx.nestedDialogOpen]:``}:null}},Wx=T.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,...o}=e,{store:s}=Px(),c=s.useState(`descriptionElementId`),l=s.useState(`disablePointerDismissal`),u=s.useState(`floatingRootContext`),d=s.useState(`popupProps`),f=s.useState(`modal`),p=s.useState(`mounted`),m=s.useState(`nested`),h=s.useState(`nestedOpenDialogCount`),g=s.useState(`open`),_=s.useState(`openMethod`),v=s.useState(`titleElementId`),y=s.useState(`transitionStatus`),b=s.useState(`role`);Hx(),Pf({open:g,ref:s.context.popupRef,onComplete(){g&&s.context.onOpenChangeComplete?.(!0)}});function x(e){return e!==`touch`||s.context.popupRef.current}let S=i===void 0?x:i,C=h>0,w=$u(`div`,e,{state:T.useMemo(()=>({open:g,nested:m,transitionStatus:y,nestedDialogOpen:C}),[g,m,y,C]),props:[d,{"aria-labelledby":v??void 0,"aria-describedby":c??void 0,role:b,tabIndex:-1,hidden:!p,onKeyDown(e){py.has(e.key)&&e.stopPropagation()},style:{[zx.nestedDialogs]:h}},o],ref:[t,s.context.popupRef,s.useStateSetter(`popupElement`)],stateAttributesMapping:Ux});return(0,J.jsx)(wg,{context:u,openInteractionType:_,disabled:!p,closeOnFocusOut:!l,initialFocus:S,returnFocus:r,modal:f!==!1,restoreFocus:`popup`,children:w})}),Gx=T.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Px(),a=i.useState(`mounted`),o=i.useState(`modal`);return a||n?(0,J.jsx)(Vx.Provider,{value:n,children:(0,J.jsxs)(mg,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(Iy,{ref:i.context.internalBackdropRef,inert:by(!open)}),e.children]})}):null});function Kx(e){let{store:t,parentContext:n,actionsRef:r}=e,i=t.useState(`open`),a=t.useState(`disablePointerDismissal`),o=t.useState(`modal`),s=t.useState(`popupElement`),{openMethod:c,triggerProps:l,reset:u}=Yy(i);xv(t);let{forceUnmount:d}=Sv(i,t,()=>{u()}),f=X(e=>{let n=yf(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=T.useCallback(()=>{t.setOpen(!1,f(vf))},[t,f]);T.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=kv({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,g]=T.useState(0),_=h===0,v=$v(m),y=R_(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=Kp(e);if(_&&!a){let e=n;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||Gp(e,s)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:_});Gy(i&&o===!0,s);let{getReferenceProps:b,getFloatingProps:x,getTriggerProps:S}=Hv([v,y]);t.useContextCallback(`onNestedDialogOpen`,e=>{g(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0)}),T.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,h]);let C=T.useMemo(()=>b(l),[b,l]),w=T.useMemo(()=>S(l),[S,l]),E=T.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:E,floatingRootContext:m,nestedOpenDialogCount:h})}var qx={...Ev,modal:iv(e=>e.modal),nested:iv(e=>e.nested),nestedOpenDialogCount:iv(e=>e.nestedOpenDialogCount),disablePointerDismissal:iv(e=>e.disablePointerDismissal),openMethod:iv(e=>e.openMethod),descriptionElementId:iv(e=>e.descriptionElementId),titleElementId:iv(e=>e.titleElementId),viewportElement:iv(e=>e.viewportElement),role:iv(e=>e.role)},Jx=class extends gv{constructor(e){super(Yx(e),{popupRef:T.createRef(),backdropRef:T.createRef(),internalBackdropRef:T.createRef(),triggerElements:new Cv,onOpenChange:void 0,onOpenChangeComplete:void 0},qx)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function Yx(e={}){return{...Tv(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function Xx(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=Px(!0),p=!!f,m=du(()=>l?.store??new Jx({open:n??r,activeTriggerId:u===void 0?d:u,modal:s,disablePointerDismissal:o,nested:p})).current;m.useControlledProp(`open`,n,r),m.useControlledProp(`activeTriggerId`,u,d),m.useSyncedValues({disablePointerDismissal:o,nested:p,modal:s}),m.useContextCallback(`onOpenChange`,i),m.useContextCallback(`onOpenChangeComplete`,a);let h=m.useState(`payload`);Kx({store:m,actionsRef:c,parentContext:f?.store.context,onOpenChange:i,triggerIdProp:u});let g=T.useMemo(()=>({store:m}),[m]);return(0,J.jsx)(Nx.Provider,{value:g,children:typeof t==`function`?t({payload:h}):t})}var Zx=T.forwardRef(function(e,t){let{render:n,className:r,id:i,...a}=e,{store:o}=Px(),s=cd(i);return o.useSyncedValueWithCleanup(`titleElementId`,s),$u(`h2`,e,{ref:t,props:[{id:s},a]})}),Qx=T.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,...l}=e,u=Px(!0),d=c?.store??u?.store;if(!d)throw Error(Ou(79));let f=cd(o),p=d.useState(`floatingRootContext`),m=d.useState(`isOpenedByTrigger`,f),h=T.useRef(null),{registerTrigger:g,isMountedByThisTrigger:_}=bv(f,h,d,{payload:s}),{getButtonProps:v,buttonRef:y}=Ld({disabled:i,native:a}),b=Hv([Tg(p,{enabled:p!=null})]),x=T.useMemo(()=>({disabled:i,open:m}),[i,m]),S=d.useState(`triggerProps`,_);return $u(`button`,e,{state:x,ref:[y,t,g,h],props:[b.getReferenceProps(),S,{[Yu]:``,id:f},l,v],stateAttributesMapping:ep})});function $x(e){return(0,J.jsx)(Xx,{...e})}function eS({className:e,children:t,side:n=`left`,...r}){return(0,J.jsxs)(Gx,{children:[(0,J.jsx)(Ix,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px]`}),(0,J.jsx)(Wx,{className:q(`fixed inset-y-0 z-50 flex h-full w-3/4 max-w-sm flex-col bg-card text-card-foreground shadow-lg outline-none`,n===`left`?`left-0 border-r border-border`:`right-0 border-l border-border`,e),...r,children:t})]})}function tS({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`sheet-header`,className:q(`flex flex-col gap-1 p-4`,e),...t})}function nS({className:e,...t}){return(0,J.jsx)(Zx,{className:q(`text-sm font-semibold`,e),...t})}function rS({className:e,...t}){return(0,J.jsx)(Rx,{className:q(`text-sm text-muted-foreground`,e),...t})}var iS=768;function aS(){let[e,t]=(0,T.useState)(void 0);return(0,T.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: ${iS-1}px)`),n=()=>t(window.innerWidth<iS);return e.addEventListener(`change`,n),t(window.innerWidth<iS),()=>e.removeEventListener(`change`,n)},[]),!!e}var oS=`sidebar_state`,sS=3600*24*7,cS=`16rem`,lS=`18rem`,uS=`3rem`,dS=`b`,fS=T.createContext(null);function pS(){let e=T.useContext(fS);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function mS({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=aS(),[c,l]=T.useState(!1),[u,d]=T.useState(e),f=t??u,p=T.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${oS}=${t}; path=/; max-age=${sS}`},[n,f]),m=T.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);T.useEffect(()=>{let e=e=>{e.key===dS&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=T.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,J.jsx)(fS.Provider,{value:g,children:(0,J.jsx)(Dx,{delay:0,children:(0,J.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":cS,"--sidebar-width-icon":uS,...i},className:q(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full`,r),...o,children:a})})})}function hS({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a}){let{isMobile:o,state:s,openMobile:c,setOpenMobile:l}=pS();return n===`none`?(0,J.jsx)(`div`,{"data-slot":`sidebar`,className:q(`bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col`,r),...a,children:i}):o?(0,J.jsx)($x,{open:c,onOpenChange:l,children:(0,J.jsxs)(eS,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden`,style:{"--sidebar-width":lS},side:e,children:[(0,J.jsxs)(tS,{className:`sr-only`,children:[(0,J.jsx)(nS,{children:`Sidebar`}),(0,J.jsx)(rS,{children:`Displays the mobile sidebar.`})]}),(0,J.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,J.jsxs)(`div`,{className:`group peer text-sidebar-foreground hidden md:block`,"data-state":s,"data-collapsible":s===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,J.jsx)(`div`,{"data-slot":`sidebar-gap`,className:q(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,J.jsx)(`div`,{"data-slot":`sidebar-container`,className:q(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...a,children:(0,J.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm`,children:i})})]})}function gS({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:q(`flex flex-col gap-2 p-2`,e),...t})}function _S({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:q(`flex flex-col gap-2 p-2`,e),...t})}function vS({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:q(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function yS({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:q(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function bS({className:e,render:t=(0,J.jsx)(`div`,{}),...n}){return Ax({render:t,props:{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:q(`text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0`,e),...n}})}function xS({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:q(`w-full text-sm`,e),...t})}function SS({className:e,...t}){return(0,J.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:q(`flex w-full min-w-0 flex-col gap-1`,e),...t})}function CS({className:e,...t}){return(0,J.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:q(`group/menu-item relative`,e),...t})}var wS=[`#e69875`,`#dbbc7f`,`#a7c080`,`#7fbbb3`,`#d699b6`,`#e67e80`],TS=[{d:`M-160 -166.3 A10 10 0 0 0 -175 -174.9 L-234 -140.9 A10 10 0 0 0 -239 -132.2 L-239 34.1 A10 10 0 0 0 -234 42.7 L-72 136.3 A10 10 0 0 0 -62 136.3 L-21 112.6 A10 10 0 0 0 -21 95.3 L-173 7.5 A10 10 0 0 1 -178 -1.2 L-178 -97 A10 10 0 0 1 -173 -105.7 L-165 -110.3 A10 10 0 0 0 -160 -118.9 Z`,axis:[-160,-148.4,-36.5,121.5]},{d:`M64 -221.7 A10 10 0 0 0 64 -239 L5 -273.1 A10 10 0 0 0 -5 -273.1 L-149 -189.9 A10 10 0 0 0 -154 -181.3 L-154 5.8 A10 10 0 0 0 -149 14.4 L-108 38.1 A10 10 0 0 0 -93 29.4 L-93 -146.1 A10 10 0 0 1 -88 -154.7 L-5 -202.6 A10 10 0 0 1 5 -202.6 L13 -198 A10 10 0 0 0 23 -198 Z`,axis:[48.5,-212.8,-123.5,29.2]},{d:`M224 -55.4 A10 10 0 0 0 239 -64.1 L239 -132.2 A10 10 0 0 0 234 -140.9 L90 -224 A10 10 0 0 0 80 -224 L-82 -130.5 A10 10 0 0 0 -87 -121.8 L-87 -74.5 A10 10 0 0 0 -72 -65.8 L80 -153.6 A10 10 0 0 1 90 -153.6 L173 -105.7 A10 10 0 0 1 178 -97 L178 -87.8 A10 10 0 0 0 183 -79.1 Z`,axis:[208.5,-64.4,-87,-92.4]},{d:`M160 166.3 A10 10 0 0 0 175 174.9 L234 140.9 A10 10 0 0 0 239 132.2 L239 -34.1 A10 10 0 0 0 234 -42.7 L72 -136.3 A10 10 0 0 0 62 -136.3 L21 -112.6 A10 10 0 0 0 21 -95.3 L173 -7.5 A10 10 0 0 1 178 1.2 L178 97 A10 10 0 0 1 173 105.7 L165 110.3 A10 10 0 0 0 160 118.9 Z`,axis:[160,148.4,36.5,-121.5]},{d:`M-64 221.7 A10 10 0 0 0 -64 239 L-5 273.1 A10 10 0 0 0 5 273.1 L149 189.9 A10 10 0 0 0 154 181.3 L154 -5.8 A10 10 0 0 0 149 -14.4 L108 -38.1 A10 10 0 0 0 93 -29.4 L93 146.1 A10 10 0 0 1 88 154.7 L5 202.6 A10 10 0 0 1 -5 202.6 L-13 198 A10 10 0 0 0 -23 198 Z`,axis:[-48.5,212.8,123.5,-29.2]},{d:`M-224 55.4 A10 10 0 0 0 -239 64.1 L-239 132.2 A10 10 0 0 0 -234 140.9 L-90 224 A10 10 0 0 0 -80 224 L82 130.5 A10 10 0 0 0 87 121.8 L87 74.5 A10 10 0 0 0 72 65.8 L-80 153.6 A10 10 0 0 1 -90 153.6 L-173 105.7 A10 10 0 0 1 -178 97 L-178 87.8 A10 10 0 0 0 -183 79.1 Z`,axis:[-208.5,64.4,87,92.4]}];function ES(e){return e?`AI is working for you 🚀`:`AI isn't working for you 💤`}function DS(e){return e?`AI is working for you`:`AI isn't working for you`}function OS(e){return wS[(e%wS.length+wS.length)%wS.length]}function kS(e){return wS.map((t,n)=>OS(e+n)).concat(OS(e)).join(`;`)}function AS({className:e,working:t=!1}){let n=ES(t);return(0,J.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`-289 -326 578 651.9`,className:e,role:`img`,"aria-label":DS(t),children:[(0,J.jsx)(`title`,{children:n}),t&&(0,J.jsx)(`defs`,{children:TS.map(({axis:[e,t,n,r]},i)=>(0,J.jsxs)(`linearGradient`,{id:`hexknot-${i}`,gradientUnits:`userSpaceOnUse`,x1:e,y1:t,x2:n,y2:r,children:[(0,J.jsx)(`stop`,{offset:`0`,stopColor:OS(i),children:(0,J.jsx)(`animate`,{attributeName:`stop-color`,dur:`6s`,repeatCount:`indefinite`,values:kS(i)})}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:OS(i-1),children:(0,J.jsx)(`animate`,{attributeName:`stop-color`,dur:`6s`,repeatCount:`indefinite`,values:kS(i-1)})})]},i))}),TS.map(({d:e},n)=>(0,J.jsx)(`path`,{fill:t?`url(#hexknot-${n})`:`var(--logo-${n+1})`,d:e},n))]})}function jS({working:e,onNavigate:t}){return(0,J.jsxs)(`a`,{href:`/`,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),t())},className:`flex shrink-0 items-center gap-3 rounded-md transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]`,children:[(0,J.jsx)(AS,{className:`h-6 w-auto shrink-0`,working:e}),(0,J.jsx)(`span`,{className:`hidden shrink-0 font-semibold sm:inline`,children:`The Framework`})]})}var MS=`fw.devices`,NS=`fw.local-origin`,PS=`http://127.0.0.1:4200`;function FS(){try{return globalThis.localStorage}catch{return}}function IS(e){let t=e;return!!t&&typeof t.id==`string`&&typeof t.label==`string`&&typeof t.url==`string`&&typeof t.token==`string`}function LS(){try{let e=FS()?.getItem(MS);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(IS):[]}catch{return[]}}function RS(e){FS()?.setItem(MS,JSON.stringify(e)),XS()}function zS(e){let t={id:e.url,label:e.label?.trim()||VS(e.url),url:e.url,token:e.token};return RS([t,...LS().filter(e=>e.id!==t.id)]),t}function BS(e){RS(LS().filter(t=>t.id!==e))}function VS(e){try{return new URL(e).host}catch{return e}}function HS(e){try{let t=new URL(e.trim());return{url:t.origin,token:t.searchParams.get(`token`)??``}}catch{return null}}function US(e){return e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e===`::1`}function WS(e,t){US(t)&&FS()?.setItem(NS,e)}function GS(){return FS()?.getItem(NS)??PS}function KS(){globalThis.location?.assign(GS())}function qS(e,t,n){return US(n)?{label:`Local`,isLocal:!0}:{label:e.find(e=>e.url===t)?.label??n,isLocal:!1}}var JS=null,YS=new Set;function XS(){JS=null;for(let e of YS)e()}function ZS(e){return YS.add(e),()=>YS.delete(e)}function QS(){return JS??=LS()}function $S(){return(0,T.useSyncExternalStore)(ZS,QS,()=>eC)}var eC=[];function tC(e,t,n,r,i=!1){let[a,o]=(0,T.useState)(t),[s,c]=(0,T.useState)(!1),l=(0,T.useRef)(t),u=(0,T.useRef)({live:!1}),d=(0,T.useCallback)((e,t)=>{t().then(t=>{e.live&&(o(t),c(!0))}).catch(()=>{})},[]);return(0,T.useEffect)(()=>{let t={live:!0};if(u.current=t,i||o(l.current),c(!1),!e)return()=>void(t.live=!1);let r=()=>d(t,e);if(r(),n===null)return()=>void(t.live=!1);let a=setInterval(r,n);return()=>{t.live=!1,clearInterval(a)}},r),{value:a,reload:(0,T.useCallback)(()=>{e&&d(u.current,e)},r),loaded:s}}function nC(e,t,n,r=!1){return tC(e,t,null,n,r).value}function rC(e,t,n,r,i=!1){return tC(e,t,n,r,i)}var iC=(...e)=>K(`/server/devices.telefunc.ts`,`checkDevices`,e);iC._key=`/server/devices.telefunc.ts:checkDevices`;var aC=1e4;function oC(e){let t=e.filter(e=>e.token).map(e=>({id:e.id,url:e.url,token:e.token})),n=t.map(e=>`${e.id} ${e.token}`).join(`|`),r=rC((0,T.useMemo)(()=>t.length?()=>iC(t):null,[n]),{},aC,[n]).value;return(0,T.useMemo)(()=>{let e={};for(let[t,n]of Object.entries(r))e[t]=n?`online`:`offline`;return e},[r])}var sC=`fw.pending-draft`;function cC(){try{return globalThis.sessionStorage}catch{return}}function lC(){if(typeof window>`u`)return;let e=new URL(window.location.href),t=e.searchParams.get(`draft`);t!==null&&(cC()?.setItem(sC,t),e.searchParams.delete(`draft`),window.history.replaceState(null,``,e.pathname+e.search+e.hash))}function uC(e){cC()?.setItem(sC,e)}function dC(){let e=cC();if(!e)return null;let t=e.getItem(sC);return t!==null&&e.removeItem(sC),t}function fC(){let e=$S(),t=oC(e);if((0,T.useEffect)(()=>{typeof window>`u`||(lC(),WS(window.location.origin,window.location.hostname))},[]),typeof window>`u`)return null;let n=window.location.origin,{label:r,isLocal:i}=qS(e,n,window.location.hostname),a=i?uo:yo,o=i||t[e.find(e=>e.url===n)?.id??``]===`online`;return(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:i?`hidden items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground sm:inline-flex`:`inline-flex items-center gap-1.5 rounded-md border border-[var(--color-primary)]/40 bg-[var(--color-primary)]/10 px-2 py-1 text-xs text-[var(--color-primary)]`}),children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:q(`h-2 w-2 shrink-0 rounded-full`,o?`bg-success`:`bg-muted-foreground/40`)}),(0,J.jsx)(a,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`max-w-[10rem] truncate`,children:r})]}),(0,J.jsx)(kx,{children:i?`Connected to this machine`:`Connected to ${r} — the agent runs on that device`})]})}var pC=(...e)=>K(`/server/preferences.telefunc.ts`,`onPreferences`,e);pC._key=`/server/preferences.telefunc.ts:onPreferences`;var mC=(...e)=>K(`/server/preferences.telefunc.ts`,`savePreferences`,e);mC._key=`/server/preferences.telefunc.ts:savePreferences`;var hC=(...e)=>K(`/server/preferences.telefunc.ts`,`patchPreferences`,e);hC._key=`/server/preferences.telefunc.ts:patchPreferences`;var gC=(...e)=>K(`/server/preferences.telefunc.ts`,`onProjectPreferences`,e);gC._key=`/server/preferences.telefunc.ts:onProjectPreferences`;var _C=(...e)=>K(`/server/preferences.telefunc.ts`,`saveProjectPreferences`,e);_C._key=`/server/preferences.telefunc.ts:saveProjectPreferences`;var vC=(...e)=>K(`/server/preferences.telefunc.ts`,`patchProjectPreferences`,e);vC._key=`/server/preferences.telefunc.ts:patchProjectPreferences`;var yC=(...e)=>K(`/server/preferences.telefunc.ts`,`onProjectPresets`,e);yC._key=`/server/preferences.telefunc.ts:onProjectPresets`;var bC=(...e)=>K(`/server/preferences.telefunc.ts`,`saveProjectPresets`,e);bC._key=`/server/preferences.telefunc.ts:saveProjectPresets`;var xC=(...e)=>K(`/server/preferences.telefunc.ts`,`onEditors`,e);xC._key=`/server/preferences.telefunc.ts:onEditors`;var SC=(...e)=>K(`/server/preferences.telefunc.ts`,`onNotifyChannels`,e);SC._key=`/server/preferences.telefunc.ts:onNotifyChannels`;var CC=(...e)=>K(`/server/preferences.telefunc.ts`,`saveDiscordCredentials`,e);CC._key=`/server/preferences.telefunc.ts:saveDiscordCredentials`;var wC=`settings`,TC=`tickets`,EC=`plan`;function DC(e){let[t,n,r,i]=e.split(`/`).filter(Boolean).map(kC);return t===`settings`?{view:`settings`,projectId:null,runId:null}:t===`tickets`?{view:`tickets`,projectId:null,runId:null}:t?n===`tickets`?{view:`tickets`,projectId:t,runId:null,ticketSlug:r??null,...r&&i===`plan`?{plan:!0}:{}}:{projectId:t,runId:n??null}:{projectId:null,runId:null}}function OC({view:e,projectId:t,runId:n,ticketSlug:r,plan:i}){if(e===`settings`)return`/${wC}`;if(e===`tickets`&&!t)return`/${TC}`;if(!t)return`/`;let a=encodeURIComponent(t);if(e===`tickets`){let e=`/${a}/${TC}`;if(!r)return e;let t=`${e}/${encodeURIComponent(r)}`;return i?`${t}/${EC}`:t}return n?`/${a}/${encodeURIComponent(n)}`:`/${a}`}function kC(e){try{return decodeURIComponent(e)}catch{return e}}var AC=new Set(cc),jC={},MC={},NC=null,PC=null,FC=new Map,IC=new Set,LC=new Map,RC=null,zC=!1,BC=new Map,VC=new Set,HC=[],UC=new Map,WC=new Map,GC=0,KC=0,qC=new Map,JC=new Map;function YC(e,t,n){let r=(e.get(t)??0)+n;return e.set(t,r),r}var XC=new Set;function ZC(){UC=new Map,WC=new Map;for(let e of XC)e()}function QC(e){return XC.add(e),()=>XC.delete(e)}function $C(e){let t=e?LC.get(e):void 0;return t?yc(t):jC}function ew(e){let t=e??``,n=UC.get(t);if(n)return n;let r=e?FC.get(e):void 0,i=$C(e),a=r||i!==jC?{...NC??jC,...i,...r}:NC??jC;return UC.set(t,a),a}function tw(e){let t=e??``,n=WC.get(t);if(n)return n;let r={},i=[[`global`,NC??jC],[`repo`,$C(e)],[`project`,(e?FC.get(e):void 0)??jC]];for(let[e,t]of i)for(let[n,i]of Object.entries(t))i!==void 0&&(r[n]=e);return WC.set(t,r),r}function nw(e){!NC&&!PC&&(PC=pC().then(e=>{NC??=e}).catch(()=>{NC??={}}).finally(()=>{PC=null,ZC()})),zC||rw(),aw(e),!(!e||FC.has(e)||IC.has(e))&&(IC.add(e),gC(e).then(t=>{FC.has(e)||FC.set(e,t)}).catch(()=>{FC.has(e)||FC.set(e,{})}).finally(()=>{IC.delete(e),ZC()}))}function rw(){RC||=xa().then(e=>{LC.clear();for(let t of e)t.fileConfig&&LC.set(t.id,t.fileConfig)}).catch(()=>{}).finally(()=>{RC=null,zC=!0,ZC()})}function iw(){rw()}if(typeof window<`u`){let e=()=>{iw(),uw()};window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&e()})}function aw(e){!e||BC.has(e)||VC.has(e)||(VC.add(e),yC(e).then(t=>{BC.has(e)||BC.set(e,t)}).catch(()=>{BC.has(e)||BC.set(e,[])}).finally(()=>{VC.delete(e),ZC()}))}function ow(){let e=typeof window>`u`?null:DC(window.location.pathname).projectId,t=(0,T.useSyncExternalStore)(QC,()=>e?BC.get(e)??HC:HC,()=>HC);return(0,T.useEffect)(()=>aw(e),[e]),t}function sw(e){let t=cw();t&&(BC.set(t,e),bC(t,e).catch(()=>{}),ZC())}function cw(){return typeof window>`u`?null:DC(window.location.pathname).projectId}function lw(e){let t=cw(),n=Object.entries(e),r=t?n.filter(([e])=>AC.has(e)):[],i=n.filter(([e])=>!t||!AC.has(e));if(i.length){let e=Object.fromEntries(i);NC={...NC??{},...e};let t=++GC;KC++,hC(e).then(e=>{e.ok&&t===GC&&(NC=e.preferences,ZC())}).catch(()=>{}).finally(()=>KC--)}if(t&&r.length){let e=Object.fromEntries(r);FC.set(t,{...FC.get(t)??{},...e});let n=YC(qC,t,1);YC(JC,t,1),vC(t,e).then(e=>{e.ok&&n===qC.get(t)&&(FC.set(t,e.preferences),ZC())}).catch(()=>{}).finally(()=>YC(JC,t,-1))}ZC()}function uw(){let e=GC;pC().then(t=>{e!==GC||KC>0||(NC=t,ZC())}).catch(()=>{});let t=cw();if(!t)return;let n=qC.get(t)??0;gC(t).then(e=>{n!==(qC.get(t)??0)||(JC.get(t)??0)>0||(FC.set(t,e),ZC())}).catch(()=>{})}function dw(){return typeof window>`u`?null:DC(window.location.pathname).projectId}function fw(){let e=typeof window>`u`?null:DC(window.location.pathname).projectId,t=(0,T.useSyncExternalStore)(QC,()=>ew(e),()=>jC);return(0,T.useEffect)(()=>nw(e),[e]),t}function pw(){let e=typeof window>`u`?null:DC(window.location.pathname).projectId,t=(0,T.useSyncExternalStore)(QC,()=>tw(e),()=>hw);return(0,T.useEffect)(()=>nw(e),[e]),t}function mw(){let e=typeof window>`u`?null:DC(window.location.pathname).projectId,t=(0,T.useSyncExternalStore)(QC,()=>e?LC.get(e)??MC:MC,()=>MC);return(0,T.useEffect)(()=>nw(e),[e]),t}var hw={};function gw(e){return e.theme??`system`}function _w(e,t){return e===`dark`||e===`system`&&t}function vw(e){return uc(e,`notifyBrowser`)}function yw(e){return uc(e,`notifyDiscord`)}function bw(e){return uc(e,`discordBot`)}function xw(e){return uc(e,`notifyNewActivity`)}function Sw(e){return uc(e,`notifyHumanIntervention`)}var Cw=[{value:`system`,label:`System`,icon:bo},{value:`light`,label:`Light`,icon:Ao},{value:`dark`,label:`Dark`,icon:xo}];function ww(){let e=gw(fw()),t=Cw.find(t=>t.value===e)??Cw[0],n=t.icon;return(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Yb,{className:q(Ol({variant:`ghost`,size:`icon-sm`}),`shrink-0 text-muted-foreground`),"aria-label":`Theme`}),children:(0,J.jsx)(n,{className:`h-4 w-4`})}),(0,J.jsxs)(kx,{children:[`Theme: `,t.label]})]}),(0,J.jsx)(Xb,{align:`end`,children:Cw.map(t=>{let n=t.icon;return(0,J.jsxs)(Zb,{closeOnClick:!1,onClick:()=>lw({theme:t.value}),children:[(0,J.jsx)(Va,{className:q(`h-3.5 w-3.5 shrink-0`,t.value===e?`opacity-100`:`opacity-0`)}),(0,J.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 opacity-70`}),t.label]},t.value)})})]})}function Tw(){return(0,T.useSyncExternalStore)(Ew,()=>typeof Notification>`u`?`unsupported`:Notification.permission,()=>`unsupported`)}function Ew(e){let t=setInterval(e,3e3);return()=>clearInterval(t)}var Dw=null,Ow=null,kw=new Set;function Aw(){for(let e of kw)e()}function jw(){return Ow||(Ow=SC().then(e=>{Dw=e,Aw()}).catch(()=>{}).finally(()=>{Ow=null}),Ow)}function Mw(){jw()}function Nw(){return(0,T.useEffect)(()=>{Dw===null&&jw()},[]),(0,T.useSyncExternalStore)(e=>(kw.add(e),()=>kw.delete(e)),()=>Dw,()=>null)}function Pw({label:e,description:t}){return(0,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`leading-tight`,children:e}),t&&(0,J.jsx)(`span`,{className:`text-xs font-normal text-[var(--color-muted-foreground)]`,children:t})]})}function Fw(e,t){lw({[e]:t})}function Iw({status:e}){return(0,J.jsx)(`span`,{"aria-hidden":!0,className:q(`mt-1.5 h-2 w-2 shrink-0 rounded-full`,e===`online`?`bg-success`:`bg-muted-foreground/40`)})}var Lw=[{value:`local`,label:`This machine`,description:`Run on this machine, as today.`},{value:`actions`,label:`GitHub Actions`,description:`Run on a fresh GitHub Actions runner.`},{value:`web`,label:`Claude web`,description:`Hand off to a Claude Code cloud session, which opens its own PR.`}];function Rw({control:e,connection:t,busy:n}){let r=!t||t.isLocal,i=t&&r&&t.selectedDeviceId?t.profiles.find(e=>e.id===t.selectedDeviceId):void 0,a=e=>r?i?.id===e.id:!!t&&e.url===t.currentUrl,o=t&&!t.isLocal?t.profiles.find(e=>e.url===t.currentUrl)?.label??`A device`:i?i.label:Lw.find(t=>t.value===e.value)?.label??Lw[0].label,s=t=>r&&!i&&t===e.value;return(0,J.jsxs)(qb,{children:[(0,J.jsxs)($b,{disabled:n,children:[(0,J.jsx)(`span`,{className:`flex-1`,children:`Run on`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:o})]}),(0,J.jsxs)(ex,{children:[Lw.map(n=>(0,J.jsxs)(Zb,{className:`items-start`,onClick:()=>{if(n.value===`local`&&t&&!t.isLocal)return t.onConnectLocal();e.onChange(n.value),t?.onSelectDriver()},children:[(0,J.jsx)(Va,{className:q(`mt-0.5 h-3.5 w-3.5 shrink-0`,s(n.value)?`opacity-100`:`opacity-0`)}),(0,J.jsx)(Pw,{label:n.label,description:n.description})]},n.value)),t?.profiles.map(e=>{let n=t.status[e.id],r=n===`offline`;return(0,J.jsxs)(Zb,{className:q(`items-start gap-2`,r&&`opacity-60`),onClick:()=>t.onSelect(e),children:[(0,J.jsx)(Va,{className:q(`mt-0.5 h-3.5 w-3.5 shrink-0`,a(e)?`opacity-100`:`opacity-0`)}),(0,J.jsx)(yo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,J.jsx)(Iw,{status:n}),(0,J.jsx)(Pw,{label:e.label,description:r?`${e.url} (offline)`:e.url}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t.onRemove(e)},"aria-label":`Remove device ${e.label}`,className:`mt-0.5 rounded p-0.5 text-[var(--color-muted-foreground)] hover:text-danger`}),children:(0,J.jsx)(Po,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,J.jsxs)(kx,{children:[`Remove `,e.label]})]})]},e.id)}),t&&(0,J.jsxs)(Zb,{className:`items-start`,disabled:n,onClick:()=>t.onAddDevice(),children:[(0,J.jsx)(Co,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(Pw,{label:`Add a device…`,description:`Paste the URL a box prints on its network bind.`})]})]})]})}function zw({row:e,busy:t,indent:n=!1}){return(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Qb,{checked:e.checked,disabled:t||!!e.disabled,onCheckedChange:t=>Fw(e.key,t),className:n?`items-start pl-8`:`items-start`}),children:(0,J.jsx)(Pw,{label:e.label,description:e.disabled&&e.disabledReason?[e.description,`— ${e.disabledReason}`].filter(Boolean).join(` `):e.description})}),(0,J.jsx)(kx,{className:`max-w-[22rem]`,children:e.title})]})}function Bw({options:e,ecoOptions:t,showEco:n,busy:r,label:i=`Session options`,runTarget:a,connection:o}){let s=e.filter(e=>e.checked&&!e.disabled).length;return(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,disabled:r,"aria-label":i,className:q(Ol({variant:`ghost`,size:`icon-sm`}),`relative h-8 w-8`)}),children:[(0,J.jsx)(Eo,{className:`h-4 w-4`}),s>0&&(0,J.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-[var(--color-primary)]`})]}),(0,J.jsx)(kx,{children:s>0?`${i} — ${s} on`:i})]}),(0,J.jsxs)(Xb,{align:`end`,className:`min-w-[19rem] max-w-[22rem]`,children:[a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Rw,{control:a,connection:o,busy:r}),e.length>0&&(0,J.jsx)(tx,{})]}),e.map(e=>(0,J.jsx)(zw,{row:e,busy:r},e.key)),n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(tx,{}),t.map(e=>(0,J.jsx)(zw,{row:e,busy:r,indent:!0},e.key))]})]})]})}function Vw(){let e=fw(),t=vw(e),n=yw(e),r=xw(e),i=Sw(e),a=bw(e),o=Tw(),s=o!==`unsupported`,c=o===`denied`,l=Nw(),u=l===null||l.discordWebhook,d=l===null||l.discordBot,f=t&&o===`granted`||n&&u,p=e=>{lw({notifyBrowser:e}),e&&o==="default"&&Notification.requestPermission()},m=c?`Blocked in your browser settings`:t&&o==="default"?`Click to allow browser notifications`:`Desktop notifications while the dashboard is open`;return(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,"aria-label":`Notifications`,className:q(`relative rounded-md p-1.5 hover:bg-accent`,f?`text-foreground`:`text-muted-foreground`)}),children:[f?(0,J.jsx)(Ra,{className:`h-4 w-4`}):(0,J.jsx)(La,{className:`h-4 w-4`}),f&&(0,J.jsx)(`span`,{className:`absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-[var(--color-primary)]`})]}),(0,J.jsx)(kx,{children:f?`Notifications on`:`Notifications`})]}),(0,J.jsxs)(Xb,{align:`end`,className:`min-w-[16rem]`,children:[(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Deliver to`}),s&&(0,J.jsx)(Qb,{checked:t,disabled:c,onCheckedChange:p,className:`items-start`,children:(0,J.jsx)(Pw,{label:`Browser`,description:m})}),(0,J.jsx)(Qb,{checked:n,onCheckedChange:e=>lw({notifyDiscord:e}),className:`items-start`,children:(0,J.jsx)(Pw,{label:`Discord`,description:u?`Reaches you with no dashboard open`:`Not configured — add a webhook in Settings`})})]}),(0,J.jsx)(tx,{}),(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Notify me about`}),(0,J.jsx)(Qb,{checked:i,onCheckedChange:e=>lw({notifyHumanIntervention:e}),className:`items-start`,children:(0,J.jsx)(Pw,{label:`Human Queue`,description:`A session awaiting you, or a PR to review`})}),(0,J.jsx)(Qb,{checked:r,onCheckedChange:e=>lw({notifyNewActivity:e}),className:`items-start`,children:(0,J.jsx)(Pw,{label:`New activity`,description:`A session started or finished`})})]}),(0,J.jsx)(tx,{}),(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Chat`}),(0,J.jsx)(Qb,{checked:a,onCheckedChange:e=>lw({discordBot:e}),className:`items-start`,children:(0,J.jsx)(Pw,{label:`Discord bot`,description:d?`Start and steer sessions from Discord`:`Not configured — add a bot token in Settings`})})]})]})]})}function Hw({projectId:e,runs:t,selectedRunId:n,onSelect:r,recentRuns:i,onSelectRecent:a,projects:o=[],onNewSessionInProject:s,onProjectAdded:c,startTick:l=0,startIntent:u=``,followLive:d=!1,working:f=!1,onDashboard:p=()=>{},onSelectProject:m=()=>{},onSettings:h=()=>{},onTickets:g,ticketsActive:_=!1,interventionCount:v=0}){let[y,b]=(0,T.useState)(null);(0,T.useEffect)(()=>{l>0&&b({intent:u,known:new Set(t.map(e=>e.id))})},[l]);let x=t.some(e=>e.status===`running`),S=t.find(e=>e.status===`running`)?.id,C=y!==null&&t.some(e=>!y.known.has(e.id));(0,T.useEffect)(()=>{C&&b(null)},[C]),(0,T.useEffect)(()=>{b(null)},[e]),(0,T.useEffect)(()=>{if(y===null||x)return;let e=setTimeout(()=>b(null),2e4);return()=>clearTimeout(e)},[y,x]);let w=e===null&&i!==void 0,E=!w&&y!==null&&!x&&!C,D=d||n!==null&&!t.some(e=>e.id===n),O=w?i.map(e=>({key:`${e.projectId}:${e.run.id}`,run:e.run,project:e.projectName,active:!1,onClick:()=>a?.(e.projectId,e.run.id)})):t.map(e=>({key:e.id,run:e,active:e.id===n||d&&e.id===S,onClick:()=>r(e.id)})),k=e!==null&&n===null&&!d,A=O.length>0||E;return(0,J.jsxs)(hS,{collapsible:`none`,className:`w-(--sidebar-width) border-r border-sidebar-border`,children:[(0,J.jsxs)(gS,{className:`gap-0.5 pb-2`,children:[(0,J.jsx)(`div`,{className:`px-1 pt-1 pb-4`,children:(0,J.jsx)(jS,{working:f,onNavigate:p})}),(0,J.jsx)(Kw,{projectId:e,projects:o,active:k,onNewSessionInProject:s,onSelect:r,onProjectAdded:c}),(0,J.jsx)(Ww,{active:e===null&&!_,count:v,onClick:p}),g&&(0,J.jsx)(Uw,{active:_,onClick:g}),(0,J.jsx)(Gw,{projects:o,selectedId:e,onSelect:m,onProjectAdded:c})]}),(0,J.jsx)(vS,{className:`overflow-hidden`,children:(0,J.jsx)(Bb,{className:`min-h-0 flex-1`,children:(0,J.jsxs)(yS,{className:`pt-3 pr-3`,children:[(0,J.jsxs)(`div`,{className:`sticky top-0 z-10`,children:[(0,J.jsx)(bS,{className:`rounded-none bg-background font-normal tracking-wide text-muted-foreground`,children:`Recent sessions`}),(0,J.jsx)(`div`,{"aria-hidden":!0,className:`rail-fade pointer-events-none absolute inset-x-0 top-full h-4 bg-gradient-to-b from-background to-transparent`})]}),(0,J.jsxs)(xS,{children:[(0,J.jsxs)(SS,{className:`gap-0.5`,children:[E&&(0,J.jsx)(CS,{children:(0,J.jsx)(qw,{status:`running`,intent:y?.intent??void 0,subtitle:`starting…`,active:D,dim:!0,onClick:()=>r(null)})}),O.map(e=>(0,J.jsx)(CS,{children:(0,J.jsx)(qw,{status:e.run.status,publishing:Il(e.run),intent:$l(e.run),driver:e.run.driver,subtitle:e.project?`${e.project} · ${Gl(e.run.startedAt)}`:Gl(e.run.startedAt),active:e.active,waiting:e.run.settledAt!==void 0,remote:e.run.target===`remote`,cloud:e.run.target===`web`,...e.run.remoteLabel?{remoteLabel:e.run.remoteLabel}:{},onClick:e.onClick})},e.key))]}),!A&&(0,J.jsx)(`p`,{className:`whitespace-nowrap px-2 py-1 text-sm text-muted-foreground`,children:`No sessions yet.`})]})]})})}),(0,J.jsx)(_S,{className:`border-t border-sidebar-border`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(fC,{}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,J.jsx)(ww,{}),(0,J.jsx)(Vw,{}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:h,"aria-label":`Settings`}),children:(0,J.jsx)(Eo,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`Settings`})]})]})})]})}function Uw({active:e,onClick:t}){return(0,J.jsxs)(`button`,{type:`button`,onClick:t,"aria-current":e?`page`:void 0,className:q(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors`,e?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-foreground hover:bg-sidebar-accent/60`),children:[(0,J.jsx)(jo,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`flex-1 text-left`,children:`Tickets`})]})}function Ww({active:e,count:t,onClick:n}){return(0,J.jsxs)(`button`,{type:`button`,onClick:n,"aria-current":e?`page`:void 0,className:q(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors`,e?`bg-sidebar-accent text-sidebar-accent-foreground`:`text-foreground hover:bg-sidebar-accent/60`),children:[(0,J.jsx)(po,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`flex-1 text-left`,children:`Overview`}),t>0&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`min-w-5 rounded-full bg-primary px-1.5 text-center text-xs font-semibold text-primary-foreground tabular-nums`}),children:t}),(0,J.jsxs)(kx,{children:[t,` item`,t===1?``:`s`,` in your Human Queue`]})]})]})}function Gw({projects:e,selectedId:t,onSelect:n,onProjectAdded:r}){let[i,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(!1);return(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-foreground transition-colors hover:bg-sidebar-accent/60`,children:[(0,J.jsx)(eo,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`flex-1 text-left`,children:`Projects`}),(0,J.jsx)(Ha,{className:q(`h-4 w-4 shrink-0 opacity-70 transition-transform`,i||`-rotate-90`),"aria-hidden":!0})]}),i&&(0,J.jsxs)(`div`,{className:`mt-0.5 ml-4 flex flex-col gap-0.5 border-l border-sidebar-border pl-2`,children:[e.length===0&&(0,J.jsx)(`p`,{className:`px-2 py-1 text-sm text-muted-foreground`,children:`No projects yet`}),e.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-current":e.id===t?`page`:void 0,className:q(`flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm transition-colors`,e.id===t?`bg-sidebar-accent font-medium text-sidebar-accent-foreground`:`text-foreground hover:bg-sidebar-accent/60`),children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{"aria-hidden":!0,className:q(`h-2 w-2 shrink-0 rounded-full`,e.activated?`bg-primary`:`bg-muted-foreground`)})}),(0,J.jsx)(kx,{children:e.activated?`activated`:`not activated`})]}),(0,J.jsxs)(`span`,{className:`sr-only`,children:[e.activated?`Activated`:`Not activated`,`: `]}),(0,J.jsx)(`span`,{className:`flex-1 truncate text-left`,children:e.name})]},e.id)),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm text-muted-foreground transition-colors hover:bg-sidebar-accent/60 hover:text-foreground`,children:[(0,J.jsx)(Co,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:`Add project`})]})]}),o&&(0,J.jsx)(Hf,{onAdded:()=>r?.(),onClose:()=>s(!1)})]})}function Kw({projectId:e,projects:t,active:n=!1,onNewSessionInProject:r,onSelect:i,onProjectAdded:a}){let[o,s]=(0,T.useState)(!1),c=q(`h-auto w-full justify-start gap-2 px-2 py-1.5 font-normal`,n&&`bg-sidebar-accent text-sidebar-accent-foreground`),l=e=>r?r(e):i(null);if(e!==null||t.length===1){let n=e??t[0].id;return(0,J.jsxs)(Y,{variant:`ghost`,className:c,onClick:()=>l(n),children:[(0,J.jsx)(Co,{className:`h-4 w-4 shrink-0`}),(0,J.jsx)(`span`,{className:`whitespace-nowrap`,children:`New session`})]})}return t.length===0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Y,{variant:`ghost`,className:c,onClick:()=>s(!0)}),children:[(0,J.jsx)(Co,{className:`h-4 w-4 shrink-0`}),(0,J.jsx)(`span`,{className:`whitespace-nowrap`,children:`New session`})]}),(0,J.jsx)(kx,{children:`Add a project to start a session`})]}),o&&(0,J.jsx)(Hf,{onAdded:()=>a?.(),onClose:()=>s(!1)})]}):(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Yb,{"aria-label":`New session`,className:q(Ol({variant:`ghost`}),c),children:[(0,J.jsx)(Co,{className:`h-4 w-4 shrink-0`}),(0,J.jsx)(`span`,{className:`whitespace-nowrap`,children:`New session`}),(0,J.jsx)(Ha,{className:`ml-auto h-3.5 w-3.5 shrink-0 opacity-70`})]}),(0,J.jsx)(Xb,{align:`start`,className:`w-[13.5rem]`,children:t.map(e=>(0,J.jsxs)(Zb,{onClick:()=>l(e.id),children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:q(`h-2 w-2 shrink-0 rounded-full`,e.activated?`bg-primary`:`bg-muted-foreground`)}),(0,J.jsx)(`span`,{className:`flex-1 truncate`,children:e.name})]},e.id))})]})}function qw({status:e,intent:t,subtitle:n,active:r,onClick:i,driver:a,dim:o=!1,waiting:s=!1,publishing:c=!1,remote:l=!1,cloud:u=!1,remoteLabel:d}){let f=s&&e===`running`,p=Ro(a),m=u&&e===`done`,h=c&&!m,g=(0,T.useRef)(null),[_,v]=(0,T.useState)(!1);(0,T.useEffect)(()=>{let e=g.current;e&&v(e.scrollWidth>e.clientWidth+1)},[t]);let y=t||`New session`,b=q(`rail-title w-full px-2 text-sm font-normal`,_&&`is-overflowing`);return(0,J.jsxs)(Y,{variant:`ghost`,className:q(`rail-row h-auto w-full flex-col items-start gap-0.5 px-0 py-2 text-left`,r&&`bg-accent text-accent-foreground`,o&&`opacity-70`),onClick:i,children:[(0,J.jsxs)(`span`,{className:`flex w-full items-center gap-2 px-2`,children:[e===`running`&&(0,J.jsx)(`span`,{className:q(`inline-block h-2 w-2 shrink-0 rounded-full`,f?`bg-muted-foreground`:`animate-pulse bg-primary`)}),h&&(0,J.jsx)(`span`,{className:`inline-block h-2 w-2 shrink-0 animate-pulse rounded-full bg-success`}),(0,J.jsx)(kl,{className:q(`shrink-0 border-transparent px-0 text-[10px] uppercase`,f||h?`text-muted-foreground`:m?`text-primary`:Ql[e]),children:f?`waiting`:m?`in cloud`:h?`publishing…`:e}),(0,J.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:n}),(l||u||p)&&(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[l&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`flex items-center`}),children:(0,J.jsx)(yo,{className:`h-3 w-3 text-muted-foreground`,"aria-label":d?`Runs on ${d}`:`Runs on a connected device`})}),(0,J.jsx)(kx,{children:d?`Runs on ${d}`:`Runs on a connected device`})]}),u&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`flex items-center`}),children:(0,J.jsx)(qa,{className:`h-3 w-3 text-muted-foreground`,"aria-label":`Runs as a Claude Code cloud session`})}),(0,J.jsx)(kx,{children:`Runs as a Claude Code cloud session; it works and opens its PR over there.`})]}),p&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`flex items-center`,role:`img`,"aria-label":Lo[p]}),children:(0,J.jsx)(ru,{agent:p,className:`h-3 w-3 text-muted-foreground`})}),(0,J.jsx)(kx,{children:Lo[p]})]})]})]}),_?(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{ref:g,className:b}),children:y}),(0,J.jsx)(kx,{side:`right`,className:`max-w-96 whitespace-pre-wrap break-words`,children:y})]}):(0,J.jsx)(`span`,{ref:g,className:b,children:y})]})}var Jw=null,Yw=new Set;function Xw(e){if(Jw!==e){Jw=e;for(let e of Yw)e()}}function Zw(){return Jw}function Qw(e){return Yw.add(e),()=>Yw.delete(e)}function $w(){return(0,T.useSyncExternalStore)(Qw,Zw,()=>null)}var eT=(...e)=>K(`/server/control.telefunc.ts`,`sendStop`,e);eT._key=`/server/control.telefunc.ts:sendStop`;var tT=(...e)=>K(`/server/control.telefunc.ts`,`sendChoice`,e);tT._key=`/server/control.telefunc.ts:sendChoice`;var nT=(...e)=>K(`/server/control.telefunc.ts`,`sendBridgeAnswer`,e);nT._key=`/server/control.telefunc.ts:sendBridgeAnswer`;var rT=(...e)=>K(`/server/control.telefunc.ts`,`sendBridgeAnswerCancel`,e);rT._key=`/server/control.telefunc.ts:sendBridgeAnswerCancel`;var iT=(...e)=>K(`/server/control.telefunc.ts`,`sendMessage`,e);iT._key=`/server/control.telefunc.ts:sendMessage`;var aT=(...e)=>K(`/server/control.telefunc.ts`,`sendSetHandoff`,e);aT._key=`/server/control.telefunc.ts:sendSetHandoff`;var oT=(...e)=>K(`/server/control.telefunc.ts`,`sendStart`,e);oT._key=`/server/control.telefunc.ts:sendStart`;var sT=(...e)=>K(`/server/control.telefunc.ts`,`sendPreview`,e);sT._key=`/server/control.telefunc.ts:sendPreview`;var cT=(...e)=>K(`/server/control.telefunc.ts`,`onServeTargets`,e);cT._key=`/server/control.telefunc.ts:onServeTargets`;var lT=(...e)=>K(`/server/control.telefunc.ts`,`sendStopPreview`,e);lT._key=`/server/control.telefunc.ts:sendStopPreview`;var uT=(...e)=>K(`/server/control.telefunc.ts`,`onPreviewStatus`,e);uT._key=`/server/control.telefunc.ts:onPreviewStatus`;var dT=(...e)=>K(`/server/control.telefunc.ts`,`sendOpenInApp`,e);dT._key=`/server/control.telefunc.ts:sendOpenInApp`;var fT=(...e)=>K(`/server/control.telefunc.ts`,`sendRemoveWorktree`,e);fT._key=`/server/control.telefunc.ts:sendRemoveWorktree`;var pT=(...e)=>K(`/server/control.telefunc.ts`,`sendDeleteSession`,e);pT._key=`/server/control.telefunc.ts:sendDeleteSession`;var mT=(...e)=>K(`/server/control.telefunc.ts`,`sendPushBranch`,e);mT._key=`/server/control.telefunc.ts:sendPushBranch`;var hT=(...e)=>K(`/server/control.telefunc.ts`,`sendOpenPullRequest`,e);hT._key=`/server/control.telefunc.ts:sendOpenPullRequest`;var gT=(...e)=>K(`/server/control.telefunc.ts`,`sendMerge`,e);gT._key=`/server/control.telefunc.ts:sendMerge`;var _T=(...e)=>K(`/server/control.telefunc.ts`,`sendQueueTicket`,e);_T._key=`/server/control.telefunc.ts:sendQueueTicket`;var vT=(...e)=>K(`/server/control.telefunc.ts`,`sendReleaseTicketLock`,e);vT._key=`/server/control.telefunc.ts:sendReleaseTicketLock`;function yT(){let{busy:e,error:t,reset:n,run:r}=iu();return{busy:e,error:t,reset:n,start:async(e,t,n,i,a=`Failed to start the session.`)=>{let o=await r(async()=>{let r=await oT(e,t,n,i);return!r.ok&&r.busy?{...r,error:`A session is already active for this project.`}:r},a);return o?.ok?o:void 0}}}function bT(e){this.content=e}bT.prototype={constructor:bT,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new bT(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new bT(n)},addToStart:function(e,t){return new bT([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new bT(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new bT(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=bT.from(e),e.size?new bT(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=bT.from(e),e.size?new bT(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=bT.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},bT.from=function(e){if(e instanceof bT)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new bT(t)};function xT(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&wT(e.charCodeAt(r-1))&&CT(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=xT(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function ST(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&wT(e.charCodeAt(i-1))&&CT(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=ST(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function CT(e){return e>=56320&&e<57344}function wT(e){return e>=55296&&e<56320}var $=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return xT(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ST(this,e,t,n)}findIndex(e){if(e==0)return ET(0,e);if(e==this.size)return ET(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ET(t+1,i):ET(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};$.empty=new $([],0);var TT={index:0,offset:0};function ET(e,t){return TT.index=e,TT.offset=t,TT}function DT(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!DT(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!DT(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var OT=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&DT(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(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].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};OT.none=[];var kT=class extends Error{},AT=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=MT(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(jT(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e($.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};AT.empty=new AT($.empty,0,0);function jT(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(jT(a.content,t-i-1,n-i-1)))}function MT(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=MT(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function NT(e,t,n){if(n.openStart>e.depth)throw new kT(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new kT(`Inconsistent open depths`);return PT(e,t,n,0)}function PT(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=PT(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return zT(a,VT(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return zT(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=HT(n,e);return zT(a,BT(e,i,o,t,r))}}function FT(e,t){if(!t.type.compatibleContent(e.type))throw new kT(`Cannot join `+t.type.name+` onto `+e.type.name)}function IT(e,t,n){let r=e.node(n);return FT(r,t.node(n)),r}function LT(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function RT(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(LT(e.nodeAfter,r),a++));for(let e=a;e<o;e++)LT(i.child(e),r);t&&t.depth==n&&t.textOffset&&LT(t.nodeBefore,r)}function zT(e,t){if(!e.type.validContent(t))throw new kT(`Invalid content for node `+e.type.name);return e.copy(t)}function BT(e,t,n,r,i){let a=e.depth>i&&IT(e,t,i+1),o=r.depth>i&&IT(n,r,i+1),s=[];return RT(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(FT(a,o),LT(zT(a,BT(e,t,n,r,i+1)),s)):(a&&LT(zT(a,VT(e,t,i+1)),s),RT(t,n,i,s),o&&LT(zT(o,VT(n,r,i+1)),s)),RT(r,null,i,s),new $(s)}function VT(e,t,n){let r=[];return RT(null,e,n,r),e.depth>n&&LT(zT(IT(e,t,n+1),VT(e,t,n+1)),r),RT(t,null,n,r),new $(r)}function HT(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy($.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var UT=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return OT.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new qT(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=KT.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else KT.set(t,r=new WT);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%GT,i}},WT=class{constructor(){this.elts=[],this.i=0}},GT=12,KT=new WeakMap,qT=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},JT=Object.create(null),YT=class e{constructor(e,t,n,r=OT.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||$.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&DT(this.attrs,t||e.defaultAttrs||JT)&&OT.sameSet(this.marks,n||OT.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return AT.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new AT(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return NT(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return UT.resolveCached(this,e)}resolveNoCache(e){return UT.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),ZT(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=$.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=OT.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!OT.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=$.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};YT.prototype.text=void 0;var XT=class e extends YT{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ZT(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function ZT(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var QT=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new $T(t,n);if(r.next==null)return e.empty;let i=eE(r);r.next&&r.err(`Unexpected trailing text`);let a=uE(sE(i));return dE(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return $.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
`)}};QT.empty=new QT(!0);var $T=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function eE(e){let t=[];do t.push(tE(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function tE(e){let t=[];do t.push(nE(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function nE(e){let t=oE(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=iE(e,t);else break;return t}function rE(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function iE(e,t){let n=rE(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:rE(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function aE(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function oE(e){if(e.eat(`(`)){let t=eE(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=aE(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function sE(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function cE(e,t){return t-e}function lE(e,t){let n=[];return r(t),n.sort(cE);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function uE(e){let t=Object.create(null);return n(lE(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);lE(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new QT(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(cE);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function dE(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function fE(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function pE(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function mE(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function hE(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new vE(e,r,t[r]);return n}var gE=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=hE(e,n.attrs),this.defaultAttrs=fE(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==QT.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:pE(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new YT(this,this.computeAttrs(e),$.from(t),OT.setFrom(n))}createChecked(e=null,t,n){return t=$.from(t),this.checkContent(t),new YT(this,this.computeAttrs(e),t,OT.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=$.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore($.empty,!0);return i?new YT(this,e,t.append(i),OT.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){mE(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:OT.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function _E(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var vE=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?_E(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},yE=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=hE(e,r.attrs),this.excluded=null;let i=fE(this.attrs);this.instance=i?new OT(this,i):null}create(e=null){return!e&&this.instance?this.instance:new OT(this,pE(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){mE(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},bE=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=bT.from(e.nodes),t.marks=bT.from(e.marks||{}),this.nodes=gE.compile(this.spec.nodes,this),this.marks=yE.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=QT.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?xE(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:xE(this,n.split(` `))}this.nodeFromJSON=e=>YT.fromJSON(this,e),this.markFromJSON=e=>OT.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof gE))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new XT(n,n.defaultAttrs,e,OT.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function xE(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function SE(e){return e.tag!=null}function CE(e){return e.style!=null}var wE=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(SE(e))this.tags.push(e);else if(CE(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new NE(this,t,!1);return n.addAll(e,OT.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new NE(this,t,!0);return n.addAll(e,OT.none,t.from,t.to),AT.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(FE(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=IE(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=IE(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},TE={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},EE={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},DE={ol:!0,ul:!0},OE=1,kE=2,AE=4;function jE(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?OE:0)|(t===`full`?kE:0)}var ME=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=OT.none,this.match=i||(a&AE?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore($.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&OE)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=$.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore($.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!TE.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},NE=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=jE(null,t.preserveWhitespace,0)|(n?AE:0);i=r?new ME(r.type,r.attrs,OT.none,!0,t.topMatch||r.type.contentMatch,a):n?new ME(null,null,OT.none,!0,null,a):new ME(e.schema.topNodeType,null,OT.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&kE?`full`:this.localPreserveWS||(r.options&OE)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;DE.hasOwnProperty(a)&&this.parser.normalizeLists&&PE(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:EE.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(TE.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=OT.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):LE(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=jE(e,i,a.options);a.options&AE&&a.content.length==0&&(o|=AE);let s=OT.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):LE(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new ME(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=OE);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function PE(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&DE.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function FE(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function IE(e){let t={};for(let n in e)t[n]=e[n];return t}function LE(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var RE=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=BE(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return BE(t).createTextNode(e.text);let{dom:n,contentDOM:r}=WE(BE(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&WE(BE(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:WE(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=zE(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return zE(e.marks)}};function zE(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function BE(e){return e.document||window.document}var VE=new WeakMap;function HE(e){let t=VE.get(e);return t===void 0&&VE.set(e,t=UE(e)),t}function UE(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function WE(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=HE(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=WE(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var GE=65535,KE=2**16;function qE(e,t){return e+t*KE}function JE(e){return e&GE}function YE(e){return(e-(e&GE))/KE}var XE=1,ZE=2,QE=4,$E=8,eD=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&$E)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&QE)>0}},tD=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=JE(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+YE(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:qE(o/3,e-s),f=e==s?ZE:e==u?XE:QE;return(t<0?e!=s:e!=u)&&(f|=$E),new eD(a,f,d)}r+=l-c}return n?e+r:new eD(e+r,0,null)}touches(e,t){let n=0,r=JE(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};tD.empty=new tD([]);var nD=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new eD(e,r,null)}},rD=Object.create(null),iD=class{getMap(){return tD.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=rD[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in rD)throw RangeError(`Duplicate use of step JSON ID `+e);return rD[e]=t,t.prototype.jsonID=e,t}},aD=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof kT)return e.fail(t.message);throw t}}};function oD(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(oD(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return $.fromArray(r)}var sD=class e extends iD{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new AT(oD(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return aD.fromReplace(e,this.from,this.to,i)}invert(){return new cD(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};iD.jsonID(`addMark`,sD);var cD=class e extends iD{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new AT(oD(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return aD.fromReplace(e,this.from,this.to,n)}invert(){return new sD(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};iD.jsonID(`removeMark`,cD);var lD=class e extends iD{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return aD.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return aD.fromReplace(e,this.pos,this.pos+1,new AT($.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new uD(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};iD.jsonID(`addNodeMark`,lD);var uD=class e extends iD{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return aD.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return aD.fromReplace(e,this.pos,this.pos+1,new AT($.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new lD(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};iD.jsonID(`removeNodeMark`,uD);var dD=class e extends iD{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&pD(e,this.from,this.to)?aD.fail(`Structure replace would overwrite content`):aD.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new tD([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?AT.empty:new AT(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?AT.empty:new AT(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,AT.fromJSON(t,n.slice),!!n.structure)}};dD.MAP_BIAS=1,iD.jsonID(`replace`,dD);var fD=class e extends iD{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(pD(e,this.from,this.gapFrom)||pD(e,this.gapTo,this.to)))return aD.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return aD.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?aD.fromReplace(e,this.from,this.to,n):aD.fail(`Content does not fit in gap`)}getMap(){return new tD([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,AT.fromJSON(t,n.slice),n.insert,!!n.structure)}};iD.jsonID(`replaceAround`,fD);function pD(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function mD(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new cD(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new sD(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function hD(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof yE){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new cD(t.from,t.to,t.style)))}function gD(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new dD(s,l,AT.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new cD(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new AT($.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new dD(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore($.empty,!0);e.replace(s,s,new AT(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function _D(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function vD(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!_D(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function yD(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=$.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=$.from(r.node(e).copy(u)),d++):c--;let f=$.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=$.from(i.node(e).copy(f)),p++):l++;e.step(new fD(c,l,o,s,new AT(u.append(f),d,p),u.size-d,!0))}function bD(e,t,n=null,r=e){let i=SD(e,t),a=i&&CD(r,t);return a?i.map(xD).concat({type:t,attrs:n}).concat(a.map(xD)):null}function xD(e){return{type:e,attrs:null}}function SD(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function CD(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function wD(e,t,n){let r=$.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=$.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new fD(i,a,i,a,new AT(r,0,0),n.length,!0))}function TD(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&OD(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&DD(e,t,n,a),gD(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new fD(c,l,c+1,l-1,new AT($.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&ED(e,t,n,a),!1}})}function ED(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function DD(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
`))}})}function OD(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function kD(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new fD(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new AT($.from(o),0,0),1,!0))}function AD(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function jD(e,t,n=1,r){let i=e.doc.resolve(t),a=$.empty,o=$.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=$.from(i.node(e).copy(a));let t=r&&r[s];o=$.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new dD(t,t,new AT(a.append(o),n,n),!0))}function MD(e,t){let n=e.resolve(t),r=n.index();return PD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function ND(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function PD(e,t){return!!(e&&t&&!e.isLeaf&&ND(e,t))}function FD(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&PD(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function ID(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);DD(e,r.node(),r.before(),s)}o.inlineContent&&gD(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new dD(l,c.map(t+n,-1),AT.empty,!0)),r===!0){let t=e.doc.resolve(l);ED(e,t.node(),t.before(),e.steps.length)}return e}function LD(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function RD(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function zD(e,t,n=t,r=AT.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return BD(i,a,r)?new dD(t,n,r):new VD(i,a,r).fit()}function BD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var VD=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=$.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=$.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new AT(i,a,o);return e>-1?new fD(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new dD(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=WD(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore($.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=WD(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new AT(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=WD(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new AT(HD(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new AT(HD(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(GD(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=UD(this.placed,t,$.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?AT.empty:new AT(HD(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new AT(HD(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!KD(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=KD(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=KD(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=UD(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=UD(this.placed,this.depth,$.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore($.empty,!0);e.childCount&&(this.placed=UD(this.placed,this.frontier.length,e))}};function HD(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(HD(e.firstChild.content,t-1,n)))}function UD(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(UD(e.lastChild.content,t-1,n)))}function WD(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function GD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,GD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore($.empty,!0)))),e.copy(r)}function KD(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!qD(n,a.content,o)?s:null}function qD(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function JD(e){return e.spec.defining||e.spec.definingForContent}function YD(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(BD(i,a,r))return e.step(new dD(t,n,r));let o=$D(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=JD(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new AT(XD(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function XD(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(XD(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore($.empty,!0))}return e}function ZD(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=LD(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new AT($.from(r),0,0))}function QD(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=$D(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function $D(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var eO=class e extends iD{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return aD.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return aD.fromReplace(e,this.pos,this.pos+1,new AT($.from(r),0,+!t.isLeaf))}getMap(){return tD.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};iD.jsonID(`attr`,eO);var tO=class e extends iD{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return aD.ok(n)}getMap(){return tD.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};iD.jsonID(`docAttr`,tO);var nO=class extends Error{};nO=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},nO.prototype=Object.create(Error.prototype),nO.prototype.constructor=nO,nO.prototype.name=`TransformError`;var rO=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nD}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new nO(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=AT.empty){let r=zD(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new AT($.from(n),0,0))}delete(e,t){return this.replace(e,t,AT.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return YD(this,e,t,n),this}replaceRangeWith(e,t,n){return ZD(this,e,t,n),this}deleteRange(e,t){return QD(this,e,t),this}lift(e,t){return yD(this,e,t),this}join(e,t=1){return ID(this,e,t),this}wrap(e,t){return wD(this,e,t),this}setBlockType(e,t=e,n,r=null){return TD(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return kD(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new eO(e,t,n)),this}setDocAttribute(e,t){return this.step(new tO(e,t)),this}addNodeMark(e,t){return this.step(new lD(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof OT)t.isInSet(n.marks)&&this.step(new uD(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new uD(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return jD(this,e,t,n),this}addMark(e,t,n){return mD(this,e,t,n),this}removeMark(e,t,n){return hD(this,e,t,n),this}clearIncompatible(e,t,n){return gD(this,e,t,n),this}},iO=Object.create(null),aO=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new oO(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=AT.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?AT.empty:t),o==0&&gO(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),gO(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new lO(e):hO(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?hO(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):hO(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new pO(e.node(0))}static atStart(e){return hO(e,e,0,0,1)||new pO(e)}static atEnd(e){return hO(e,e,e.content.size,e.childCount,-1)||new pO(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=iO[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in iO)throw RangeError(`Duplicate use of selection JSON ID `+e);return iO[e]=t,t.prototype.jsonID=e,t}getBookmark(){return lO.between(this.$anchor,this.$head).getBookmark()}};aO.prototype.visible=!0;var oO=class{constructor(e,t){this.$from=e,this.$to=t}},sO=!1;function cO(e){!sO&&!e.parent.inlineContent&&(sO=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var lO=class e extends aO{constructor(e,t=e){cO(e),cO(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return aO.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=AT.empty){if(super.replace(e,t),t==AT.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new uO(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=aO.findFrom(n,r,!0)||aO.findFrom(n,-r,!0);if(e)n=e.$head;else return aO.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(aO.findFrom(t,-r,!0)||aO.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};aO.jsonID(`text`,lO);var uO=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return lO.between(e.resolve(this.anchor),e.resolve(this.head))}},dO=class e extends aO{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?aO.near(a):new e(a)}content(){return new AT($.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new fO(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};dO.prototype.visible=!1,aO.jsonID(`node`,dO);var fO=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new uO(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&dO.isSelectable(n)?new dO(t):aO.near(t)}},pO=class e extends aO{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=AT.empty){if(t==AT.empty){e.delete(0,e.doc.content.size);let t=aO.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return mO}};aO.jsonID(`all`,pO);var mO={map(){return this},resolve(e){return new pO(e)}};function hO(e,t,n,r,i,a=!1){if(t.inlineContent)return lO.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=hO(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&dO.isSelectable(r))return dO.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function gO(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof dD||i instanceof fD))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(aO.near(e.doc.resolve(o),n))}var _O=1,vO=2,yO=4,bO=class extends rO{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|_O)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&_O)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=vO,this}ensureMarks(e){return OT.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&vO)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||OT.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(aO.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=yO,this}get scrolledIntoView(){return(this.updated&yO)>0}};function xO(e,t){return!t||!e?e:e.bind(t)}var SO=class{constructor(e,t,n){this.name=e,this.init=xO(t.init,n),this.apply=xO(t.apply,n)}},CO=[new SO(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new SO(`selection`,{init(e,t){return e.selection||aO.atStart(t.doc)},apply(e){return e.selection}}),new SO(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new SO(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],wO=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=CO.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new SO(e.key,e.spec.state,e))})}},TO=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new bO(this)}static create(t){let n=new wO(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new wO(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new wO(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=YT.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=aO.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function EO(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=EO(i,t,{})),n[r]=i}return n}var DO=class{constructor(e){this.spec=e,this.props={},e.props&&EO(e.props,this,this.props),this.key=e.key?e.key.key:kO(`plugin`)}getState(e){return e[this.key]}},OO=Object.create(null);function kO(e){return e in OO?e+`$`+ ++OO[e]:(OO[e]=0,e+`$`)}var AO=class{constructor(e=`key`){this.key=kO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},jO=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},MO=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},NO=null,PO=function(e,t,n){let r=NO||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},FO=function(){NO=null},IO=function(e,t,n,r){return n&&(RO(e,t,n,r,-1)||RO(e,t,n,r,1))},LO=/^(img|br|input|textarea|hr)$/i;function RO(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:zO(e))){let n=e.parentNode;if(!n||n.nodeType!=1||UO(e)||LO.test(e.nodeName)||e.contentEditable==`false`)return!1;t=jO(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?zO(e):0}else return!1}}function zO(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function BO(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=zO(e)}else if(e.parentNode&&!UO(e))t=jO(e),e=e.parentNode;else return null}}function VO(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!UO(e))t=jO(e)+1,e=e.parentNode;else return null}}function HO(e,t,n){for(let r=t==0,i=t==zO(e);r||i;){if(e==n)return!0;let t=jO(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==zO(e)}}function UO(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var WO=function(e){return e.focusNode&&IO(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function GO(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function KO(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function qO(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(zO(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(zO(r.startContainer),r.startOffset)}}}var JO=typeof navigator<`u`?navigator:null,YO=typeof document<`u`?document:null,XO=JO&&JO.userAgent||``,ZO=/Edge\/(\d+)/.exec(XO),QO=/MSIE \d/.exec(XO),$O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(XO),ek=!!(QO||$O||ZO),tk=QO?document.documentMode:$O?+$O[1]:ZO?+ZO[1]:0,nk=!ek&&/gecko\/(\d+)/i.test(XO);nk&&+(/Firefox\/(\d+)/.exec(XO)||[0,0])[1];var rk=!ek&&/Chrome\/(\d+)/.exec(XO),ik=!!rk,ak=rk?+rk[1]:0,ok=!ek&&!!JO&&/Apple Computer/.test(JO.vendor),sk=ok&&(/Mobile\/\w+/.test(XO)||!!JO&&JO.maxTouchPoints>2),ck=sk||(JO?/Mac/.test(JO.platform):!1),lk=JO?/Win/.test(JO.platform):!1,uk=/Android \d/.test(XO),dk=!!YO&&`webkitFontSmoothing`in YO.documentElement.style,fk=dk?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function pk(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function mk(e,t){return typeof e==`number`?e:e[t]}function hk(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function gk(e,t,n){if(!jk(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=MO(o);continue}let e=o,n=e==a.body,s=n?pk(a):hk(e),c=0,l=0;if(t.top<s.top+mk(r,`top`)?l=-(s.top-t.top+mk(i,`top`)):t.bottom>s.bottom-mk(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+mk(i,`top`)-s.top:t.bottom-s.bottom+mk(i,`bottom`)),t.left<s.left+mk(r,`left`)?c=-(s.left-t.left+mk(i,`left`)):t.right>s.right-mk(r,`right`)&&(c=t.right-s.right+mk(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:MO(o)}}function _k(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:vk(e.dom)}}function vk(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=MO(r));return t}function yk({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;bk(n,r==0?0:r-t)}function bk(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var xk=null;function Sk(e){if(e.setActive)return e.setActive();if(xk)return e.focus(xk);let t=vk(e);e.focus(xk==null?{get preventScroll(){return xk={preventScroll:!0},!0}}:void 0),xk||(xk=!1,bk(t,0))}function Ck(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=PO(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?wk(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:Ck(n,i)}function wk(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Mk(r,1);if(n.top!=n.bottom&&Tk(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Tk(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Ek(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Dk(e,t,n){let{node:r,offset:i}=Ck(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Ok(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function kk(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Tk(t,i))return kk(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Ak(e,t){let n=e.dom.ownerDocument,r,i=0,a=qO(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!Tk(t,n)||(o=kk(e.dom,t,n),!o))return null}if(ok)for(let e=o;r&&e;e=MO(e))e.draggable&&(r=void 0);if(o=Ek(o,t),r){if(nk&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;dk&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Ok(e,r,i,t))}s??=Dk(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function jk(e){return e.top<e.bottom||e.left<e.right}function Mk(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(jk(e))return e}return Array.prototype.find.call(n,jk)||e.getBoundingClientRect()}var Nk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pk(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=dk||nk;if(r.nodeType==3)if(o&&(Nk.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Mk(PO(r,i,i),n);if(nk&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Mk(PO(r,i-1,i-1),-1);if(t.top==e.top){let n=Mk(PO(r,i,i+1),-1);if(n.top!=e.top)return Fk(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Fk(Mk(PO(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==zO(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return Ik(e.getBoundingClientRect(),!1)}if(a==null&&i<zO(r)){let e=r.childNodes[i];if(e.nodeType==1)return Ik(e.getBoundingClientRect(),!0)}return Ik(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==zO(r))){let e=r.childNodes[i-1],t=e.nodeType==3?PO(e,zO(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Fk(Mk(t,1),!1)}if(a==null&&i<zO(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?PO(e,0,+!o):e.nodeType==1?e:null:null;if(t)return Fk(Mk(t,-1),!0)}return Fk(Mk(r.nodeType==3?PO(r):r,-n),n>=0)}function Fk(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Ik(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Lk(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Rk(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Lk(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Pk(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=PO(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var zk=/[\u0590-\u08ac]/;function Bk(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!zk.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Lk(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Vk=null,Hk=null,Uk=!1;function Wk(e,t,n){return Vk==t&&Hk==n?Uk:(Vk=t,Hk=n,Uk=n==`up`||n==`down`?Rk(e,t,n):Bk(e,t,n))}var Gk=0,Kk=1,qk=2,Jk=3,Yk=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Gk,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>jO(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof nA){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Xk&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?jO(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?jO(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=jO(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=jO(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((nk||ok)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:jO(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(nk&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&ok)&&IO(o.node,o.offset,l.anchorNode,l.anchorOffset)&&IO(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&nk)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?qk:Kk,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Jk:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?qk:Jk}n=a}this.dirty=qk}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?qk:Kk;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Xk=class extends Yk{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Gk&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Zk=class extends Yk{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Qk=class e extends Yk{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=RE.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Jk||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Jk&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Gk){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Gk}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=yA(a,n,o,r)),t>0&&(a=yA(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},$k=class e extends Yk{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=RE.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=uA(u,r,n),l?c=new rA(t,n,r,i,u,d||null,f,l):n.isText?new tA(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>$.empty)}return e}matchesNode(e,t,n){return this.dirty==Gk&&e.eq(this.node)&&dA(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new pA(this,a&&a.node,e);gA(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?OT.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==qk)&&(a&&this.protectLocalComposition(e,a),iA(this.contentDOM,this.children,e),sk&&_A(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof lO)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=vA(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new Zk(this,i,t,r);e.input.compositionNodes.push(a),this.children=yA(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Jk||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Gk}updateOuterDeco(e){if(dA(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=cA(this.dom,this.nodeDOM,sA(this.outerDeco,this.node,t),sA(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function eA(e,t,n,r,i){uA(r,t,e);let a=new $k(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var tA=class e extends $k{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Jk||this.dirty!=Gk&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Gk||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Gk,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Jk)}get domAtom(){return!1}isText(e){return this.node.text==e}},nA=class extends Yk{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Gk&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},rA=class extends $k{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==Jk)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function iA(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=fA(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Qk){let t=r?r.previousSibling:e.lastChild;iA(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=fA(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var aA=function(e){e&&(this.nodeName=e)};aA.prototype=Object.create(null);var oA=[new aA];function sA(e,t,n){if(e.length==0)return oA;let r=n?oA[0]:new aA,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new aA(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new aA(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function cA(e,t,n,r){if(n==oA&&r==oA)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=oA[0],i=t)}lA(i,o||oA[0],a)}return i}function lA(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function uA(e,t,n){return cA(e,e,oA,sA(t,n,e.nodeType!=1))}function dA(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function fA(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var pA=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=mA(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Gk,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof Qk&&t.dirty!=Jk&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Qk.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Jk&&a.dom==a.contentDOM&&(a.dirty=qk),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof $k){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Jk&&dA(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=qk,u.updateChildren(r,a+1),u.dirty=Gk),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!dA(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=$k.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=$k.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Xk(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Qk;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof tA)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ok||ik)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new nA(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function mA(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Qk)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function hA(e,t){return e.type.side-t.type.side}function gA(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(hA);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function _A(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function vA(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function yA(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function bA(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(WO(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&dO.isSelectable(e)&&i.parent&&!(e.isInline&&HO(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new dO(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=jA(e,u,s,n)}return l}function xA(e){return e.editable?e.hasFocus():NA(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function SA(e,t=!1){let n=e.state.selection;if(kA(e,n),!xA(e))return;let r=e.input.mouseDown;if(!t&&ik&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&IO(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)OA(e);else{let{anchor:r,head:i}=n,a,o;CA&&!(n instanceof lO)&&(n.$from.parent.inlineContent||(a=wA(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=wA(e,n.to))),e.docView.setSelection(r,i,e,t),CA&&(a&&EA(a),o&&EA(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&DA(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var CA=ok||ik&&ak<63;function wA(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(ok&&i&&i.contentEditable==`false`)return TA(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return TA(i);if(a)return TA(a)}}function TA(e){return e.contentEditable=`true`,ok&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function EA(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function DA(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!xA(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function OA(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,jO(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&ek&&tk<=11&&(n.disabled=!0,n.disabled=!1)}function kA(e,t){if(t instanceof dO){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(AA(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else AA(e)}function AA(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function jA(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||lO.between(t,n,r)}function MA(e){return e.editable&&!e.hasFocus()?!1:NA(e)}function NA(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function PA(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return IO(t.node,t.offset,n.anchorNode,n.anchorOffset)}function FA(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&aO.findFrom(a,t)}function IA(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function LA(e,t,n){let r=e.state.selection;if(r instanceof lO){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return IA(e,new lO(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=FA(e.state,t);return n&&n instanceof dO?IA(e,n):!1}else if(!(ck&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?dO.isSelectable(i)?IA(e,new dO(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):dk?IA(e,new lO(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof dO&&r.node.isInline)return IA(e,new lO(t>0?r.$to:r.$from));else{let n=FA(e.state,t);return n?IA(e,n):!1}}function RA(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function zA(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function BA(e,t){return t<0?VA(e):HA(e)}function VA(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(nk&&n.nodeType==1&&r<RA(n)&&zA(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(zA(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(UA(n))break;else{let t=n.previousSibling;for(;t&&zA(t,-1);)i=n.parentNode,a=jO(t),t=t.previousSibling;if(t)n=t,r=RA(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?KA(e,n,r):i&&KA(e,i,a)}function HA(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=RA(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(zA(e,1))a=n,o=++r;else break}else if(UA(n))break;else{let t=n.nextSibling;for(;t&&zA(t,1);)a=t.parentNode,o=jO(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=RA(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&KA(e,a,o)}function UA(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function WA(e,t){for(;e&&t==e.childNodes.length&&!UO(e);)t=jO(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function GA(e,t){for(;e&&!t&&!UO(e);)t=jO(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function KA(e,t,n){if(t.nodeType!=3){let e,r;(r=WA(t,n))?(t=r,n=0):(e=GA(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(WO(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&SA(e)},50)}function qA(e,t){let n=e.state.doc.resolve(t);if(!(ik||lk)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function JA(e,t,n){let r=e.state.selection;if(r instanceof lO&&!r.empty||n.indexOf(`s`)>-1||ck&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=FA(e.state,t);if(n&&n instanceof dO)return IA(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof pO?aO.near(n,t):aO.findFrom(n,t);return o?IA(e,o):!1}return!1}function YA(e,t){if(!(e.state.selection instanceof lO))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function XA(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ZA(e){if(!ok||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;XA(e,n,`true`),setTimeout(()=>XA(e,n,`false`),20)}return!1}function QA(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function $A(e,t){let n=t.keyCode,r=QA(t);if(n==8||ck&&n==72&&r==`c`)return YA(e,-1)||BA(e,-1);if(n==46&&!t.shiftKey||ck&&n==68&&r==`c`)return YA(e,1)||BA(e,1);if(n==13||n==27)return!0;if(n==37||ck&&n==66&&r==`c`){let t=n==37?qA(e,e.state.selection.from)==`ltr`?-1:1:-1;return LA(e,t,r)||BA(e,t)}else if(n==39||ck&&n==70&&r==`c`){let t=n==39?qA(e,e.state.selection.from)==`ltr`?1:-1:1;return LA(e,t,r)||BA(e,t)}else if(n==38||ck&&n==80&&r==`c`)return JA(e,-1,r)||BA(e,-1);else if(n==40||ck&&n==78&&r==`c`)return ZA(e)||JA(e,1,r)||BA(e,1);else if(r==(ck?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function ej(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||RE.fromSchema(e.state.schema),s=uj(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=lj[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`

`),slice:t}}function tj(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new AT($.from(e.state.schema.text(t.replace(/\r\n?/g,`
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=RE.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=pj(n),dk&&mj(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||wE.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!nj.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=hj(cj(s,+u[1],+u[2]),u[4]);else if(s=AT.maxOpen(rj(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=cj(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var nj=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function rj(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&aj(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=oj(a[a.length-1],i.length));let n=ij(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return $.from(a)}return e}function ij(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,$.from(e));return e}function aj(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=aj(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append($.from(ij(n,e,i+1))))}}function oj(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,oj(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore($.empty,!0);return e.copy(n.append(r))}function sj(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=sj(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore($.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function cj(e,t,n){return t<e.openStart&&(e=new AT(sj(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new AT(sj(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var lj={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function uj(){return document.implementation.createHTMLDocument(`title`)}var dj=null;function fj(e){let t=window.trustedTypes;return t?(dj||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),dj.createHTML(e)):e}function pj(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=uj(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&lj[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=fj(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function mj(e){let t=e.querySelectorAll(ik?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function hj(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=$.from(t.create(r[e+1],i)),a++,o++}return new AT(i,a,o)}var gj={},_j={},vj={touchstart:!0,touchmove:!0},yj=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function bj(e){for(let t in gj){let n=gj[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Tj(e,t)&&!wj(e,t)&&(e.editable||!(t.type in _j))&&n(e,t)},vj[t]?{passive:!0}:void 0)}ok&&e.dom.addEventListener(`input`,()=>null),Cj(e)}function xj(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Sj(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Cj(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>wj(e,t))})}function wj(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Tj(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Ej(e,t){!wj(e,t)&&gj[t.type]&&(e.editable||!(t.type in _j))&&gj[t.type](e,t)}_j.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Uj(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(uk&&ik&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),sk&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,GO(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||$A(e,n)?n.preventDefault():xj(e,`key`)},_j.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},_j.keypress=(e,t)=>{let n=t;if(Uj(e)||!n.charCode||n.ctrlKey&&!n.altKey||ck&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof lO)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Dj(e){return{left:e.clientX,top:e.clientY}}function Oj(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function kj(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Aj(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function jj(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&dO.isSelectable(r)?(Aj(e,new dO(n),`pointer`),!0):!1}function Mj(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof dO&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(dO.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(Aj(e,dO.create(e.state.doc,i),`pointer`),!0)}function Nj(e,t,n,r,i){return kj(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Mj(e,n):jj(e,n))}function Pj(e,t,n,r){return kj(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Fj(e,t,n,r){return kj(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Ij(e,n,r)}function Ij(e,t,n){if(n.button!=0)return!1;let r=Lj(e,t,!0),i=e.state.doc;return r?(Aj(e,r,`pointer`),r instanceof lO&&i.eq(e.state.doc)&&(e.input.mouseDown=new Hj(e,r)),!0):!1}function Lj(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?lO.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return lO.create(r,a+1,a+1+t.content.size);if(n&&dO.isSelectable(t))return dO.create(r,a)}return null}function Rj(e){return Yj(e)}var zj=ck?`metaKey`:`ctrlKey`;gj.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Rj(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Oj(n,e.input.lastClick)&&!n[zj]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Dj(n));o&&(a==`singleClick`?e.input.mouseDown=new Vj(e,o,n,!!r):(a==`doubleClick`?Pj:Fj)(e,o.pos,o.inside,n)?n.preventDefault():xj(e,`pointer`))};var Bj=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},Vj=class extends Bj{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[zj],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof dO&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&nk&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),xj(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||SA(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Dj(e))),this.updateAllowDefault(e),this.allowDefault||!t?xj(this.view,`pointer`):Nj(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ok&&this.mightDrag&&!this.mightDrag.node.isAtom||ik&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Aj(this.view,aO.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):xj(this.view,`pointer`)}move(e){this.updateAllowDefault(e),xj(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},Hj=class extends Bj{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),xj(this.view,`pointer`);let t=this.view.posAtCoords(Dj(e)),n=t&&Lj(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];Aj(this.view,lO.create(r,a,o),`pointer`)}};gj.touchstart=e=>{e.input.lastTouch=Date.now(),Rj(e),xj(e,`pointer`)},gj.touchmove=e=>{e.input.lastTouch=Date.now(),xj(e,`pointer`)},gj.contextmenu=e=>Rj(e);function Uj(e,t){return e.composing?!0:ok&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Wj=uk?5e3:-1;_j.compositionstart=_j.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof lO&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||ik&&lk&&Gj(e)))e.markCursor=e.state.storedMarks||n.marks(),Yj(e,!0),e.markCursor=null;else if(Yj(e,!t.selection.empty),nk&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Kj(e,Wj)};function Gj(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}_j.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Kj(e,20))};function Kj(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Yj(e),t))}function qj(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Jj(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=BO(t.focusNode,t.focusOffset),r=VO(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Yj(e,t=!1){if(!(uk&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),qj(e),t||e.docView&&e.docView.dirty){let n=bA(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Xj(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Zj=ek&&tk<15||sk&&fk<604;gj.copy=_j.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Zj?null:n.clipboardData,{dom:o,text:s}=ej(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Xj(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Qj(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function $j(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?eM(e,r.value,null,i,t):eM(e,r.textContent,r.innerHTML,i,t)},50)}function eM(e,t,n,r,i){let a=tj(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||AT.empty)))return!0;if(!a)return!1;let o=Qj(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function tM(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}_j.paste=(e,t)=>{let n=t;if(e.composing&&!uk)return;let r=Zj?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&eM(e,tM(r),r.getData(`text/html`),i,n)?n.preventDefault():$j(e,n)};var nM=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},rM=ck?`altKey`:`ctrlKey`;function iM(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[rM]:!n}gj.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Dj(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof dO?i.to-1:i.to))){if(r&&r.mightDrag)o=dO.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=dO.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=ej(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!ik||ak>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zj?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Zj||n.dataTransfer.setData(`text/plain`,c),e.dragging=new nM(l,iM(e,n),o)},gj.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},_j.dragover=_j.dragenter=(e,t)=>t.preventDefault(),_j.drop=(e,t)=>{try{aM(e,t,e.dragging)}finally{e.dragging=null}};function aM(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Dj(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=tj(e,tM(t.dataTransfer),Zj?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&iM(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||AT.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?RD(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&dO.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new dO(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(jA(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}gj.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&SA(e)},20))},gj.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},gj.beforeinput=(e,t)=>{if(ik&&uk&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,GO(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in _j)gj[e]=_j[e];function oM(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var sM=class e{constructor(e,t){this.toDOM=e,this.spec=t||fM,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new uM(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&oM(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},cM=class e{constructor(e,t){this.attrs=e,this.spec=t||fM}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new uM(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&oM(this.attrs,t.attrs)&&oM(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},lM=class e{constructor(e,t){this.attrs=e,this.spec=t||fM}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new uM(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&oM(this.attrs,t.attrs)&&oM(this.spec,t.spec)}destroy(){}},uM=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new sM(n,r))}static inline(t,n,r,i){return new e(t,n,new cM(r,i))}static node(t,n,r,i){return new e(t,n,new lM(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof cM}get widget(){return this.type instanceof sM}},dM=[],fM={},pM=class e{constructor(e,t){this.local=e.length?e:dM,this.children=t.length?t:dM}static create(e,t){return t.length?xM(t,e,0,fM):mM}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==mM||e.maps.length==0?this:this.mapInner(e,t,0,0,n||fM)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?gM(this.children,o||[],t,n,r,i,a):o?new e(o.sort(SM),dM):mM}add(t,n){return n.length?this==mM?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=yM(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,xM(s,e,o+1,fM)),a+=3}});let o=_M(a?bM(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(SM):this.local,i||this.children)}remove(e){return e.length==0||this==mM?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==mM?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):mM}forChild(t,n){if(this==mM)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof cM){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(SM),dM);return r?new hM([t,r]):t}return r||mM}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return CM(this.localsInner(e))}localsInner(e){if(this==mM)return dM;if(e.inlineContent||!this.local.some(cM.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof cM||t.push(this.local[e]);return t}forEachSet(e){e(this)}};pM.empty=new pM([],[]),pM.removeOverlap=CM;var mM=pM.empty,hM=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,fM));return e.from(r)}forChild(t,n){if(n.isLeaf)return pM.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=mM&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?CM(n?t:t.sort(SM)):dM}static from(t){switch(t.length){case 0:return mM;case 1:return t[0];default:return new e(t.every(e=>e instanceof pM)?t:t.reduce((e,t)=>e.concat(t instanceof pM?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function gM(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==mM?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=xM(vM(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new pM(t.sort(SM),s)}function _M(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new uM(i.from+t,i.to+t,i.type))}return n}function vM(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function yM(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function bM(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function xM(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=yM(e,t,o+n);if(s){a=!0;let e=xM(s,t,n+o+1,r);e!=mM&&i.push(o,o+t.nodeSize,e)}});let o=_M(a?bM(e):e,-n).sort(SM);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new pM(o,i):mM}function SM(e,t){return e.from-t.from||e.to-t.to}function CM(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),wM(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),wM(t,i,r.copy(a.from,r.to)));break}}}return t}function wM(e,t,n){for(;t<e.length&&SM(n,e[t])>0;)t++;e.splice(t,0,n)}function TM(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=mM&&t.push(r)}),e.cursorWrapper&&t.push(pM.create(e.state.doc,[e.cursorWrapper.deco])),hM.from(t)}var EM={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},DM=ek&&tk<=11,OM=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},kM=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new OM,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);ek&&tk<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ok&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),DM&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,EM)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(MA(this.view)){if(this.suppressingSelectionUpdates)return SA(this.view);if(ek&&tk<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&IO(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=MO(n))t.add(n);for(let r=e.anchorNode;r;r=MO(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&MA(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ik&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(nk&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||FM(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&WO(n)&&(c=bA(e))&&c.eq(aO.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,SA(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),MM(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,IM(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||SA(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ek&&tk<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?jO(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?jO(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},AM=new WeakMap,jM=!1;function MM(e){if(!AM.has(e)&&(AM.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=nk,jM)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),jM=!0}}function NM(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return IO(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function PM(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return NM(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?NM(e,n):null}function FM(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function IM(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function LM(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],WO(c)||l.push({node:c.focusNode,offset:c.focusOffset})),ik&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||wE.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace!=`pre`||`full`,findPositions:l,ruleFromNode:RM,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function RM(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(ok&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||ok&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var zM=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function BM(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=bA(e,t);if(n&&!e.state.selection.eq(n)){if(ik&&uk&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,GO(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=LM(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=GM(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(sk&&e.input.lastIOSEnter>Date.now()-225||uk)&&i.some(e=>e.nodeType==1&&!zM.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,GO(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof lO&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=VM(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof lO&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ek&&tk<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((sk&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,GO(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&UM(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,GO(8,`Backspace`)))){uk&&ik&&e.domObserver.suppressSelectionUpdates();return}ik&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),uk&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,GO(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=VM(e,n.doc,l.sel);t&&!(ik&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||ek&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){ek&&tk<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>SA(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=HM(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function VM(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:jA(e,t.resolve(n.anchor),t.resolve(n.head))}function HM(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if($.from(l).eq(e))return{mark:s,type:o}}function UM(e,t,n,r,i){if(n-t<=i.pos-r.pos||WM(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(WM(a,!0,!0));return!o.parent.isTextblock||o.pos>n||WM(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function WM(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function GM(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var KM=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new yj,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach($M),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=YM(this),JM(this),this.nodeViews=ZM(this),this.docView=eA(this.state.doc,qM(this),TM(this),this.dom,this),this.domObserver=new kM(this,(e,t,n,r)=>BM(this,e,t,n,r)),this.domObserver.start(),bj(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Cj(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach($M),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(qj(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ZM(this);QM(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Cj(this),this.editable=YM(this),JM(this);let o=TM(this),s=qM(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&_k(this);if(i){this.domObserver.stop();let t=l&&(ek||ik)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&XM(n.selection,e.selection);if(l){let n=ik?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Jj(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=eA(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&PA(this)&&i.delaySelUpdate())?SA(this,t):(kA(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&yk(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof dO){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&gk(this,t.getBoundingClientRect(),e)}else gk(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new nM(e.slice,e.move,r<0?void 0:dO.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(ek){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Sk(this.dom),SA(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Ak(this,e)}coordsAtPos(e,t=1){return Pk(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Wk(this,t||this.state,e)}pasteHTML(e,t){return eM(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return eM(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return ej(this,e)}destroy(){this.docView&&(Sj(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],TM(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,FO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ej(this,e)}domSelectionRange(){let e=this.domSelection();return e?ok&&this.root.nodeType===11&&KO(this.dom.ownerDocument)==this.dom&&PM(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};KM.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function qM(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[uM.node(0,e.state.doc.content.size,t)]}function JM(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:uM.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function YM(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function XM(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function ZM(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function QM(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function $M(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var eN={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},tN={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},nN=typeof navigator<`u`&&/Mac/.test(navigator.platform),rN=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),iN=0;iN<10;iN++)eN[48+iN]=eN[96+iN]=String(iN);for(var iN=1;iN<=24;iN++)eN[iN+111]=`F`+iN;for(var iN=65;iN<=90;iN++)eN[iN]=String.fromCharCode(iN+32),tN[iN]=String.fromCharCode(iN);for(var aN in eN)tN.hasOwnProperty(aN)||(tN[aN]=eN[aN]);function oN(e){var t=!(nN&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||rN&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?tN:eN)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var sN=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),cN=typeof navigator<`u`&&/Win/.test(navigator.platform);function lN(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))sN?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function uN(e){let t=Object.create(null);for(let n in e)t[lN(n)]=e[n];return t}function dN(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function fN(e){return new DO({props:{handleKeyDown:pN(e)}})}function pN(e){let t=uN(e);return function(e,n){let r=oN(n),i,a=t[dN(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[dN(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(cN&&n.ctrlKey&&n.altKey)&&(i=eN[n.keyCode])&&i!=r){let r=t[dN(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var mN=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function hN(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var gN=(e,t,n)=>{let r=hN(e,n);if(!r)return!1;let i=SN(r);if(!i){let n=r.blockRange(),i=n&&vD(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(BN(e,i,t,-1))return!0;if(r.parent.content.size==0&&(bN(a,`end`)||dO.isSelectable(a)))for(let n=r.depth;;n--){let o=zD(e.doc,r.before(n),r.after(n),AT.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(bN(a,`end`)?aO.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):dO.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},_N=(e,t,n)=>{let r=hN(e,n);if(!r)return!1;let i=SN(r);return i?yN(e,i,t):!1},vN=(e,t,n)=>{let r=CN(e,n);if(!r)return!1;let i=EN(r);return i?yN(e,i,t):!1};function yN(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=zD(e.doc,i,o,AT.empty);if(!s||s.from!=i||s instanceof dD&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(lO.create(t.doc,i)),n(t.scrollIntoView())}return!0}function bN(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var xN=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=SN(r)}let o=a&&a.nodeBefore;return!o||!dO.isSelectable(o)?!1:(t&&t(e.tr.setSelection(dO.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function SN(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function CN(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var wN=(e,t,n)=>{let r=CN(e,n);if(!r)return!1;let i=EN(r);if(!i)return!1;let a=i.nodeAfter;if(BN(e,i,t,1))return!0;if(r.parent.content.size==0&&(bN(a,`start`)||dO.isSelectable(a))){let n=zD(e.doc,r.before(),r.after(),AT.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(bN(a,`start`)?aO.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):dO.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},TN=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=EN(r)}let o=a&&a.nodeAfter;return!o||!dO.isSelectable(o)?!1:(t&&t(e.tr.setSelection(dO.create(e.doc,a.pos)).scrollIntoView()),!0)};function EN(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var DN=(e,t)=>{let n=e.selection,r=n instanceof dO,i;if(r){if(n.node.isTextblock||!MD(e.doc,n.from))return!1;i=n.from}else if(i=FD(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(dO.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},ON=(e,t)=>{let n=e.selection,r;if(n instanceof dO){if(n.node.isTextblock||!MD(e.doc,n.to))return!1;r=n.to}else if(r=FD(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},kN=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&vD(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},AN=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
`).scrollIntoView()),!0)};function jN(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var MN=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=jN(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(aO.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},NN=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof pO||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=jN(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(lO.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},PN=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(AD(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&vD(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function FN(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof dO&&t.selection.node.isBlock)return!r.parentOffset||!AD(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=jN(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof lO||t.selection instanceof pO)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=AD(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,AD(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var IN=FN(),LN=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(dO.create(e.doc,i))),!0)},RN=(e,t)=>(t&&t(e.tr.setSelection(new pO(e.doc))),!0);function zN(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||MD(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function BN(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&zN(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=$.empty;for(let e=o.length-1;e>=0;e--)s=$.from(o[e].create(null,s));s=$.from(i.copy(s));let c=e.tr.step(new fD(t.pos-1,r,t.pos,r,new AT(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&MD(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:aO.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&vD(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&bN(a,`start`,!0)&&bN(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=$.empty;for(let e=o.length-1;e>=0;e--)r=$.from(o[e].copy(r));n(e.tr.step(new fD(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new AT(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function VN(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(lO.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var HN=VN(-1),UN=VN(1);function WN(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&bD(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function GN(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function KN(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var qN=KN(mN,gN,xN),JN=KN(mN,wN,TN),YN={Enter:KN(AN,NN,PN,IN),"Mod-Enter":MN,Backspace:qN,"Mod-Backspace":qN,"Shift-Backspace":qN,Delete:JN,"Mod-Delete":JN,"Mod-a":RN},XN={"Ctrl-h":YN.Backspace,"Alt-Backspace":YN[`Mod-Backspace`],"Ctrl-d":YN.Delete,"Ctrl-Alt-Backspace":YN[`Mod-Delete`],"Alt-Delete":YN[`Mod-Delete`],"Alt-d":YN[`Mod-Delete`],"Ctrl-a":HN,"Ctrl-e":UN};for(let e in YN)XN[e]=YN[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function ZN(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return QN(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function QN(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new qT(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new qT(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=bD(a,n,r,t);return s?(e&&$N(e,t,s,i,n),!0):!1}function $N(e,t,n,r,i){let a=$.empty;for(let e=n.length-1;e>=0;e--)a=$.from(n[e].type.create(n[e].attrs,a));e.step(new fD(t.start-(r?2:0),t.end,t.start,t.end,new AT(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&AD(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function eP(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?tP(t,n,e,a):nP(t,n,a):!0:!1}}function tP(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new fD(a-1,o,a,o,new AT($.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new qT(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=vD(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return MD(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function nP(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?$.empty:$.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new fD(d-+!!s,f+ +!!c,d+1,f-1,new AT((s?$.empty:$.from(i.copy($.empty))).append(c?$.empty:$.from(i.copy($.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function rP(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=$.from(r?e.create():null),o=new AT($.from(e.create(null,$.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new fD(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function iP(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var aP=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:iP({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},oP=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function sP(e,t,n){return e.config[t]===void 0&&e.parent?sP(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?sP(e.parent,t,n):null}):e.config[t]}function cP(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function lP(e){let t=[],{nodeExtensions:n,markExtensions:r}=cP(e),i=[...n,...r],a={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{let n=sP(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=sP(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function uP(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function dP(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=t?t.split(`;`).map(e=>e.trim()).filter(Boolean):[],i=n[e]?n[e].split(`;`).map(e=>e.trim()).filter(Boolean):[],a=new Map;i.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());a.set(t,n)}),n[e]=Array.from(a.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function fP(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>dP(e,t),{})}function pP(e){return typeof e==`function`}function mP(e,t=void 0,...n){return pP(e)?t?e.bind(t)(...n):e(...n):e}function hP(e={}){return Object.keys(e).length===0&&e.constructor===Object}function gP(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function _P(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):gP(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function vP(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&hP(t)?!1:t!=null))}function yP(e,t){let n=lP(e),{nodeExtensions:r,markExtensions:i}=cP(e);return new bE({topNode:r.find(e=>sP(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=vP({...e.reduce((e,t)=>{let n=sP(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:mP(sP(r,`content`,a)),marks:mP(sP(r,`marks`,a)),group:mP(sP(r,`group`,a)),inline:mP(sP(r,`inline`,a)),atom:mP(sP(r,`atom`,a)),selectable:mP(sP(r,`selectable`,a)),draggable:mP(sP(r,`draggable`,a)),code:mP(sP(r,`code`,a)),whitespace:mP(sP(r,`whitespace`,a)),linebreakReplacement:mP(sP(r,`linebreakReplacement`,a)),defining:mP(sP(r,`defining`,a)),isolating:mP(sP(r,`isolating`,a)),attrs:Object.fromEntries(i.map(e=>[e.name,{default:e?.attribute?.default}]))}),s=mP(sP(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>_P(e,i)));let c=sP(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:fP(e,i)}));let l=sP(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=vP({...e.reduce((e,t)=>{let n=sP(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:mP(sP(r,`inclusive`,a)),excludes:mP(sP(r,`excludes`,a)),group:mP(sP(r,`group`,a)),spanning:mP(sP(r,`spanning`,a)),code:mP(sP(r,`code`,a)),attrs:Object.fromEntries(i.map(e=>[e.name,{default:e?.attribute?.default}]))}),s=mP(sP(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>_P(e,i)));let c=sP(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:fP(e,i)})),[r.name,o]}))})}function bP(e,t){return t.nodes[e]||t.marks[e]||null}function xP(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function SP(e,t){let n=RE.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}var CP=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function wP(e){return Object.prototype.toString.call(e)===`[object RegExp]`}var TP=class{constructor(e){this.find=e.find,this.handler=e.handler}},EP=(e,t)=>{if(wP(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function DP(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=CP(c)+i;return a.forEach(e=>{if(l)return;let a=EP(u,e.find);if(!a)return;let c=s.state.tr,d=iP({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new aP({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function OP(e){let{editor:t,rules:n}=e,r=new DO({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:SP($.from(e),a.schema);let{from:i}=s,o=i+e.length;DP({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return DP({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&DP({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?DP({editor:t,from:a.pos,to:a.pos,text:`
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function kP(e){return Object.prototype.toString.call(e).slice(8,-1)}function AP(e){return kP(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function jP(e,t){let n={...e};return AP(e)&&AP(t)&&Object.keys(t).forEach(r=>{AP(t[r])&&AP(e[r])?n[r]=jP(e[r],t[r]):n[r]=t[r]}),n}var MP=class e{constructor(e={}){this.type=`mark`,this.name=`mark`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=mP(sP(this,`addOptions`,{name:this.name}))),this.storage=mP(sP(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>jP(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=mP(sP(n,`addOptions`,{name:n.name})),n.storage=mP(sP(n,`addStorage`,{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}};function NP(e){return typeof e==`number`}var PP=class{constructor(e){this.find=e.find,this.handler=e.handler}},FP=(e,t,n)=>{if(wP(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function IP(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new aP({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;let f=Math.max(r,t),p=Math.min(i,t+e.content.size);FP(e.textBetween(f-t,p-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=f+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(p)})}),d.every(e=>e!==null)}var LP=null,RP=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function zP(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=iP({state:e,transaction:c});if(!(!IP({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new DO({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(LP=t)},i=()=>{LP&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=LP;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:SP($.from(t),r.schema);let{from:n}=d,i=n+t.length,a=RP(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!NP(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}function BP(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}var VP=class e{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=e.resolve(t),this.schema=yP(this.extensions,n),this.setupExtensions()}static resolve(t){let n=e.sort(e.flatten(t)),r=BP(n.map(e=>e.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),n}static flatten(e){return e.map(e=>{let t=sP(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...this.flatten(t())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{let n=sP(e,`priority`)||100,r=sP(t,`priority`)||100;return n>r?-1:+(n<r)})}get commands(){return this.extensions.reduce((e,t)=>{let n=sP(t,`addCommands`,{name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:bP(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:t}=this,n=e.sort([...this.extensions].reverse()),r=[],i=[],a=n.map(e=>{let n={name:e.name,options:e.options,storage:e.storage,editor:t,type:bP(e.name,this.schema)},a=[],o=sP(e,`addKeyboardShortcuts`,n),s={};if(e.type===`mark`&&sP(e,`exitable`,n)&&(s.ArrowRight=()=>MP.handleExit({editor:t,mark:e})),o){let e=Object.fromEntries(Object.entries(o()).map(([e,n])=>[e,()=>n({editor:t})]));s={...s,...e}}let c=fN(s);a.push(c);let l=sP(e,`addInputRules`,n);xP(e,t.options.enableInputRules)&&l&&r.push(...l());let u=sP(e,`addPasteRules`,n);xP(e,t.options.enablePasteRules)&&u&&i.push(...u());let d=sP(e,`addProseMirrorPlugins`,n);if(d){let e=d();a.push(...e)}return a}).flat();return[OP({editor:t,rules:r}),...zP({editor:t,rules:i}),...a]}get attributes(){return lP(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=cP(this.extensions);return Object.fromEntries(t.filter(e=>!!sP(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=sP(t,`addNodeView`,{name:t.name,options:t.options,storage:t.storage,editor:e,type:uP(t.name,this.schema)});return r?[t.name,(i,a,o,s,c)=>{let l=fP(i,n);return r()({node:i,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}setupExtensions(){this.extensions.forEach(e=>{this.editor.extensionStorage[e.name]=e.storage;let t={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:bP(e.name,this.schema)};e.type===`mark`&&(mP(sP(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=sP(e,`onBeforeCreate`,t),r=sP(e,`onCreate`,t),i=sP(e,`onUpdate`,t),a=sP(e,`onSelectionUpdate`,t),o=sP(e,`onTransaction`,t),s=sP(e,`onFocus`,t),c=sP(e,`onBlur`,t),l=sP(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}},HP=class e{constructor(e={}){this.type=`extension`,this.name=`extension`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=mP(sP(this,`addOptions`,{name:this.name}))),this.storage=mP(sP(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>jP(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=mP(sP(n,`addOptions`,{name:n.name})),n.storage=mP(sP(n,`addStorage`,{name:n.name,options:n.options})),n}};function UP(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`

`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function WP(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var GP=HP.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new DO({key:new AO(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=WP(n);return UP(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),KP=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),qP=(e=!1)=>({commands:t})=>t.setContent(``,e),JP=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=vD(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},YP=e=>t=>e(t),XP=()=>({state:e,dispatch:t})=>NN(e,t),ZP=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new lO(r.doc.resolve(Math.max(o-1,0)))),!0},QP=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1},$P=e=>({tr:t,state:n,dispatch:r})=>{let i=uP(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},eF=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},tF=()=>({state:e,dispatch:t})=>mN(e,t),nF=()=>({commands:e})=>e.keyboardShortcut(`Enter`),rF=()=>({state:e,dispatch:t})=>MN(e,t);function iF(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:wP(t[r])?t[r].test(e[r]):t[r]===e[r])}function aF(e,t,n={}){return e.find(e=>e.type===t&&iF(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function oF(e,t,n={}){return!!aF(e,t,n)}function sF(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t)||(n||=r.node.marks[0]?.attrs,!aF([...r.node.marks],t,n)))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&oF([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&oF([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function cF(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var tee=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=cF(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=sF(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=lO.create(o,e.from,e.to);n.setSelection(t)}}return!0},lF=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function uF(e){return e instanceof lO}function dF(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function fF(e,t=null){if(!t)return null;let n=aO.atStart(e),r=aO.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?lO.create(e,dF(0,i,a),dF(e.content.size,i,a)):lO.create(e,dF(t,i,a),dF(t,i,a))}function pF(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function mF(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function hF(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var gF=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(mF()||pF())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),hF()&&!mF()&&!pF()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&e===null||e===!1)return!0;if(a&&e===null&&!uF(n.state.selection))return o(),!0;let s=fF(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},_F=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),vF=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),yF=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&yF(r)}return e};function bF(e){let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return yF(n)}function xF(e,t,n){if(e instanceof YT||e instanceof $)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return $.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),xF(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new bE({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?wE.fromSchema(a).parseSlice(bF(e),n.parseOptions):wE.fromSchema(a).parse(bF(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=wE.fromSchema(t);return n.slice?r.parseSlice(bF(e),n.parseOptions).content:r.parse(bF(e),n.parseOptions)}return xF(``,t,n)}function SF(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof dD||i instanceof fD))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(aO.near(e.doc.resolve(o),n))}var CF=e=>!(`type`in e),wF=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xF(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=xF(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((CF(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof $){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else f=i,r.replaceWith(c,l,f);n.updateSelection&&SF(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},TF=()=>({state:e,dispatch:t})=>DN(e,t),EF=()=>({state:e,dispatch:t})=>ON(e,t),DF=()=>({state:e,dispatch:t})=>gN(e,t),OF=()=>({state:e,dispatch:t})=>wN(e,t),kF=()=>({state:e,dispatch:t,tr:n})=>{try{let r=FD(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},AF=()=>({state:e,dispatch:t,tr:n})=>{try{let r=FD(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},jF=()=>({state:e,dispatch:t})=>_N(e,t),MF=()=>({state:e,dispatch:t})=>vN(e,t);function NF(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function PF(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))mF()||NF()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var FF=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=PF(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function IF(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?uP(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>iF(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var LF=(e,t={})=>({state:n,dispatch:r})=>IF(n,uP(e,n.schema),t)?kN(n,r):!1,RF=()=>({state:e,dispatch:t})=>PN(e,t),zF=e=>({state:t,dispatch:n})=>eP(uP(e,t.schema))(t,n),BF=()=>({state:e,dispatch:t})=>AN(e,t);function VF(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function HF(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var UF=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VF(typeof e==`string`?e:e.name,r.schema);return s?(s===`node`&&(a=uP(e,r.schema)),s===`mark`&&(o=cF(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&n.setNodeMarkup(r,void 0,HF(e.attrs,t)),o&&e.marks.length&&e.marks.forEach(i=>{o===i.type&&n.addMark(r,r+e.nodeSize,o.create(HF(i.attrs,t)))})})}),!0):!1},WF=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),GF=()=>({tr:e,dispatch:t})=>{if(t){let t=new pO(e.doc);e.setSelection(t)}return!0},KF=()=>({state:e,dispatch:t})=>xN(e,t),qF=()=>({state:e,dispatch:t})=>TN(e,t),JF=()=>({state:e,dispatch:t})=>LN(e,t),YF=()=>({state:e,dispatch:t})=>UN(e,t),XF=()=>({state:e,dispatch:t})=>HN(e,t);function ZF(e,t,n={},r={}){return xF(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var QF=(e,t=!1,n={},r={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(n.preserveWhitespace!==`full`){let s=ZF(e,i.schema,n,{errorOnInvalidContent:r.errorOnInvalidContent??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!t),!0}return o&&a.setMeta(`preventUpdate`,!t),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent??i.options.enableContentCheck})};function $F(e,t){let n=cF(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function eI(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function tI(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function nI(e){return t=>tI(t.$from,e)}function rI(e,t){return UP(e,{from:0,to:e.content.size},t)}function iI(e,t){let n=uP(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function aI(e,t){let n=VF(typeof t==`string`?t:t.name,e.schema);return n===`node`?iI(e,t):n===`mark`?$F(e,t):{}}function oI(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=sF(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function sI(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}function cI(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?cF(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>iF(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize),c=a-n;o+=c,s.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>iF(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function lI(e,t,n={}){if(!t)return IF(e,null,n)||cI(e,null,n);let r=VF(t,e.schema);return r===`node`?IF(e,t,n):r===`mark`&&cI(e,t,n)}function uI(e,t){let{nodeExtensions:n}=cP(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=mP(sP(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function dI(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return/^\s*$/m.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(dI(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function fI(e){return e instanceof dO}function pI(e,t,n){let{selection:r}=t,i=null;if(uF(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return!!n.isInSet(t)||!t.some(e=>e.type.excludes(n))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var mI=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=cF(e,r.schema);if(i)if(o){let e=$F(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return pI(r,n,c)},hI=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),gI=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=uP(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>GN(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>GN(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},_I=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=dF(e,0,n.content.size),i=dO.create(n,r);t.setSelection(i)}return!0},vI=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=lO.atStart(n).from,o=lO.atEnd(n).to,s=dF(r,a,o),c=dF(i,a,o),l=lO.create(n,s,c);t.setSelection(l)}return!0},yI=e=>({state:t,dispatch:n})=>rP(uP(e,t.schema))(t,n);function bI(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var xI=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=sI(l,s.node().type.name,s.node().attrs);if(a instanceof dO&&a.node.isBlock)return!s.parentOffset||!AD(o,s.pos)?!1:(r&&(e&&bI(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:eI(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=AD(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&AD(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof lO&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&bI(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},SI=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=uP(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=$.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=$.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...sI(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append($.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new AT(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(lO.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...sI(d,u.type.name,u.attrs),...t},m={...sI(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!AD(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},CI=(e,t)=>{let n=nI(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&MD(e.doc,n.pos)&&e.join(n.pos),!0},wI=(e,t)=>{let n=nI(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&MD(e.doc,r)&&e.join(r),!0},TI=Object.freeze({__proto__:null,blur:KP,clearContent:qP,clearNodes:JP,command:YP,createParagraphNear:XP,cut:ZP,deleteCurrentNode:QP,deleteNode:$P,deleteRange:eF,deleteSelection:tF,enter:nF,exitCode:rF,extendMarkRange:tee,first:lF,focus:gF,forEach:_F,insertContent:vF,insertContentAt:wF,joinBackward:DF,joinDown:EF,joinForward:OF,joinItemBackward:kF,joinItemForward:AF,joinTextblockBackward:jF,joinTextblockForward:MF,joinUp:TF,keyboardShortcut:FF,lift:LF,liftEmptyBlock:RF,liftListItem:zF,newlineInCode:BF,resetAttributes:UF,scrollIntoView:WF,selectAll:GF,selectNodeBackward:KF,selectNodeForward:qF,selectParentNode:JF,selectTextblockEnd:YF,selectTextblockStart:XF,setContent:QF,setMark:mI,setMeta:hI,setNode:gI,setNodeSelection:_I,setTextSelection:vI,sinkListItem:yI,splitBlock:xI,splitListItem:SI,toggleList:(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=uP(e,o.schema),m=uP(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=nI(e=>uI(e.type.name,d))(h);if(y.depth>=1&&x&&y.depth-x.depth<=1){if(x.node.type===p)return l.liftListItem(m);if(uI(x.node.type.name,d)&&p.validContent(x.node.content)&&s)return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>CI(a,p)).command(()=>wI(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>CI(a,p)).command(()=>wI(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>CI(a,p)).command(()=>wI(a,p)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=cF(e,r.schema);return cI(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{let a=uP(e,r.schema),o=uP(t,r.schema),s=IF(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},toggleWrap:(e,t={})=>({state:n,commands:r})=>{let i=uP(e,n.schema);return IF(n,i,t)?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=cF(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=sF(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=VF(typeof e==`string`?e:e.name,r.schema);return s?(s===`node`&&(a=uP(e,r.schema)),s===`mark`&&(o=cF(e,r.schema)),i&&n.selection.ranges.forEach(e=>{let i=e.$from.pos,s=e.$to.pos,c,l,u,d;n.selection.empty?r.doc.nodesBetween(i,s,(e,t)=>{a&&a===e.type&&(u=Math.max(t,i),d=Math.min(t+e.nodeSize,s),c=t,l=e)}):r.doc.nodesBetween(i,s,(e,r)=>{r<i&&a&&a===e.type&&(u=Math.max(r,i),d=Math.min(r+e.nodeSize,s),c=r,l=e),r>=i&&r<=s&&(a&&a===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type){let c=Math.max(r,i),l=Math.min(r+e.nodeSize,s);n.addMark(c,l,o.create({...a.attrs,...t}))}}))}),l&&(c!==void 0&&n.setNodeMarkup(c,void 0,{...l.attrs,...t}),o&&l.marks.length&&l.marks.forEach(e=>{o===e.type&&n.addMark(u,d,o.create({...e.attrs,...t}))}))}),!0):!1},wrapIn:(e,t={})=>({state:n,dispatch:r})=>WN(uP(e,n.schema),t)(n,r),wrapInList:(e,t={})=>({state:n,dispatch:r})=>ZN(uP(e,n.schema),t)(n,r)}),EI=HP.create({name:`commands`,addCommands(){return{...TI}}}),DI=HP.create({name:`drop`,addProseMirrorPlugins(){return[new DO({key:new AO(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),OI=HP.create({name:`editable`,addProseMirrorPlugins(){return[new DO({key:new AO(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),kI=new AO(`focusEvents`),AI=HP.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new DO({key:kI,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),jI=HP.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:aO.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return mF()||NF()?i:r},addProseMirrorPlugins(){return[new DO({key:new AO(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=aO.atStart(t.doc).from,l=aO.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!dI(n.doc))return;let u=n.tr,d=iP({state:n,transaction:u}),{commands:f}=new aP({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),MI=HP.create({name:`paste`,addProseMirrorPlugins(){return[new DO({key:new AO(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),NI=HP.create({name:`tabindex`,addProseMirrorPlugins(){return[new DO({key:new AO(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),PI=Object.freeze({__proto__:null,ClipboardTextSerializer:GP,Commands:EI,Drop:DI,Editable:OI,FocusEvents:AI,Keymap:jI,Paste:MI,Tabindex:NI,focusEventsPluginKey:kI}),FI=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=this.pos+r+ +!a;if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;let s=this.resolvedPos.doc.resolve(o);if(!i&&s.depth<=this.depth)return;let c=new e(s,this.editor,i,i?n:null);i&&(c.actualDepth=this.depth+1),t.push(new e(s,this.editor,i,i?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},II=`.ProseMirror {
  position: relative;
}

.ProseMirror {
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}

.ProseMirror [contenteditable="false"] {
  white-space: normal;
}

.ProseMirror [contenteditable="false"] [contenteditable="true"] {
  white-space: pre-wrap;
}

.ProseMirror pre {
  white-space: pre-wrap;
}

img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.ProseMirror-gapcursor {
  display: none;
  pointer-events: none;
  position: absolute;
  margin: 0;
}

.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid black;
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}

@keyframes ProseMirror-cursor-blink {
  to {
    visibility: hidden;
  }
}

.ProseMirror-hideselection *::selection {
  background: transparent;
}

.ProseMirror-hideselection *::-moz-selection {
  background: transparent;
}

.ProseMirror-hideselection * {
  caret-color: transparent;
}

.ProseMirror-focused .ProseMirror-gapcursor {
  display: block;
}

.tippy-box[data-animation=fade][data-state=hidden] {
  opacity: 0
}`;function LI(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var RI=class extends oP{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement(`div`),content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`contentError`,this.options.onContentError),this.createView(),this.injectCSS(),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=LI(II,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let n=pP(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[OI,GP.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),EI,AI,jI,NI,DI,MI].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new VP(e,this)}createCommandManager(){this.commandManager=new aP({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=ZF(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=ZF(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let t=fF(e,this.options.autofocus);this.view=new KM(this.options.element,{...this.options.editorProps,attributes:{role:`textbox`,...this.options.editorProps?.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:TO.create({doc:e,selection:t||void 0})});let n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();let r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e}),n&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let r=e.getMeta(`focus`),i=e.getMeta(`blur`);r&&this.emit(`focus`,{editor:this,event:r.event,transaction:e}),i&&this.emit(`blur`,{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta(`preventUpdate`))&&this.emit(`update`,{editor:this,transaction:e})}getAttributes(e){return aI(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return lI(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return SP(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`

`,textSerializers:n={}}=e||{};return rI(this.state.doc,{blockSeparator:t,textSerializers:{...WP(this.schema),...n}})}get isEmpty(){return dI(this.state.doc)}getCharacterCount(){return console.warn(`[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.`),this.state.doc.content.size-2}destroy(){if(this.emit(`destroy`),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){return!this.view?.docView}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new FI(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function zI(e){return new TP({find:e.find,handler:({state:t,range:n,match:r})=>{let i=mP(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(oI(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}}})}function BI(e){return new TP({find:e.find,handler:({state:t,range:n,match:r})=>{let i=mP(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()}})}function VI(e){return new TP({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=mP(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)}})}function HI(e){return new TP({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=mP(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&bD(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&MD(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)}})}var UI=class e{constructor(e={}){this.type=`node`,this.name=`node`,this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=mP(sP(this,`addOptions`,{name:this.name}))),this.storage=mP(sP(this,`addStorage`,{name:this.name,options:this.options}))||{}}static create(t={}){return new e(t)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>jP(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(t={}){let n=new e(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=mP(sP(n,`addOptions`,{name:n.name})),n.storage=mP(sP(n,`addStorage`,{name:n.name,options:n.options})),n}};function WI(e){return new PP({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=mP(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let r=c.search(/\S/),i=n.from+c.indexOf(s),u=i+s.length;if(oI(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>i).length)return null;u<n.to&&o.delete(u,n.to),i>n.from&&o.delete(n.from+r,i),l=n.from+r+s.length,o.addMark(n.from+r,l,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function GI(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof dO){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function KI(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function qI(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var JI={exports:{}},YI={},XI;function ZI(){if(XI)return YI;XI=1;var e=T.default;function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var n=typeof Object.is==`function`?Object.is:t,r=e.useState,i=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function s(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),l=s[0].inst,u=s[1];return a(function(){l.value=n,l.getSnapshot=t,c(l)&&u({inst:l})},[e,n,t]),i(function(){return c(l)&&u({inst:l}),e(function(){c(l)&&u({inst:l})})},[e]),o(n),n}function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}function l(e,t){return t()}var u=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?l:s;return YI.useSyncExternalStore=e.useSyncExternalStore===void 0?u:e.useSyncExternalStore,YI}JI.exports=ZI();var QI=JI.exports,$I=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},eL=({contentComponent:e})=>{let t=QI.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return T.createElement(T.Fragment,null,Object.values(t))};function tL(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Kd.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var nL=class extends T.Component{constructor(e){super(e),this.editorContentRef=T.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!e.editor?.contentComponent}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=tL(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){let e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;let t=document.createElement(`div`);t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){let{editor:e,innerRef:t,...n}=this.props;return T.createElement(T.Fragment,null,T.createElement(`div`,{ref:$I(t,this.editorContentRef),...n}),e?.contentComponent&&T.createElement(eL,{contentComponent:e.contentComponent}))}},rL=(0,T.forwardRef)((e,t)=>{let n=T.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return T.createElement(nL,{key:n,innerRef:t,...e})}),iL=T.memo(rL),aL=qI(function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!(o===`_owner`&&t.$$typeof)&&!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}),oL={exports:{}},sL={},cL;function lL(){if(cL)return sL;cL=1;var e=T.default,t=QI;function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,c=e.useDebugValue;return sL.useSyncExternalStoreWithSelector=function(e,t,n,l,u){var d=a(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!i){if(i=!0,a=e,e=l(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return o=t}return o=e}if(t=o,r(a,e))return t;var n=l(e);return u!==void 0&&u(t,n)?t:(a=e,o=n)}var i=!1,a,o,s=n===void 0?null:n;return[function(){return e(t())},s===null?void 0:function(){return e(s())}]},[t,n,l,u]);var p=i(e,d[0],d[1]);return o(function(){f.hasValue=!0,f.value=p},[p]),c(p),p},sL}oL.exports=lL();var uL=oL.exports,dL=typeof window<`u`?T.useLayoutEffect:T.useEffect,fL=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function pL(e){let[t]=(0,T.useState)(()=>new fL(e.editor)),n=uL.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??aL);return dL(()=>t.watch(e.editor),[e.editor,t]),(0,T.useDebugValue)(n),n}var mL=typeof window>`u`,hL=mL||!!(typeof window<`u`&&window.next),gL=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?mL||hL?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){return new RI({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function _L(e={},t=[]){let n=(0,T.useRef)(e);n.current=e;let[r]=(0,T.useState)(()=>new gL(n)),i=QI.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,T.useDebugValue)(i),(0,T.useEffect)(r.onRender(t)),pL({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&t===0?0:t+1}),i}(0,T.createContext)({editor:null}).Consumer;var vL=(0,T.createContext)({onDragStart:void 0}),yL=()=>(0,T.useContext)(vL);T.forwardRef((e,t)=>{let{onDragStart:n}=yL(),r=e.as||`div`;return T.createElement(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});var bL=/^\s*>\s$/,xL=UI.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return[`blockquote`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[HI({find:bL,type:this.type})]}}),SL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,CL=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,wL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,TL=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,EL=MP.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return[`strong`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[zI({find:SL,type:this.type}),zI({find:wL,type:this.type})]},addPasteRules(){return[WI({find:CL,type:this.type}),WI({find:TL,type:this.type})]}}),DL=`listItem`,OL=`textStyle`,kL=/^\s*([-+*])\s$/,AL=UI.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(DL,this.editor.getAttributes(OL)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=HI({find:kL,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=HI({find:kL,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(OL),editor:this.editor})),[e]}}),jL=/(^|[^`])`([^`]+)`(?!`)/,ML=/(^|[^`])`([^`]+)`(?!`)/g,NL=MP.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[zI({find:jL,type:this.type})]},addPasteRules(){return[WI({find:ML,type:this.type})]}}),PL=/^```([a-z]+)?[\s\n]$/,FL=/^~~~([a-z]+)?[\s\n]$/,IL=UI.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,dP(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`

`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(aO.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[VI({find:PL,type:this.type,getAttributes:e=>({language:e[1]})}),VI({find:FL,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new DO({key:new AO(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(lO.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),LL=UI.create({name:`doc`,topNode:!0,content:`block+`});function RL(e={}){return new DO({view(t){return new zL(t,e)}})}var zL=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=RD(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},BL=HP.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[RL(this.options)]}}),VL=class e extends aO{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):aO.near(r)}content(){return AT.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new HL(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!WL(e)||!GL(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!dO.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};VL.prototype.visible=!1,VL.findFrom=VL.findGapCursorFrom,aO.jsonID(`gapcursor`,VL);var HL=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return VL.valid(t)?new VL(t):aO.near(t)}};function UL(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function WL(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||UL(e.type))return!0;if(e.inlineContent)return!1}}return!0}function GL(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||UL(e.type))return!0;if(e.inlineContent)return!1}}return!0}function KL(){return new DO({props:{decorations:ZL,createSelectionBetween(e,t,n){return t.pos==n.pos&&VL.valid(n)?new VL(n):null},handleClick:YL,handleKeyDown:qL,handleDOMEvents:{beforeinput:XL}}})}var qL=pN({ArrowLeft:JL(`horiz`,-1),ArrowRight:JL(`horiz`,1),ArrowUp:JL(`vert`,-1),ArrowDown:JL(`vert`,1)});function JL(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof lO){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=VL.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new VL(c))),!0):!1}}function YL(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!VL.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&dO.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new VL(r))),!0)}function XL(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof VL))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=$.empty;for(let e=r.length-1;e>=0;e--)i=$.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new AT(i,0,0));return a.setSelection(lO.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function ZL(e){if(!(e.selection instanceof VL))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,pM.create(e.doc,[uM.widget(e.selection.head,t,{key:`gapcursor`})])}var QL=HP.create({name:`gapCursor`,addProseMirrorPlugins(){return[KL()]},extendNodeSchema(e){return{allowGapCursor:mP(sP(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),$L=UI.create({name:`hardBreak`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,dP(this.options.HTMLAttributes,e)]},renderText(){return`
`},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),eR=UI.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,dP(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>VI({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),tR=200,nR=function(){};nR.prototype.append=function(e){return e.length?(e=nR.from(e),!this.length&&e||e.length<tR&&this.leafAppend(e)||this.length<tR&&e.leafPrepend(this)||this.appendInner(e)):this},nR.prototype.prepend=function(e){return e.length?nR.from(e).append(this):this},nR.prototype.appendInner=function(e){return new iR(this,e)},nR.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?nR.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},nR.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},nR.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},nR.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},nR.from=function(e){return e instanceof nR?e:e&&e.length?new rR(e):nR.empty};var rR=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=tR)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=tR)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(nR);nR.empty=new rR([]);var iR=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(nR),aR=500,oR=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new cR(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new cR(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new cR(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>uR&&(s=sR(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new nD;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new cR(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new cR(i,o,l))}else r.push(new cR(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new cR(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>aR&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new cR(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(nR.from(i.reverse()),a)}};oR.empty=new oR(nR.empty,0);function sR(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var cR=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},lR=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},uR=20;function dR(e,t,n,r){let i=n.getMeta(yR),a;if(i)return i.historyState;n.getMeta(bR)&&(e=new lR(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(yR))return o.getMeta(yR).redo?new lR(e.done.addTransform(n,void 0,r,vR(t)),e.undone,pR(n.mapping.maps),e.prevTime,e.prevComposition):new lR(e.done,e.undone.addTransform(n,void 0,r,vR(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!fR(n,e.prevRanges)),s=o?mR(e.prevRanges,n.mapping):pR(n.mapping.maps);return new lR(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,vR(t)),oR.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new lR(e.done.rebased(n,a),e.undone.rebased(n,a),mR(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new lR(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),mR(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function fR(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function pR(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function mR(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function hR(e,t,n){let r=vR(t),i=yR.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new lR(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(yR,{redo:n,historyState:c})}var gR=!1,_R=null;function vR(e){let t=e.plugins;if(_R!=t){gR=!1,_R=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){gR=!0;break}}return gR}var yR=new AO(`history`),bR=new AO(`closeHistory`);function xR(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new DO({key:yR,state:{init(){return new lR(oR.empty,oR.empty,null,0,-1)},apply(t,n,r){return dR(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?CR:n==`historyRedo`?wR:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function SR(e,t){return(n,r)=>{let i=yR.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=hR(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var CR=SR(!1,!0),wR=SR(!0,!0),TR=HP.create({name:`history`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>CR(e,t),redo:()=>({state:e,dispatch:t})=>wR(e,t)}},addProseMirrorPlugins(){return[xR(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ER=UI.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{}}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,dP(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!GI(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$from:r,$to:i}=n,a=e();return r.parentOffset===0?a.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):fI(n)?a.insertContentAt(i.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:e,dispatch:t})=>{if(t){let{$to:t}=e.selection,n=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(lO.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(dO.create(e.doc,t.pos)):e.setSelection(lO.create(e.doc,t.pos));else{let r=t.parent.type.contentMatch.defaultType?.create();r&&(e.insert(n,r),e.setSelection(lO.create(e.doc,n+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[BI({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),DR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,OR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,kR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,AR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,jR=MP.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[zI({find:DR,type:this.type}),zI({find:kR,type:this.type})]},addPasteRules(){return[WI({find:OR,type:this.type}),WI({find:AR,type:this.type})]}}),MR=UI.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,dP(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),NR=`listItem`,PR=`textStyle`,FR=/^(\d+)\.\s$/,IR=UI.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,dP(this.options.HTMLAttributes,n),0]:[`ol`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(NR,this.editor.getAttributes(PR)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=HI({find:FR,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=HI({find:FR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(PR)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),LR=UI.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),RR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,zR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,BR=MP.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,dP(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[zI({find:RR,type:this.type})]},addPasteRules(){return[WI({find:zR,type:this.type})]}}),VR=UI.create({name:`text`,group:`inline`}),HR=HP.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(EL.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(xL.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(AL.configure(this.options.bulletList)),this.options.code!==!1&&e.push(NL.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(IL.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(LL.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(BL.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(QL.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push($L.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(eR.configure(this.options.heading)),this.options.history!==!1&&e.push(TR.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(ER.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(jR.configure(this.options.italic)),this.options.listItem!==!1&&e.push(MR.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(IR.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(LR.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(BR.configure(this.options.strike)),this.options.text!==!1&&e.push(VR.configure(this.options.text)),e}}),UR={};function WR(e){let t=UR[e];if(t)return t;t=UR[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function GR(e,t){typeof t!=`string`&&(t=GR.defaultChars);let n=WR(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}GR.defaultChars=`;/?:@&=+$,#`,GR.componentChars=``;var KR={};function qR(e){let t=KR[e];if(t)return t;t=KR[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function JR(e,t,n){typeof t!=`string`&&(n=t,t=JR.defaultChars),n===void 0&&(n=!0);let r=qR(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}JR.defaultChars=`;/?:@&=+$,-_.!~*'()#`,JR.componentChars=`-_.!~*'()`;function YR(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function XR(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var ZR=/^([a-z0-9.+-]+:)/i,QR=/:[0-9]*$/,nee=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,$R=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
`,`	`],ez=[`/`,`?`,`#`],tz=255,nz=/^[+a-z0-9A-Z_-]{0,63}$/,rz=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,iz={javascript:!0,"javascript:":!0},az={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function oz(e,t){if(e&&e instanceof XR)return e;let n=new XR;return n.parse(e,t),n}XR.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=nee.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=ZR.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&iz[o])&&(a=a.substr(2),this.slashes=!0)),!iz[o]&&(i||o&&!az[o])){let e=-1;for(let t=0;t<ez.length;t++)r=a.indexOf(ez[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<$R.length;t++)r=a.indexOf($R[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(nz)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(nz)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(rz);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>tz&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),az[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},XR.prototype.parseHost=function(e){let t=QR.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var sz=n({decode:()=>GR,encode:()=>JR,format:()=>YR,parse:()=>oz}),cz=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,lz=/[\0-\x1F\x7F-\x9F]/,uz=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,dz=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,fz=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,pz=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,mz=n({Any:()=>cz,Cc:()=>lz,Cf:()=>uz,P:()=>dz,S:()=>fz,Z:()=>pz}),hz=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),gz=new Uint16Array(`Ȁaglq	\x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),_z=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),vz=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function yz(e){return e>=55296&&e<=57343||e>1114111?65533:_z.get(e)??e}var bz;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(bz||={});var xz=32,Sz;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(Sz||={});function Cz(e){return e>=bz.ZERO&&e<=bz.NINE}function wz(e){return e>=bz.UPPER_A&&e<=bz.UPPER_F||e>=bz.LOWER_A&&e<=bz.LOWER_F}function Tz(e){return e>=bz.UPPER_A&&e<=bz.UPPER_Z||e>=bz.LOWER_A&&e<=bz.LOWER_Z||Cz(e)}function Ez(e){return e===bz.EQUALS||Tz(e)}var Dz;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Dz||={});var Oz;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Oz||={});var kz=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Dz.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Oz.Strict}startEntity(e){this.decodeMode=e,this.state=Dz.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Dz.EntityStart:return e.charCodeAt(t)===bz.NUM?(this.state=Dz.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Dz.NamedEntity,this.stateNamedEntity(e,t));case Dz.NumericStart:return this.stateNumericStart(e,t);case Dz.NumericDecimal:return this.stateNumericDecimal(e,t);case Dz.NumericHex:return this.stateNumericHex(e,t);case Dz.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|xz)===bz.LOWER_X?(this.state=Dz.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Dz.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(Cz(r)||wz(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(Cz(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===bz.SEMI)this.consumed+=1;else if(this.decodeMode===Oz.Strict)return 0;return this.emitCodePoint(yz(this.result),this.consumed),this.errors&&(e!==bz.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&Sz.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=jz(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Oz.Attribute&&(i===0||Ez(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&Sz.VALUE_LENGTH)>>14,i!==0){if(a===bz.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Oz.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&Sz.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~Sz.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case Dz.NamedEntity:return this.result!==0&&(this.decodeMode!==Oz.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Dz.NumericDecimal:return this.emitNumericEntity(0,2);case Dz.NumericHex:return this.emitNumericEntity(0,3);case Dz.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Dz.EntityStart:return 0}}};function Az(e){let t=``,n=new kz(e,e=>t+=vz(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function jz(e,t,n,r){let i=(t&Sz.BRANCH_LENGTH)>>7,a=t&Sz.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var Mz=Az(hz);Az(gz);function Nz(e,t=Oz.Legacy){return Mz(e,t)}function Pz(e){return Mz(e,Oz.Strict)}var Fz=n({arrayReplaceAt:()=>Vz,asciiTrim:()=>uB,assign:()=>Bz,escapeHtml:()=>eB,escapeRE:()=>nB,fromCodePoint:()=>Uz,has:()=>zz,isMdAsciiPunct:()=>sB,isPunctChar:()=>aB,isPunctCharCode:()=>oB,isSpace:()=>rB,isString:()=>Lz,isValidEntityCode:()=>Hz,isWhiteSpace:()=>iB,lib:()=>dB,normalizeReference:()=>cB,unescapeAll:()=>Yz,unescapeMd:()=>Jz});function Iz(e){return Object.prototype.toString.call(e)}function Lz(e){return Iz(e)===`[object String]`}var Rz=Object.prototype.hasOwnProperty;function zz(e,t){return Rz.call(e,t)}function Bz(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function Vz(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Hz(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Uz(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var Wz=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Gz=RegExp(Wz.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),Kz=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function qz(e,t){if(t.charCodeAt(0)===35&&Kz.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Hz(n)?Uz(n):e}let n=Nz(e);return n===e?e:n}function Jz(e){return e.indexOf(`\\`)<0?e:e.replace(Wz,`$1`)}function Yz(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(Gz,function(e,t,n){return t||qz(e,n)})}var Xz=/[&<>"]/,Zz=/[&<>"]/g,Qz={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function $z(e){return Qz[e]}function eB(e){return Xz.test(e)?e.replace(Zz,$z):e}var tB=/[.?*+^$[\]\\(){}|-]/g;function nB(e){return e.replace(tB,`\\$&`)}function rB(e){switch(e){case 9:case 32:return!0}return!1}function iB(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function aB(e){return dz.test(e)||fz.test(e)}function oB(e){return aB(Uz(e))}function sB(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function cB(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function lB(e){return e===32||e===9||e===10||e===13}function uB(e){let t=0;for(;t<e.length&&lB(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&lB(e.charCodeAt(n));n--);return e.slice(t,n+1)}var dB={mdurl:sz,ucmicro:mz};function fB(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function pB(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=Yz(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=Yz(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function mB(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=Yz(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=Yz(e.slice(t,a)),o}var hB=n({parseLinkDestination:()=>pB,parseLinkLabel:()=>fB,parseLinkTitle:()=>mB}),gB={};gB.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+eB(a.content)+`</code>`},gB.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+eB(e[t].content)+`</code></pre>
`},gB.fence=function(e,t,n,r,i){let a=e[t],o=a.info?Yz(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||eB(a.content),l.indexOf(`<pre`)===0)return l+`
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},gB.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},gB.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
`:`<br>
`},gB.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
`:`<br>
`:`
`},gB.text=function(e,t){return eB(e[t].content)},gB.html_block=function(e,t){return e[t].content},gB.html_inline=function(e,t){return e[t].content};function _B(){this.rules=Bz({},gB)}_B.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+eB(e.attrs[t][0])+`="`+eB(e.attrs[t][1])+`"`;return r},_B.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=`
`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`>
`:`>`,i},_B.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},_B.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
`;break;default:}return r},_B.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function vB(){this.__rules__=[],this.__cache__=null}vB.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},vB.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},vB.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},vB.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},vB.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},vB.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},vB.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},vB.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},vB.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},vB.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function yB(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}yB.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},yB.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},yB.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},yB.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},yB.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function bB(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}bB.prototype.Token=yB;var xB=/\r\n?|\n/g,SB=/\0/g;function CB(e){let t;t=e.src.replace(xB,`
`),t=t.replace(SB,`�`),e.src=t}function wB(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function TB(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function EB(e){return/^<a[>\s]/i.test(e)}function DB(e){return/^<\/a\s*>/i.test(e)}function OB(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(EB(o.content)&&i>0&&i--,DB(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=Vz(r,a,c)}}}}var kB=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,AB=/\((c|tm|r)\)/i,jB=/\((c|tm|r)\)/gi,MB={c:`©`,r:`®`,tm:`™`};function NB(e,t){return MB[t.toLowerCase()]}function PB(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(jB,NB)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function FB(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&kB.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function IB(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(AB.test(e.tokens[t].content)&&PB(e.tokens[t].children),kB.test(e.tokens[t].content)&&FB(e.tokens[t].children))}var LB=/['"]/,RB=/['"]/g,zB=`’`;function BB(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function VB(e,t){let n=``,r=0;t.sort((e,t)=>e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function HB(e,t){let n,r=[],i={};for(let a=0;a<e.length;a++){let o=e[a],s=e[a].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!==`text`)continue;let c=o.content,l=0,u=c.length;OUTER:for(;l<u;){RB.lastIndex=l;let o=RB.exec(c);if(!o)break;let d=!0,f=!0;l=o.index+1;let p=o[0]===`'`,m=32;if(o.index-1>=0)m=c.charCodeAt(o.index-1);else for(n=a-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(l<u)h=c.charCodeAt(l);else for(n=a+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=sB(m)||oB(m),_=sB(h)||oB(h),v=iB(m),y=iB(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&o[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&BB(i,a,o.index,zB);continue}if(f)for(n=r.length-1;n>=0;n--){let e=r[n];if(r[n].level<s)break;if(e.single===p&&r[n].level===s){e=r[n];let s,c;p?(s=t.md.options.quotes[2],c=t.md.options.quotes[3]):(s=t.md.options.quotes[0],c=t.md.options.quotes[1]),BB(i,a,o.index,c),BB(i,e.token,e.pos,s),r.length=n;continue OUTER}}d?r.push({token:a,pos:o.index,single:p,level:s}):f&&p&&BB(i,a,o.index,zB)}}Object.keys(i).forEach(function(t){e[t].content=VB(e[t].content,i[t])})}function UB(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!LB.test(e.tokens[t].content)||HB(e.tokens[t].children,e)}function WB(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var GB=[[`normalize`,CB],[`block`,wB],[`inline`,TB],[`linkify`,OB],[`replacements`,IB],[`smartquotes`,UB],[`text_join`,WB]];function KB(){this.ruler=new vB;for(let e=0;e<GB.length;e++)this.ruler.push(GB[e][0],GB[e][1])}KB.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},KB.prototype.State=bB;function qB(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(rB(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}qB.prototype.push=function(e,t,n){let r=new yB(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},qB.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},qB.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},qB.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&rB(this.src.charCodeAt(e));e++);return e},qB.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!rB(this.src.charCodeAt(--e)))return e+1;return e},qB.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},qB.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},qB.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(rB(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},qB.prototype.Token=yB;var JB=65536;function YB(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function XB(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function ZB(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!rB(s)||o===45&&rB(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!rB(t))return!1;a++}let c=YB(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=YB(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=XB(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=YB(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=XB(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>JB))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function QB(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
`,a.map=[t,e.line],!0}function $B(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function eV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(rB(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function tV(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!rB(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function nV(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!rB(e.src.charCodeAt(r))?-1:r}function rV(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!rB(a))?-1:i}function iV(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function aV(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=rV(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=nV(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=rV(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=nV(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&iV(e,h),!0}function oV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!rB(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!rB(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&rB(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&rB(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=cB(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var sV=`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(`.`),cV=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),lV=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),uV=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+sV.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(lV.source+`\\s*$`),/^$/,!1]];function dV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<uV.length&&!uV[s][0].test(o);s++);if(s===uV.length)return!1;if(r)return uV[s][2];let c=t+1,l=uV[s][1].test(``);if(!uV[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),uV[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function fV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!rB(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&rB(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=uB(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function pV(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=uB(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function mV(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=uB(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var hV=[[`table`,ZB,[`paragraph`,`reference`]],[`code`,QB],[`fence`,$B,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,eV,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,tV,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,aV,[`paragraph`,`reference`,`blockquote`]],[`reference`,oV],[`html_block`,dV,[`paragraph`,`reference`,`blockquote`]],[`heading`,fV,[`paragraph`,`reference`,`blockquote`]],[`lheading`,pV],[`paragraph`,mV]];function gV(){this.ruler=new vB;for(let e=0;e<hV.length;e++)this.ruler.push(hV[e][0],hV[e][1],{alt:(hV[e][2]||[]).slice()})}gV.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},gV.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},gV.prototype.State=qB;function _V(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}_V.prototype.pushPending=function(){let e=new yB(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},_V.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new yB(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},_V.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else(i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else(s&64512)==56320&&(s=65533);let c=sB(i)||oB(i),l=sB(s)||oB(s),u=iB(i),d=iB(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},_V.prototype.Token=yB;function vV(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function yV(e,t){let n=e.pos;for(;n<e.posMax&&!vV(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var bV=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function xV(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(bV);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function SV(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&rB(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var CV=[];for(let e=0;e<256;e++)CV.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){CV[e.charCodeAt(0)]=1});function wV(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),rB(i));)n++;return e.pos=n,!0}if(i===32){if(!t){let t=e.push(`text_special`,``,0);t.content=`\\`,t.markup=`\\`,t.info=`escape`}return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&CV[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function TV(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function EV(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function DV(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function OV(e){let t=e.tokens_meta,n=e.tokens_meta.length;DV(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&DV(e,t[r].delimiters)}var kV={tokenize:EV,postProcess:OV};function AV(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function jV(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function MV(e){let t=e.tokens_meta,n=e.tokens_meta.length;jV(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&jV(e,t[r].delimiters)}var NV={tokenize:AV,postProcess:MV};function PV(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!rB(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!rB(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!rB(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[cB(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function FV(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!rB(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!rB(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!rB(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[cB(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var IV=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,LV=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function RV(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(LV.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(IV.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function zV(e){return/^<a[>\s]/i.test(e)}function BV(e){return/^<\/a\s*>/i.test(e)}function VV(e){let t=e|32;return t>=97&&t<=122}function HV(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!VV(i))return!1;let a=e.src.slice(r).match(cV);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],zV(t.content)&&e.linkLevel++,BV(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var UV=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,WV=/^&([a-z][a-z0-9]{1,31});/i;function GV(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(UV);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=Hz(t)?Uz(t):Uz(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(WV);if(r){let n=Pz(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function KV(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function qV(e){let t=e.tokens_meta,n=e.tokens_meta.length;KV(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&KV(t[e].delimiters)}function JV(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var YV=[[`text`,yV],[`linkify`,xV],[`newline`,SV],[`escape`,wV],[`backticks`,TV],[`strikethrough`,kV.tokenize],[`emphasis`,NV.tokenize],[`link`,PV],[`image`,FV],[`autolink`,RV],[`html_inline`,HV],[`entity`,GV]],XV=[[`balance_pairs`,qV],[`strikethrough`,kV.postProcess],[`emphasis`,NV.postProcess],[`fragments_join`,JV]];function ZV(){this.ruler=new vB;for(let e=0;e<YV.length;e++)this.ruler.push(YV[e][0],YV[e][1]);this.ruler2=new vB;for(let e=0;e<XV.length;e++)this.ruler2.push(XV[e][0],XV[e][1])}ZV.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},ZV.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},ZV.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},ZV.prototype.State=_V;function QV(e){let t={};e||={},t.src_Any=cz.source,t.src_Cc=lz.source,t.src_Z=pz.source,t.src_P=dz.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><|]`;return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function $V(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function eH(e){return Object.prototype.toString.call(e)}function tH(e){return eH(e)===`[object String]`}function nH(e){return eH(e)===`[object Object]`}function rH(e){return eH(e)===`[object RegExp]`}function iH(e){return eH(e)===`[object Function]`}function aH(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var oH={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function sH(e){return Object.keys(e||{}).reduce(function(e,t){return e||oH.hasOwnProperty(t)},!1)}var cH={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},lH=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,uH=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function dH(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function fH(){return function(e,t){t.normalize(e)}}function pH(e){let t=e.re=QV(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(lH),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.email_fuzzy_global=RegExp(r(t.tpl_email_fuzzy),`ig`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_fuzzy_global=RegExp(r(t.tpl_link_fuzzy),`ig`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.link_no_ip_fuzzy_global=RegExp(r(t.tpl_link_no_ip_fuzzy),`ig`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "${e}": ${t}`)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,nH(n)){rH(n.validate)?r.validate=dH(n.validate):iH(n.validate)?r.validate=n.validate:a(t,n),iH(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=fH();return}if(tH(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:fH()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(aH).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`ig`),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,`i`),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,`i`)}function mH(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}function hH(e,t){if(!(this instanceof hH))return new hH(e,t);t||sH(e)&&(t=e,e={}),this.__opts__=$V({},oH,t),this.__schemas__=$V({},cH,e),this.__compiled__={},this.__tlds__=uH,this.__tlds_replaced__=!1,this.re={},pH(this)}hH.prototype.add=function(e,t){return this.__schemas__[e]=t,pH(this),this},hH.prototype.set=function(e){return this.__opts__=$V(this.__opts__,e),this},hH.prototype.test=function(e){if(!e.length)return!1;let t,n;if(this.re.schema_test.test(e)){for(n=this.re.schema_search,n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&e.search(this.re.host_fuzzy_test)>=0&&e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&e.indexOf(`@`)>=0&&e.match(this.re.email_fuzzy)!==null)},hH.prototype.pretest=function(e){return this.re.pretest.test(e)},hH.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},hH.prototype.match=function(e){let t=[],n=[],r=[],i=[],a,o,s;function c(e,t){return e?t?e.index===t.index?e.lastIndex>=t.lastIndex?e:t:e.index<t.index?e:t:e:t}if(!e.length)return null;if(this.re.schema_test.test(e))for(s=this.re.schema_search,s.lastIndex=0;(a=s.exec(e))!==null;)o=this.testSchemaAt(e,a[2],s.lastIndex),o&&n.push({schema:a[2],index:a.index+a[1].length,lastIndex:a.index+a[0].length+o});if(this.__opts__.fuzzyLink&&this.__compiled__[`http:`])for(s=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)r.push({schema:``,index:a.index+a[1].length,lastIndex:a.index+a[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`])for(s=this.re.email_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)i.push({schema:`mailto:`,index:a.index+a[1].length,lastIndex:a.index+a[0].length});let l=[0,0,0],u=0;for(;;){let a=[n[l[0]],i[l[1]],r[l[2]]],o=c(c(a[0],a[1]),a[2]);if(!o)break;if(o===a[0]?l[0]++:o===a[1]?l[1]++:l[2]++,o.index<u)continue;let s=new mH(e,o.schema,o.index,o.lastIndex);this.__compiled__[s.schema].normalize(s,this),t.push(s),u=o.lastIndex}return t.length?t:null},hH.prototype.matchAtStart=function(e){if(!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new mH(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__compiled__[r.schema].normalize(r,this),r},hH.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),pH(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,pH(this),this)},hH.prototype.normalize=function(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)},hH.prototype.onCompile=function(){};var gH=2147483647,_H=36,vH=1,yH=26,bH=38,xH=700,SH=72,CH=128,wH=`-`,TH=/^xn--/,EH=/[^\0-\x7F]/,DH=/[\x2E\u3002\uFF0E\uFF61]/g,OH={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},kH=_H-vH,AH=Math.floor,jH=String.fromCharCode;function MH(e){throw RangeError(OH[e])}function NH(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function PH(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(DH,`.`);let i=NH(e.split(`.`),t).join(`.`);return r+i}function FH(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var IH=e=>String.fromCodePoint(...e),LH=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:_H},RH=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},zH=function(e,t,n){let r=0;for(e=n?AH(e/xH):e>>1,e+=AH(e/t);e>455;r+=_H)e=AH(e/kH);return AH(r+36*e/(e+bH))},BH=function(e){let t=[],n=e.length,r=0,i=CH,a=SH,o=e.lastIndexOf(wH);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&MH(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=_H;;i+=_H){s>=n&&MH(`invalid-input`);let o=LH(e.charCodeAt(s++));o>=_H&&MH(`invalid-input`),o>AH((gH-r)/t)&&MH(`overflow`),r+=o*t;let c=i<=a?vH:i>=a+yH?yH:i-a;if(o<c)break;let l=_H-c;t>AH(gH/l)&&MH(`overflow`),t*=l}let c=t.length+1;a=zH(r-o,c,o==0),AH(r/c)>gH-i&&MH(`overflow`),i+=AH(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},VH=function(e){let t=[];e=FH(e);let n=e.length,r=CH,i=0,a=SH;for(let n of e)n<128&&t.push(jH(n));let o=t.length,s=o;for(o&&t.push(wH);s<n;){let n=gH;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>AH((gH-i)/c)&&MH(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>gH&&MH(`overflow`),n===r){let e=i;for(let n=_H;;n+=_H){let r=n<=a?vH:n>=a+yH?yH:n-a;if(e<r)break;let i=e-r,o=_H-r;t.push(jH(RH(r+i%o,0))),e=AH(i/o)}t.push(jH(RH(e,0))),a=zH(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},HH={version:`2.3.1`,ucs2:{decode:FH,encode:IH},decode:BH,encode:VH,toASCII:function(e){return PH(e,function(e){return EH.test(e)?`xn--`+VH(e):e})},toUnicode:function(e){return PH(e,function(e){return TH.test(e)?BH(e.slice(4).toLowerCase()):e})}},UH={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},WH=/^(vbscript|javascript|file|data):/,GH=/^data:image\/(gif|png|jpeg|webp);/;function KH(e){let t=e.trim().toLowerCase();return!WH.test(t)||GH.test(t)}var qH=[`http:`,`https:`,`mailto:`];function JH(e){let t=oz(e,!0);if(t.hostname&&(!t.protocol||qH.indexOf(t.protocol)>=0))try{t.hostname=HH.toASCII(t.hostname)}catch{}return JR(YR(t))}function YH(e){let t=oz(e,!0);if(t.hostname&&(!t.protocol||qH.indexOf(t.protocol)>=0))try{t.hostname=HH.toUnicode(t.hostname)}catch{}return GR(YR(t),GR.defaultChars+`%`)}function XH(e,t){if(!(this instanceof XH))return new XH(e,t);t||Lz(e)||(t=e||{},e=`default`),this.inline=new ZV,this.block=new gV,this.core=new KB,this.renderer=new _B,this.linkify=new hH,this.validateLink=KH,this.normalizeLink=JH,this.normalizeLinkText=YH,this.utils=Fz,this.helpers=Bz({},hB),this.options={},this.configure(e),t&&this.set(t)}XH.prototype.set=function(e){return Bz(this.options,e),this},XH.prototype.configure=function(e){let t=this;if(Lz(e)){let t=e;if(e=UH[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this},XH.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},XH.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},XH.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},XH.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},XH.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},XH.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},XH.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var ZH=new bE({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},blockquote:{content:`block+`,group:`block`,parseDOM:[{tag:`blockquote`}],toDOM(){return[`blockquote`,0]}},horizontal_rule:{group:`block`,parseDOM:[{tag:`hr`}],toDOM(){return[`div`,[`hr`]]}},heading:{attrs:{level:{default:1}},content:`(text | image)*`,group:`block`,defining:!0,parseDOM:[{tag:`h1`,attrs:{level:1}},{tag:`h2`,attrs:{level:2}},{tag:`h3`,attrs:{level:3}},{tag:`h4`,attrs:{level:4}},{tag:`h5`,attrs:{level:5}},{tag:`h6`,attrs:{level:6}}],toDOM(e){return[`h`+e.attrs.level,0]}},code_block:{content:`text*`,group:`block`,code:!0,defining:!0,marks:``,attrs:{params:{default:``}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>({params:e.getAttribute(`data-params`)||``})}],toDOM(e){return[`pre`,e.attrs.params?{"data-params":e.attrs.params}:{},[`code`,0]]}},ordered_list:{content:`list_item+`,group:`block`,attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:`ol`,getAttrs(e){return{order:e.hasAttribute(`start`)?+e.getAttribute(`start`):1,tight:e.hasAttribute(`data-tight`)}}}],toDOM(e){return[`ol`,{start:e.attrs.order==1?null:e.attrs.order,"data-tight":e.attrs.tight?`true`:null},0]}},bullet_list:{content:`list_item+`,group:`block`,attrs:{tight:{default:!1}},parseDOM:[{tag:`ul`,getAttrs:e=>({tight:e.hasAttribute(`data-tight`)})}],toDOM(e){return[`ul`,{"data-tight":e.attrs.tight?`true`:null},0]}},list_item:{content:`block+`,defining:!0,parseDOM:[{tag:`li`}],toDOM(){return[`li`,0]}},text:{group:`inline`},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:`inline`,draggable:!0,parseDOM:[{tag:`img[src]`,getAttrs(e){return{src:e.getAttribute(`src`),title:e.getAttribute(`title`),alt:e.getAttribute(`alt`)}}}],toDOM(e){return[`img`,e.attrs]}},hard_break:{inline:!0,group:`inline`,selectable:!1,parseDOM:[{tag:`br`}],toDOM(){return[`br`]}}},marks:{em:{parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style=italic`},{style:`font-style=normal`,clearMark:e=>e.type.name==`em`}],toDOM(){return[`em`]}},strong:{parseDOM:[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return[`strong`]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:`a[href]`,getAttrs(e){return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM(e){return[`a`,e.attrs]}},code:{code:!0,parseDOM:[{tag:`code`}],toDOM(){return[`code`]}}}});function QH(e,t){if(e.isText&&t.isText&&OT.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var $H=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:OT.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),n=t.content,r=n[n.length-1],i=this.schema.text(e,t.marks),a;r&&(a=QH(r,i))?n[n.length-1]=a:n.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let n=e[t],r=this.tokenHandlers[n.type];if(!r)throw Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n,e,t)}}addNode(e,t,n){let r=this.top(),i=e.createAndFill(t,n,r?r.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:OT.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function eU(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function tU(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function nU(e){return e[e.length-1]==`
`?e.slice(0,e.length-1):e}function rU(){}function iU(e,t){let n=Object.create(null);for(let r in t){let i=t[r];if(i.block){let t=e.nodeType(i.block);tU(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,eU(i,n,r,a)),e.addText(nU(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,eU(i,n,r,a)),n[r+`_close`]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);n[r]=(e,n,r,a)=>e.addNode(t,eU(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];tU(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(eU(i,n,r,a))),e.addText(nU(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(eU(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)tU(i,r)?n[r]=rU:(n[r+`_open`]=rU,n[r+`_close`]=rU);else throw RangeError(`Unrecognized parsing spec `+JSON.stringify(i))}return n.text=(e,t)=>e.addText(t.content),n.inline=(e,t)=>e.parseTokens(t.children),n.softbreak=n.softbreak||(e=>e.addText(` `)),n}var aU=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=iU(e,n)}parse(e,t={}){let n=new $H(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,t));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function oU(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new aU(ZH,XH(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:oU(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:oU(t,n)})},heading:{block:`heading`,getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:`code_block`,noCloseToken:!0},fence:{block:`code_block`,getAttrs:e=>({params:e.info||``}),noCloseToken:!0},hr:{node:`horizontal_rule`},image:{node:`image`,getAttrs:e=>({src:e.attrGet(`src`),title:e.attrGet(`title`)||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:`hard_break`},em:{mark:`em`},strong:{mark:`strong`},link:{mark:`link`,getAttrs:e=>({href:e.attrGet(`href`),title:e.attrGet(`title`)||null})},code_inline:{mark:`code`,noCloseToken:!0}});var sU={open:``,close:``,mixable:!0},cU=new class{constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){t=Object.assign({},this.options,t);let n=new dU(this.nodes,this.marks,t);return n.renderContent(e),n.out}}({blockquote(e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},code_block(e,t){let n=t.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";e.write(r+(t.attrs.params||``)+`
`),e.text(t.textContent,!1),e.write(`
`),e.write(r),e.closeBlock(t)},heading(e,t){e.write(e.repeat(`#`,t.attrs.level)+` `),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||`---`),e.closeBlock(t)},bullet_list(e,t){e.renderList(t,`  `,()=>(t.attrs.bullet||`*`)+` `)},ordered_list(e,t){let n=t.attrs.order??1,r=String(n+t.childCount-1).length,i=e.repeat(` `,r+2);e.renderList(t,i,t=>{let i=String(n+t);return e.repeat(` `,r-i.length)+i+`. `})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write(`![`+e.esc(t.attrs.alt||``)+`](`+t.attrs.src.replace(/[\(\)]/g,`\\$&`)+(t.attrs.title?` "`+t.attrs.title.replace(/"/g,`\\"`)+`"`:``)+`)`)},hard_break(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(`\\
`);return}},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:`*`,close:`*`,mixable:!0,expelEnclosingWhitespace:!0},strong:{open:`**`,close:`**`,mixable:!0,expelEnclosingWhitespace:!0},link:{open(e,t,n,r){return e.inAutolink=uU(t,n,r),e.inAutolink?`<`:`[`},close(e,t,n,r){let{inAutolink:i}=e;return e.inAutolink=void 0,i?`>`:`](`+t.attrs.href.replace(/[\(\)"]/g,`\\$&`)+(t.attrs.title?` "${t.attrs.title.replace(/"/g,`\\"`)}"`:``)+`)`},mixable:!0},code:{open(e,t,n,r){return lU(n.child(r),-1)},close(e,t,n,r){return lU(n.child(r-1),1)},escape:!1}});function lU(e,t){let n=/`+/g,r,i=0;if(e.isText)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a}function uU(e,t,n){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!=e.attrs.href||r.marks[r.marks.length-1]!=e?!1:n==t.childCount-1||!e.isInSet(t.child(n+1).marks)}var dU=class{constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.delim=``,this.out=``,this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
`),e>1){let t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
`}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=sU}return t}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let n=e.split(`
`);for(let e=0;e<n.length;e++)this.write(),!t&&n[e][0]==`[`&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!=n.length-1&&(this.out+=`
`)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,n,r)=>this.render(t,e,r))}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))}));let s=r;if(r=``,t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let[e,r,i]=/^(\s*)(.*)$/m.exec(t.text);r&&(s+=r,t=i?t.withText(i):null,t||(o=n))}if(t&&t.isText&&o.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(r=a,t=i?t.withText(i):null,t||(o=n))}let c=o.length?o[o.length-1]:null,l=c&&this.getMark(c.type.name).escape===!1,u=o.length-+!!l;outer:for(let e=0;e<u;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let r=0;r<n.length;r++){let i=n[r];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?o=o.slice(0,r).concat(t).concat(o.slice(r,e)).concat(o.slice(e+1,u)):r>e&&(o=o.slice(0,e).concat(o.slice(e+1,r)).concat(t).concat(o.slice(r,u)));continue outer}}}let d=0;for(;d<Math.min(n.length,u)&&o[d].eq(n[d]);)++d;for(;d<n.length;)this.text(this.markString(n.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;n.length<u;){let t=o[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}l&&t.isText?this.text(this.markString(c,!0,e,a)+t.text+this.markString(c,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}t?.isText&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r,e.forEach((i,a,o)=>{o&&r&&this.flushClose(1),this.wrapBlock(t,n(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,n)=>t==`_`&&n>0&&n+1<e.length&&e[n-1].match(/\w/)&&e[n+1].match(/\w/)?t:`\\`+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/,`$1\\. `)),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,`\\$&`)),e}quote(e){let t=e.indexOf(`"`)==-1?`""`:e.indexOf(`'`)==-1?`''`:`()`;return t[0]+e+t[1]}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,n){for(;;t++){if(t>=e.childCount)return!1;let r=e.child(t);if(r.type.name!=this.options.hardBreakNodeName)return n.isInSet(r.marks);t++}}},fU=a(f(((e,t)=>{var n=!0,r=!1,i=!1;t.exports=function(e,t){t&&(n=!t.enabled,r=!!t.label,i=!!t.labelAfter),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var t=e.tokens,r=2;r<t.length;r++)s(t,r)&&(c(t[r],e.Token),a(t[r-2],`class`,`task-list-item`+(n?``:` enabled`)),a(t[o(t,r-2)],`class`,`contains-task-list`))})};function a(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function o(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function s(e,t){return p(e[t])&&m(e[t-1])&&h(e[t-2])&&g(e[t])}function c(e,t){if(e.children.unshift(l(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),r)if(i){e.children.pop();var n=`task-item-`+Math.ceil(1e4*1e3*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+` id="`+n+`">`,e.children.push(f(e.content,n,t))}else e.children.unshift(u(t)),e.children.push(d(t))}function l(e,t){var r=new t(`html_inline`,``,0),i=n?` disabled="" `:``;return e.content.indexOf(`[ ] `)===0?r.content=`<input class="task-list-item-checkbox"`+i+`type="checkbox">`:(e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0)&&(r.content=`<input class="task-list-item-checkbox" checked=""`+i+`type="checkbox">`),r}function u(e){var t=new e(`html_inline`,``,0);return t.content=`<label>`,t}function d(e){var t=new e(`html_inline`,``,0);return t.content=`</label>`,t}function f(e,t,n){var r=new n(`html_inline`,``,0);return r.content=`<label class="task-list-item-label" for="`+t+`">`+e+`</label>`,r.attrs=[{for:t}],r}function p(e){return e.type===`inline`}function m(e){return e.type===`paragraph_open`}function h(e){return e.type===`list_item_open`}function g(e){return e.content.indexOf(`[ ] `)===0||e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0}}))(),1),pU=Object.defineProperty,mU=(e,t,n)=>t in e?pU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hU=(e,t,n)=>(mU(e,typeof t==`symbol`?t:t+``,n),n),gU=HP.create({name:`markdownTightLists`,addOptions:()=>({tight:!0,tightClass:`tight`,listTypes:[`bulletList`,`orderedList`]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>e.getAttribute(`data-tight`)===`true`||!e.querySelector(`p`),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?`true`:null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function a(e){if(!r.isActive(e))return!1;let n=r.getAttributes(e);return i.updateAttributes(e,{tight:t??!(n!=null&&n.tight)})}return e.options.listTypes.some(e=>a(e))}}}}}),_U=XH();function vU(e,t){return _U.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new _U.inline.State(e,null,null,[]).scanDelims(t,!0)}function yU(e,t,n,r){let i=e.substring(0,n)+e.substring(n+t.length);return i=i.substring(0,n+r)+t+i.substring(n+r),i}function bU(e,t,n,r){let i=n,a=e;for(;i<r&&!vU(a,i).can_open;)a=yU(a,t,i,1),i++;return{text:a,from:i,to:r}}function xU(e,t,n,r){let i=r,a=e;for(;i>n&&!vU(a,i).can_close;)a=yU(a,t,i,-1),i--;return{text:a,from:n,to:i}}function SU(e,t,n,r){let i={text:e,from:n,to:r};return i=bU(i.text,t,i.from,i.to),i=xU(i.text,t,i.from,i.to),i.to-i.from<t.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+t.length)),i.text}var CU=class extends dU{constructor(e,t,n){super(e,t,n??{}),hU(this,`inTable`,!1),this.inlines=[]}render(e,t,n){super.render(e,t,n);let r=this.inlines[this.inlines.length-1];if(r!=null&&r.start&&r!=null&&r.end){let{delimiter:e,start:t,end:n}=this.normalizeInline(r);this.out=SU(this.out,e,t,n),this.inlines.pop()}}markString(e,t,n,r){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,n,r)}normalizeInline(e){let{start:t,end:n}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}},wU=MP.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?TU(t)?.[0]??``:(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),``)},close(e,t){return this.editor.storage.markdown.options.html?TU(t)?.[1]??``:``}},parse:{}}}}});function TU(e){let t=e.type.schema,n=t.text(` `,[e]),r=SP($.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function EU(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function DU(e){return e?.replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function OU(e){let t=e.parentElement,n=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)n.appendChild(t.firstChild);n.childNodes.length>0&&t.parentElement.insertBefore(n,t),t.parentElement.insertBefore(e,t),t.childNodes.length===0&&t.remove()}function kU(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var AU=UI.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(jU(t,n)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}}}});function jU(e,t){let n=e.type.schema,r=SP($.from(e),n);return e.isBlock&&(t instanceof $||t.type.name===n.topNodeType.name)?MU(r):r}function MU(e){let t=EU(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
${t.innerHTML}
`:`
`,t.outerHTML}var NU=UI.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:cU.nodes.blockquote,parse:{}}}}}),PU=UI.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,`  `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),FU=UI.create({name:`codeBlock`}).extend({addStorage(){return{markdown:{serialize(e,t){e.write("```"+(t.attrs.language||``)+`
`),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),IU=UI.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?AU.storage.markdown.serialize.call(this,e,t,n):`\\
`);return}},parse:{}}}}}),LU=UI.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:cU.nodes.heading,parse:{}}}}}),RU=UI.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:cU.nodes.horizontal_rule,parse:{}}}}}),zU=UI.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:cU.nodes.image,parse:{}}}}}),BU=UI.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:cU.nodes.list_item,parse:{}}}}}),VU=UI.create({name:`orderedList`});function HU(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var UU=VU.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=HU(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),WU=UI.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:cU.nodes.paragraph,parse:{}}}}});function GU(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var KU=UI.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!JU(t)){AU.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function qU(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function JU(e){let t=GU(e),n=t[0],r=t.slice(1);return!(GU(n).some(e=>e.type.name!==`tableHeader`||qU(e)||e.childCount>1)||r.some(e=>GU(e).some(e=>e.type.name===`tableHeader`||qU(e)||e.childCount>1)))}var YU=[NU,PU,FU,IU,LU,RU,AU,zU,BU,UU,WU,KU,UI.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),UI.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:PU.storage.markdown.serialize,parse:{setup(e){e.use(fU.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),UI.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(DU(t.text))},parse:{}}}}}),MP.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:cU.marks.strong,parse:{}}}}}),MP.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:cU.marks.code,parse:{}}}}}),wU,MP.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:cU.marks.em,parse:{}}}}}),MP.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:cU.marks.link,parse:{}}}}}),MP.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function XU(e){let t=e.storage?.markdown,n=YU.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var ZU=class{constructor(e){hU(this,`editor`,null),this.editor=e}serialize(e){let t=new CU(this.nodes,this.marks,{hardBreakNodeName:IU.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(AU)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(wU)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=XU(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=XU(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},QU=class{constructor(e,t){hU(this,`editor`,null),hU(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(XH({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=XU(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=EU(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=XU(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&OU(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}kU(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
`?t:t[t.length-1]===`
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},$U=HP.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new DO({key:new AO(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return wE.fromSchema(this.editor.schema).parseSlice(EU(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),eW=HP.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=PI.Commands.config.addCommands();return{setContent:(t,n,r)=>i=>e.setContent(i.editor.storage.markdown.parser.parse(t),n,r)(i),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new QU(this.editor,this.options),serializer:new ZU(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[gU.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),$U.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),tW=[{kind:`macro`,label:`AWAIT`,text:`<AWAIT>`,hint:`Stop and wait for the user`},{kind:`macro`,label:`REVIEW_FILE`,text:`<REVIEW_FILE>`,hint:`The review scratch file`},{kind:`macro`,label:`TODO_FILE`,text:`<TODO_FILE>`,hint:`The session TODO file`},{kind:`macro`,label:`PLAN_FILE`,text:`<PLAN_FILE>`,hint:`The session plan file`},{kind:`macro`,label:`SESSION_NAME`,text:`<SESSION_NAME>`,hint:`The sanitized branch slug`},{kind:`macro`,label:`FUNCTION`,text:`<FUNCTION>`,hint:`A function placeholder`}],nW=[{kind:`action`,label:`showChoices()`,text:`showChoices()`,hint:`Single-select gate`},{kind:`action`,label:`showMultiSelect()`,text:`showMultiSelect()`,hint:`Multi-select gate`},{kind:`action`,label:`showMarkdown()`,text:`showMarkdown()`,hint:`Push a markdown view`}],rW=/<[A-Z][A-Z0-9_]*>|show[A-Za-z]+\(\)/g;function iW(e){return[...tW,...nW].find(t=>t.text.toLowerCase()===e.toLowerCase())||(e.endsWith(`()`)?{kind:`action`,label:e,text:e}:{kind:`macro`,label:e.replace(/^<|>$/g,``),text:e})}var aW=UI.create({name:`token`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{kind:{default:`macro`},label:{default:``},text:{default:``}}},parseHTML(){return[{tag:`span[data-token]`}]},renderHTML({node:e,HTMLAttributes:t}){return[`span`,dP(t,{"data-token":e.attrs.kind,class:`pe-token`}),e.attrs.label||e.attrs.text]},renderText({node:e}){return e.attrs.text},addInputRules(){let e=e=>{let t=iW(e[0]);return{kind:t.kind,label:t.label,text:t.text}};return[BI({find:/<[A-Za-z][A-Za-z0-9_]*>$/,type:this.type,getAttributes:e}),BI({find:/show[A-Za-z]+\(\)$/,type:this.type,getAttributes:e})]},addStorage(){return{markdown:{serialize(e,t){e.write(t.attrs.text)},parse:{}}}}});function oW(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=KI(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}var sW=new AO(`suggestion`);function cW({pluginKey:e=sW,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:h=oW}){let g,_=p?.(),v=new DO({key:e,view(){return{update:async(e,n)=>{var r,i,a,o,s;let c=this.key?.getState(n),l=this.key?.getState(e.state),u=c.active&&l.active&&c.range.from!==l.range.from,p=!c.active&&l.active,m=c.active&&!l.active,h=!p&&!m&&c.query!==l.query,v=p||u&&h,y=h||u,b=m||u&&h;if(!v&&!y&&!b)return;let x=b&&!v?c:l,S=e.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);g={editor:t,range:x.range,query:x.query,text:x.text,items:[],command:e=>d({editor:t,range:x.range,props:e}),decorationNode:S,clientRect:S?()=>{let{decorationId:n}=this.key?.getState(t.state);return e.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:null},v&&((r=_?.onBeforeStart)==null||r.call(_,g)),y&&((i=_?.onBeforeUpdate)==null||i.call(_,g)),(y||v)&&(g.items=await f({editor:t,query:x.query})),b&&((a=_?.onExit)==null||a.call(_,g)),y&&((o=_?.onUpdate)==null||o.call(_,g)),v&&((s=_?.onStart)==null||s.call(_,g))},destroy:()=>{var e;g&&((e=_?.onExit)==null||e.call(_,g))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(e,s,c,l){let{isEditable:u}=t,{composing:d}=t.view,{selection:f}=e,{empty:p,from:g}=f,_={...s};if(_.composing=d,u&&(p||t.view.composing)){(g<s.range.from||g>s.range.to)&&!d&&!s.composing&&(_.active=!1);let e=h({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:f.$from}),c=`id_${Math.floor(Math.random()*4294967295)}`;e&&m({editor:t,state:l,range:e.range,isActive:s.active})?(_.active=!0,_.decorationId=s.decorationId?s.decorationId:c,_.range=e.range,_.query=e.query,_.text=e.text):_.active=!1}else _.active=!1;return _.active||(_.decorationId=null,_.range={from:0,to:0},_.query=null,_.text=null),_}},props:{handleKeyDown(e,t){let{active:n,range:r}=v.getState(e.state);return n&&(_?.onKeyDown)?.call(_,{view:e,event:t,range:r})||!1},decorations(e){let{active:t,range:n,decorationId:r,query:i}=v.getState(e);if(!t)return null;let a=!i?.length,o=[c];return a&&o.push(u),pM.create(e.doc,[uM.inline(n.from,n.to,{nodeName:s,class:o.join(` `),"data-decoration-id":r,"data-decoration-content":l})])}}});return v}function lW(e){return`prompt-suggestion-option-${e}`}var uW=(0,T.forwardRef)(function({items:e,command:t,emptyNote:n,onActiveChange:r},i){let[a,o]=(0,T.useState)(0);return(0,T.useEffect)(()=>o(0),[e]),(0,T.useEffect)(()=>{r?.(e.length>0?lW(a):null)},[e,a,r]),(0,T.useImperativeHandle)(i,()=>({onKeyDown:n=>{if(e.length===0)return!1;if(n.key===`ArrowDown`)return o(t=>(t+1)%e.length),!0;if(n.key===`ArrowUp`)return o(t=>(t-1+e.length)%e.length),!0;if(n.key===`Enter`||n.key===`Tab`){let n=e[a];return n&&t(n),!0}return!1}})),e.length===0?(0,J.jsx)(`div`,{role:`status`,className:`w-64 rounded-md border border-border bg-card p-2 text-sm text-muted-foreground shadow-md`,children:n??`No matches`}):(0,J.jsx)(`div`,{role:`listbox`,"aria-label":`Suggestions`,className:`max-h-72 w-64 overflow-y-auto rounded-md border border-border bg-card p-1 text-sm shadow-md`,children:e.map((n,r)=>(0,J.jsxs)(`div`,{children:[n.group&&(r===0||e[r-1]?.group!==n.group)&&(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70`,children:n.group}),(0,J.jsxs)(`button`,{type:`button`,id:lW(r),role:`option`,"aria-selected":r===a,...n.title?{title:n.title}:{},onMouseDown:e=>{e.preventDefault(),t(n)},onMouseEnter:()=>o(r),className:q(`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left`,r===a?`bg-accent text-accent-foreground`:`hover:bg-accent/60`),children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:n.label}),n.hint&&(0,J.jsx)(`span`,{className:`ml-auto truncate text-xs text-muted-foreground`,children:n.hint})]})]},n.id))})});function dW(e,t){if(!t)return;let n=window.innerHeight-t.bottom;e.style.left=`${t.left}px`,n<320?(e.style.top=``,e.style.bottom=`${window.innerHeight-t.top+4}px`):(e.style.bottom=``,e.style.top=`${t.bottom+4}px`)}function fW(e){let t=null,n=null,r=null,i=null,a=null,o=e=>{a&&(e?a.setAttribute(`aria-activedescendant`,e):a.removeAttribute(`aria-activedescendant`))},s=i=>{let{items:s,command:c}=i,l=s.length===0&&!i.query?e.emptyNote:void 0,u=s.length>0||!!l;t&&(t.style.display=u?``:`none`),a?.setAttribute(`aria-expanded`,u?`true`:`false`),u||o(null),n?.render((0,T.createElement)(uW,{items:s,command:c,emptyNote:l,onActiveChange:o,ref:e=>{r=e}}))},c=()=>{t&&dW(t,i?.()??null)};return{onStart(e){t=document.createElement(`div`),t.style.position=`fixed`,t.style.zIndex=`50`,document.body.appendChild(t),n=(0,b.createRoot)(t),i=e.clientRect??null,a=e.editor?.view.dom??null,c(),s(e),window.addEventListener(`scroll`,c,!0),window.addEventListener(`resize`,c)},onUpdate(e){i=e.clientRect??null,c(),s(e)},onKeyDown(e){return e.event.key===`Escape`?!1:r?.onKeyDown(e.event)??!1},onExit(){window.removeEventListener(`scroll`,c,!0),window.removeEventListener(`resize`,c),a?.setAttribute(`aria-expanded`,`false`),o(null),a=null,n?.unmount(),t?.remove(),n=null,t=null,r=null,i=null}}}function pW(e){return HP.create({name:`suggestion-${e.key}`,addProseMirrorPlugins(){return[cW({editor:this.editor,char:e.char,pluginKey:new AO(e.key),items:({query:t})=>e.items(t.toLowerCase()),command:({editor:t,range:n,props:r})=>e.onSelect(r,{editor:t,range:n}),render:()=>fW(e)})]}})}function mW(e){let t=e.schema.nodes.token;if(!t)return;let n=[];if(e.state.doc.descendants((e,t)=>{if(!(!e.isText||!e.text)&&!e.marks.some(e=>e.type.name===`code`))for(let r of e.text.matchAll(rW)){let e=t+(r.index??0);n.push({from:e,to:e+r[0].length,text:r[0]})}}),n.length===0)return;let r=e.state.tr;for(let e of n.reverse()){let n=iW(e.text);r.replaceWith(e.from,e.to,t.create({kind:n.kind,label:n.label,text:n.text}))}e.view.dispatch(r)}function hW(e,t,n){e.chain().focus().deleteRange(t).insertContent([{type:`token`,attrs:{kind:n.kind,label:n.label,text:n.text}},{type:`text`,text:` `}]).run()}function gW(e,t){e.commands.setContent(t),mW(e),e.commands.focus(`end`)}var _W=(0,T.forwardRef)(function({onChange:e,onSubmit:t,onPreset:n,onMentionProject:r,onMentionFile:i,onMentionRemoved:a,projects:o,files:s=[],presets:c,customPresets:l=[],projectPresets:u=[],onNewPreset:d,disabled:f=!1,placeholder:p=`Describe what to build…  ( / commands · < tags · @ projects · # files )`,initialText:m,compact:h=!1},g){let[_,v]=(0,T.useState)(!0),y=(0,T.useRef)(o),b=(0,T.useRef)(s),x=(0,T.useRef)(c),S=(0,T.useRef)(l),C=(0,T.useRef)(u),w=(0,T.useRef)(d),E=(0,T.useRef)(n),D=(0,T.useRef)(r),O=(0,T.useRef)(i),k=(0,T.useRef)(a),A=(0,T.useRef)(e),j=(0,T.useRef)(t);(0,T.useEffect)(()=>{y.current=o,b.current=s,x.current=c,S.current=l,C.current=u,w.current=d,E.current=n,D.current=r,O.current=i,k.current=a,A.current=e,j.current=t});let M=(0,T.useRef)(new Set),N=e=>{let t=new Set;e.state.doc.descendants(e=>(e.type.name===`token`&&(e.attrs.kind===`project`||e.attrs.kind===`file`)&&t.add(String(e.attrs.text)),!0));for(let e of M.current)if(!t.has(e)){if(e.startsWith(`#`))k.current?.(e.slice(1));else if(e.startsWith(`@`)){let t=y.current.find(t=>t.name===e.slice(1));t&&k.current?.(t.path)}}M.current=t},P=(e,t)=>{let n=!e.isEmpty;return gW(e,t),v(e.isEmpty),A.current(e.storage.markdown.getMarkdown()),N(e),n},F=_L({immediatelyRender:!1,extensions:[HR,eW.configure({html:!1,linkify:!1,breaks:!0,transformPastedText:!0}),aW,pW({char:`/`,key:`slash`,items:e=>{let t=e.toLowerCase(),n=x.current.filter(n=>n.id.includes(e)||n.label.toLowerCase().includes(t)).map(e=>({id:`preset:${e.id}`,label:`/${e.id}`,hint:e.label,group:`Presets`,...e.tooltip?{title:e.tooltip}:{}})),r=S.current.filter(e=>e.label.toLowerCase().includes(t)).map(e=>({id:`custom-preset:${e.id}`,label:e.label,hint:`saved preset`,group:`Presets`})),i=C.current.filter(e=>e.label.toLowerCase().includes(t)).map(e=>({id:`project-preset:${e.id}`,label:e.label,hint:`project preset`,group:`Presets`})),a=w.current&&`new preset`.includes(t)?[{id:`new-preset`,label:`New preset…`,hint:`save the current prompt`,group:`Presets`}]:[],o=nW.filter(e=>e.label.toLowerCase().includes(t)).map(e=>({id:`action:${e.text}`,label:e.label,hint:e.hint,group:`Actions`}));return[...n,...r,...i,...a,...o]},onSelect:(e,{editor:t,range:n})=>{if(e.id.startsWith(`preset:`)){let r=x.current.find(t=>`preset:${t.id}`===e.id);if(r){t.chain().focus().deleteRange(n).run();let e=P(t,r.render());E.current?.(r.label,e,r.newSession)}return}if(e.id.startsWith(`custom-preset:`)){let r=S.current.find(t=>`custom-preset:${t.id}`===e.id);if(r){t.chain().focus().deleteRange(n).run();let e=P(t,r.prompt);E.current?.(r.label,e)}return}if(e.id.startsWith(`project-preset:`)){let r=C.current.find(t=>`project-preset:${t.id}`===e.id);if(r){t.chain().focus().deleteRange(n).run();let e=P(t,r.prompt);E.current?.(r.label,e)}return}if(e.id===`new-preset`){t.chain().focus().deleteRange(n).run(),w.current?.();return}let r=nW.find(t=>`action:${t.text}`===e.id);r&&hW(t,n,r)}}),pW({char:`<`,key:`tag`,items:e=>tW.filter(t=>t.label.toLowerCase().includes(e)).map(e=>({id:`macro:${e.text}`,label:e.label,hint:e.hint,group:`Tags`})),onSelect:(e,{editor:t,range:n})=>{let r=tW.find(t=>`macro:${t.text}`===e.id);r&&hW(t,n,r)}}),pW({char:`@`,key:`at`,emptyNote:`No projects to reference yet.`,items:e=>y.current.filter(t=>t.name.toLowerCase().includes(e)).slice(0,8).map(e=>({id:`project:${e.id}`,label:`@${e.name}`,hint:`project`,group:`Projects`})),onSelect:(e,{editor:t,range:n})=>{let r=y.current.find(t=>`project:${t.id}`===e.id);r&&(hW(t,n,{kind:`project`,label:`@${r.name}`,text:`@${r.name}`}),D.current?.(r.path))}}),pW({char:`#`,key:`hash`,emptyNote:`No files indexed here yet.`,items:e=>b.current.filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,8).map(e=>({id:`file:${e}`,label:`#${e}`,hint:`file`,group:`Files`})),onSelect:(e,{editor:t,range:n})=>{let r=e.id.slice(5);hW(t,n,{kind:`file`,label:`#${r}`,text:`#${r}`}),O.current?.(r)}})],editorProps:{attributes:{class:`pe-prose focus:outline-none`,role:`textbox`,"aria-multiline":`true`,"aria-label":`Prompt`,"aria-placeholder":p},handleKeyDown:(e,t)=>(t.metaKey||t.ctrlKey)&&t.key===`Enter`?(t.preventDefault(),j.current(),!0):t.key===`Enter`&&!t.shiftKey&&!t.altKey&&!t.isComposing?e.dom.getAttribute(`aria-expanded`)===`true`||e.state.selection.$from.parent.type.name===`codeBlock`?!1:(t.preventDefault(),j.current(),!0):!1},onUpdate:({editor:e})=>{v(e.isEmpty),A.current(e.storage.markdown.getMarkdown()),N(e)}});(0,T.useImperativeHandle)(g,()=>({clear:()=>{F?.commands.clearContent(),v(!0),A.current(``),F&&N(F)},focus:()=>F?.commands.focus(`end`),loadTemplate:e=>F?P(F,e):!1})),(0,T.useEffect)(()=>{F?.setEditable(!f)},[F,f]);let I=(0,T.useRef)(!1);(0,T.useEffect)(()=>{!F||I.current||!m||(I.current=!0,P(F,m))},[F,m]);let L=h?`px-2 py-1.5`:`px-4 pt-4 pb-3`,R=h?`left-2 top-1.5`:`left-4 top-4`;return(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(Bb,{className:h?`rounded-md border border-border focus-within:ring-2 focus-within:ring-[var(--color-primary)]`:``,viewportClassName:h?`max-h-32 min-h-8`:`max-h-64 min-h-[2.75rem]`,children:(0,J.jsx)(iL,{editor:F,className:`w-full bg-transparent text-sm ${L}`})}),_&&(0,J.jsx)(`span`,{className:`pointer-events-none absolute text-sm text-muted-foreground ${R}`,children:p})]})});function vW({open:e,onOpenChange:t,title:n,children:r}){return(0,J.jsx)(Xx,{open:e,onOpenChange:t,children:(0,J.jsxs)(Gx,{children:[(0,J.jsx)(Ix,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px]`}),(0,J.jsxs)(Wx,{className:`fixed left-1/2 top-1/2 z-50 w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-card p-4 text-card-foreground shadow-lg outline-none`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,J.jsx)(Zx,{className:`text-sm font-semibold`,children:n}),(0,J.jsx)(Lx,{"aria-label":`Close`,className:`rounded p-0.5 text-muted-foreground outline-none hover:text-foreground`,children:(0,J.jsx)(Po,{className:`h-4 w-4`,"aria-hidden":!0})})]}),r]})]})})}var yW=80;function bW(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`p-${Date.now()}`}function xW({currentPrompt:e,busy:t,canSaveToProject:n,onSave:r,onCancel:i}){let[a,o]=(0,T.useState)(``),[s,c]=(0,T.useState)(e),[l,u]=(0,T.useState)(`user`),d=()=>{let e=a.trim(),t=s.trim();!e||!t||r({id:bW(),label:e,prompt:t},n?l:`user`)};return(0,J.jsx)(vW,{open:!0,onOpenChange:e=>{e||i()},title:`New preset`,children:(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),d())},children:[(0,J.jsx)(`input`,{type:`text`,value:a,maxLength:yW,placeholder:`Preset name`,disabled:t,autoFocus:!0,onChange:e=>o(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground`}),(0,J.jsx)(`textarea`,{value:s,placeholder:`The prompt this preset runs…`,disabled:t,rows:5,onChange:e=>c(e.target.value),className:`w-full resize-y rounded-md border border-border bg-background px-2 py-1 font-mono text-xs text-foreground`}),n&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[var(--color-muted-foreground)]`,children:[(0,J.jsx)(`span`,{children:`Save to`}),(0,J.jsx)(`div`,{className:`inline-flex overflow-hidden rounded-md border border-border`,children:[`user`,`project`].map(e=>(0,J.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>u(e),"aria-pressed":l===e,className:l===e?`bg-foreground px-2 py-0.5 text-background`:`px-2 py-0.5 text-foreground hover:bg-[var(--color-muted)]`,children:e===`user`?`Just me`:`This project`},e))}),(0,J.jsx)(`span`,{className:`truncate`,children:l===`project`?`Committed to the repo, shared with your team`:`Private to you, on every project`})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center justify-end gap-2`,children:[(0,J.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),(0,J.jsx)(Y,{type:`button`,size:`sm`,disabled:t||!a.trim()||!s.trim(),onClick:d,children:`Save preset`})]})]})})}function SW({preset:e,busy:t,onLoad:n,onDelete:r}){return(0,J.jsxs)(Zb,{disabled:t,onClick:()=>n(e.prompt,e.label),className:`items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,disabled:t,onClick:t=>{t.stopPropagation(),r(e.id)},"aria-label":`Delete preset ${e.label}`,className:`rounded p-0.5 text-[var(--color-muted-foreground)] hover:text-danger`}),children:(0,J.jsx)(Po,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,J.jsxs)(kx,{children:[`Delete "`,e.label,`"`]})]})]})}function CW({presets:e,customPresets:t,projectPresets:n,busy:r,onLoad:i,onNew:a,onDelete:o,onDeleteProject:s}){return(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,disabled:r,"aria-label":`Presets`,className:q(Ol({variant:`ghost`,size:`icon-sm`}),`h-8 w-8`)}),children:(0,J.jsx)(Oo,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`Load a preset prompt — also available by typing / in the editor`})]}),(0,J.jsxs)(Xb,{align:`start`,className:`min-w-[16rem] max-w-[20rem]`,children:[(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Presets`}),e.map(e=>{let t={disabled:r,onClick:()=>i(e.render(),e.label,e.newSession),className:`items-start`},n=(0,J.jsx)(Pw,{label:e.label,description:`/${e.id}`});return e.tooltip?(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Zb,{...t}),children:n}),(0,J.jsx)(kx,{className:`max-w-[22rem]`,children:e.tooltip})]},e.id):(0,J.jsx)(Zb,{...t,children:n},e.id)})]}),t.length>0&&(0,J.jsxs)(Kb,{children:[(0,J.jsx)(tx,{}),(0,J.jsx)(nx,{children:`Your presets`}),t.map(e=>(0,J.jsx)(SW,{preset:e,busy:r,onLoad:i,onDelete:o},e.id))]}),n.length>0&&(0,J.jsxs)(Kb,{children:[(0,J.jsx)(tx,{}),(0,J.jsx)(nx,{children:`Project presets`}),n.map(e=>(0,J.jsx)(SW,{preset:e,busy:r,onLoad:i,onDelete:s},e.id))]}),a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(tx,{}),(0,J.jsxs)(Zb,{disabled:r,onClick:a,children:[(0,J.jsx)(Co,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`New preset…`]})]})]})]})}function wW(e,t){return e.find(e=>e.value===t)??e[0]}function TW(e,t){return e?(e.models.find(e=>e.value===t)??e.models[0])?.label??``:``}function EW({agents:e,agent:t,model:n,onChange:r,busy:i}){let a=wW(e,t),o=TW(a,n);return(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,disabled:i,className:q(Ol({variant:`ghost`,size:`sm`}),`gap-1.5 px-2 font-normal`)}),children:[a?.icon?(0,J.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center`,children:a.icon}):a?.label,o,(0,J.jsx)(Ha,{className:`h-3.5 w-3.5 opacity-70`})]}),(0,J.jsx)(kx,{children:`Agent: ${a?.label??``} · Model: ${o}`})]}),(0,J.jsx)(Xb,{align:`end`,children:e.map(e=>(0,J.jsxs)(qb,{children:[(0,J.jsxs)($b,{children:[(0,J.jsx)(Va,{className:q(`h-3.5 w-3.5 shrink-0`,e.value===t?`opacity-100`:`opacity-0`)}),e.icon&&(0,J.jsx)(`span`,{className:`flex h-4 w-4 items-center justify-center`,children:e.icon}),(0,J.jsx)(`span`,{className:`flex-1`,children:e.label})]}),(0,J.jsx)(ex,{children:e.models.map(i=>(0,J.jsxs)(Zb,{onClick:()=>r(e.value,i.value),children:[(0,J.jsx)(Va,{className:q(`h-3.5 w-3.5 shrink-0`,e.value===t&&i.value===n?`opacity-100`:`opacity-0`)}),i.label]},i.value))})]},e.value))})]})}function DW(e){let t=e.transparent??!1,n=bc(e),r=e.technical??!1,i=e.vanilla??!1,a=e.eco??!1,o=e.ecoPlanning??!1,s=e.ecoResearch??!1,c=e.ecoMaintenance??!1,l=e.onBeforeMergeableQuality??!1,u=e.browser??!1,d=xc(e),f=e.agent??`claude`,p=Lo[Fo.includes(f)?f:`claude`],m=i||t,h=!a||m;return{main:[{key:`transparent`,label:`Transparent`,description:`Raw ${p} — turns the whole framework off.`,title:`Fully transparent (#625): run the agent exactly like plain ${p}, with no framework system prompt, controls, dashboard, guard, or TODO loop. Overrides the options below.`,checked:t},{key:`autopilot`,label:`Autopilot`,description:`Auto-accepts the recommended choice after a countdown.`,title:`Auto-accept the recommended choice after a countdown, instead of waiting for you to pick`,checked:n&&!t,...OW(t)},{key:`technical`,label:`Technical control`,description:`Surfaces technical detail like tech-stack choices.`,title:`Expose technical detail (e.g. tech-stack choices)`,checked:r&&!t,...OW(t)},{key:`vanilla`,label:`Disable system prompt`,description:`Drops the added system prompt; keeps the session controls.`,title:`Remove the built-in system prompt but keep the framework's session controls. For a fully raw session, use Transparent. Expand 'Enhanced System Prompt' to read what it removes.`,checked:i&&!t,...OW(t)},{key:`eco`,label:`Eco`,description:`Trims the system prompt to save tokens.`,title:`Trim the built-in system prompt to save tokens`,checked:a&&!m,...m?{disabled:!0,disabledReason:`nothing to trim while the system prompt is off`}:{}},{key:`onBeforeMergeableQuality`,label:`Post-merge cleanup`,description:`Runs quality passes once it is ready to merge.`,title:`When the session signals it's ready for merge, run maintainability, readability, and security-audit passes`,checked:l&&!t,...OW(t)},{key:`autoPushBranch`,label:`Push branch`,description:`Pushes the session branch when it finishes.`,title:`Push the session's branch to the remote when it finishes. The bottom rung: with this off the session publishes nothing, and neither PR nor merge can run`,checked:d.push},{key:`autoOpenPr`,label:`Open PR`,description:`Opens a draft pull request when it finishes.`,title:`Open a draft pull request when the session finishes, pushing the branch on the way. Draft, so it does not request review; it still shows on the needs-you queue`,checked:d.pr,...d.push?{}:{disabled:!0,disabledReason:`nothing to open while Push branch is off`}},{key:`autoMerge`,label:`Auto-merge`,description:`Merges the pull request once it is opened.`,title:`Merge the pull request the session opens: GitHub auto-merge where the repo allows it, so it lands when checks pass; merged directly otherwise`,checked:(e.autoMerge??!1)&&d.pr,...d.pr?{}:{disabled:!0,disabledReason:`nothing to merge while Open PR is off`}},{key:`browser`,label:`Browser`,description:`Gives the agent a real browser to inspect pages.`,title:`Give the agent a real browser via chrome-devtools-mcp: navigate pages, read console + network, inspect the DOM, and screenshot`,checked:u&&!t&&f===`claude`,...t||f!==`claude`?{disabled:!0,disabledReason:t?`off while Transparent is on`:`only on Claude Code — the browser is wired through its MCP config`}:{}}],eco:[{key:`ecoPlanning`,label:`Auto planning`,description:`Drops the planning section; the agent plans itself.`,title:`Drop the planning section, letting the agent plan on its own`,checked:o&&!h,...h?{disabled:!0,disabledReason:`only applies while Eco is on`}:{}},{key:`ecoResearch`,label:`Auto research`,description:`Drops the alternatives/variability section.`,title:`Drop the alternatives/variability section`,checked:s&&!h,...h?{disabled:!0,disabledReason:`only applies while Eco is on`}:{}},{key:`ecoMaintenance`,label:`Auto maintenance`,description:`Drops the maintenance section from the post-merge prompt.`,title:`Drop the Maintenance section from the post-merge cleanup prompt`,checked:c&&l&&!h,...h||!l?{disabled:!0,disabledReason:h?`only applies while Eco is on`:`only applies while Post-merge cleanup is on`}:{}}]}}function OW(e){return e?{disabled:!0,disabledReason:`off while Transparent is on`}:{}}var kW=new Set([`autopilot`,`autoPushBranch`,`autoOpenPr`,`autoMerge`,`browser`]);function AW(e){return DW(e).main.filter(e=>kW.has(e.key))}function jW({onClose:e,onAdded:t}){let[n,r]=(0,T.useState)(``),[i,a]=(0,T.useState)(``),o=HS(n),s=o!==null&&o.token!==``,c=()=>{!o||!s||(zS({url:o.url,token:o.token,...i.trim()?{label:i}:{}}),t(),e())};return(0,J.jsx)(vW,{open:!0,onOpenChange:t=>{t||e()},title:`Add a device`,children:(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),c())},children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Paste the URL the box printed on its network bind (it looks like `,(0,J.jsx)(`code`,{children:`http://host:port/?token=…`}),`).`]}),(0,J.jsx)(`input`,{type:`text`,value:n,placeholder:`http://host:port/?token=…`,autoFocus:!0,onChange:e=>r(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs text-foreground`}),(0,J.jsx)(`input`,{type:`text`,value:i,maxLength:60,placeholder:o?`Name (optional) — defaults to ${new URL(o.url).host}`:`Name (optional)`,onChange:e=>a(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground`}),n.trim()!==``&&!s&&(0,J.jsx)(`p`,{className:`text-xs text-warning`,children:o===null?`That is not a valid URL.`:`This URL has no token, so the box could not authenticate you.`}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center justify-end gap-2`,children:[(0,J.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:e,children:`Cancel`}),(0,J.jsx)(Y,{type:`button`,size:`sm`,disabled:!s,onClick:c,children:`Add device`})]})]})})}function MW({options:e,sources:t,fileConfig:n}){let r=e.filter(e=>e.checked&&!e.disabled),i=[...n.preset?[{key:`preset`,label:`preset: ${n.preset}`,repo:!0}]:[],...n.event?[{key:`event`,label:`kind: ${n.event}`,repo:!0}]:[],...r.map(e=>({key:e.key,label:e.label,repo:t[e.key]===`repo`}))];return i.length?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`mr-0.5`,children:`Settings:`}),i.map(e=>(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:e.repo?`rounded border border-dashed border-border px-1.5 py-0.5`:`rounded border border-transparent bg-muted px-1.5 py-0.5`}),children:[e.label,e.repo&&(0,J.jsx)(`span`,{className:`ml-1 opacity-70`,children:`repo`})]}),(0,J.jsx)(kx,{children:e.repo?`From this repo’s the-framework.yml, committed for everyone who clones it`:`Your setting, from the options gear`})]},e.key))]}):null}var NW={claude:{icon:(0,J.jsx)(eu,{className:`h-4 w-4`}),models:[{value:``,label:`Default`},{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}]},codex:{icon:(0,J.jsx)(tu,{className:`h-4 w-4`}),models:[{value:``,label:`Default`},{value:`gpt-5-codex`,label:`GPT-5 Codex`},{value:`gpt-5`,label:`GPT-5`},{value:`o3`,label:`o3`}]}},PW=Fo.map(e=>({value:e,label:Lo[e],...NW[e]})),FW=(0,T.forwardRef)(function({files:e,addContext:t,removeContext:n,onSubmit:r,onPromptChange:i,onPreset:a,busy:o,submitLabel:s,submitBusyLabel:c,placeholder:l,compact:u=!1,showAgentModel:d=!0,inSession:f=!1,sessionEnded:p=!1,sessionName:m,contextControl:h,resolvedRowStart:g,idleControl:_},v){let[y,b]=(0,T.useState)(``),[x,S]=(0,T.useState)(`build`),[C,w]=(0,T.useState)(!1),[E,D]=(0,T.useState)(!1),[O,k]=(0,T.useState)(!1),A=(0,T.useRef)(null),j=$S(),M=oC(j),N=$w(),P=N?j.find(e=>e.id===N):void 0,F=!!N&&M[N]===`offline`,I=typeof window>`u`?null:window.location.origin,L=typeof window>`u`||US(window.location.hostname),R=nC(xa,[],[]),z=fw(),B=pw(),ee=mw(),V=z.technical??!1,H=z.vanilla??!1,te=(0,T.useMemo)(()=>sc.map(e=>({id:e.name,label:e.label,...e.tooltip?{tooltip:e.tooltip}:{},render:()=>e.render(void 0,{session_name:m,settings:{technical_control:V}}),...e.newSession?{newSession:!0}:{}})),[m,V]),U=z.transparent??!1,W=z.eco??!1;z.browser;let ne=z.model??``,re=z.agent??`claude`,ie=z.target??`local`,ae=z.customPresets??[],oe=ow(),se=dw();gw(z);let ce=H||U;(0,T.useImperativeHandle)(v,()=>({clear:()=>{A.current?.clear(),b(``),S(`build`)},focus:()=>A.current?.focus()}));let[le,ue]=(0,T.useState)(void 0);(0,T.useEffect)(()=>{if(u||f)return;lC();let e=dC();e&&ue(e)},[u,f]);let de=(0,T.useRef)(!1),fe=e=>{e?.preventDefault();let t=y.trim();!t||o||de.current||F||(de.current=!0,Promise.resolve(r(t,x,{newSession:C})).finally(()=>{de.current=!1}))},pe=(e,t,n=!1)=>{S(`prompt`),w(n),a?.(e,t)},me=(e,t,n)=>{let r=A.current?.loadTemplate(e)??!1;pe(t,r,n)},he=e=>{b(e);let t=!e.trim()&&x!==`build`?`build`:x;t!==x&&S(t),t===`build`&&C&&w(!1),i?.(e,t)},{main:ge,eco:_e}=DW(z),ve=(0,J.jsx)(_W,{ref:A,compact:u,onChange:he,onSubmit:fe,onPreset:pe,onMentionProject:t,onMentionFile:t,...n?{onMentionRemoved:n}:{},projects:R,files:e,presets:te,customPresets:ae,projectPresets:oe,...u?{}:{onNewPreset:()=>D(!0)},disabled:o,...l?{placeholder:l}:{},...le?{initialText:le}:{}}),ye=d&&(0,J.jsx)(EW,{agents:PW,agent:re,model:ne,onChange:(e,t)=>lw({agent:e,model:t}),busy:o}),be=!u&&(0,J.jsx)(CW,{presets:te,customPresets:ae,projectPresets:oe,busy:o,onLoad:me,onNew:()=>D(!0),onDelete:e=>lw({customPresets:ae.filter(t=>t.id!==e)}),onDeleteProject:e=>sw(oe.filter(t=>t.id!==e))}),xe=f&&!p?null:(0,J.jsx)(Bw,{options:f?AW(z):ge,ecoOptions:f?[]:_e,showEco:!f&&W&&!ce,busy:o,...f?{label:`Resume options`}:{},...f?{}:{runTarget:{value:ie,onChange:e=>lw({target:e})}},...f?{}:{connection:{profiles:j,currentUrl:I,isLocal:L,selectedDeviceId:N,onSelect:e=>Xw(e.id),onSelectDriver:()=>Xw(null),onConnectLocal:KS,onAddDevice:()=>k(!0),onRemove:e=>{N===e.id&&Xw(null),BS(e.id)},status:M}}}),Se=!!y.trim(),Ce=(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{type:`submit`,size:`icon-sm`,onClick:fe,disabled:o||!Se||F,"aria-hidden":!Se,tabIndex:Se?void 0:-1,"aria-label":s,className:q(`h-8 w-8 shrink-0 transition-[margin,opacity,transform] duration-150 ease-out`,Se?`ml-0 translate-x-0 opacity-100 disabled:opacity-100`:`pointer-events-none -ml-[2.375rem] translate-x-2 opacity-0 disabled:opacity-0`)}),children:o?(0,J.jsx)(go,{className:`h-4 w-4 animate-spin`}):(0,J.jsx)(Ia,{className:`h-4 w-4`})}),(0,J.jsx)(kx,{children:o?c:`${s}  (Enter · Shift+Enter for a new line)`})]}),we=!Se&&_?_:Ce,Te=F&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:`${P?.label??`The selected device`} is offline. Pick another target in "Run on" to start.`}),Ee=O&&(0,J.jsx)(jW,{onClose:()=>k(!1),onAdded:()=>A.current?.focus()});return u?(0,J.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:ve}),ye,xe,we,Ee]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`rounded-lg border border-border bg-transparent focus-within:border-muted-foreground/40`,children:[ve,(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-2 pb-2`,children:[be,h,(0,J.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[ye,xe,we]})]})]}),Te,!f&&(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-3`,children:[g,(0,J.jsx)(MW,{options:ge,sources:B,fileConfig:ee})]}),E&&(0,J.jsx)(xW,{currentPrompt:y,busy:o,canSaveToProject:se!==null,onCancel:()=>{D(!1),A.current?.focus()},onSave:(e,t)=>{t===`project`?sw([...oe,e]):lw({customPresets:[...ae,e]}),D(!1),A.current?.focus()}}),Ee]})});function IW({files:e,onRemove:t,busy:n}){return e.length===0?null:(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>t(e),"aria-label":`Remove ${e} from context`,className:`flex h-3.5 w-3.5 items-center justify-center rounded text-muted-foreground hover:text-danger disabled:opacity-50`}),children:(0,J.jsx)(Po,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(kx,{children:[`Remove `,e]})]}),(0,J.jsx)(`span`,{className:`truncate`,title:e,children:e})]},e))})}function LW({otherProjects:e,context:t,contextFiles:n,summary:r,busy:i,onToggle:a}){return(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,disabled:i,className:q(Ol({variant:`ghost`,size:`sm`}),`h-8 items-center gap-1.5 px-2 text-[11px] font-normal text-muted-foreground hover:text-foreground`)}),children:[(0,J.jsx)(fo,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),`Context`,r&&(0,J.jsxs)(`span`,{className:`text-primary`,children:[` · `,r]})]}),(0,J.jsx)(kx,{children:`Narrow the run to specific repos and files`})]}),(0,J.jsxs)(Xb,{align:`start`,className:`min-w-[18rem] max-w-[24rem]`,children:[(0,J.jsxs)(Kb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(nx,{}),children:`Projects`}),(0,J.jsx)(kx,{className:`max-w-[22rem]`,children:`The agent can still reach every repo; ticking some just narrows its focus.`})]}),e.length>0?e.map(e=>(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Qb,{checked:t.has(e.path),onCheckedChange:()=>a(e.path),disabled:i}),children:(0,J.jsx)(`span`,{className:`truncate`,children:e.name})}),(0,J.jsx)(kx,{children:e.path})]},e.id)):(0,J.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground/60`,children:`No other repos to add.`})]}),(0,J.jsx)(tx,{}),(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Files`}),n.length>0?(0,J.jsx)(`div`,{className:`px-2 py-1`,children:(0,J.jsx)(IW,{files:n,onRemove:a,busy:i})}):(0,J.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground/60`,children:`None yet — add with # or the Files tab.`})]})]})]})}var RW=T.createContext(void 0);function zW(e){let t=T.useContext(RW);if(t===void 0&&!e)throw Error(Ou(47));return t}function BW(){return{...Tv(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0}}var VW={...Ev,disabled:iv(e=>e.disabled),instantType:iv(e=>e.instantType),openMethod:iv(e=>e.openMethod),openChangeReason:iv(e=>e.openChangeReason),modal:iv(e=>e.modal),stickIfOpen:iv(e=>e.stickIfOpen),titleElementId:iv(e=>e.titleElementId),descriptionElementId:iv(e=>e.descriptionElementId),openOnHover:iv(e=>e.openOnHover),closeDelay:iv(e=>e.closeDelay)},HW=class e extends gv{constructor(e){let t={...BW(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:T.createRef(),backdropRef:T.createRef(),internalBackdropRef:T.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:T.createRef(),beforeContentFocusGuardRef:T.createRef(),stickIfOpenTimeout:new Cp,triggerElements:new Cv},VW)}setOpen=(e,t)=>{let n=t.reason===nf,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;let a={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested,triggerElement:t.trigger};this.state.floatingRootContext.context.events?.emit(`openchange`,a);let o=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Kd.flushSync(o)):o(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=du(()=>t??new e(n)).current;return Df(r.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function UW({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=HW.useStore(s?.store,{open:n??r,modal:o,activeTriggerId:c===void 0?l:c});u.useControlledProp(`open`,n,r),u.useControlledProp(`activeTriggerId`,c,l);let d=u.useState(`open`),f=u.useState(`positionerElement`),p=u.useState(`payload`),m=u.useState(`openChangeReason`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:h,triggerProps:g,reset:_}=Yy(d);xv(u);let{forceUnmount:v}=Sv(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),_()});Gy(d&&o===!0&&m!==`trigger-hover`&&h!==`touch`,f),T.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let y=T.useCallback(e=>{let t=yf(e);return t.preventUnmountOnClose=()=>{u.set(`preventUnmountingOnClose`,!0)},t},[u]),b=T.useCallback(()=>{u.setOpen(!1,y(vf))},[u,y]);T.useImperativeHandle(e.actionsRef,()=>({unmount:v,close:b}),[v,b]);let x=kv({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=Hv([R_(x,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),$v(x)]),E=T.useMemo(()=>S(g),[S,g]),D=T.useMemo(()=>w(g),[w,g]),O=T.useMemo(()=>C(),[C]);u.useSyncedValues({modal:o,openMethod:h,activeTriggerProps:E,inactiveTriggerProps:D,popupProps:O,floatingRootContext:x,nested:Ih()!=null});let k=T.useMemo(()=>({store:u}),[u]);return(0,J.jsx)(RW.Provider,{value:k,children:typeof t==`function`?t({payload:p}):t})}function WW(e){return zW(!0)?(0,J.jsx)(UW,{props:e}):(0,J.jsx)(Bh,{children:(0,J.jsx)(UW,{props:e})})}var GW=T.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,...f}=e,p=zW(!0),m=o?.store??p?.store;if(!m)throw Error(Ou(74));let h=cd(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`floatingRootContext`),v=m.useState(`isOpenedByTrigger`,h),y=T.useRef(null),{registerTrigger:b,isMountedByThisTrigger:x}=bv(h,y,m,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),S=m.useState(`openChangeReason`),C=m.useState(`stickIfOpen`),w=m.useState(`openMethod`),E=Vv(_,{enabled:_!=null&&c&&(w!==`touch`||S!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:ry(),restMs:l,delay:{close:u},triggerElementRef:y,isActiveTrigger:g}),D=Hv([Tg(_,{enabled:_!=null,stickIfOpen:C})]),O=m.useState(`triggerProps`,x),k=T.useMemo(()=>({disabled:i,open:v}),[i,v]),{getButtonProps:A,buttonRef:j}=Ld({disabled:i,native:a}),M=T.useMemo(()=>({open(e){return e&&S===`trigger-press`?tp.open(e):ep.open(e)}}),[S]),N=$u(`button`,e,{state:k,ref:[j,t,b,y],props:[D.getReferenceProps(),E,O,{[Yu]:``,id:h},f,A],stateAttributesMapping:M}),P=T.useRef(null),F=X(e=>{Kd.flushSync(()=>{m.setOpen(!1,yf(uf,e.nativeEvent,e.currentTarget))}),Oh(P.current)?.focus()}),I=X(e=>{let t=m.select(`positionerElement`);if(t&&kh(e,t))m.context.beforeContentFocusGuardRef.current?.focus();else{Kd.flushSync(()=>{m.setOpen(!1,yf(uf,e.nativeEvent,e.currentTarget))});let n=Dh(y.current);for(;n!==null&&Gp(t,n)||n?.hasAttribute(`aria-hidden`);){let e=n;if(n=wh(n),n===e)break}n?.focus()}});return g?(0,J.jsxs)(T.Fragment,{children:[(0,J.jsx)(Qh,{ref:P,onFocus:F}),(0,J.jsx)(T.Fragment,{children:N},h),(0,J.jsx)(Qh,{ref:m.context.triggerFocusTargetRef,onFocus:I})]}):(0,J.jsx)(T.Fragment,{children:N},h)}),KW=T.createContext(void 0);function qW(){let e=T.useContext(KW);if(e===void 0)throw Error(Ou(45));return e}var JW=T.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=zW();return i.useState(`mounted`)||n?(0,J.jsx)(KW.Provider,{value:n,children:(0,J.jsx)(mg,{ref:t,...r,renderGuards:!1})}):null}),YW=T.createContext(void 0);function XW(){let e=T.useContext(YW);if(!e)throw Error(Ou(46));return e}var ZW=T.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Zu,...g}=e,{store:_}=zW(),v=qW(),y=Rh(),b=_.useState(`floatingRootContext`),x=_.useState(`mounted`),S=_.useState(`open`),C=_.useState(`openChangeReason`),w=_.useState(`activeTriggerElement`),E=_.useState(`modal`),D=_.useState(`positionerElement`),O=_.useState(`instantType`),k=_.useState(`transitionStatus`),A=T.useRef(null),j=Nf(D,!1,!1),M=Ay({anchor:i,floatingRootContext:b,positionMethod:a,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:v,nodeId:y,collisionAvoidance:h,adaptiveOrigin:Dy}),N=T.useMemo(()=>{let e={};return S||(e.pointerEvents=`none`),{role:`presentation`,hidden:!x,style:{...M.positionerStyles,...e}}},[S,x,M.positionerStyles]),P=T.useMemo(()=>({props:N,...M}),[N,M]),F=b?.select(`domReferenceElement`);Z(()=>{let e=F,t=A.current;if(e&&(A.current=e),t&&e&&e!==t){_.set(`instantType`,void 0);let e=new AbortController;return j(()=>{_.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,j,_]);let I=T.useMemo(()=>({open:S,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:O}),[S,P.side,P.align,P.anchorHidden,O]),L=T.useCallback(e=>{_.set(`positionerElement`,e)},[_]),R=$u(`div`,e,{state:I,props:[P.props,my(k),g],ref:[t,L],stateAttributesMapping:np});return(0,J.jsxs)(YW.Provider,{value:P,children:[x&&E===!0&&C!==`trigger-hover`&&(0,J.jsx)(Iy,{ref:_.context.internalBackdropRef,inert:by(!S),cutout:w}),(0,J.jsx)(zh,{id:y,children:R})]})}),QW={...np,...zf},$W=T.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,...o}=e,{store:s}=zW(),c=XW(),l=ay(!0)!=null,u=Sy(),d=s.useState(`open`),f=s.useState(`openMethod`),p=s.useState(`instantType`),m=s.useState(`transitionStatus`),h=s.useState(`popupProps`),g=s.useState(`titleElementId`),_=s.useState(`descriptionElementId`),v=s.useState(`modal`),y=s.useState(`mounted`),b=s.useState(`openChangeReason`),x=s.useState(`popupElement`),S=s.useState(`payload`),C=s.useState(`positionerElement`),w=s.useState(`activeTriggerElement`),E=s.useState(`floatingRootContext`);Pf({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}});let D=s.useState(`disabled`),O=s.useState(`openOnHover`),k=s.useState(`closeDelay`);Lv(E,{enabled:O&&!D,closeDelay:k});function A(e){return e!==`touch`||s.context.popupRef.current}let j=i===void 0?A:i,M=T.useMemo(()=>({open:d,side:c.side,align:c.align,instant:p,transitionStatus:m}),[d,c.side,c.align,p,m]),N=T.useCallback(e=>{s.set(`popupElement`,e)},[s]);function P(){E.context.events.emit(`measure-layout`)}function F(e,t){E.context.events.emit(`measure-layout-complete`,{previousDimensions:e,nextDimensions:t})}Cx({popupElement:x,positionerElement:C,mounted:y,content:S,enabled:T.useCallback(()=>s.context.triggerElements.size>1,[s]),onMeasureLayout:P,onMeasureLayoutComplete:F,side:c.side,direction:u});let I=$u(`div`,e,{state:M,ref:[t,s.context.popupRef,N],props:[h,{"aria-labelledby":g,"aria-describedby":_,onKeyDown(e){l&&py.has(e.key)&&e.stopPropagation()}},my(m),o],stateAttributesMapping:QW});return(0,J.jsx)(wg,{context:E,openInteractionType:f,modal:v===`trap-focus`,disabled:!y||b===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:hd(w)?w:void 0,nextFocusableElement:s.context.triggerFocusTargetRef,beforeContentFocusGuardRef:s.context.beforeContentFocusGuardRef,children:I})}),eG=`data-[popup-open]:bg-[var(--color-accent)] data-[popup-open]:text-[var(--color-accent-foreground)]`,tG=WW;function nG({className:e,...t}){return(0,J.jsx)(GW,{className:typeof e==`function`?e:q(eG,e),...t})}function rG({className:e,sideOffset:t=6,align:n=`start`,children:r,...i}){return(0,J.jsx)(JW,{children:(0,J.jsx)(ZW,{sideOffset:t,align:n,className:`z-50 outline-none`,children:(0,J.jsx)($W,{className:q(`rounded-md border border-[var(--color-border)] bg-[var(--color-card)] text-[var(--color-card-foreground)] shadow-md outline-none`,e),...i,children:(0,J.jsx)(Bb,{viewportClassName:`max-h-[var(--available-height)]`,children:(0,J.jsx)(`div`,{className:`p-3`,children:r})})})})})}function iG({prompt:e,disabled:t,onDisabledChange:n,transparent:r,onTransparentChange:i,browser:a,autopilot:o,eco:s,context:c,user:l,busy:u}){let d=Xs({antiLazyPill:!t,...r?{transparent:!0}:{},...a?{browser:!0}:{},tf:{prompt:e,params:{autopilot:o,...s?{eco:s}:{}}},...c.length?{context:c}:{},...l?{user:l}:{}}),f=!t&&!r,p=!r,m=f&&p;return(0,J.jsxs)(tG,{children:[(0,J.jsxs)(nG,{className:q(`flex items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground outline-none hover:text-foreground`),children:[(0,J.jsx)(`span`,{className:q(`h-1.5 w-1.5 shrink-0 rounded-full`,m?`bg-success`:`bg-muted-foreground`),"aria-hidden":!0}),`Enhanced System Prompt`,(0,J.jsx)(`span`,{className:`sr-only`,children:m?` (fully enabled)`:` (not fully enabled)`}),(0,J.jsx)(Ha,{className:`h-3.5 w-3.5 opacity-70`,"aria-hidden":!0})]}),(0,J.jsx)(rG,{align:`start`,className:`w-[min(42rem,calc(100vw-2rem))] text-xs text-muted-foreground`,children:(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{children:`The Framework wraps your prompt with a so-called "system prompt" (it's just a prompt wrapping your prompt) in order to enable long-running autonomous agents.`}),(0,J.jsxs)(`label`,{className:`flex w-fit cursor-pointer items-center gap-2`,children:[(0,J.jsx)(Vf,{checked:f,onCheckedChange:e=>n(!e),disabled:u||r,...r?{title:`Off while the framework integration is off`}:{}}),`Anti-laziness and improved large-scope planning`]}),(0,J.jsxs)(`label`,{className:`flex w-fit cursor-pointer items-center gap-2`,children:[(0,J.jsx)(Vf,{checked:p,onCheckedChange:e=>i?.(!e),disabled:u||!i}),`Integration with The Framework`,(0,J.jsx)(`span`,{className:`text-muted-foreground/80`,children:`(some functionality stops working)`})]}),d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`pre`,{className:`max-h-96 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 font-mono text-foreground`,children:d}),(0,J.jsxs)(`p`,{children:[d.length.toLocaleString(),` characters. This is the whole system prompt: nothing else is appended when the session starts.`]})]}):(0,J.jsx)(`p`,{className:`text-foreground`,children:`No extra system prompt: only the built-in system prompt of your AI model provider.`})]})})]})}function aG({projectId:e,onRunStarted:t,files:n,context:r,addContext:i,removeContext:a,toggleContext:o}){let[s,c]=(0,T.useState)(``),[l,u]=(0,T.useState)(null),{busy:d,error:f,reset:p,start:m}=yT(),h=(0,T.useRef)(null),g=fw(),_=bc(g),v=g.vanilla??!1,y=g.transparent??!1,b=nC(xa,[],[]),x=nC(()=>ha(e),null,[e]),S=new Set(b.map(e=>e.path)),C=[...r].filter(e=>!S.has(e)),w=b.filter(t=>t.id!==e),E=w.filter(e=>r.has(e.path)).length,D=[E>0?`${E} project${E>1?`s`:``}`:null,C.length>0?`${C.length} file${C.length>1?`s`:``}`:null].filter(Boolean).join(` · `),O=$S(),k=$w(),A=k?O.find(e=>e.id===k):void 0,j={...Sc(g,[...r]),...A?{remote:{url:A.url,token:A.token,label:A.label}}:{}},M=j.target===`web`&&!A,N=nC(()=>M?wa(e):Promise.resolve(null),null,[e,M]),P=M&&N!==null&&N.known&&!N.trusted,F=j.target!==`actions`&&!A,I=j.agent??`claude`,L=F&&(j.autoOpenPr===!0||j.autoMerge===!0),R=nC(()=>F?Ta(I,L):Promise.resolve(null),null,[I,F,L]),z=j.autoMerge===!0&&!A,B=nC(()=>z?Ea(e):Promise.resolve(null),null,[e,z]),ee=z&&B!==null&&B.known&&!B.allowed,V=async(n,r)=>{if(d)return;u(`Starting…`);let i=await m(e,n,r,r===`prompt`?{...j,unattended:!0}:j);u(null),i&&(t?.(n,i.runId,A?.label),h.current?.clear(),c(``))},H=(0,J.jsx)(iG,{prompt:s,disabled:v,onDisabledChange:e=>lw({vanilla:e}),transparent:y,onTransparentChange:e=>lw({transparent:e}),browser:j.browser??!1,autopilot:_,eco:j.eco,context:[...r],user:x,busy:d});return(0,J.jsxs)(`form`,{onSubmit:e=>e.preventDefault(),className:`p-3`,children:[(0,J.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Start a session`}),(0,J.jsx)(FW,{ref:h,files:n,addContext:i,removeContext:a,onSubmit:V,onPromptChange:e=>{c(e),!e.trim()&&l&&u(null),f&&p()},onPreset:(e,t)=>{p(),u(t?`${e} preset loaded over your draft — undo (⌘Z) brings the draft back`:`${e} preset loaded — review or edit, then Start`)},busy:d,submitLabel:`Start session`,submitBusyLabel:`Starting…`,contextControl:(0,J.jsx)(LW,{otherProjects:w,context:r,contextFiles:C,summary:D,busy:d,onToggle:o}),resolvedRowStart:H}),f&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:f}),l&&!f&&(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:l}),P&&(0,J.jsxs)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:[`Claude Code has not been trusted in this project, so a Claude web run cannot start a cloud session. One-time fix: run `,(0,J.jsx)(`code`,{className:`font-mono`,children:`claude`}),` in`,` `,(0,J.jsx)(`code`,{className:`font-mono`,children:N.root}),` once and accept the trust prompt, then start the session — future runs inherit it.`]}),R?.problems.map(e=>(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:e},e)),R?.warnings.map(e=>(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:e},e)),j.model===`haiku`&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:`Haiku consistently skips the session-finish protocol, so a publishing run ends as an unmerged draft PR and needs hand-holding. Pick Fable for real work — Haiku is best kept for throwaway experiments.`}),ee&&(0,J.jsxs)(`p`,{role:`alert`,className:`mt-2 text-xs text-warning`,children:[`This repo has GitHub auto-merge disabled, so an auto-merged session lands its PR immediately — CI is not awaited. To let checks gate the merge, enable`,` `,(0,J.jsx)(`span`,{className:`font-medium`,children:`Allow auto-merge`}),` in the repo settings and mark a check (e.g. `,(0,J.jsx)(`code`,{className:`font-mono`,children:`build`}),`) as required.`]})]})}function oG(){return nC(()=>xC(),[],[])}function sG({projectId:e,runId:t,inline:n=!1}){let[r,i]=(0,T.useState)(null),[a,o]=(0,T.useState)([]),{busy:s,error:c,reset:l,run:u}=iu();(0,T.useEffect)(()=>{let n=!0;return i(null),o([]),l(),uT(e,t??void 0).then(e=>{!n||!e.running||i(e.url??null)}),cT(e,t??void 0).then(e=>{n&&o(e)}),()=>{n=!1}},[e,t,l]);let d=async n=>{let r=await u(()=>sT(e,n,t??void 0),`Failed to start the preview.`);r?.ok&&i(r.url)},f=async()=>{await u(async()=>(await lT(e,t??void 0),!0),`Failed to stop the preview.`)&&i(null)},p=(0,J.jsx)(J.Fragment,{children:r?(0,J.jsxs)(`div`,{className:`inline-flex h-7 items-center overflow-hidden rounded-md border border-border`,children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`flex h-full items-center px-2 hover:bg-accent hover:text-accent-foreground`}),children:(0,J.jsx)(Za,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:`Open in browser`})]}),(0,J.jsx)(`span`,{className:`h-full w-px bg-border`}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:()=>void f(),disabled:s,className:`flex h-full items-center px-2 hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`}),children:(0,J.jsx)(ko,{className:`h-3 w-3 fill-current`})}),(0,J.jsx)(kx,{children:`Stop serving`})]})]}):a.length>1?(0,J.jsxs)(`div`,{className:`inline-flex h-7 items-center overflow-hidden rounded-md border border-border`,children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:()=>void d(),disabled:s,className:`flex h-full items-center px-2 hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`}),children:(0,J.jsx)(So,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:s?`Starting…`:`Serve the last app`})]}),(0,J.jsx)(`span`,{className:`h-full w-px bg-border`}),(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Yb,{disabled:s,className:`flex h-full items-center px-1.5 hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`}),children:(0,J.jsx)(Ha,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:`Pick an app to serve`})]}),(0,J.jsx)(Xb,{align:`end`,children:(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Serve which app`}),a.map(e=>(0,J.jsxs)(Zb,{onClick:()=>void d(e.id),children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label}),(0,J.jsx)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground`,children:e.script})]},e.id))]})})]})]}):(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{variant:`outline`,size:`icon-sm`,disabled:s,onClick:()=>void d()}),children:(0,J.jsx)(So,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:s?`Starting…`:`Serve the built result`})]})});return n?(0,J.jsxs)(J.Fragment,{children:[p,c&&(0,J.jsx)(`p`,{className:`w-full text-xs text-danger`,children:c})]}):(0,J.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2 text-xs`,children:[(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-wide text-muted-foreground`,children:`Serve`}),!r&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Serve this project's built result`}),(0,J.jsx)(`span`,{className:`ml-auto flex items-center gap-2`,children:p}),c&&(0,J.jsx)(`p`,{className:`w-full text-danger`,children:c})]})}function cG({projectId:e,runId:t}){let n=nC(()=>ta(e),null,[e],!0),{busy:r,error:i,reset:a,run:o}=iu(),s=fw().editor,c=oG(),l=s&&!c.some(e=>e.bin===s)?[...c,{bin:s,label:s}]:c;(0,T.useEffect)(()=>a(),[e,t,a]);let u=n=>o(()=>dT(e,n,t??void 0),`Failed to open.`);return(0,J.jsxs)(J.Fragment,{children:[n&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:Ol({variant:`outline`,size:`icon-sm`})}),children:(0,J.jsx)(so,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:`Open on GitHub`})]}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{variant:`outline`,size:`icon-sm`,disabled:r,onClick:()=>void u(`files`)}),children:(0,J.jsx)(to,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(kx,{children:[t?`Open this session's folder`:`Open folder`,` (Finder / Explorer)`]})]}),(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,disabled:r,"aria-label":`Open in editor`,className:Ol({variant:`outline`,size:`icon-sm`})}),children:(0,J.jsx)(Ja,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:`Open in editor`})]}),(0,J.jsxs)(Xb,{align:`end`,className:`min-w-[15rem]`,children:[(0,J.jsxs)(Zb,{disabled:r,onClick:()=>void u(`editor`),children:[(0,J.jsx)(Ja,{className:`h-3.5 w-3.5 shrink-0`}),t?`Open this session's checkout`:`Open in your editor`]}),(0,J.jsx)(tx,{}),(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Preferred editor`}),(0,J.jsxs)(Zb,{disabled:r,closeOnClick:!1,onClick:()=>lw({editor:``}),className:`items-start`,children:[(0,J.jsx)(Va,{className:q(`mt-0.5 h-3.5 w-3.5 shrink-0`,s?`opacity-0`:`opacity-100`)}),(0,J.jsx)(Pw,{label:`Default`,description:`$FRAMEWORK_EDITOR, or code`})]}),l.map(e=>(0,J.jsxs)(Zb,{disabled:r,closeOnClick:!1,onClick:()=>lw({editor:e.bin}),className:`items-start`,children:[(0,J.jsx)(Va,{className:q(`mt-0.5 h-3.5 w-3.5 shrink-0`,s===e.bin?`opacity-100`:`opacity-0`)}),(0,J.jsx)(Pw,{label:e.label,description:e.bin})]},e.bin))]})]})]}),(0,J.jsx)(sG,{projectId:e,runId:t,inline:!0}),i&&(0,J.jsx)(`span`,{className:`text-xs text-danger`,children:i})]})}function lG({projectId:e,runId:t,inline:n=!1,label:r,projectName:i,summary:a,runState:o,expanded:s=!1,onToggle:c}){let[l,u]=(0,T.useState)(1e4),{value:d}=rC(()=>t?pa(e,t):na(e),null,l,[e,t,l],!0);if((0,T.useEffect)(()=>u(d?.prPending?1e3:1e4),[d?.prPending]),!d)return null;let f=`path`in d?d:void 0,p=d.branch,m=Xo(f?.sizeBytes,``),h=f?.own?`Uncommitted changes in this session`:`Uncommitted changes`,g=f?`${p??`no branch`}\n${f.path}`:`branch ${p}`,_=r&&p?p.replace(/^the-framework\//,``):p??`no branch`,v=(0,J.jsxs)(J.Fragment,{children:[c&&(0,J.jsx)(Ua,{className:q(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,s&&`rotate-90`)}),r&&(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:[i&&(0,J.jsxs)(`span`,{className:`flex min-w-0 shrink-[999] items-center gap-1.5 overflow-hidden text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`truncate`,title:i,children:i}),(0,J.jsx)(`span`,{className:`shrink-0 text-muted-foreground/60`,"aria-hidden":!0,children:`/`})]}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,title:r,children:r})]}),(0,J.jsxs)(`span`,{className:q(`flex items-center gap-1.5 overflow-hidden`,r?`hidden min-w-0 shrink-[999] text-muted-foreground @2xl:flex`:`min-w-0 shrink-0 text-muted-foreground`),children:[(0,J.jsx)(io,{className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:q(`truncate`,r?`max-w-[14rem]`:`max-w-[16rem] font-medium text-foreground`)}),children:_}),(0,J.jsx)(kx,{className:`whitespace-pre-line`,children:g})]})]}),(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`}),children:[(0,J.jsx)(`span`,{className:q(`h-2 w-2 rounded-full`,d.dirty?`bg-warning`:`bg-muted-foreground`)}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:d.dirty?`dirty`:`clean`})]}),(0,J.jsx)(kx,{children:d.dirty?h:`Clean`})]}),o,m&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground @4xl:inline`}),children:m}),(0,J.jsx)(kx,{children:`This session's worktree on disk`})]}),(0,J.jsx)(`span`,{className:`hidden shrink-0 @5xl:inline`,children:a})]}),y=(0,J.jsxs)(J.Fragment,{children:[c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-expanded":s,className:`flex min-w-0 items-center gap-2 overflow-hidden rounded text-left hover:text-foreground`,children:v}):v,d.pr&&(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`a`,{href:d.pr.url,target:`_blank`,rel:`noreferrer`,className:q(`flex shrink-0 items-center gap-1.5 text-primary hover:underline`,!n&&`ml-auto`)}),children:[(0,J.jsxs)(`span`,{children:[`PR #`,d.pr.number]}),(0,J.jsx)(`span`,{className:`rounded-full border border-border px-1.5 text-[10px] uppercase text-muted-foreground`,children:d.pr.state.toLowerCase()})]}),(0,J.jsx)(kx,{children:d.pr.title})]})]});return n?(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 overflow-hidden text-xs`,children:y}):(0,J.jsx)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2 text-xs`,children:y})}function uG({projectId:e}){return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border px-4 py-2`,children:[(0,J.jsx)(lG,{projectId:e,inline:!0}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,J.jsx)(cG,{projectId:e})]})}function dG({loop:e}){return(0,J.jsxs)(`section`,{className:`rounded-lg border border-border p-3`,children:[(0,J.jsxs)(`h3`,{className:`mb-1 flex h-8 items-center gap-2 text-xs font-normal tracking-wide text-muted-foreground`,children:[`Loop status`,(0,J.jsx)(kl,{className:e.productionGrade?`text-primary`:e.finished?`text-muted-foreground`:``,children:e.productionGrade?`production-grade`:e.finished?`ended early`:`pass ${e.pass}`})]}),e.blockers.length>0?(0,J.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:e.blockers.map((e,t)=>(0,J.jsxs)(`li`,{className:`text-foreground`,children:[(0,J.jsx)(`span`,{className:`mr-1.5 inline-block h-1 w-1 shrink-0 rounded-full bg-muted-foreground align-middle`,"aria-hidden":!0}),e]},t))}):(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.passing?`No blockers — the checklist passed.`:`Pass ${e.pass} in progress…`})]})}function fG(e){let t=es(e),n=Pl(e),r=n!==void 0&&!n.ok&&!n.stopped,i=n?.stopped===!0;return!t.sessionName&&!t.readyForMerge&&!r&&!i?null:r?{dot:`bg-danger`,label:n?.detail?`failed — ${n.detail}`:`failed`,tone:`text-danger`}:i?{dot:`bg-warning`,label:`stopped`,tone:`text-warning`}:Fl(e)?{dot:`animate-pulse bg-success`,label:`publishing…`,tone:`text-muted-foreground`}:t.readyForMerge?{dot:`bg-success`,label:`ready for merge`,tone:`text-muted-foreground`}:Ml(e)?{dot:`animate-pulse bg-warning`,label:`building…`,tone:`text-muted-foreground`}:{dot:`bg-muted-foreground`,label:`finished`,tone:`text-muted-foreground`}}function pG(e){let t=e?.sessionLink,n=e?.sessionId;return!t||!n||!t.includes(n)?null:{href:t,label:`Open session (${n}) ↗`}}function mG({events:e,showSessionLink:t=!0,showName:n=!0,showStatus:r=!0,showLoop:i=!0}){let a=i?Qo(e):null,o=ns(e),s=$o(e),c=es(e),l=r?fG(e):null,u=t?pG(o):null;return!a&&!s&&!u&&!l?null:(0,J.jsxs)(`div`,{className:`grid gap-3 border-b border-border p-4 md:grid-cols-2`,children:[l&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm md:col-span-2`,children:[(0,J.jsx)(`span`,{className:q(`h-2.5 w-2.5 shrink-0 rounded-full`,l.dot),"aria-hidden":!0}),n&&c.sessionName&&(0,J.jsx)(`span`,{className:`font-medium`,children:c.sessionName}),(0,J.jsx)(`span`,{className:q(`text-xs`,l.tone),children:l.label})]}),a&&(0,J.jsx)(dG,{loop:a}),s&&(0,J.jsxs)(`section`,{className:`rounded-lg border border-border p-3 md:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Deploy`}),(0,J.jsxs)(`p`,{className:`text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium uppercase`,children:s.render}),` → `,s.target,(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,s.reason,`)`]})]})]}),u&&(0,J.jsx)(`a`,{href:u.href,target:`_blank`,rel:`noreferrer`,className:`text-xs text-primary underline underline-offset-2 md:col-span-2`,children:u.label})]})}function hG({choice:e,pick:t,meta:n,footer:r}){let[i,a]=(0,T.useState)(!1),o=new Set(zo(t));return(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-baseline gap-2 px-4 py-2 text-left text-xs text-muted-foreground hover:bg-accent/40`,"aria-expanded":i,children:[(0,J.jsx)(`span`,{className:`shrink-0 text-success`,children:`✓`}),(0,J.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.title}),n,(0,J.jsx)(`span`,{className:`ml-auto shrink-0`,children:i?`Collapse`:`Expand`})]}),i&&(0,J.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,J.jsxs)(`ul`,{className:`space-y-1 text-sm`,children:[e.options.map(e=>(0,J.jsxs)(`li`,{className:q(`flex items-baseline gap-2`,o.has(e.id)?``:`text-muted-foreground`),children:[(0,J.jsx)(`span`,{className:q(`w-4 shrink-0`,o.has(e.id)?`text-success`:``),children:o.has(e.id)?`✓`:``}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),o.size===0&&(0,J.jsx)(`li`,{className:`text-muted-foreground`,children:`Accepted none`})]}),r]})]})}function gG({projectId:e,runId:t,choice:n,active:r=!1,countdown:i=!0,inline:a=!1,onAnswered:o}){let{busy:s,error:c,run:l}=iu(),[u,d]=(0,T.useState)(!1),[f,p]=(0,T.useState)(()=>new Set(n.multi?n.options.filter(e=>e.default).map(e=>e.id):[])),m=(0,T.useRef)(f);m.current=f;let h=bc(fw()),[g,_]=(0,T.useState)(null),[v,y]=(0,T.useState)(!1),b=s||u,x=(r,i=`user`)=>{l(()=>tT(e,n.id,r,i,t??void 0),`Could not send your choice — try again.`).then(e=>{e!==void 0&&(d(!0),o?.(r))})},S=e=>p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),C=n.recommended??n.options[0]?.id,w=n.options.find(e=>e.id!==C)?.id??C,E=()=>n.multi?[...m.current]:C??``,D=(e=`user`)=>x(E(),e);return(0,T.useEffect)(()=>{let e=()=>y(!0);return window.addEventListener(`mousemove`,e,{once:!0}),()=>window.removeEventListener(`mousemove`,e)},[]),(0,T.useEffect)(()=>{if(!r)return;let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&!b&&(e.preventDefault(),D())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,b]),(0,T.useEffect)(()=>{if(!i||!h||v||b){_(null);return}let e=Math.ceil((n.autoAcceptMs??1e4)/1e3);_(e);let t=setInterval(()=>{--e,e<=0?(clearInterval(t),_(null),D(`autopilot`)):_(e)},1e3);return()=>clearInterval(t)},[h,v,b]),(0,J.jsxs)(`section`,{role:`region`,"aria-label":n.title,className:a?`rounded-md border border-border bg-accent/40 p-3`:`border-b border-border bg-accent/40 p-4`,children:[(0,J.jsx)(`div`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Your call`}),(0,J.jsx)(`h2`,{className:`mb-3 text-sm font-medium`,children:n.title}),n.confirm?(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(Y,{className:`bg-success text-background hover:bg-success hover:opacity-90`,disabled:b||!C,onClick:()=>C&&x(C),children:`Approve`}),(0,J.jsx)(Y,{variant:`outline`,className:`border-danger/50 text-danger hover:bg-danger/10 hover:text-danger`,disabled:b||!w,onClick:()=>w&&x(w),children:`Decline`})]}):n.multi?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`ul`,{className:`mb-3 space-y-1`,children:n.options.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm`,children:[(0,J.jsx)(Vf,{className:`mt-0.5`,checked:f.has(e.id),onCheckedChange:()=>S(e.id),disabled:b}),(0,J.jsxs)(`span`,{children:[e.label,e.detail&&(0,J.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.detail})]})]})},e.id))}),(0,J.jsx)(Y,{disabled:b,onClick:()=>x([...f]),children:f.size===0?`Accept none`:`Accept ${f.size} selected`})]}):(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.options.map(e=>(0,J.jsxs)(Y,{variant:e.id===n.recommended?`default`:`outline`,className:q(`h-auto flex-col items-start gap-0.5 py-2 text-left`),disabled:b,onClick:()=>x(e.id),children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[e.label,e.id===n.recommended&&(0,J.jsx)(`span`,{className:`ml-2 text-xs font-normal opacity-80`,children:`Recommended`})]}),e.detail&&(0,J.jsx)(`span`,{className:`text-xs font-normal opacity-80`,children:e.detail})]},e.id))}),c&&(0,J.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:c}),(0,J.jsx)(`div`,{className:`mt-3 flex items-center gap-3 text-xs text-muted-foreground`,children:b?(0,J.jsx)(`span`,{role:`status`,children:s?`Sending your choice…`:`Choice sent — waiting for the session to pick it up…`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,J.jsx)(Vf,{checked:h,onCheckedChange:e=>lw({autopilot:e})}),` Autopilot`]}),h&&(0,J.jsx)(`span`,{className:q(g!==null&&!v&&`font-medium text-foreground`),children:v?`Auto accept canceled — pick manually`:g!==null&&`● Auto accept in ${g}s — move the mouse to cancel`}),r&&(0,J.jsx)(`span`,{className:`ml-auto`,children:`Ctrl+Enter to accept`})]})})]})}var _G=[],vG=e=>`${e.projectId} ${e.runId} ${e.choice.id}`;function yG({onOpenSession:e}){let{value:t,loaded:n}=rC(Qi,_G,5e3,[]),[r,i]=(0,T.useState)(()=>new Map),a=(0,T.useRef)(new Map),o=t.map(e=>{let t=vG(e);return{key:t,question:e,...r.has(t)?{answered:r.get(t)}:{}}}),s=new Set(o.map(e=>e.key));for(let[e,t]of r)s.has(e)||o.push({key:e,question:t.question,answered:t});if(!n||o.length===0)return null;let c=o.filter(e=>!e.answered).length,l=e=>a.current.get(e)?.scrollIntoView({behavior:`smooth`,block:`start`});return(0,J.jsxs)(`section`,{"aria-label":`Open questions`,className:`border-t border-border p-3`,children:[(0,J.jsxs)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:[`Waiting on you · `,c]}),(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(Bb,{className:`min-w-0 flex-1`,viewportClassName:`max-h-[70vh]`,children:(0,J.jsx)(`div`,{className:`space-y-3`,children:o.map(({key:t,question:n,answered:r})=>(0,J.jsx)(`div`,{ref:e=>{e?a.current.set(t,e):a.current.delete(t)},children:r?(0,J.jsx)(hG,{choice:n.choice,pick:r.pick,meta:(0,J.jsx)(`span`,{className:`truncate`,children:bG(n)}),footer:(0,J.jsx)(`button`,{type:`button`,onClick:()=>e(n.projectId,n.runId),className:`mt-3 text-xs text-muted-foreground hover:text-foreground`,children:`Open session →`})}):(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(n.projectId,n.runId),className:`flex w-full items-baseline gap-2 px-4 py-2 text-left text-xs text-muted-foreground hover:bg-accent/40`,title:`Open this session`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:bG(n)}),(0,J.jsx)(`span`,{className:`truncate`,children:n.projectName}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0`,children:`Open session →`})]}),(0,J.jsx)(gG,{projectId:n.projectId,runId:n.runId,choice:n.choice,countdown:!1,onAnswered:e=>i(r=>new Map(r).set(t,{question:n,pick:e}))})]})},t))})}),o.length>1&&(0,J.jsx)(`nav`,{"aria-label":`Jump to a question`,className:`sticky top-2 w-44 shrink-0 space-y-1 self-start`,children:o.map(({key:e,question:t,answered:n})=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>l(e),className:q(`flex w-full items-baseline gap-1.5 rounded px-2 py-1 text-left text-xs hover:bg-accent/40`,n?`text-muted-foreground/60`:`text-muted-foreground`),children:[n&&(0,J.jsx)(`span`,{className:`shrink-0 text-success`,children:`✓`}),(0,J.jsx)(`span`,{className:`truncate`,children:bG(t)})]},e))})]})]})}function bG(e){return e.sessionName??e.intent?.split(`
`)[0]?.slice(0,80)??e.runId}function xG({text:e,compact:t=!1}){return(0,J.jsx)(`div`,{className:t?`space-y-1.5 text-xs leading-relaxed`:`space-y-2 text-sm leading-relaxed`,children:TG(e,t)})}function SG(e,t){return(0,J.jsx)(`pre`,{className:`overflow-x-auto rounded bg-muted p-2 text-xs`,children:(0,J.jsx)(`code`,{children:e.join(`
`)})},t)}function CG(e){let t=e.trim().split(`|`);return t[0]?.trim()===``&&t.shift(),t[t.length-1]?.trim()===``&&t.pop(),t.map(e=>e.trim())}function wG(e){return CG(e).length>0&&CG(e).every(e=>/^:?-{3,}:?$/.test(e))}function TG(e,t=!1){let n=e.replace(/\r\n/g,`
`).split(`
`),r=[],i=[],a=null,o=[],s=0,c=()=>{i.length&&(r.push((0,J.jsx)(`ul`,{className:`ml-4 list-disc space-y-1 marker:text-muted-foreground`,children:i},s++)),i=[])},l=()=>{if(o.length===0)return;let e=o;if(o=[],e.length>=2&&wG(e[1])){let t=CG(e[0]),n=e.slice(2).map(CG);r.push((0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:t.map((e,t)=>(0,J.jsx)(`th`,{className:`border-b border-border px-2 py-1 text-left font-semibold`,children:OG(e)},t))})}),(0,J.jsx)(`tbody`,{children:n.map((e,n)=>(0,J.jsx)(`tr`,{children:t.map((t,n)=>(0,J.jsx)(`td`,{className:`border-b border-border/50 px-2 py-1 align-top`,children:OG(e[n]??``)},n))},n))})]})},s++))}else for(let t of e)r.push((0,J.jsx)(`p`,{children:OG(t)},s++))};for(let e of n){if(e.trim().startsWith("```")){a===null?(c(),a=[]):(r.push(SG(a,s++)),a=null);continue}if(a!==null){a.push(e);continue}if(/^\s*\|.*\|\s*$/.test(e)){c(),o.push(e);continue}l();let n=/^(#{1,6})\s+(.*)$/.exec(e);if(n){c();let e=n[1].length,i=t?[`text-sm`,`text-sm`,`text-xs`,`text-xs`,`text-xs`,`text-xs`]:[`text-lg`,`text-base`,`text-sm`,`text-sm`,`text-sm`,`text-sm`];r.push((0,J.jsx)(`p`,{className:`font-semibold ${i[e-1]}`,children:OG(n[2])},s++));continue}let u=/^\s*[-*]\s+\[([ xX])\]\s+(.*)$/.exec(e);if(u){i.push((0,J.jsxs)(`li`,{className:`list-none -ml-4 flex items-start gap-2`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:u[1].toLowerCase()===`x`,readOnly:!0,className:`mt-1`}),(0,J.jsx)(`span`,{children:OG(u[2])})]},s++));continue}let d=/^\s*[-*]\s+(.*)$/.exec(e);if(d){i.push((0,J.jsx)(`li`,{children:OG(d[1])},s++));continue}c(),e.trim()&&r.push((0,J.jsx)(`p`,{children:OG(e)},s++))}return c(),l(),a!==null&&r.push(SG(a,s++)),r}var EG=`text-primary underline underline-offset-2 break-all`;function DG(e,t,n){return(0,J.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:EG,children:t},n)}function OG(e){let t=[],n=/(`[^`]+`|\[[^\]]+\]\(https?:\/\/[^\s)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|https?:\/\/[^\s<>)\]]+)/g,r=0,i,a=0;for(;i=n.exec(e);){i.index>r&&t.push((0,J.jsx)(T.Fragment,{children:e.slice(r,i.index)},a++));let n=i[0];if(n.startsWith("`"))t.push((0,J.jsx)(`code`,{className:`rounded bg-muted px-1 text-xs`,children:n.slice(1,-1)},a++));else if(n.startsWith(`[`)){let e=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(n);e?t.push(DG(e[2],e[1],a++)):t.push((0,J.jsx)(T.Fragment,{children:n},a++))}else n.startsWith(`**`)?t.push((0,J.jsx)(`strong`,{children:n.slice(2,-2)},a++)):n.startsWith(`*`)?t.push((0,J.jsx)(`em`,{children:n.slice(1,-1)},a++)):t.push(DG(n,n,a++));r=i.index+n.length}return r<e.length&&t.push((0,J.jsx)(T.Fragment,{children:e.slice(r)},a++)),t}function kG({docs:e,loaded:t}){let[n,r]=(0,T.useState)(0);if(!t)return(0,J.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading…`});if(e.length===0)return(0,J.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No PLAN/TODO docs yet.`});let i=e[Math.min(n,e.length-1)];return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1 border-b border-border p-2`,children:e.map((e,t)=>(0,J.jsx)(Y,{variant:`ghost`,size:`sm`,className:q(`h-7 text-xs`,t===n&&`bg-accent text-accent-foreground`),onClick:()=>r(t),children:e.name},e.name))}),(0,J.jsx)(Bb,{className:`min-h-0 flex-auto`,children:(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsx)(xG,{text:i.content})})})]})}var AG=[];function jG({projectId:e}){let{value:t,loaded:n}=rC(()=>Gi(e),AG,4e3,[e]);return!n||t.length===0?null:(0,J.jsxs)(`section`,{"aria-label":`Docs`,className:`border-t border-border p-3`,children:[(0,J.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Docs`}),(0,J.jsx)(`div`,{className:`flex max-h-[28rem] flex-col overflow-hidden rounded-md border border-border`,children:(0,J.jsx)(kG,{docs:t,loaded:!0})})]})}function MG({logs:e,loaded:t}){return t?e.length===0?(0,J.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No finished sessions recorded in this project yet.`}):(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col`,children:[(0,J.jsxs)(`p`,{className:`shrink-0 border-b border-border px-4 py-2 text-xs text-muted-foreground`,children:[`Finished sessions in this project, newest first — from `,(0,J.jsx)(`code`,{className:`font-mono`,children:`.the-framework/LOGS.md`}),`, committed to the repo, so it survives a fresh clone.`]}),(0,J.jsx)(Bb,{className:`min-h-0 flex-auto`,children:(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map((e,t)=>(0,J.jsxs)(`li`,{className:`px-4 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(kl,{className:`text-[10px] uppercase text-muted-foreground`,children:e.kind}),(0,J.jsx)(kl,{className:q(`border-transparent px-0 text-[10px] uppercase`,Ql[e.status]),children:e.status}),(0,J.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:Vl(e.at)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm`,children:e.title})]},t))})})]}):(0,J.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading…`})}var NG=[];function PG({projectId:e}){let{value:t,loaded:n}=rC(()=>Ki(e),NG,1e4,[e]);return!n||t.length===0?null:(0,J.jsxs)(`section`,{"aria-label":`History`,className:`border-t border-border p-3`,children:[(0,J.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`History`}),(0,J.jsx)(`div`,{className:`flex max-h-[24rem] flex-col overflow-hidden rounded-md border border-border`,children:(0,J.jsx)(MG,{logs:t,loaded:!0})})]})}function FG({projectId:e,events:t,onRunStarted:n,files:r,context:i,addContext:a,removeContext:o,toggleContext:s,onOpenSession:c}){return(0,J.jsxs)(Bb,{className:`min-h-0 flex-1`,children:[(0,J.jsx)(uG,{projectId:e}),(0,J.jsx)(aG,{projectId:e,onRunStarted:n,files:r,context:i,addContext:a,removeContext:o,toggleContext:s}),t.length>0&&(0,J.jsx)(mG,{events:t}),(0,J.jsx)(yG,{onOpenSession:c}),(0,J.jsx)(jG,{projectId:e}),(0,J.jsx)(PG,{projectId:e})]})}var IG=(...e)=>K(`/server/quota.telefunc.ts`,`onQuota`,e);IG._key=`/server/quota.telefunc.ts:onQuota`;var LG=(...e)=>K(`/server/quota.telefunc.ts`,`onAutoPm`,e);LG._key=`/server/quota.telefunc.ts:onAutoPm`;var RG=(...e)=>K(`/server/quota.telefunc.ts`,`sendAutoPmSweep`,e);RG._key=`/server/quota.telefunc.ts:sendAutoPmSweep`;var zG=3e4;function BG(){return rC(IG,void 0,zG,[]).value}function VG(){return rC(LG,void 0,zG,[]).value}function HG(e){return new Intl.DateTimeFormat(`en-US`,{weekday:`short`}).format(e).slice(0,2).toUpperCase()}function UG(e,t,n=HG){let r=t-e;if(!(r>0))return[];let i=[e],a=new Date(e);for(a.setHours(24,0,0,0);a.getTime()<t;)i.push(a.getTime()),a.setHours(24,0,0,0);i.push(t);let o=[];for(let t=0;t<i.length-1;t++){let a=i[t],s=i[t+1];o.push({startPercent:(a-e)/r*100,endPercent:(s-e)/r*100,label:n(a)})}let s=o[0],c=o.at(-1);return o.length>1&&s.label===c.label&&(s.endPercent-s.startPercent>=c.endPercent-c.startPercent?c.label=void 0:s.label=void 0),o}var WG=5;function GG(e,t,n=WG){return e>=100?`full`:e>t+n?`over`:e>=t-n?`near`:`under`}var KG=100/7;function qG(e,t){return Math.min(Math.max(e+t,0),100)}function JG(e,t,n){return(e-t)/100*n}function YG(e,t){let n=Math.min(Math.max(e,0),100);return{start:n,end:Math.max(n,Math.min(Math.max(t,0),100))}}function XG({className:e,...t}){return(0,J.jsx)(`div`,{className:q(`rounded-lg border border-border bg-card text-card-foreground`,e),...t})}function ZG({className:e,...t}){return(0,J.jsx)(`div`,{className:q(`flex flex-col gap-1 px-4 pt-4`,e),...t})}function QG({className:e,...t}){return(0,J.jsx)(`h3`,{className:q(`text-sm font-semibold`,e),...t})}function $G({className:e,...t}){return(0,J.jsx)(`div`,{className:q(`p-4`,e),...t})}var eK={under:`bg-success`,near:`bg-info`,over:`bg-warning`,full:`bg-danger`},tK={under:`text-success`,near:`text-info`,over:`text-warning`,full:`text-danger`},nK=` — `;function rK(e){return e.find(e=>e.kind===`week`)}function iK({swatch:e,children:t}){return(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e,t]})}function aK({status:e,percentUsed:t,offset:n,onChangeOffset:r,others:i}){let{boundary:a}=e,o=UG(a.startsAt,a.resetsAt),s=GG(t,a.percent),c=qG(a.percent,n),l=YG(t,c),u=l.end>l.start,d=JG(c,a.percent,a.resetsAt-a.startsAt),f=c>a.percent+KG,p=`${Math.round(t)}% of the week used, against a boundary of ${Math.round(a.percent)}% on day ${a.day} of 7`,m=JG(t,a.percent,a.resetsAt-a.startsAt),h=m>=0,g=h?`Over-consuming`:`Under-consuming`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`div`,{className:`relative h-4 text-[10px] font-medium tracking-wide text-muted-foreground`,children:o.map((e,t)=>e.label&&(0,J.jsx)(`span`,{className:`absolute top-0 -translate-x-1/2`,style:{left:`${(e.startPercent+e.endPercent)/2}%`},children:e.label},t))}),(0,J.jsxs)(`div`,{className:`relative h-4`,children:[(0,J.jsxs)(`div`,{role:`img`,"aria-label":p,className:`absolute inset-x-0 top-[3px] h-2.5 overflow-hidden rounded-full bg-muted`,children:[(0,J.jsx)(`div`,{className:q(`absolute inset-y-0 left-0`,eK[s]),style:{width:`${l.start}%`}}),u&&(0,J.jsx)(`div`,{className:q(`absolute inset-y-0 opacity-35`,eK[s]),style:{left:`${l.start}%`,width:`${l.end-l.start}%`}}),o.slice(1).map((e,t)=>(0,J.jsx)(`div`,{className:`absolute inset-y-0 w-1 bg-background/60`,style:{left:`${e.startPercent}%`},"aria-hidden":!0},t)),(0,J.jsx)(`div`,{className:`absolute inset-y-0 w-0.5 -translate-x-1/2 bg-foreground`,style:{left:`${Math.min(Math.max(a.percent,0),100)}%`},"aria-hidden":!0})]}),(0,J.jsx)(`input`,{type:`range`,"aria-label":`Unattended work stops at`,className:q(`absolute inset-0 h-full w-full cursor-grab appearance-none bg-transparent active:cursor-grabbing`,`[&::-webkit-slider-runnable-track]:bg-transparent`,`[&::-moz-range-track]:border-none [&::-moz-range-track]:bg-transparent`,`[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full`,`[&::-webkit-slider-thumb]:border [&::-webkit-slider-thumb]:border-background [&::-webkit-slider-thumb]:bg-foreground [&::-webkit-slider-thumb]:shadow-sm`,`[&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-none`,`[&::-moz-range-thumb]:border [&::-moz-range-thumb]:border-background [&::-moz-range-thumb]:bg-foreground [&::-moz-range-thumb]:shadow-sm`),min:0,max:100,step:`any`,value:c,onChange:e=>{let t=Math.round(Number(e.target.value)-a.percent);r(Math.min(Math.max(t,-50),50))}})]}),(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:`cursor-default`}),children:[g,`: `,(0,J.jsx)(`span`,{className:q(`font-medium`,tK[s]),children:Kl(Math.abs(m))})]}),(0,J.jsxs)(kx,{className:`max-w-64`,children:[`You are `,Jl(Math.abs(m)),` `,h?`above`:`below`,` the quota boundary.`,(0,J.jsx)(`br`,{}),(0,J.jsx)(`br`,{}),`You're`,` `,h?`over-consuming`:`under-consuming`,`: you spend `,h?`faster`:`slower`,` than the week's pace allows.`]})]}),nK,(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:`cursor-default`}),children:[`resets `,Xl(a.resetsAt)]}),(0,J.jsx)(kx,{children:Zl(a.resetsAt)})]}),i.length>1?(0,J.jsxs)(J.Fragment,{children:[nK,(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`cursor-default`}),children:`show all limits`}),(0,J.jsx)(kx,{children:(0,J.jsx)(`table`,{className:`border-collapse text-left`,children:(0,J.jsx)(`tbody`,{children:i.map(e=>(0,J.jsx)(sK,{window:e},e.label))})})})]})]}):null]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,J.jsx)(iK,{swatch:(0,J.jsx)(`span`,{className:q(`h-2 w-2 rounded-sm`,eK[s]),"aria-hidden":!0}),children:`Used`}),(0,J.jsx)(iK,{swatch:(0,J.jsx)(`span`,{className:q(`h-2 w-2 rounded-sm opacity-35`,eK[s]),"aria-hidden":!0}),children:`Budget for Autonomous AI`}),(0,J.jsx)(iK,{swatch:(0,J.jsx)(`span`,{className:`h-2 w-0.5 bg-foreground`,"aria-hidden":!0}),children:(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:`inline-flex cursor-default items-center gap-0.5`}),children:[`Quota boundary`,(0,J.jsx)(Wa,{className:`h-3 w-3`,"aria-hidden":!0})]}),(0,J.jsxs)(kx,{className:`max-w-64 space-y-2`,children:[(0,J.jsx)(`p`,{children:`Not a hard limit — just an indication of whether you're over- or under-consuming. It's calculated as a pro-rated share of the weekly limit.`}),(0,J.jsx)(`p`,{children:`If your usage matches the quota boundary, then you're spending exactly what the week's pace allows.`}),(0,J.jsx)(`p`,{children:`Fun fact: the quota boundary is shown exactly at the current time in the week usage bar above.`})]})]})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[f&&(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`span`,{className:`inline-flex cursor-default items-center gap-0.5 text-warning`}),children:[`⚠️  Eager consumption`,(0,J.jsx)(Wa,{className:`h-3 w-3`,"aria-hidden":!0})]}),(0,J.jsxs)(kx,{children:[`Autonomous AI will spend tokens `,Jl(d),` faster than the week's pace allows`]})]}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`cursor-default`}),children:u?(0,J.jsxs)(J.Fragment,{children:[`✅ Autonomous AI `,(0,J.jsx)(`em`,{children:`enabled`}),` `,(0,J.jsx)(`small`,{className:`text-muted-foreground/70`,children:`move slider to the left to disable`})]}):(0,J.jsxs)(J.Fragment,{children:[`❌ Autonomous AI `,(0,J.jsx)(`em`,{children:`disabled`}),` `,(0,J.jsx)(`small`,{className:`text-muted-foreground/70`,children:`move slider to the right to enable`})]})}),(0,J.jsx)(kx,{className:`max-w-64`,children:u?`Autonomous AI enabled means that agents will automatically work on tasks in the AI queue, and tasks will be automatically added to the AI queue.`:`Autonomous AI disabled means that agents won't automatically start to work — every new agentic work is triggered by you manually.`})]})]})]})]})}function oK({window:e}){return(0,J.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[Math.round(e.percentUsed),`% used`,e.resetsAtText?`${nK}resets ${e.resetsAtText}`:``]})]})}function sK({window:e}){return(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{className:`pr-3 align-baseline text-muted-foreground`,children:e.label}),(0,J.jsxs)(`td`,{className:`whitespace-nowrap align-baseline text-muted-foreground`,children:[Math.round(e.percentUsed),`% used`,e.resetsAtText?`${nK}resets ${e.resetsAtText}`:``]})]})}function cK(e){switch(e.unavailable){case void 0:return;case`no-subscription`:return`This account has no subscription usage to report, so there is no boundary to measure against.`;case`agent-not-found`:return`Claude Code was not found, so usage cannot be read.`;case`unrecognized`:return e.windows.length?`Claude Code's latest usage readout wasn't one this version recognizes, so these numbers are from the reading before it.`:`Claude Code reported its usage in a way this version does not recognize. Trying again shortly.`;default:return e.windows.length?`Couldn't refresh just now, so these numbers may be a little behind.`:`Reading your usage now.`}}function lK(e){let[t,n]=(0,T.useState)(e??7.142857142857143),r=(0,T.useRef)(null);return(0,T.useEffect)(()=>{e!==void 0&&(r.current!==null&&r.current!==e||(r.current=null,n(e)))},[e]),[t,e=>{n(e),r.current=e,lw({autoSpendOffset:e})}]}function uK(){let e=BG(),[t,n]=lK(e?.boundary?.limit.offset),r=e?cK(e):void 0,i=e?.unavailable!==void 0&&e.windows.length>0?e.readAt:void 0,a=e?rK(e.windows):void 0,o=e?.windows??[];return(0,J.jsxs)(XG,{children:[(0,J.jsx)(ZG,{children:(0,J.jsx)(QG,{className:`text-base`,children:`Usage`})}),(0,J.jsxs)($G,{className:`space-y-4`,children:[!e&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Reading your usage…`}),e?.boundary&&a?(0,J.jsx)(aK,{status:e.boundary,percentUsed:a.percentUsed,offset:t,onChangeOffset:n,others:o}):e&&e.windows.length?(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:a?.resetsAtText?`Couldn't parse quota: the week resets “${a.resetsAtText}”, which isn't a phrasing this version recognizes.`:`Couldn't parse quota: the readout has no week this version can place.`}):null,!(e?.boundary&&a)&&o.length?(0,J.jsx)(`div`,{className:`space-y-1 border-t border-border pt-3`,children:o.map(e=>(0,J.jsx)(oK,{window:e},e.label))}):null,r?(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[r,i===void 0?``:` Last read ${Gl(new Date(i).toISOString())}.`]}):null]})]})}var dK=`Brings sessions into Discord: it posts what each session is doing, and lets you start and steer sessions by replying — so you can follow work with no dashboard open.`,fK=`Delivers notifications to Discord, so a session waiting on you reaches you with no dashboard open.`;function pK(e){let t=bw(fw());return(0,J.jsx)(hK,{...e,credential:`botToken`,title:`Discord bot`,description:dK,label:`Bot token`,placeholder:`Paste the bot token`,steps:[`Create a Discord application with a bot, and invite it to your server.`,`Copy the bot token from its Bot tab.`,`Paste it below.`],toggle:{on:t,onLabel:`Bot enabled`,offLabel:`Bot disabled`,description:`Whether Discord messages may start and steer sessions.`,set:e=>lw({discordBot:e})}})}function mK(e){let t=yw(fw());return(0,J.jsx)(hK,{...e,credential:`webhook`,title:`Discord notifications`,description:fK,label:`Webhook URL`,placeholder:`https://discord.com/api/webhooks/…`,steps:[`In Discord, open the channel the notifications should land in.`,`Edit Channel → Integrations → Webhooks → New Webhook, then Copy Webhook URL.`,`Paste it below.`],toggle:{on:t,onLabel:`Discord delivery on`,offLabel:`Discord delivery off`,description:`Whether notifications are posted to Discord.`,set:e=>lw({notifyDiscord:e})}})}function hK({open:e,onOpenChange:t,channels:n,onSaved:r,credential:i,title:a,description:o,label:s,placeholder:c,steps:l,toggle:u}){let d=n?.sources[i],f=d!==void 0,p=d===`env`,m=n?.editable??!1,[h,g]=(0,T.useState)(``),[_,v]=(0,T.useState)(!1),[y,b]=(0,T.useState)(null),[x,S]=(0,T.useState)(!1);(0,T.useEffect)(()=>{e||(g(``),b(null),S(!1))},[e]);let C=m&&!p&&(!f||x),w=h.trim()?Tc(i,h):void 0,E=async e=>{v(!0),b(null);let t=await CC(i===`botToken`?{botToken:e}:{webhook:e}).catch(()=>({ok:!1,error:`Could not reach the daemon.`}));if(v(!1),!t.ok){b(t.error);return}g(``),S(!1),r()};return(0,J.jsx)(vW,{open:e,onOpenChange:t,title:a,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:o}),p?(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Set by `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:wc(i)}),` in the daemon's environment, so it is not editable here. Unset it and restart the daemon to manage it from the dashboard instead.`]}):m?f&&!x?(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsxs)(`span`,{children:[s,` saved`]}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Held on the daemon, and never shown again.`})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,J.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>S(!0),children:`Replace`}),(0,J.jsx)(Y,{variant:`ghost`,size:`sm`,disabled:_,onClick:()=>void E(null),children:`Remove`})]})]}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`Not configured yet`}),(0,J.jsx)(`ol`,{className:`list-decimal space-y-1 pl-5 text-muted-foreground`,children:l.map(e=>(0,J.jsx)(`li`,{children:e},e))})]}):(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`This server does not store credentials, so Discord cannot be set up from here.`}),C&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s}),(0,J.jsx)(`input`,{type:`password`,value:h,placeholder:c,autoFocus:!0,autoComplete:`off`,spellCheck:!1,onChange:e=>g(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs text-foreground`})]}),w&&(0,J.jsx)(`p`,{className:`text-xs text-warning`,children:w}),(0,J.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[x&&(0,J.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{S(!1),g(``)},children:`Cancel`}),(0,J.jsx)(Y,{size:`sm`,disabled:!h.trim()||!!w||_,onClick:()=>void E(h),children:_?`Saving…`:`Save`})]})]}),y&&(0,J.jsx)(`p`,{className:`text-xs text-destructive`,children:y}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{children:u.on?u.onLabel:u.offLabel}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:f?u.description:`Can be turned on now; it starts working once the credential is set.`})]}),(0,J.jsx)(Y,{variant:u.on?`outline`:`default`,size:`sm`,onClick:()=>u.set(!u.on),children:u.on?`Disable`:`Enable`})]})]})})}function gK({dismissible:e=!1,onRunStarted:t}){let{value:n,reload:r}=rC(ea,null,1e4,[]),{value:i,reload:a}=rC(Ca,null,3e4,[]),o=Nw(),s=fw(),c=Tw(),{start:l,busy:u,error:d}=yT(),[f,p]=(0,T.useState)(!1),[m,h]=(0,T.useState)(!1),[g,_]=(0,T.useState)(null),[v,y]=(0,T.useState)(!1),[b,x]=(0,T.useState)(!1),S=i?.cwdProjectId??n?.projects[0]?.projectId??null,C=n?.totals.projects??0,w=n?.projects.some(e=>e.hasTickets)??!1,E=c===`granted`&&vw(s),D=[{key:`project`,label:`Add a project`,description:`A project is a git repo The Framework may work in.`,done:C>0,action:(0,J.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[i?.cwd&&!i.cwdProjectId&&(0,J.jsx)(Y,{size:`sm`,onClick:async()=>{if(!i?.cwd)return;h(!0),_(null);let e=await Sa(i.cwd,!1).catch(()=>({ok:!1,error:`Could not reach the daemon.`}));if(h(!1),!e.ok){_(e.error);return}r(),a()},disabled:m,children:m?`Adding…`:`Add ${i.cwd} as project`}),(0,J.jsx)(Y,{size:`sm`,variant:`outline`,onClick:()=>p(!0),children:`Select & add project directory`})]}),g&&(0,J.jsx)(`span`,{className:`text-xs text-destructive`,children:g})]})},{key:`todos`,label:`Populate the queue of AI tasks`,description:`TODO_AGENTS.md is the queue: each unchecked item is work the agent picks up on its own, so a filled queue is what lets it keep going without you.`,done:(n?.totals.openTodos??0)>0},{key:`tickets`,label:`Populate tickets/`,description:`tickets/ holds the bigger things to work on, in the repo. The agent researches and plans them, and they are the input the queue is filled from.`,done:w,optional:!0,action:(0,J.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,J.jsx)(Y,{size:`sm`,onClick:async()=>{if(!S)return;let e=oc.importTickets.render(),n=await l(S,e,`prompt`,{unattended:!0});n&&t(S,e,n.runId)},disabled:!S||u,children:u?`Starting…`:`Import tickets from GitHub`}),!S&&(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add a project first`}),d&&(0,J.jsx)(`span`,{className:`text-xs text-destructive`,children:d})]})},{key:`discord-bot`,label:`Add the Discord bot`,description:dK,done:o?.discordBot??!1,optional:!0,action:(0,J.jsx)(Y,{size:`sm`,variant:`outline`,onClick:()=>y(!0),children:`Set up the bot`})},{key:`browser-notification`,label:`Add browser notifications`,description:`Desktop pings while the dashboard is open, so a session waiting on you does not sit unnoticed.`,done:E,optional:!0,action:c===`denied`?(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Blocked in your browser settings`}):c===`unsupported`?(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not supported by this browser`}):(0,J.jsx)(Y,{size:`sm`,variant:`outline`,onClick:()=>{lw({notifyBrowser:!0}),c==="default"&&Notification.requestPermission()},children:`Enable`})},{key:`discord-notification`,label:`Add Discord notifications`,description:fK,done:o?.discordWebhook??!1,optional:!0,action:(0,J.jsx)(Y,{size:`sm`,variant:`outline`,onClick:()=>x(!0),children:`Add the webhook`})}],O=D.filter(e=>e.done).length;return(0,J.jsxs)(XG,{children:[(0,J.jsxs)(ZG,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(QG,{className:`text-base`,children:`Onboarding`}),(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,` of `,D.length,` set up.`]})]}),e&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>lw({onboardingDismissed:!0}),"aria-label":`Remove, you can resume the onboarding on the settings page`}),children:(0,J.jsx)(Po,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`Remove, you can resume the onboarding on the settings page`})]})]}),(0,J.jsx)($G,{children:(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:D.map(e=>(0,J.jsxs)(`li`,{className:`flex items-start justify-between gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[e.done?(0,J.jsx)(Do,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--color-primary)]`,"aria-label":`Done`}):(0,J.jsx)(ko,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,"aria-label":`Not done`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`p`,{className:e.done?`text-sm text-muted-foreground line-through`:`text-sm`,children:[e.label,e.optional&&(0,J.jsx)(`span`,{className:`ml-2 rounded-full border border-border px-1.5 py-0.5 align-middle text-[10px] font-normal uppercase tracking-wide text-muted-foreground`,children:`Optional`})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description})]})]}),!e.done&&e.action&&(0,J.jsx)(`div`,{className:`shrink-0`,children:e.action})]},e.key))})}),f&&(0,J.jsx)(Hf,{onAdded:()=>{r(),a()},onClose:()=>p(!1)}),(0,J.jsx)(pK,{open:v,onOpenChange:y,channels:o,onSaved:Mw}),(0,J.jsx)(mK,{open:b,onOpenChange:x,channels:o,onSaved:Mw})]})}var _K=[];function vK(e){return`Work on tickets/${e}. Do not start any other ticket.`}function yK(e,t){uC(vK(e.ticket.file)),t(e.projectId)}var bK=[{key:`in-progress`,label:`In progress`,dot:`bg-primary`},{key:`ai-queue`,label:`AI Queue`,dot:`bg-warning`}],xK=[{key:`high-priority`,label:`High priority`,dot:`bg-info`}];function SK({onSelectProject:e,onSelectRun:t}){let{value:n}=rC(Xi,_K,1e4,[]),r=r=>(0,J.jsx)(CK,{lane:r,tickets:n.filter(e=>e.bucket===r.key),onSelectProject:e,onSelectRun:t},r.key);return(0,J.jsxs)(XG,{children:[(0,J.jsx)(ZG,{children:(0,J.jsxs)(QG,{className:`flex items-center gap-2 text-base`,children:[(0,J.jsx)($a,{className:`h-4 w-4 text-muted-foreground`}),`Hot tickets`]})}),(0,J.jsx)($G,{children:n.length===0?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Nothing in progress, queued, or high priority.`}):(0,J.jsxs)(`div`,{className:`grid items-start gap-x-8 gap-y-5 sm:grid-cols-2`,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-5`,children:bK.map(r)}),(0,J.jsx)(`div`,{className:`flex flex-col gap-5`,children:xK.map(r)})]})})]})}function CK({lane:e,tickets:t,onSelectProject:n,onSelectRun:r}){let i=t.length===0;return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-wide`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:q(`h-2 w-2 shrink-0 rounded-full`,e.dot,i&&`opacity-40`)}),(0,J.jsx)(`span`,{className:i?`text-muted-foreground`:`text-foreground/80`,children:e.label}),(0,J.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),!i&&(0,J.jsx)(`ul`,{className:`mt-1.5`,children:t.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:()=>e.runId?r(e.projectId,e.runId):yK(e,n),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`}),children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:e.ticket.title}),(0,J.jsx)(wK,{ticket:e}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,J.jsx)(kx,{className:`max-w-[24rem]`,children:e.ticket.summary||e.ticket.title})]})},`${e.projectId}:${e.ticket.file}`))})]})}function wK({ticket:e}){if(e.runId)return(0,J.jsx)(`span`,{className:`shrink-0 rounded border border-primary/40 px-1 text-[10px] uppercase tracking-wide text-primary`,children:`implementing`});let t=e.bucket===`in-progress`?e.ticket.planned?`planned`:null:e.bucket===`high-priority`?e.ticket.priority??null:null;return t?(0,J.jsx)(`span`,{className:`shrink-0 rounded border border-border px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:t}):null}var TK=[];function EK(e){return e?e.length?e.length===1?e[0].message:e.map(e=>`${e.path.split(`/`).pop()||e.path}: ${e.message}`).join(` · `):`The sweep ran and considered no projects.`:`The sweep ran.`}function DK({onRunStarted:e}){let t=nC(xa,TK,[]),n=fw(),r=VG(),{busy:i,error:a,start:o}=yT(),[s,c]=(0,T.useState)(null),[l,u]=(0,T.useState)(null),[d,f]=(0,T.useState)(!1),[p,m]=(0,T.useState)(null),h=(s!==null&&t.some(e=>e.id===s)?s:t[0]?.id)??null,g=n.autoPm??!1,_=n.autoPmOptOut??[],v=(e,t)=>lw({autoPmOptOut:t?_.filter(t=>t!==e.name):[..._,e.name]}),y=n.autoPmConcurrency??2,b=g&&r?.nextSweepAt!==void 0?`Auto-runs ${Wl(r.nextSweepAt)}`:`Auto-run`,x=async()=>{if(d)return;f(!0),m(null);let e=await RG().catch(()=>({ok:!1}));f(!1),e.ok?m(EK(`outcomes`in e?e.outcomes:void 0)):m(`This dashboard is not running the sweep, so there is nothing to trigger here.`)},S=async t=>{if(!h||i)return;if(t.drains){u(t.name),m(null);let e=await RG({drainOnly:!0}).catch(()=>({ok:!1}));u(null),e.ok?m(EK(`outcomes`in e?e.outcomes:void 0)):m(`This dashboard is not running the sweep, so there is nothing to trigger here.`);return}u(t.name);let r=await o(h,t.prompt,`prompt`,{...Sc(n),unattended:!0});u(null),r&&e(h,t.prompt,r.runId)};return(0,J.jsxs)(XG,{children:[(0,J.jsx)(ZG,{children:(0,J.jsxs)(QG,{className:`flex items-center gap-2 text-base`,children:[(0,J.jsx)(Ba,{className:`h-4 w-4 text-muted-foreground`}),`Routine work`]})}),(0,J.jsx)($G,{className:`space-y-3`,children:t.length===0?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Add a project to run a routine.`}):(0,J.jsxs)(J.Fragment,{children:[t.length>1&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(`label`,{htmlFor:`routine-project`,className:`text-muted-foreground`,children:`Run in`}),(0,J.jsx)(`select`,{id:`routine-project`,className:`min-w-0 flex-1 rounded-md border border-border bg-transparent px-2 py-1 text-sm`,value:h??``,onChange:e=>c(e.target.value),children:t.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:mc.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-3 py-2 first:pt-0`,children:[(0,J.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-center gap-3`,children:[(0,J.jsx)(Vf,{checked:!_.includes(e.name),onCheckedChange:t=>v(e,t)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.label??e.name}),e.describe&&(0,J.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.describe})]})]}),(0,J.jsxs)(Y,{type:`button`,variant:`outline`,size:`xs`,disabled:i||!h,onClick:()=>void S(e),children:[(0,J.jsx)(So,{className:`h-3 w-3`,"aria-hidden":!0}),l===e.name?`Starting…`:`Run now`]})]},e.name))}),a&&(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a}),(0,J.jsxs)(`div`,{className:`border-t border-border pt-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-sm`}),children:[(0,J.jsx)(Vf,{checked:g,onCheckedChange:e=>lw({autoPm:e})}),(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:b})]}),(0,J.jsx)(kx,{children:`Automatically run the ticked routines on a regular schedule.`})]}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:x,disabled:d,className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-foreground hover:bg-accent disabled:opacity-50`}),children:d?`Triggering…`:`Trigger routine now`}),(0,J.jsx)(kx,{children:g?`Run the scheduled sweep now instead of waiting for the countdown.`:`Run the sweep once now. Auto-run stays off, so nothing further is scheduled.`})]})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`label`,{htmlFor:`auto-pm-concurrency`,className:`cursor-pointer text-sm text-foreground`}),children:`Concurrent agents`}),(0,J.jsx)(kx,{children:`How many agents the routine keeps going at once while there is queued work.`})]}),(0,J.jsx)(`input`,{id:`auto-pm-concurrency`,type:`number`,min:1,max:10,step:1,value:y,onChange:e=>{let t=e.target.value.trim();if(!t)return;let n=Math.round(Number(t));Number.isFinite(n)&&lw({autoPmConcurrency:Math.min(Math.max(n,1),10)})},className:`w-16 rounded border border-border bg-background px-2 py-1 text-sm text-foreground`})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:y===1?`Only while nothing else is running and the week's allowance is not already spent.`:`Keeps up to ${y} agents going at once on queued work, and only while the week's allowance is not already spent.`}),g&&mc.every(e=>_.includes(e.name))&&(0,J.jsx)(`p`,{className:`mt-1 text-xs text-warning`,children:`Every routine is unticked, so the schedule has nothing to run.`}),p&&(0,J.jsx)(`p`,{role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:p})]})]})})]})}function OK({working:e,loading:t,onSelectRun:n}){return(0,J.jsxs)(XG,{children:[(0,J.jsx)(ZG,{children:(0,J.jsxs)(QG,{className:`flex items-center gap-2 text-base`,children:[(0,J.jsx)(za,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),`Agents`,(0,J.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:`Agents currently working`})]})}),(0,J.jsx)($G,{children:t?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Loading…`}):e.length===0?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No agents working right now.`}):(0,J.jsx)(`ul`,{className:`space-y-0.5`,children:e.map(e=>(0,J.jsx)(kK,{label:AK(e),at:e.updatedAt,projectName:e.projectName,onOpen:()=>n(e.projectId,e.runId)},`${e.projectId}:${e.runId}`))})})]})}function kK({label:e,at:t,projectName:n,onOpen:r}){return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-foreground/50`,children:`•`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:n}),t&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-xs tabular-nums text-muted-foreground/80`}),children:Ul(t)}),(0,J.jsx)(kx,{children:Vl(t)})]})]})})}function AK(e){return e.intent?.trim()||e.sessionName?.trim()||e.scope?.trim()||e.projectName}var jK=/^\s*\[([^\]]+)\]\(([^)\s]+)\)\s*/,MK=`tickets/`;function NK(e){let t=jK.exec(e);if(!t)return{text:e.trim()};let n=t[1].trim(),r=t[2];return r.startsWith(MK)?{text:n,ticket:r.slice(8)}:/^https?:\/\//.test(r)?{text:n,url:r}:{text:n}}function PK(e){return`Open TODO_AGENTS.md and work on this one open entry only, then check it off. Do not start any other entry. The entry:\n\n${e}`}function FK({queue:e,loading:t,onOpenTicket:n,onRunStarted:r}){let i=fw(),{busy:a,error:o,start:s}=yT(),[c,l]=(0,T.useState)(null),u=async(e,t)=>{if(a)return;let n=`${e}\n${t}`,o=PK(t);l(n);let c=await s(e,o,`prompt`,{...Sc(i),unattended:!0});l(null),c&&r(e,o,c.runId)},d=e.filter(e=>e.open>0);return(0,J.jsxs)(XG,{children:[(0,J.jsxs)(ZG,{children:[(0,J.jsxs)(QG,{className:`flex items-center gap-2 text-base`,children:[(0,J.jsx)(ho,{className:`h-4 w-4 text-muted-foreground`}),`AI Queue`]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Tasks AI will work on next`})]}),(0,J.jsxs)($G,{children:[t?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Loading…`}):d.length===0?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Nothing queued.`}):(0,J.jsx)(`ul`,{className:`space-y-4`,children:d.map(e=>(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.projectName}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs tabular-nums text-muted-foreground`,children:e.open})]}),(0,J.jsx)(`ul`,{className:`mt-1.5 space-y-1 pl-0.5`,children:e.items.filter(e=>!e.done).map((t,r)=>{let i=NK(t.text),o=`${e.projectId}\n${t.text}`;return(0,J.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`•`}),i.ticket===void 0?i.url===void 0?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:t.text,children:i.text}):(0,J.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noreferrer`,className:`min-w-0 flex-1 truncate hover:text-foreground hover:underline`,title:t.text,children:i.text}):(0,J.jsx)(`button`,{type:`button`,onClick:()=>n(e.projectId,i.ticket),className:`min-w-0 flex-1 truncate text-left hover:text-foreground hover:underline`,title:t.text,children:i.text}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Spin up an agent working on this entry`,disabled:a,onClick:()=>void u(e.projectId,t.text),className:`shrink-0 text-muted-foreground hover:text-foreground`}),children:c===o?(0,J.jsx)(go,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):(0,J.jsx)(So,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`Spin up an agent working on this entry`})]})]},r)})})]},e.projectId))}),o&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:o})]})]})}function IK({onSelectProject:e,onSelectRun:t,onOpenTicket:n,onRunStarted:r,interventions:i}){let{value:a}=rC(ea,null,5e3,[]),o=fw().onboardingDismissed??!1,s=a===null;return(0,J.jsx)(Bb,{className:`min-h-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-6 p-6`,children:[!o&&(0,J.jsx)(gK,{dismissible:!0,onRunStarted:r}),(0,J.jsx)(uK,{}),(0,J.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-2`,children:[(0,J.jsx)(LK,{items:i,onSelectProject:e,onSelectRun:t}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(OK,{working:a?.active??[],loading:s,onSelectRun:t}),(0,J.jsx)(FK,{queue:a?.queue??[],loading:s,onOpenTicket:n,onRunStarted:r})]})]}),(0,J.jsx)(DK,{onRunStarted:r}),(0,J.jsx)(SK,{onSelectProject:e,onSelectRun:t})]})})}function LK({items:e,onSelectProject:t,onSelectRun:n}){let r=e=>e.runId?n(e.projectId,e.runId):t(e.projectId);return(0,J.jsxs)(XG,{children:[(0,J.jsxs)(ZG,{children:[(0,J.jsxs)(QG,{className:`flex items-center gap-2 text-base`,children:[(0,J.jsx)(lo,{className:`h-4 w-4 text-muted-foreground`}),`Human Queue`,e.length>0&&(0,J.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground tabular-nums`,children:e.length})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agents awaiting your approval, review, or input`})]}),(0,J.jsx)($G,{children:e.length===0?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`AI doesn't need you.`}):(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map(e=>(0,J.jsx)(`li`,{children:e.kind===`awaiting`?(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full items-center gap-2.5 py-2 text-left hover:opacity-80`}),children:[(0,J.jsx)(vo,{className:`h-4 w-4 shrink-0 text-warning`}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-warning`,children:`Awaiting`}),(0,J.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,J.jsx)(kx,{children:`Open the session to answer`})]}):e.kind===`unpushed`?(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full items-center gap-2.5 py-2 text-left hover:opacity-80`}),children:[(0,J.jsx)(io,{className:`h-4 w-4 shrink-0 text-info`}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-info`,children:`Unpushed`}),(0,J.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),e.commits!==void 0&&e.commits>0&&(0,J.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.commits===1?`1 commit`:`${e.commits} commits`}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,J.jsx)(kx,{children:`Open the session: work on ${e.branch??``} was never pushed`})]}):(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-2.5 py-2 hover:opacity-80`}),children:[(0,J.jsx)(oo,{className:`h-4 w-4 shrink-0 text-success`}),(0,J.jsxs)(`span`,{className:`shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,children:[`#`,e.number]}),(0,J.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.projectName})]}),(0,J.jsx)(kx,{children:`Open PR #${e.number} on GitHub`})]})},hc(e)))})})]})}function RK({text:e,label:t,className:n}){let[r,i]=(0,T.useState)(!1),a=(0,T.useRef)(void 0);(0,T.useEffect)(()=>()=>clearTimeout(a.current),[]);let o=()=>{navigator.clipboard?.writeText(e).then(()=>{i(!0),clearTimeout(a.current),a.current=setTimeout(()=>i(!1),1500)})},s=r?Va:Ya;return(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:o,"aria-label":t,className:q(`inline-flex shrink-0 items-center rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground`,r&&`text-success`,n)}),children:(0,J.jsx)(s,{className:`h-3 w-3`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:r?`Copied`:t})]})}function zK({enabled:e,onChange:t}){let[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(!1);return(0,T.useEffect)(()=>{if(!e){r(null),a(!1);return}let t=!0;return va().then(e=>{t&&r(e)}).catch(()=>{}),()=>{t=!1}},[e]),e?(0,J.jsxs)(`div`,{className:`mt-2 space-y-2 rounded-md border border-border bg-muted/30 p-3 text-xs`,children:[(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Install the browser extension, open its options, and paste this token. It reports the question a Claude web session is parked on, so it shows up here instead of only on claude.ai.`}),n===null?(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Restart the dashboard to generate the token.`}):(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono`,children:i?n:`•`.repeat(24)}),(0,J.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?`Hide`:`Reveal`}),(0,J.jsx)(RK,{text:n,label:`Copy the bridge token`})]})]}):null}function BK(){let e=$S(),t=oC(e),n=$w(),[r,i]=(0,T.useState)(!1),a=e=>{n===e.id&&Xw(null),BS(e.id)};return(0,J.jsxs)(XG,{children:[(0,J.jsxs)(ZG,{className:`flex flex-row items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(QG,{children:`Devices`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Other machines running The Framework that you can run a session on. Saved in this browser, not on the server, because each one is reached with its own token.`})]}),(0,J.jsx)(Y,{size:`sm`,variant:`outline`,className:`shrink-0 whitespace-nowrap`,onClick:()=>i(!0),children:`Add device`})]}),(0,J.jsx)($G,{children:e.length===0?(0,J.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No devices saved. Add one with the URL another machine prints when it starts.`}):(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`truncate text-sm`,children:e.label}),(0,J.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.url})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,J.jsx)(VK,{state:t[e.id]}),(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:()=>a(e),"aria-label":`Remove ${e.label}`}),children:(0,J.jsx)(Mo,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,J.jsxs)(kx,{children:[`Remove `,e.label]})]})]})]},e.id))})}),r&&(0,J.jsx)(jW,{onClose:()=>i(!1),onAdded:()=>i(!1)})]})}function VK({state:e}){let t=e===`online`?`Online`:e===`offline`?`Offline`:`Checking…`;return(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:q(`h-1.5 w-1.5 rounded-full`,e===`online`?`bg-[var(--color-primary)]`:`bg-muted-foreground/40`)}),t]})}function HK({onRunStarted:e}){let t=fw(),n=oG(),r=gw(t),{main:i,eco:a}=DW(t),o=Tw(),s=Nw(),c=s===null||s.discordWebhook,l=s===null||s.discordBot,u=o===`denied`,[d,f]=(0,T.useState)(!1),[p,m]=(0,T.useState)(!1);return(0,J.jsxs)(Bb,{className:`min-h-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6 p-6`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Settings`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your defaults, everywhere. A project can still override its run options from the launcher.`})]}),(0,J.jsx)(gK,{onRunStarted:e}),(0,J.jsxs)(UK,{title:`Appearance`,children:[(0,J.jsx)(qK,{label:`Theme`,description:`Follow the system, or pin light or dark.`,value:r,options:[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],onChange:e=>lw({theme:e})}),(0,J.jsx)(qK,{label:`Editor`,description:`Which editor “Open in editor” launches.`,value:t.editor??``,options:[{value:``,label:`Auto-detect`},...n.map(e=>({value:e.bin,label:e.label}))],onChange:e=>lw({editor:e})})]}),(0,J.jsxs)(UK,{title:`Agent`,children:[(0,J.jsx)(qK,{label:`Agent`,description:`Which coding agent runs the work.`,value:t.agent??Fo[0],options:Fo.map(e=>({value:e,label:Lo[e]})),onChange:e=>lw({agent:e})}),(0,J.jsx)(JK,{label:`Model`,description:`Passed through to the agent. Empty uses the agent's own default.`,value:t.model??``,placeholder:`the agent's default`,onChange:e=>lw({model:e})}),(0,J.jsx)(qK,{label:`Run on`,description:`Where a session executes: this machine, a fresh GitHub Actions runner, or a Claude Code cloud session.`,value:t.target??`local`,options:[{value:`local`,label:`This device`},{value:`actions`,label:`GitHub Actions`},{value:`web`,label:`Claude web`}],onChange:e=>lw({target:e})})]}),(0,J.jsx)(BK,{}),(0,J.jsx)(UK,{title:`Run options`,description:`What a new session starts with. The launcher can still change them for one session.`,children:i.map(e=>(0,J.jsx)(GK,{row:e},e.key))}),(0,J.jsx)(UK,{title:`Eco`,description:`Drop sections of the system prompt to spend fewer tokens.`,children:a.map(e=>(0,J.jsx)(GK,{row:e},e.key))}),(0,J.jsxs)(UK,{title:`Notifications`,children:[(0,J.jsx)(KK,{label:`Browser`,description:u?`Blocked in your browser settings`:`Desktop notifications while the dashboard is open.`,checked:(t.notifyBrowser??!0)&&!u,disabled:u,onChange:e=>lw({notifyBrowser:e})}),(0,J.jsx)(KK,{label:`Discord`,description:c?`Deliver to Discord, so notifications reach you with no dashboard open.`:`Not configured — no webhook is set on the daemon`,checked:t.notifyDiscord??!1,onChange:e=>lw({notifyDiscord:e}),action:(0,J.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>m(!0),children:s?.discordWebhook?`Webhook`:`Set up`})}),(0,J.jsx)(KK,{label:`Human Queue`,description:`A session awaiting your answer, or a PR ready to review.`,checked:t.notifyHumanIntervention??!0,onChange:e=>lw({notifyHumanIntervention:e})}),(0,J.jsx)(KK,{label:`New activity`,description:`Also ping when a session starts or finishes.`,checked:t.notifyNewActivity??!1,onChange:e=>lw({notifyNewActivity:e})}),(0,J.jsx)(KK,{label:`Discord bot`,description:l?`Let Discord messages start and steer sessions.`:`Not configured — no bot token is set on the daemon`,checked:t.discordBot??!1,onChange:e=>lw({discordBot:e}),action:(0,J.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>f(!0),children:s?.discordBot?`Bot token`:`Set up`})})]}),(0,J.jsxs)(UK,{title:`Automation`,children:[(0,J.jsx)(KK,{label:`Auto PM`,description:`Start queued work on its own while there is quota left in the week.`,checked:t.autoPm??!1,onChange:e=>lw({autoPm:e})}),(0,J.jsx)(YK,{label:`Spend offset`,description:`How far unattended work sits from the quota boundary, in percentage points (max 50). Negative holds it back; positive lets it borrow from the days ahead.`,value:Math.round((t.autoSpendOffset??7.142857142857143)*10)/10,min:-50,max:50,onChange:e=>lw({autoSpendOffset:e})})]}),(0,J.jsxs)(UK,{title:`Claude web`,description:`A Claude web run hands off and ends, so the questions its session asks never reach this dashboard. The browser bridge carries them back.`,children:[(0,J.jsx)(KK,{label:`Browser bridge`,description:`Opens one route on this daemon that a browser extension can reach, guarded by the token below.`,checked:t.bridge??!1,onChange:e=>lw({bridge:e})}),(0,J.jsx)(zK,{enabled:t.bridge??!1,onChange:e=>lw({bridge:e})})]})]}),(0,J.jsx)(pK,{open:d,onOpenChange:f,channels:s,onSaved:Mw}),(0,J.jsx)(mK,{open:p,onOpenChange:m,channels:s,onSaved:Mw})]})}function UK({title:e,description:t,children:n}){return(0,J.jsxs)(XG,{children:[(0,J.jsxs)(ZG,{children:[(0,J.jsx)(QG,{children:e}),t&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(0,J.jsx)($G,{children:(0,J.jsx)(`div`,{className:`divide-y divide-border`,children:n})})]})}function WK({label:e,description:t,control:n,dimmed:r=!1}){return(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-3 first:pt-0 last:pb-0`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:q(`text-sm`,r&&`text-muted-foreground`),children:e}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]}),(0,J.jsx)(`div`,{className:`shrink-0`,children:n})]})}function GK({row:e}){let t=e.disabled??!1;return(0,J.jsx)(WK,{label:e.label,description:(t?e.disabledReason:e.description)??e.description??``,dimmed:t,control:(0,J.jsx)(Vf,{checked:e.checked,disabled:t,onCheckedChange:t=>lw({[e.key]:t===!0}),"aria-label":e.label})})}function KK({label:e,description:t,checked:n,onChange:r,disabled:i=!1,action:a}){return(0,J.jsx)(WK,{label:e,description:t,dimmed:i,control:(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[a,(0,J.jsx)(Vf,{checked:n,disabled:i,onCheckedChange:e=>r(e===!0),"aria-label":e})]})})}function qK({label:e,description:t,value:n,options:r,onChange:i}){return(0,J.jsx)(WK,{label:e,description:t,control:(0,J.jsx)(`select`,{value:n,onChange:e=>i(e.target.value),"aria-label":e,className:`rounded-md border border-border bg-background px-2 py-1 text-sm`,children:r.map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value))})})}function JK({label:e,description:t,value:n,placeholder:r,onChange:i}){return(0,J.jsx)(WK,{label:e,description:t,control:(0,J.jsx)(`input`,{type:`text`,value:n,placeholder:r,onChange:e=>i(e.target.value),"aria-label":e,className:`w-48 rounded-md border border-border bg-background px-2 py-1 text-sm`})})}function YK({label:e,description:t,value:n,min:r,max:i,onChange:a}){return(0,J.jsx)(WK,{label:e,description:t,control:(0,J.jsx)(`input`,{type:`number`,value:n,min:r,max:i,onChange:e=>a(Math.min(Math.max(Math.round(Number(e.target.value)||0),r),i)),"aria-label":e,className:`w-24 rounded-md border border-border bg-background px-2 py-1 text-sm`})})}function XK(e){if(e===void 0)return;let t=Number.parseInt(e,10);return Number.isNaN(t)?void 0:t}function ZK(e){let t=XK(e);return t===void 0?`text-muted-foreground`:t>=8?`text-danger`:t>=5?`text-warning`:`text-muted-foreground`}function QK(e){return e.flatMap(e=>e.tickets.map(t=>({projectId:e.projectId,projectName:e.projectName,ticket:t})))}var $K=[{id:`critical`,label:`Critical`,min:8,max:10},{id:`medium`,label:`Medium`,min:5,max:7},{id:`low`,label:`Low`,min:0,max:4}],eq=[{id:`trivial`,label:`Trivial`,min:0,max:2},{id:`moderate`,label:`Moderate`,min:3,max:5},{id:`large`,label:`Large`,min:6,max:10}],tq=[{id:`low`,label:`Low`,min:0,max:2},{id:`medium`,label:`Medium`,min:3,max:5},{id:`high`,label:`High`,min:6,max:10}],nq=[{id:`unplanned`,label:`Unplanned`},{id:`planned`,label:`Planned`},{id:`claimed`,label:`Claimed`}],rq={buckets:[],range:null,none:!1};function iq(){return{filters:{q:``,priority:{...rq},effort:{...rq},uncertainty:{...rq},topics:[],topicsNone:!1,stage:[],projects:[],unlinked:!1},sort:{key:`date`,dir:`desc`},group:`project`}}function aq(e){return e.q.trim()!==``||oq(e.priority)||oq(e.effort)||oq(e.uncertainty)||e.topics.length>0||e.topicsNone||e.stage.length>0||e.projects.length>0||e.unlinked}function oq(e){return e.buckets.length>0||e.range!==null||e.none}function sq(e){return(e.topics??[]).map(e=>e.toLowerCase())}function cq(e,t,n){return oq(t)?e===void 0?t.none:t.buckets.some(t=>lq(e,t,n))?!0:t.range!==null&&e>=t.range[0]&&e<=t.range[1]:!0}function lq(e,t,n){let r=n.find(e=>e.id===t);return r!==void 0&&e>=r.min&&e<=r.max}function uq(e,t){return t===`unplanned`?!e.planned:t===`planned`?e.planned:e.locked===!0}function dq(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return!0;let r=[e.ticket.title,e.ticket.summary,e.ticket.file,...sq(e.ticket)].join(` `).toLowerCase();return n.every(e=>r.includes(e))}function fq(e,t){let n=e.ticket;if(!dq(e,t.q)||!cq(XK(n.priority),t.priority,$K)||!cq(n.effort,t.effort,eq)||!cq(n.uncertainty,t.uncertainty,tq))return!1;if(t.topics.length>0||t.topicsNone){let e=sq(n);if(!(t.topics.some(t=>e.includes(t))||t.topicsNone&&e.length===0))return!1}return!(t.stage.length>0&&!t.stage.some(e=>uq(n,e))||t.projects.length>0&&!t.projects.includes(e.projectId)||t.unlinked&&n.github!==void 0)}function pq(e,t){return e.filter(e=>fq(e,t))}function mq(e,t){return t===`date`?e.ticket.date:t===`priority`?XK(e.ticket.priority):t===`title`?e.ticket.title.toLowerCase():e.ticket.effort}function hq(e,t){let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mq(e,t.key),a=mq(r,t.key);if(i!==a){if(i===void 0)return 1;if(a===void 0)return-1;let e=typeof i==`string`?i.localeCompare(a):i-a;if(e!==0)return e*n}return r.ticket.date.localeCompare(e.ticket.date)})}var gq={date:`desc`,priority:`desc`,title:`asc`,effort:`asc`};function _q(e){return{key:e,dir:gq[e]}}function vq(e,t){let n=t.filter(t=>e.buckets.includes(t.id)).sort((e,t)=>e.min-t.min);if(n.length===0)return null;for(let e=1;e<n.length;e++)if(n[e].min>n[e-1].max+1)return null;return[n[0].min,n[n.length-1].max]}function yq(e,t){return{buckets:e.buckets.includes(t)?e.buckets.filter(e=>e!==t):[...e.buckets,t],range:null,none:e.none}}function bq(e,t){return{buckets:[],range:t,none:e.none}}function xq(e,t){return{...e,none:t}}function Sq(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function Cq(e,t,n){return pq(e,{...t,...n})}function wq(e,t,n,r){let i=Cq(e,t,{[n]:{...rq}}),a=e=>n===`priority`?XK(e.priority):n===`effort`?e.effort:e.uncertainty,o={};for(let e of r)o[e.id]=i.filter(t=>{let n=a(t.ticket);return n!==void 0&&n>=e.min&&n<=e.max}).length;return{buckets:o,none:i.filter(e=>a(e.ticket)===void 0).length}}function Tq(e,t){let n=Cq(e,t,{topics:[],topicsNone:!1}),r=new Map;for(let e of n)for(let t of new Set(sq(e.ticket)))r.set(t,(r.get(t)??0)+1);for(let e of t.topics)r.has(e)||r.set(e,0);return{topics:[...r.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),none:n.filter(e=>sq(e.ticket).length===0).length}}function Eq(e,t){let n=Cq(e,t,{stage:[]});return{unplanned:n.filter(e=>uq(e.ticket,`unplanned`)).length,planned:n.filter(e=>uq(e.ticket,`planned`)).length,claimed:n.filter(e=>uq(e.ticket,`claimed`)).length}}function Dq(e,t){let n=Cq(e,t,{projects:[]}),r={};for(let e of n)r[e.projectId]=(r[e.projectId]??0)+1;return r}function Oq(e,t){return Cq(e,t,{unlinked:!1}).filter(e=>e.ticket.github===void 0).length}var kq=/^(\d{1,2})-(\d{1,2})$/;function Aq(e,t){let n={...rq};if(!e)return n;for(let r of e.split(`,`))if(r===`none`)n.none=!0;else if(t.some(e=>e.id===r))n.buckets=[...n.buckets,r];else{let e=kq.exec(r);if(e){let[t,r]=[Number(e[1]),Number(e[2])];t<=r&&r<=10&&(n.range=[t,r])}}return n}function jq(e){let t=[...e.buckets];return e.range&&t.push(`${e.range[0]}-${e.range[1]}`),e.none&&t.push(`none`),t.join(`,`)}var Mq=[`date`,`priority`,`title`,`effort`];function Nq(e){let t=new URLSearchParams(e),n=iq();n.filters.q=t.get(`q`)??``,n.filters.priority=Aq(t.get(`priority`),$K),n.filters.effort=Aq(t.get(`effort`),eq),n.filters.uncertainty=Aq(t.get(`uncertainty`),tq);let r=(t.get(`topics`)??``).split(`,`).filter(Boolean);n.filters.topicsNone=r.includes(`none`),n.filters.topics=r.filter(e=>e!==`none`).map(e=>e.toLowerCase()),n.filters.stage=(t.get(`stage`)??``).split(`,`).filter(e=>nq.some(t=>t.id===e)),n.filters.projects=(t.get(`project`)??``).split(`,`).filter(Boolean),n.filters.unlinked=t.get(`github`)===`unlinked`;let i=t.get(`sort`);i&&Mq.includes(i)&&(n.sort.key=i);let a=t.get(`dir`);return n.sort.dir=a===`asc`||a===`desc`?a:gq[n.sort.key],t.get(`group`)===`none`&&(n.group=`none`),n}function Pq(e){let t=new URLSearchParams,n=e.filters;n.q.trim()&&t.set(`q`,n.q.trim());for(let[e,r]of[[`priority`,n.priority],[`effort`,n.effort],[`uncertainty`,n.uncertainty]]){let n=jq(r);n&&t.set(e,n)}let r=[...n.topics,...n.topicsNone?[`none`]:[]];return r.length&&t.set(`topics`,r.join(`,`)),n.stage.length&&t.set(`stage`,n.stage.join(`,`)),n.projects.length&&t.set(`project`,n.projects.join(`,`)),n.unlinked&&t.set(`github`,`unlinked`),e.sort.key!==`date`&&t.set(`sort`,e.sort.key),e.sort.dir!==gq[e.sort.key]&&t.set(`dir`,e.sort.dir),e.group===`none`&&t.set(`group`,`none`),t.toString()}function Fq(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Iq(e,t){return e-t}function Lq(e,t,n){let r=e.slice();return r[t]=n,r.sort(Iq)}function Rq(e,t,n,r,i,a){let o=e;return o=Ob(o,n,r),i&&(o=Lq(a,t,Ob(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function zq(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var Bq={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null},Vq=T.createContext(void 0);function Hq(){let e=T.useContext(Vq);if(e===void 0)throw Error(Ou(62));return e}function Uq(e){return`key`in e?pf:lf}function Wq(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?Fq(e,t):!1}var Gq=T.forwardRef(function(e,t){let{"aria-labelledby":n,className:r,defaultValue:i,disabled:a=!1,id:o,format:s,largeStep:c=10,locale:l,render:u,max:d=100,min:f=0,minStepsBetweenValues:p=0,name:m,onValueChange:h,onValueCommitted:g,orientation:_=`horizontal`,step:v=1,thumbCollisionBehavior:y=`push`,thumbAlignment:b=`center`,value:x,...S}=e,C=cd(o),w=X(h),E=X(g),{clearErrors:D}=Gd(),{state:O,disabled:k,name:A,setTouched:j,setDirty:M,validityData:N,shouldValidateOnChange:P,validation:F}=Bd(),{labelId:I}=Yd(),L=n??I,R=k||a,z=A??m,[B,ee]=lu({controlled:x,default:i??f,name:`Slider`}),V=T.useRef(null),H=T.useRef(null),te=T.useRef([]),U=T.useRef(null),W=T.useRef(null),ne=T.useRef(-1),re=T.useRef(null),ie=T.useRef(null),ae=T.useRef(`none`),oe=wf(s),[se,ce]=T.useState(-1),[le,ue]=T.useState(-1),[de,fe]=T.useState(!1),[pe,me]=T.useState(()=>new Map),[he,ge]=T.useState([void 0,void 0]),_e=X(e=>{ce(e),e!==-1&&ue(e)});qd({id:C,commit:F.commit,value:B,controlRef:H,name:z,getValue:()=>B}),xf(B,()=>{D(z),P()?F.commit(B):F.commit(B,!0);let e=N.initialValue,t;t=Array.isArray(B)&&Array.isArray(e)?!Fq(B,e):B!==e,M(t)});let ve=X(e=>{e&&(H.current=e)}),ye=Array.isArray(B),be=T.useMemo(()=>ye?B.slice().sort(Iq):[Ob(B,f,d)],[d,f,ye,B]),xe=X((e,t)=>{if(Number.isNaN(e)||Wq(e,B))return;let n=t??yf(`none`,void 0,void 0,{activeThumbIndex:-1});ae.current=n.reason;let r=new event.constructor(event.type,event);Object.defineProperty(r,"target",{writable:!0,value:{value:e,name:z}}),n.event=r,ie.current=e,w(e,n),!n.isCanceled&&ee(e)}),Se=X((e,t,n)=>{let r=Rq(e,t,f,d,ye,be);if(zq(r,v,p)){let e=Uq(n);xe(r,yf(e,n.nativeEvent,void 0,{activeThumbIndex:t})),j(!0);let i=ie.current??r;E(i,bf(e,n.nativeEvent))}});Z(()=>{let e=Wp(Zh(V.current));R&&e&&V.current?.contains(e)&&e.blur()},[R]),R&&se!==-1&&_e(-1);let Ce=T.useMemo(()=>({...O,activeThumbIndex:se,disabled:R,dragging:de,orientation:_,max:d,min:f,minStepsBetweenValues:p,step:v,values:be}),[O,se,R,de,d,f,p,_,v,be]),we=T.useMemo(()=>({active:se,controlRef:H,disabled:R,dragging:de,validation:F,formatOptionsRef:oe,handleInputChange:Se,indicatorPosition:he,inset:b!==`center`,labelId:L,largeStep:c,lastUsedThumbIndex:le,lastChangedValueRef:ie,lastChangeReasonRef:ae,locale:l,max:d,min:f,minStepsBetweenValues:p,name:z,onValueCommitted:E,orientation:_,pressedInputRef:U,pressedThumbCenterOffsetRef:W,pressedThumbIndexRef:ne,pressedValuesRef:re,registerFieldControlRef:ve,renderBeforeHydration:b===`edge`,setActive:_e,setDragging:fe,setIndicatorPosition:ge,setValue:xe,state:Ce,step:v,thumbCollisionBehavior:y,thumbMap:pe,thumbRefs:te,values:be}),[se,H,L,R,de,F,oe,Se,he,c,le,ie,ae,l,d,f,p,z,E,_,U,W,ne,re,ve,_e,fe,ge,xe,Ce,v,y,b,pe,te,be]),Te=$u(`div`,e,{state:Ce,ref:[t,V],props:[{"aria-labelledby":L,id:C,role:`group`},F.getValidationProps,S],stateAttributesMapping:Bq});return(0,J.jsx)(Vq.Provider,{value:we,children:(0,J.jsx)(My,{elementsRef:te,onMapChange:me,children:Te})})}),Kq=new Map;function qq(e,t){let n=JSON.stringify({locale:e,options:t}),r=Kq.get(n);if(r)return r;let i=new Intl.NumberFormat(e,t);return Kq.set(n,i),i}function Jq(e,t,n){return e==null?``:qq(t,n).format(e)}function Yq(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function Xq(e){if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function Zq(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Xq(t)))}function Qq({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=Ob(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=Ob(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=Ob(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function $q({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=Ob(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,x=n.map((e,t)=>t===i?h:d[t]??u[t]),S=a;S=v?Math.max(a,n[b]):Math.min(a,n[b]);let C=Qq({values:n,index:b,nextValue:S,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:x}),w=v?b-1:b+1;if(w>=0&&w<C.length){let e=C[w-1],t=C[w+1],n=e==null?o:e+f;n=Math.max(n,o+w*f);let r=t==null?s:t-f;r=Math.min(r,s-(C.length-1-w)*f);let i=Ob(h,n,r);C[w]=Number(i.toFixed(12))}return{value:C,thumbIndex:b,didSwap:!0}}case`push`:return{value:Qq({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=Ob(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var eJ=2;function tJ(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function nJ(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var rJ=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{disabled:a,dragging:o,validation:s,inset:c,lastChangedValueRef:l,lastChangeReasonRef:u,max:d,min:f,minStepsBetweenValues:p,onValueCommitted:m,orientation:h,pressedInputRef:g,pressedThumbCenterOffsetRef:_,pressedThumbIndexRef:v,pressedValuesRef:y,registerFieldControlRef:b,renderBeforeHydration:x,setActive:S,setDragging:C,setValue:w,state:E,step:D,thumbCollisionBehavior:O,thumbRefs:k,values:A}=Hq(),j=Sy(),M=A.length>1,N=h===`vertical`,P=T.useRef(null),F=T.useRef(null),I=X(e=>{e&&F.current==null&&(F.current??=getComputedStyle(e))}),L=T.useRef(null),R=T.useRef(0),z=T.useRef(0),B=wf(A),ee=X(e=>{v.current!==e&&(v.current=e);let t=k.current[e];if(!t){_.current=null,g.current=null;return}g.current=t.querySelector(`input[type="range"]`)}),V=X(e=>{let t=P.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=tJ(F.current,N),c=z.current,l=(N?r:n)-s.start-s.end-c*2,u=_.current??0,m=e.x-u,h=e.y-u,g=Ob(((N?i-h-s.end:(j===`rtl`?o-m:m-a)-s.start)-c)/l,0,1),b=(d-f)*g+f;if(b=Zq(b,D,f),b=Ob(b,f,d),!M)return{value:b,thumbIndex:0,didSwap:!1};let x=v.current;if(x<0)return null;let S=$q({behavior:O,values:A,currentValues:B.current??A,initialValues:y.current,pressedIndex:x,nextValue:b,min:f,max:d,step:D,minStepsBetweenValues:p});return O===`swap`&&S.didSwap?ee(S.thumbIndex):v.current=S.thumbIndex,S}),H=X(e=>{y.current=M?A.slice():null,B.current=A;let t=v.current,n=t;if(t>-1&&t<A.length){if(A[t]===d){let e=t;for(;e>0&&A[e-1]===d;)--e;n=e}}else{let t=N?`y`:`x`,r;n=-1;for(let i=0;i<k.current.length;i+=1){let a=k.current[i];if(md(a)){let o=Yq(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&ee(n),c){let e=k.current[n];if(md(e)){let t=e.getBoundingClientRect();z.current=t[N?`height`:`width`]/2}}}),te=X(e=>{k.current?.[e]?.querySelector(`input[type="range"]`)?.focus({preventScroll:!0})}),U=X(e=>{let t=nJ(e,L);if(t==null)return;if(R.current+=1,e.type===`pointermove`&&e.buttons===0){W(e);return}let n=V(t);n!=null&&zq(n.value,D,p)&&(!o&&R.current>eJ&&C(!0),w(n.value,yf(mf,e,void 0,{activeThumbIndex:n.thumbIndex})),B.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&te(n.thumbIndex))});function W(e){S(-1),C(!1),g.current=null,_.current=null,v.current=-1;let t=nJ(e,L),n=t==null?null:V(t);if(n!=null){let t=u.current;s.commit(l.current??n.value),m(l.current??n.value,bf(t,e))}`pointerType`in e&&P.current?.hasPointerCapture(e.pointerId)&&P.current?.releasePointerCapture(e.pointerId),L.current=null,y.current=null,re()}let ne=X(e=>{if(a)return;let t=e.changedTouches[0];t!=null&&(L.current=t.identifier);let n=nJ(e,L);if(n!=null){H(n);let t=V(n);if(t==null)return;te(t.thumbIndex),w(t.value,yf(cf,e,void 0,{activeThumbIndex:t.thumbIndex})),B.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&te(t.thumbIndex)}R.current=0;let r=Zh(P.current);r.addEventListener(`touchmove`,U,{passive:!0}),r.addEventListener(`touchend`,W,{passive:!0})}),re=X(()=>{let e=Zh(P.current);e.removeEventListener(`pointermove`,U),e.removeEventListener(`pointerup`,W),e.removeEventListener(`touchmove`,U),e.removeEventListener(`touchend`,W),y.current=null}),ie=jf();return T.useEffect(()=>{let e=P.current;return e?(e.addEventListener(`touchstart`,ne,{passive:!0}),()=>{e.removeEventListener(`touchstart`,ne),ie.cancel(),re()}):()=>re()},[re,ne,P,ie]),T.useEffect(()=>{a&&re()},[a,re]),$u(`div`,e,{state:E,ref:[t,b,P,I],props:[{"data-base-ui-slider-control":x?``:void 0,onPointerDown(e){let t=P.current;if(!t||a||e.defaultPrevented||!md(e.target)||e.button!==0)return;let n=nJ(e,L);if(n!=null){H(n);let r=V(n);if(r==null)return;Gp(k.current[r.thumbIndex],Wp(Zh(t)))?e.preventDefault():ie.request(()=>{te(r.thumbIndex)}),C(!0),_.current??(w(r.value,yf(cf,e.nativeEvent,void 0,{activeThumbIndex:r.thumbIndex})),B.current=Array.isArray(r.value)?r.value:[r.value],r.didSwap&&te(r.thumbIndex))}e.nativeEvent.pointerId&&t.setPointerCapture(e.nativeEvent.pointerId),R.current=0;let r=Zh(P.current);r.addEventListener(`pointermove`,U,{passive:!0}),r.addEventListener(`pointerup`,W,{once:!0})},tabIndex:-1},i],stateAttributesMapping:Bq})}),iJ=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=Hq();return $u(`div`,e,{state:a,ref:t,props:[{style:{position:`relative`}},i],stateAttributesMapping:Bq})});function aJ(e,t,n){return(e-t)*100/(n-t)}function oJ(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=Yd(),o=cd(t);return Z(()=>{if(!(!n&&!t||a===ou)){if(n){let e=r?.current;md(e)&&e.closest(`label`)!=null?a(t??null):a(i??o)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,i,a,n,o]),i??o}var sJ=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),cJ=`PageUp`,lJ=`PageDown`,uJ=new Set([oy,sy,cy,ly,uy,`End`,cJ,lJ]);function dJ(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${Jq(e[t],r,n)} start range`:`${Jq(e[t],r,n)} end range`:n?Jq(e[t],r,n):void 0}function fJ(e,t,n,r,i){return n===1?Math.min(e+t,i):Math.max(e-t,r)}var pJ=T.forwardRef(function(e,t){let{render:n,children:r,className:i,"aria-describedby":a,"aria-label":o,"aria-labelledby":s,disabled:c=!1,getAriaLabel:l,getAriaValueText:u,id:d,index:f,inputRef:p,onBlur:m,onFocus:h,onKeyDown:g,tabIndex:_,...v}=e,y=cd(d),{active:b,lastUsedThumbIndex:x,controlRef:S,disabled:C,validation:w,formatOptionsRef:E,handleInputChange:D,inset:O,labelId:k,largeStep:A,locale:j,max:M,min:N,minStepsBetweenValues:P,name:F,orientation:I,pressedInputRef:L,pressedThumbCenterOffsetRef:R,pressedThumbIndexRef:z,renderBeforeHydration:B,setActive:ee,setIndicatorPosition:V,state:H,step:te,values:U}=Hq(),W=Sy(),ne=c||C,re=U.length>1,ie=I===`vertical`,ae=W===`rtl`,{setTouched:oe,setFocused:se,validationMode:ce}=Bd(),le=T.useRef(null),ue=T.useRef(null),de=cd(),fe=oJ(),pe=re?de:fe,{ref:me,index:he}=fp({metadata:T.useMemo(()=>({inputId:pe}),[pe])}),ge=re?f??he:0,_e=ge===U.length-1,ve=U[ge],ye=aJ(ve,N,M),[be,xe]=T.useState(!1),[Se,Ce]=T.useState();Df(()=>xe(!0));let we=x>=0&&x<U.length?x:-1,Te=X(()=>{let e=S.current,t=le.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=ie?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*ye/100)/r[i]*100;Ce(o),ge===0?V(e=>[o,e[1]]):_e&&V(e=>[e[0],o])});Z(()=>{O&&queueMicrotask(Te)},[Te,O]),Z(()=>{O&&Te()},[Te,O,ye]);let Ee=T.useCallback(()=>{let e=ie?`bottom`:`insetInlineStart`,t=ie?`left`:`top`,n;return re?b===ge?n=2:we===ge&&(n=1):b===ge&&(n=1),O?{"--position":`${Se}%`,visibility:B&&!be||Se===void 0?`hidden`:void 0,position:`absolute`,[e]:`var(--position)`,[t]:`50%`,translate:`${(ie||!ae?-1:1)*50}% ${(ie?1:-1)*50}%`,zIndex:n}:Number.isFinite(ye)?{position:`absolute`,[e]:`${ye}%`,[t]:`50%`,translate:`${(ie||!ae?-1:1)*50}% ${(ie?1:-1)*50}%`,zIndex:n}:Su},[b,ge,O,be,Se,re,B,ae,we,ye,ie]),De;I===`vertical`&&(De=ae?`vertical-rl`:`vertical-lr`);let Oe=Lu({"aria-label":typeof l==`function`?l(ge):o,"aria-labelledby":s??k,"aria-describedby":a,"aria-orientation":I,"aria-valuenow":ve,"aria-valuetext":typeof u==`function`?u(Jq(ve,j,E.current??void 0),ve,ge):dJ(U,ge,E.current??void 0,j),disabled:ne,id:pe,max:M,min:N,name:F,onChange(e){D(e.target.valueAsNumber,ge,e)},onFocus(){ee(ge),se(!0)},onBlur(){le.current&&(ee(-1),oe(!0),se(!1),ce===`onBlur`&&w.commit(Rq(ve,ge,N,M,re,U)))},onKeyDown(e){if(!uJ.has(e.key))return;py.has(e.key)&&e.stopPropagation();let t=null,n=Zq(ve,te,N);switch(e.key){case oy:t=fJ(n,e.shiftKey?A:te,1,N,M);break;case ly:t=fJ(n,e.shiftKey?A:te,ae?-1:1,N,M);break;case sy:t=fJ(n,e.shiftKey?A:te,-1,N,M);break;case cy:t=fJ(n,e.shiftKey?A:te,ae?1:-1,N,M);break;case cJ:t=fJ(n,A,1,N,M);break;case lJ:t=fJ(n,A,-1,N,M);break;case`End`:t=M,re&&(t=Number.isFinite(U[ge+1])?U[ge+1]-te*P:M);break;case uy:t=N,re&&(t=Number.isFinite(U[ge-1])?U[ge-1]+te*P:N);break;default:break}t!==null&&(D(t,ge,e),e.preventDefault())},step:te,style:{...Su,width:`100%`,height:`100%`,writingMode:De},tabIndex:_??void 0,type:`range`,value:ve??``},w.getInputValidationProps),ke=gu(ue,w.inputRef,p);return $u(`div`,e,{state:H,ref:[t,me,le],props:[{[sJ.index]:ge,children:(0,J.jsxs)(T.Fragment,{children:[r,(0,J.jsx)(`input`,{ref:ke,...Oe}),O&&!be&&B&&_e&&(0,J.jsx)(`script`,{dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:y,onBlur:m,onFocus:h,onPointerDown(e){if(z.current=ge,le.current!=null){let t=I===`horizontal`?`x`:`y`,n=Yq(le.current),r=(I===`horizontal`?e.clientX:e.clientY)-n[t];R.current=r}ue.current!=null&&L.current!==ue.current&&(L.current=ue.current)},style:Ee(),suppressHydrationWarning:B||void 0,tabIndex:-1},v],stateAttributesMapping:Bq})});function mJ(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&!a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function hJ(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var gJ=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{indicatorPosition:a,inset:o,max:s,min:c,orientation:l,renderBeforeHydration:u,state:d,values:f}=Hq(),[p,m]=T.useState(!1);Df(()=>m(!0));let h=l===`vertical`,g=f.length>1,_=o?mJ(h,g,a[0],a[1],u,p):hJ(h,g,aJ(f[0],c,s),aJ(f[f.length-1],c,s));return $u(`div`,e,{state:d,ref:t,props:[{"data-base-ui-slider-indicator":u?``:void 0,style:_,suppressHydrationWarning:u||void 0},i],stateAttributesMapping:Bq})}),_J=`h-3.5 w-3.5 rounded-full border border-primary bg-card shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-1`;function vJ({value:e,onValueChange:t,min:n=0,max:r=10,className:i,"aria-label":a}){return(0,J.jsx)(Gq,{value:e,onValueChange:e=>{Array.isArray(e)&&e.length===2&&t([e[0],e[1]])},min:n,max:r,step:1,className:q(`w-full`,i),children:(0,J.jsx)(rJ,{className:`flex w-full touch-none select-none items-center py-1.5`,children:(0,J.jsxs)(iJ,{className:`relative h-1 w-full rounded-full bg-[var(--color-muted)]`,children:[(0,J.jsx)(gJ,{className:`rounded-full bg-primary`}),(0,J.jsx)(pJ,{"aria-label":a?`${a} minimum`:`Minimum`,className:_J}),(0,J.jsx)(pJ,{"aria-label":a?`${a} maximum`:`Maximum`,className:_J})]})})})}function yJ({label:e,count:t,checked:n,onChange:r,tone:i}){return(0,J.jsxs)(`label`,{className:`flex cursor-pointer select-none items-center gap-2 rounded-sm px-1 py-1 text-sm hover:bg-accent/60`,children:[(0,J.jsx)(Vf,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":e}),(0,J.jsx)(`span`,{className:q(`min-w-0 flex-1 truncate`,i),children:e}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:t})]})}function bJ({label:e,active:t,...n}){return(0,J.jsxs)(Y,{variant:`outline`,size:`xs`,...n,className:q(`gap-1`,t>0&&`border-[var(--color-primary)]/50`),children:[e,t>0&&(0,J.jsx)(`span`,{className:`rounded bg-primary/15 px-1 text-[10px] text-primary`,children:t}),(0,J.jsx)(Ha,{className:`h-3 w-3 opacity-60`,"aria-hidden":!0})]})}function xJ(e){return e.buckets.length+ +!!e.range+ +!!e.none}function SJ({label:e,noneLabel:t,buckets:n,filter:r,counts:i,onChange:a}){return(0,J.jsxs)(tG,{children:[(0,J.jsx)(nG,{render:(0,J.jsx)(bJ,{label:e,active:xJ(r)})}),(0,J.jsxs)(rG,{className:`w-56`,children:[(0,J.jsx)(`div`,{className:`space-y-0.5`,children:n.map(e=>(0,J.jsx)(yJ,{label:`${e.label} (${e.min}–${e.max})`,count:i.buckets[e.id]??0,checked:r.buckets.includes(e.id),onChange:()=>a(yq(r,e.id))},e.id))}),(0,J.jsx)(Mx,{className:`my-2`}),(()=>{let t=vq(r,n),i=r.buckets.length>0&&t===null,o=r.range??t;return(0,J.jsxs)(`div`,{className:q(`px-1`,i&&`opacity-40`),"data-dimmed":i||void 0,title:i?`The selected buckets skip a middle span — dragging the range replaces them`:void 0,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,J.jsxs)(`span`,{children:[`Range: `,o?`${o[0]}–${o[1]}`:i?`not one span`:`any`]}),r.range&&(0,J.jsx)(`button`,{type:`button`,"aria-label":`Clear the ${e.toLowerCase()} range`,onClick:()=>a(bq(r,null)),className:`text-muted-foreground hover:text-foreground`,children:(0,J.jsx)(Po,{className:`h-3 w-3`,"aria-hidden":!0})})]}),(0,J.jsx)(vJ,{"aria-label":`${e} range`,value:o??[0,10],onValueChange:e=>a(bq(r,e))})]})})(),(i.none>0||r.none)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Mx,{className:`my-2`}),(0,J.jsx)(yJ,{label:t,count:i.none,checked:r.none,onChange:e=>a(xq(r,e))})]})]})]})}function CJ({label:e,active:t,children:n}){return(0,J.jsxs)(tG,{children:[(0,J.jsx)(nG,{render:(0,J.jsx)(bJ,{label:e,active:t})}),(0,J.jsx)(rG,{className:`w-56`,children:(0,J.jsx)(`div`,{className:`space-y-0.5`,children:n})})]})}var wJ={date:`Date`,priority:`Priority`,title:`Title`,effort:`Effort`},TJ={date:{desc:`Newest first`,asc:`Oldest first`},priority:{desc:`Highest first`,asc:`Lowest first`},title:{asc:`A to Z`,desc:`Z to A`},effort:{asc:`Easiest first`,desc:`Hardest first`}};function EJ({view:e,rows:t,projects:n,onChange:r}){let i=e.filters,a=t=>r({...e,filters:{...i,...t}}),o=(0,T.useRef)(null),[s,c]=(0,T.useState)(!1);(0,T.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)||(e.preventDefault(),o.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let l=Tq(t,i),u=Eq(t,i),d=Oq(t,i),f=t.some(e=>e.ticket.effort!==void 0),p=t.some(e=>e.ticket.uncertainty!==void 0),m=n.length>1?Dq(t,i):{},h=aq(i);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(To,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,J.jsx)(jx,{ref:o,value:i.q,onChange:e=>a({q:e.target.value}),onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:`Search tickets…`,"aria-label":`Search tickets`,className:`h-7 w-56 pl-7 pr-6 text-xs`}),!s&&i.q===``&&(0,J.jsx)(`kbd`,{className:`pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 rounded border border-border bg-muted/60 px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,J.jsx)(SJ,{label:`Priority`,noneLabel:`No priority`,buckets:$K,filter:i.priority,counts:wq(t,i,`priority`,$K),onChange:e=>a({priority:e})}),(l.topics.length>0||l.none>0)&&(0,J.jsxs)(CJ,{label:`Topics`,active:i.topics.length+ +!!i.topicsNone,children:[l.topics.map(([e,t])=>(0,J.jsx)(yJ,{label:e,count:t,checked:i.topics.includes(e),onChange:()=>a({topics:Sq(i.topics,e)})},e)),(l.none>0||i.topicsNone)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Mx,{className:`my-2`}),(0,J.jsx)(yJ,{label:`No topics`,count:l.none,checked:i.topicsNone,onChange:e=>a({topicsNone:e})})]})]}),(0,J.jsx)(CJ,{label:`Stage`,active:i.stage.length,children:nq.map(e=>(0,J.jsx)(yJ,{label:e.label,count:u[e.id],checked:i.stage.includes(e.id),onChange:()=>a({stage:Sq(i.stage,e.id)})},e.id))}),(f||xJ(i.effort)>0)&&(0,J.jsx)(SJ,{label:`Effort`,noneLabel:`No effort`,buckets:eq,filter:i.effort,counts:wq(t,i,`effort`,eq),onChange:e=>a({effort:e})}),(p||xJ(i.uncertainty)>0)&&(0,J.jsx)(SJ,{label:`Uncertainty`,noneLabel:`No uncertainty`,buckets:tq,filter:i.uncertainty,counts:wq(t,i,`uncertainty`,tq),onChange:e=>a({uncertainty:e})}),n.length>1&&(0,J.jsx)(CJ,{label:`Project`,active:i.projects.length,children:n.map(e=>(0,J.jsx)(yJ,{label:e.name,count:m[e.id]??0,checked:i.projects.includes(e.id),onChange:()=>a({projects:Sq(i.projects,e.id)})},e.id))}),(d>0||i.unlinked)&&(0,J.jsxs)(Y,{variant:`outline`,size:`xs`,onClick:()=>a({unlinked:!i.unlinked}),className:q(i.unlinked&&`border-[var(--color-primary)]/50 bg-primary/10`),"aria-pressed":i.unlinked,children:[`Not linked `,(0,J.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:d})]}),h&&(0,J.jsxs)(Y,{variant:`ghost`,size:`xs`,onClick:()=>r({...e,filters:iq().filters}),children:[(0,J.jsx)(Po,{className:`h-3 w-3`,"aria-hidden":!0}),` Clear`]}),(0,J.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:(0,J.jsxs)(Gb,{children:[(0,J.jsx)(Yb,{render:(0,J.jsxs)(Y,{variant:`outline`,size:`xs`,className:`gap-1`,children:[`Sort: `,wJ[e.sort.key],e.sort.dir===`desc`?(0,J.jsx)(Na,{className:`h-3 w-3`,"aria-hidden":!0}):(0,J.jsx)(Ia,{className:`h-3 w-3`,"aria-hidden":!0}),(0,J.jsx)(Ha,{className:`h-3 w-3 opacity-60`,"aria-hidden":!0})]})}),(0,J.jsxs)(Xb,{children:[Object.keys(wJ).map(t=>(0,J.jsxs)(Zb,{closeOnClick:!1,onClick:()=>{e.sort.key!==t&&r({...e,sort:_q(t)})},children:[(0,J.jsx)(`span`,{className:`flex h-3.5 w-3.5 items-center justify-center`,children:e.sort.key===t&&(0,J.jsx)(Va,{className:`h-3.5 w-3.5`,"aria-hidden":!0})}),wJ[t]]},t)),(0,J.jsx)(tx,{}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5`,children:[[`asc`,`desc`].map(t=>(0,J.jsx)(`button`,{type:`button`,"aria-label":TJ[e.sort.key][t],"aria-pressed":e.sort.dir===t,onClick:()=>r({...e,sort:{...e.sort,dir:t}}),className:q(`flex h-6 w-7 items-center justify-center rounded-sm hover:bg-[var(--color-accent)] hover:text-[var(--color-accent-foreground)]`,e.sort.dir===t&&`bg-[var(--color-accent)] text-[var(--color-accent-foreground)]`),children:t===`asc`?(0,J.jsx)(Fa,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):(0,J.jsx)(Ma,{className:`h-3.5 w-3.5`,"aria-hidden":!0})},t)),(0,J.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:TJ[e.sort.key][e.sort.dir]})]}),(0,J.jsx)(tx,{}),(0,J.jsx)(Qb,{checked:e.group===`project`,onCheckedChange:()=>r({...e,group:e.group===`project`?`none`:`project`}),children:`Group by project`})]})]})})]})}var DJ=oc.importTickets.render(),OJ=oc.updateTickets.render(),kJ={};function AJ(e){return`Create tickets/${e.replace(/\.md$/,``)}.plan.md`}function jJ(e){return`Work on tickets/${e}. Do not start any other ticket.`}function MJ({ticket:e,projectName:t,busy:n,onOpen:r,onStartWork:i,onOpenPlan:a,onStartPlan:o,onTopicClick:s,onClaimedClick:c}){return(0,J.jsxs)(`li`,{className:`flex items-stretch transition-colors hover:bg-accent/60`,children:[(0,J.jsx)(`div`,{className:`flex w-10 shrink-0 items-center justify-center`,children:(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:i,disabled:n,"aria-label":`Start work on ${e.title}`,className:`text-muted-foreground/50 hover:text-foreground disabled:opacity-50`}),children:(0,J.jsx)(So,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`Spin up an agent working on this ticket`})]})}),(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`flex min-w-0 flex-1 items-center gap-2 py-2 pl-0 pr-3 text-left text-sm`,children:(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.title})}),t&&(0,J.jsx)(`span`,{className:`flex shrink-0 items-center pr-2 text-xs text-muted-foreground`,children:t}),(0,J.jsxs)(`span`,{className:`hidden shrink-0 items-center gap-1.5 sm:flex`,children:[e.topics?.map(e=>s?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e),title:`Filter by ${e}`,className:`shrink-0 rounded-full border border-border px-1.5 text-[10px] text-muted-foreground hover:border-foreground/40 hover:text-foreground`,children:e},e):(0,J.jsx)(kl,{className:`shrink-0 border-border px-1.5 text-[10px] text-muted-foreground`,children:e},e)),e.locked&&(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:c?(0,J.jsx)(`button`,{type:`button`,onClick:c,className:`flex shrink-0 items-center gap-1 text-[10px] text-warning hover:opacity-80`}):(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-1 text-[10px] text-warning`}),children:[(0,J.jsx)(co,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),e.lockedBy&&(0,J.jsx)(`span`,{className:`inline-block max-w-[8rem] truncate`,children:e.lockedBy})]}),(0,J.jsxs)(kx,{children:[`Claimed${e.lockedBy?` by ${e.lockedBy}`:``} — an agent is working on this ticket (planning it or implementing it).`,c?` Click to see all claimed tickets.`:``]})]}),e.effort!==void 0&&(0,J.jsxs)(kl,{className:`shrink-0 border-transparent px-1 text-[10px] text-muted-foreground`,children:[`Effort: `,e.effort]}),e.uncertainty!==void 0&&(0,J.jsxs)(kl,{className:`shrink-0 border-transparent px-1 text-[10px] text-muted-foreground`,children:[`Uncertainty: `,e.uncertainty]})]}),(0,J.jsx)(`span`,{className:q(`flex w-16 shrink-0 items-center justify-end text-[10px]`,ZK(e.priority)),children:e.priority?`Priority: ${e.priority}`:``}),(0,J.jsx)(`span`,{className:`flex w-14 shrink-0 items-center justify-end text-[10px] text-muted-foreground/70`,title:Vl(e.date),children:Ul(e.date)}),(0,J.jsx)(`div`,{className:`flex w-10 shrink-0 items-center justify-center`,children:e.planned?(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:()=>a?.(),disabled:!a,"aria-label":`View the plan for ${e.title}`,className:`text-info hover:text-info/80 disabled:pointer-events-none disabled:opacity-50`}),children:(0,J.jsx)(Ga,{className:`h-4 w-4`,strokeWidth:2.5,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`View the plan`})]}):(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`button`,{type:`button`,onClick:o,disabled:n,"aria-label":`Create a plan for ${e.title}`,className:`text-muted-foreground/50 hover:text-foreground disabled:opacity-50`}),children:(0,J.jsx)(Ka,{className:`h-4 w-4`,"aria-hidden":!0})}),(0,J.jsx)(kx,{children:`Plan this ticket — starts a session to write its plan`})]})}),e.github?(0,J.jsxs)(`a`,{href:e.github.url,target:`_blank`,rel:`noreferrer`,className:`flex w-20 shrink-0 items-center justify-end gap-1 px-3 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[(0,J.jsx)(so,{className:`h-4 w-4`,"aria-hidden":!0}),e.github.label]}):(0,J.jsx)(`span`,{className:`w-20 shrink-0`,"aria-hidden":!0})]})}function NJ({projectId:e,tickets:t,loaded:n,hiddenByFilter:r=0,onOpen:i,onOpenPlan:a,onRunStarted:o,onTopicClick:s,onClaimedClick:c,onClearFilters:l}){let{busy:u,error:d,run:f}=iu(),p=nC(e?()=>ua(e):null,kJ,[e]);if(!e)return null;if(!n)return(0,J.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading…`});let m=async(t,n,r={})=>{let i=await f(()=>oT(e,t,`prompt`,r),n);i?.ok&&o?.(t,i.runId)},h=()=>m(DJ,`The import could not be started.`,{unattended:!0}),g=()=>m(OJ,`The update could not be started.`,{unattended:!0}),_=e=>m(AJ(e),`The planning session could not be started.`),v=e=>m(jJ(e),`The work session could not be started.`,{unattended:!0,ticket:`tickets/${e}`});return t.length===0&&r>0?(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border p-4 text-sm`,children:[(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[r,` ticket`,r===1?``:`s`,` hidden by the current filters.`]}),l&&(0,J.jsx)(Y,{variant:`outline`,size:`xs`,onClick:l,children:`Clear filters`})]}):t.length===0?(0,J.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border p-4 text-sm`,children:[(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`No tickets yet. Tickets live in `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1`,children:`tickets/`}),` and are what the agent plans from.`]}),d&&(0,J.jsx)(`p`,{className:`text-xs text-danger`,children:d}),(0,J.jsx)(Y,{size:`sm`,variant:`outline`,disabled:u,onClick:()=>void h(),children:u?`Starting…`:`Import tickets from GitHub`})]}):(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[d&&(0,J.jsx)(`p`,{className:`border-b border-border p-2 text-xs text-danger`,children:d}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border bg-muted/40 px-2 py-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:p.lastImportedAt?`Updated from GitHub ${Gl(p.lastImportedAt)}`:`No record of an import yet`}),(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-6 shrink-0 gap-1 px-2 text-xs`,disabled:u,onClick:()=>void g()}),children:[(0,J.jsx)(wo,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),u?`Starting…`:`Update from GitHub`]}),(0,J.jsx)(kx,{children:p.lastImportedAt?`Bring tickets/ up to date with the issues and comments changed since the last import.`:`Bring tickets/ up to date with GitHub. With no import on record, everything open comes across.`})]})]}),(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:t.map(e=>(0,J.jsx)(MJ,{ticket:e,busy:u,onOpen:()=>i(e.file),onStartWork:()=>void v(e.file),onOpenPlan:a?()=>a(e.file):void 0,onStartPlan:()=>void _(e.file),onTopicClick:s,onClaimedClick:c},e.file))})]})}var PJ=[];function FJ(){return typeof window>`u`?iq():Nq(window.location.search)}function IJ({onOpenTicket:e,onOpenTicketPlan:t,onRunStarted:n}){let{value:r,loaded:i}=rC(da,PJ,1e4,[]),[a,o]=(0,T.useState)(FJ),s=e=>{if(o(e),typeof window<`u`){let t=Pq(e);window.history.replaceState(null,``,window.location.pathname+(t?`?${t}`:``))}},c=()=>s({...a,filters:iq().filters}),l=e=>{a.filters.topics.includes(e)||s({...a,filters:{...a.filters,topics:[...a.filters.topics,e]}})},u=()=>{a.filters.stage.includes(`claimed`)||s({...a,filters:{...a.filters,stage:[...a.filters.stage,`claimed`]}})},d=(0,T.useMemo)(()=>QK(r),[r]),f=pq(d,a.filters),p=aq(a.filters),{busy:m,error:h,run:g}=iu(),_=async(e,t)=>{let r=AJ(t),i=await g(()=>oT(e,r,`prompt`),`The planning session could not be started.`);i?.ok&&n?.(e,r,i.runId)},v=async(e,t)=>{let r=jJ(t),i=await g(()=>oT(e,r,`prompt`,{unattended:!0,ticket:`tickets/${t}`}),`The work session could not be started.`);i?.ok&&n?.(e,r,i.runId)},y=a.filters.projects.length>0?r.filter(e=>a.filters.projects.includes(e.projectId)):r,b=hq(f,a.sort);return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`space-y-2 border-b border-border px-6 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h1`,{className:`text-base font-semibold`,children:[`Tickets`,i&&d.length>0&&(0,J.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-muted-foreground`,children:[f.length,`/`,d.length]})]}),(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Every project's `,(0,J.jsx)(`code`,{className:`rounded bg-muted px-1`,children:`tickets/`}),` backlog — what the agent plans from.`]})]}),(0,J.jsx)(EJ,{view:a,rows:d,projects:r.map(e=>({id:e.projectId,name:e.projectName})),onChange:s})]}),(0,J.jsx)(Bb,{className:`min-h-0 flex-1`,children:(0,J.jsx)(`div`,{className:`w-full p-6`,children:i?r.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects registered yet.`}):a.group===`none`?(0,J.jsxs)(`div`,{className:`space-y-2`,children:[h&&(0,J.jsx)(`p`,{className:`text-xs text-danger`,children:h}),p&&d.length-f.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,J.jsxs)(`span`,{children:[d.length-f.length,` ticket`,d.length-f.length===1?``:`s`,` hidden by the current filters.`]}),(0,J.jsx)(Y,{variant:`outline`,size:`xs`,onClick:c,children:`Clear filters`})]}),b.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d.length===0?`No tickets in any project yet — group by project to import from GitHub.`:`No tickets match.`}):(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:(0,J.jsx)(`ul`,{className:`divide-y divide-border`,children:b.map(n=>(0,J.jsx)(MJ,{ticket:n.ticket,projectName:n.projectName,busy:m,onOpen:()=>e(n.projectId,n.ticket.file),onStartWork:()=>void v(n.projectId,n.ticket.file),onOpenPlan:t?()=>t(n.projectId,n.ticket.file):void 0,onStartPlan:()=>void _(n.projectId,n.ticket.file),onTopicClick:l,onClaimedClick:u},`${n.projectId}/${n.ticket.file}`))})})]}):(0,J.jsx)(`div`,{className:`space-y-8`,children:y.map(r=>{let i=f.filter(e=>e.projectId===r.projectId),o=hq(i,a.sort);return(0,J.jsxs)(`section`,{className:`min-w-0 space-y-2`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:r.projectName}),(0,J.jsx)(NJ,{projectId:r.projectId,tickets:o.map(e=>e.ticket),loaded:!0,hiddenByFilter:r.tickets.length-i.length,onOpen:t=>e(r.projectId,t),onOpenPlan:t?e=>t(r.projectId,e):void 0,onRunStarted:(e,t)=>n?.(r.projectId,e,t),onTopicClick:l,onClaimedClick:u,onClearFilters:p?c:void 0})]},r.projectId)})}):(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})})})]})}function LJ({projectId:e,slug:t,onBack:n}){let{value:r,loaded:i}=rC(()=>la(e,t),null,1e4,[e,t]),[a,o]=(0,T.useState)(!1),{busy:s,error:c,run:l}=iu(),u=async()=>{r&&(await l(()=>_T(e,r.title,{file:r.file,...r.priority?{priority:r.priority}:{}}),`The ticket could not be queued.`))?.ok&&o(!0)},[d,f]=(0,T.useState)(!1),p=!!r?.locked&&!d,m=async()=>{r&&(await l(()=>vT(e,r.file),`The lock could not be released.`))?.ok&&f(!0)};return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(`div`,{className:`border-b border-border px-4 py-2`,children:(0,J.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-1.5`,onClick:n,children:[(0,J.jsx)(Pa,{className:`h-4 w-4`}),` Tickets`]})}),(0,J.jsx)(Bb,{className:`min-h-0 flex-1`,children:(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl p-6`,children:i?r?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold`,children:r.title}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[p&&(0,J.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:s,onClick:()=>void m(),title:r.lockedBy?`Claimed by ${r.lockedBy}`:void 0,className:`gap-1.5`,children:[(0,J.jsx)(_o,{className:`h-3.5 w-3.5`}),` Release lock`]}),(0,J.jsx)(Y,{size:`sm`,variant:`outline`,disabled:s||a,onClick:()=>void u(),className:`gap-1.5`,children:a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Va,{className:`h-3.5 w-3.5`}),` Queued`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(mo,{className:`h-3.5 w-3.5`}),` Queue`]})})]})]}),r.summary&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:r.summary}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,title:Vl(r.date),children:Ul(r.date)}),r.priority&&(0,J.jsxs)(kl,{className:q(`border-transparent px-0 text-[10px]`,ZK(r.priority)),children:[`Priority: `,r.priority]}),r.github&&(0,J.jsxs)(`a`,{href:r.github.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[(0,J.jsx)(so,{className:`h-4 w-4`,"aria-hidden":!0}),r.github.label]}),r.topics?.map(e=>(0,J.jsx)(kl,{className:`border-border px-1.5 text-[10px] text-muted-foreground`,children:e},e)),r.planned&&(0,J.jsx)(kl,{className:`border-transparent px-0 text-[10px] uppercase`,children:`planned`}),p&&(0,J.jsxs)(kl,{className:`border-transparent px-0 text-[10px] text-warning`,children:[(0,J.jsx)(`span`,{className:`uppercase`,children:`claimed`}),r.lockedBy&&(0,J.jsxs)(J.Fragment,{children:[`\xA0· `,r.lockedBy]})]}),r.effort!==void 0&&(0,J.jsxs)(kl,{className:`border-transparent px-0 text-[10px] text-muted-foreground`,children:[`Effort: `,r.effort]}),r.uncertainty!==void 0&&(0,J.jsxs)(kl,{className:`border-transparent px-0 text-[10px] text-muted-foreground`,children:[`Uncertainty: `,r.uncertainty]}),(0,J.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:r.file})]}),c&&(0,J.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:c}),(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsx)(xG,{text:r.content})})]}):(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This ticket does not exist.`}):(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})})})]})}var RJ=`tickets`;function zJ(e){return`${RJ}/${e.replace(/\.md$/,``)}.plan.md`}function BJ({projectId:e,slug:t,onBack:n}){let r=zJ(t),{value:i,loaded:a}=rC(()=>sa(e,r),null,1e4,[e,r]);return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-4 py-2`,children:[(0,J.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-1.5`,onClick:n,children:[(0,J.jsx)(Pa,{className:`h-4 w-4`}),` Tickets`]}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:r})]}),(0,J.jsx)(Bb,{className:`min-h-0 flex-1`,children:(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl p-6`,children:a?!i||i.binary?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This ticket has no plan yet.`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(xG,{text:i.text}),i.truncated&&(0,J.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Plan truncated — open the file to read the rest.`})]}):(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`})})})]})}function VJ(e,t,n=!0){let[r,i]=(0,T.useState)(15e3),{value:a,reload:o,loaded:s}=rC(n&&t?()=>ma(e,t):null,null,r,[e,t,n,r],!0);(0,T.useEffect)(()=>i(a?.prPending?1e3:15e3),[a?.prPending]);let{busy:c,error:l,run:u}=iu(),[d,f]=(0,T.useState)(null);return{handoff:a,loaded:s,busy:c,error:l,pending:d,act:(e,t,n)=>{f(e),u(t,n).then(e=>{f(null),e!==void 0&&o()})}}}function HJ(e){let t=e?.sessionId;if(!t)return null;let n=e.workspace;return n?`mkdir -p ${n} && cd ${n} && claude --resume ${t}`:t}function UJ(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Px(),d=!!u,f=du(()=>s?.store??new Jx({open:n??r,activeTriggerId:c===void 0?l:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`})).current;f.useControlledProp(`open`,n,r),f.useControlledProp(`activeTriggerId`,c,l),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Kx({store:f,actionsRef:o,parentContext:u?.store.context,onOpenChange:i,triggerIdProp:c});let m=T.useMemo(()=>({store:f}),[f]);return(0,J.jsx)(Nx.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})}function WJ({trigger:e,open:t,onOpenChange:n,title:r,body:i,confirmLabel:a,confirmBusyLabel:o=`Working…`,onConfirm:s,onSuccess:c,fallbackError:l=`Something went wrong.`,destructive:u=!0}){let[d,f]=(0,T.useState)(!1),p=t??d,m=n??f,{busy:h,error:g,run:_,reset:v}=iu();return(0,J.jsxs)(UJ,{open:p,onOpenChange:e=>{h||(m(e),e&&v())},children:[e&&(0,J.jsx)(Qx,{render:e}),(0,J.jsxs)(Gx,{children:[(0,J.jsx)(Ix,{className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px]`}),(0,J.jsxs)(Wx,{className:`fixed left-1/2 top-1/2 z-50 w-[min(26rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-card p-5 text-card-foreground shadow-lg`,children:[(0,J.jsx)(Zx,{className:`text-sm font-semibold`,children:r}),(0,J.jsx)(Rx,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:i}),g&&(0,J.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:g}),(0,J.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,J.jsx)(Lx,{render:(0,J.jsx)(Y,{variant:`outline`,size:`sm`,disabled:h,children:`Cancel`})}),(0,J.jsx)(Y,{variant:u?`destructive`:`default`,size:`sm`,disabled:h,onClick:()=>{_(s,l).then(e=>{e!==void 0&&(m(!1),queueMicrotask(()=>c?.()))})},className:q(h&&`cursor-progress`),children:h?o:a})]})]})]})]})}function GJ({projectId:e,runId:t,events:n,label:r,retainedWorktree:i=!1,onWorktreeRemoved:a,onDeleted:o}){let s=Ml(n),c=ns(n),l=pG(c),u=s||i,d=HJ(c),[f,p]=(0,T.useState)(!1),m=(0,T.useRef)(void 0);(0,T.useEffect)(()=>()=>clearTimeout(m.current),[]);let h=()=>{d&&navigator.clipboard?.writeText(d).then(()=>{p(!0),clearTimeout(m.current),m.current=setTimeout(()=>p(!1),1500)})},g=nC(()=>ta(e),null,[e],!0),_=fw().editor,v=oG(),y=_&&!v.some(e=>e.bin===_)?[...v,{bin:_,label:_}]:v,[b,x]=(0,T.useState)(null),[S,C]=(0,T.useState)([]),{busy:w,error:E,reset:D,run:O}=iu();(0,T.useEffect)(()=>{let n=!0;return x(null),C([]),D(),uT(e,t??void 0).then(e=>{n&&e.running&&x(e.url??null)}),cT(e,t??void 0).then(e=>{n&&C(e)}),()=>{n=!1}},[e,t,D]);let[k,A]=(0,T.useState)(!1);(0,T.useEffect)(()=>A(!1),[t]);let j=w||k&&s,[M,N]=(0,T.useState)(!1);(0,T.useEffect)(()=>N(!1),[t]);let[P,F]=(0,T.useState)(!1),I=n=>O(()=>dT(e,n,t??void 0),`Failed to open.`),L=n=>void O(()=>sT(e,n,t??void 0),`Failed to start the preview.`).then(e=>{e?.ok&&x(e.url)}),R=()=>void O(async()=>(await lT(e,t??void 0),!0),`Failed to stop the preview.`).then(e=>{e&&x(null)}),z=()=>void O(()=>eT(e,t??void 0).then(()=>!0),`Could not stop the session.`).then(e=>{e&&A(!0)}),B=()=>{t&&O(()=>gT(e,t),`Could not arm the merge.`).then(e=>{e?.ok&&N(!0)})},ee=()=>{t&&O(()=>fT(e,t),`Could not remove the worktree.`).then(e=>{e!==void 0&&a?.()})},V=r?.trim()||t;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Gb,{children:[(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Yb,{type:`button`,"aria-label":`Session actions`,className:Ol({variant:`outline`,size:`icon-sm`})}),children:(0,J.jsx)(Xa,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(kx,{children:`Session actions`})]}),(0,J.jsxs)(Xb,{align:`end`,className:`min-w-[14rem]`,children:[g&&(0,J.jsxs)(Zb,{render:(0,J.jsx)(`a`,{href:g,target:`_blank`,rel:`noreferrer`}),children:[(0,J.jsx)(so,{className:`h-3.5 w-3.5 shrink-0`}),` Open on GitHub`]}),(0,J.jsxs)(Zb,{disabled:w,onClick:()=>void I(`files`),title:t&&!u?`This session no longer has its own checkout`:void 0,children:[(0,J.jsx)(to,{className:`h-3.5 w-3.5 shrink-0`}),` `,t?u?`Open session's folder`:`Open project folder`:`Open folder`]}),(0,J.jsxs)(qb,{children:[(0,J.jsxs)($b,{disabled:w,children:[(0,J.jsx)(Ja,{className:`h-3.5 w-3.5 shrink-0`}),` Open in editor`]}),(0,J.jsxs)(ex,{className:`min-w-[15rem]`,children:[(0,J.jsxs)(Zb,{disabled:w,onClick:()=>void I(`editor`),children:[(0,J.jsx)(Ja,{className:`h-3.5 w-3.5 shrink-0`}),` `,t?`Open this session's checkout`:`Open in your editor`]}),(0,J.jsx)(tx,{}),(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Preferred editor`}),(0,J.jsxs)(Zb,{disabled:w,closeOnClick:!1,onClick:()=>lw({editor:``}),className:`items-start`,children:[(0,J.jsx)(Va,{className:q(`mt-0.5 h-3.5 w-3.5 shrink-0`,_?`opacity-0`:`opacity-100`)}),(0,J.jsx)(Pw,{label:`Default`,description:`$FRAMEWORK_EDITOR, or code`})]}),y.map(e=>(0,J.jsxs)(Zb,{disabled:w,closeOnClick:!1,onClick:()=>lw({editor:e.bin}),className:`items-start`,children:[(0,J.jsx)(Va,{className:q(`mt-0.5 h-3.5 w-3.5 shrink-0`,_===e.bin?`opacity-100`:`opacity-0`)}),(0,J.jsx)(Pw,{label:e.label,description:e.bin})]},e.bin))]})]})]}),l&&(0,J.jsxs)(Zb,{render:(0,J.jsx)(`a`,{href:l.href,target:`_blank`,rel:`noreferrer`}),children:[(0,J.jsx)(Za,{className:`h-3.5 w-3.5 shrink-0`}),` `,l.label.replace(` ↗`,``)]}),d&&c?.sessionId&&(0,J.jsxs)(Zb,{closeOnClick:!1,onClick:h,title:d,children:[f?(0,J.jsx)(Va,{className:`h-3.5 w-3.5 shrink-0 text-success`}):(0,J.jsx)(Ya,{className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`flex-1`,children:f?`Copied`:c.workspace?`Copy resume command`:`Copy session id`}),(0,J.jsx)(`span`,{className:`ml-auto pl-3 font-mono text-[10px] text-muted-foreground`,children:c.sessionId.slice(0,8)})]}),(0,J.jsx)(tx,{}),b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Zb,{render:(0,J.jsx)(`a`,{href:b,target:`_blank`,rel:`noreferrer`}),children:[(0,J.jsx)(Za,{className:`h-3.5 w-3.5 shrink-0`}),` Open preview`]}),(0,J.jsxs)(Zb,{disabled:w,onClick:()=>void R(),children:[(0,J.jsx)(ko,{className:`h-3 w-3 shrink-0 fill-current`}),` Stop serving`]})]}):S.length>1?(0,J.jsxs)(qb,{children:[(0,J.jsxs)($b,{disabled:w,children:[(0,J.jsx)(So,{className:`h-3.5 w-3.5 shrink-0`}),` Serve`]}),(0,J.jsx)(ex,{children:(0,J.jsxs)(Kb,{children:[(0,J.jsx)(nx,{children:`Serve which app`}),S.map(e=>(0,J.jsxs)(Zb,{disabled:w,onClick:()=>L(e.id),children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label}),(0,J.jsx)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground`,children:e.script})]},e.id))]})})]}):(0,J.jsxs)(Zb,{disabled:w,onClick:()=>L(),children:[(0,J.jsx)(So,{className:`h-3.5 w-3.5 shrink-0`}),` `,w?`Starting…`:`Serve`]}),s&&(0,J.jsxs)(Zb,{disabled:j,onClick:()=>void z(),children:[(0,J.jsx)(ko,{className:`h-3 w-3 shrink-0 fill-current`}),` `,j?`Stopping…`:`Stop session`]}),s&&t&&(0,J.jsxs)(Zb,{disabled:M||w,onClick:()=>B(),children:[(0,J.jsx)(ao,{className:`h-3.5 w-3.5 shrink-0`}),` `,M?`Merge armed`:`Merge when finished`]}),(i&&!s||o&&!s)&&t&&(0,J.jsx)(tx,{}),i&&!s&&t&&(0,J.jsxs)(Zb,{disabled:w,onClick:()=>ee(),children:[(0,J.jsx)(no,{className:`h-3.5 w-3.5 shrink-0`}),` Remove worktree`]}),o&&!s&&t&&(0,J.jsxs)(Zb,{onClick:()=>F(!0),className:`text-danger`,children:[(0,J.jsx)(Mo,{className:`h-3.5 w-3.5 shrink-0`}),` Delete session`]}),E&&(0,J.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-danger`,children:E})]})]}),o&&t&&(0,J.jsx)(WJ,{open:P,onOpenChange:F,title:`Delete this session?`,body:(0,J.jsxs)(J.Fragment,{children:[`Deleting `,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:V}),` removes it from the dashboard for good — its history can’t be recovered. Its branch and any pull request stay in git.`]}),confirmLabel:`Delete`,confirmBusyLabel:`Deleting…`,fallbackError:`Could not delete the session.`,onConfirm:()=>pT(e,t).then(e=>e.ok?e:Promise.reject(Error(e.error))),onSuccess:o})]})}function KJ({projectId:e,runId:t,events:n,retainedWorktree:r=!1,onWorktreeRemoved:i,onDeleted:a,label:o,projectName:s,summary:c,expanded:l=!1,onToggle:u,actions:d}){let f=fG(n);return(0,J.jsxs)(`div`,{className:`@container flex items-center gap-2 overflow-hidden px-4 py-2`,children:[(0,J.jsx)(lG,{projectId:e,runId:t,inline:!0,label:o,projectName:s,summary:c,expanded:l,onToggle:u,runState:f&&(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,title:f.label,children:[(0,J.jsx)(`span`,{className:q(`h-2 w-2 shrink-0 rounded-full`,f.dot),"aria-hidden":!0}),(0,J.jsx)(`span`,{className:q(`max-w-40 truncate`,f.tone),children:f.label})]})}),(0,J.jsx)(`div`,{className:`grow shrink-0`}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[d,(0,J.jsx)(GJ,{projectId:e,runId:t,events:n,label:o,retainedWorktree:r,onWorktreeRemoved:i,onDeleted:a})]})]})}var qJ=`This session was stopped before it finished, not because the work was done. Look at what you had already done, then carry on from there. The session lifecycle still applies: once the work is genuinely finished with nothing left to do, call setReadyForMerge() — without it the finished work is never merged.`;function JJ({projectId:e,runId:t,live:n,sessionId:r,driver:i,files:a,addContext:o,removeContext:s,sessionName:c,onRunStarted:l,outcome:u}){let d=(0,T.useRef)(null),{busy:f,error:p,run:m}=iu(),{busy:h,error:g,start:_}=yT(),{busy:v,error:y,run:b}=iu(),[x,S]=(0,T.useState)(!1);(0,T.useEffect)(()=>S(!1),[t]),(0,T.useEffect)(()=>{n||S(!1)},[n]);let[C,w]=(0,T.useState)(!1);(0,T.useEffect)(()=>w(!1),[t]),(0,T.useEffect)(()=>{n&&w(!1)},[n]);let E=v||x&&n,[D,O]=(0,T.useState)(null),k=!n&&r!==void 0,A=async(a,o,s)=>{if(f||h)return;if(s.newSession||!n&&!k){let t=await _(e,a,`prompt`,{});t&&(d.current?.clear(),l?.(a,t.runId)),d.current?.focus();return}if(n){await m(()=>iT(e,a,t??void 0).then(()=>!0),`Could not send — the session may have just ended. Your text is kept, try again.`)&&(O(a),d.current?.clear()),d.current?.focus();return}let c=Ro(i),u=await _(e,a,`prompt`,{resumeSession:r,...t?{continueRunId:t}:{},...c&&c!==`claude`?{agent:c}:{}},`Failed to continue the session.`);u&&(d.current?.clear(),l?.(a,u.runId))},j=()=>void b(()=>eT(e,t??void 0).then(()=>!0),`Could not stop the session.`).then(e=>{e&&S(!0)}),M=async()=>{if(h||!r)return;let n=Ro(i),a=await _(e,qJ,`prompt`,{resumeSession:r,...t?{continueRunId:t}:{},...n&&n!==`claude`?{agent:n}:{}},`Failed to resume the session.`);a&&(w(!0),l?.(qJ,a.runId))},N=n?(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{type:`button`,size:`icon-sm`,onClick:j,disabled:E,"aria-label":`Stop session`,className:`h-8 w-8 shrink-0 disabled:opacity-100`}),children:E?(0,J.jsx)(go,{className:`h-4 w-4 animate-spin`}):(0,J.jsx)(ko,{className:`h-3 w-3 fill-current`})}),(0,J.jsx)(kx,{children:E?`Stopping…`:`Stop session`})]}):k&&(u?.stopped||C)?(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(Y,{type:`button`,size:`icon-sm`,onClick:()=>void M(),disabled:h||C,"aria-label":`Resume`,className:`h-8 w-8 shrink-0 disabled:opacity-100`}),children:h||C?(0,J.jsx)(go,{className:`h-4 w-4 animate-spin`}):(0,J.jsx)(So,{className:`h-3.5 w-3.5 fill-current`})}),(0,J.jsx)(kx,{children:h||C?`Resuming…`:`Resume the session`})]}):void 0,P=p??g??y;return(0,J.jsxs)(`div`,{className:`p-2`,children:[(0,J.jsx)(XJ,{live:n,resumable:k,outcome:u,queued:D,muted:!!P}),P&&(0,J.jsx)(`p`,{role:`alert`,className:`mb-1 px-2 text-xs text-danger`,children:P}),(0,J.jsx)(FW,{ref:d,files:a,addContext:o,removeContext:s,onSubmit:A,busy:f||h,submitLabel:`Send`,submitBusyLabel:n?`Sending…`:k?`Resuming…`:`Starting…`,showAgentModel:!1,inSession:!0,sessionEnded:!n,sessionName:c,idleControl:N,placeholder:n?`Message the session…  ( / commands · < tags · @ projects · # files )`:k?`Message the session to continue it…  ( / commands · < tags · @ projects · # files )`:YJ})]})}var YJ=`This session can’t be continued — it ended before the agent reported a session id. Your next message starts a new one.`;function XJ({live:e,resumable:t,outcome:n,queued:r,muted:i}){return e?!r||i?null:(0,J.jsxs)(`p`,{role:`status`,className:`mb-1 truncate px-2 text-xs text-muted-foreground`,children:[`Queued — the session reads it between turns: “`,r,`”`]}):t?(0,J.jsx)(`p`,{className:`mb-2 px-2 text-xs text-muted-foreground`,children:n&&!n.ok&&!n.stopped?`Session failed — your next message resumes it where it stopped.`:n?.stopped?`Session stopped — your next message resumes it.`:`Session ended — your next message continues it.`}):null}var ZJ={driver:`agent`,settled:`waiting`,usage:`cost`,"session-update":`resume`};function QJ(e){return ZJ[e]??e.replace(/-/g,` `)}var $J=new WeakMap;function eY(e){$J.set(e,Date.now())}function tY(e){return $J.get(e)}function nY({projectId:e,runId:t,inline:n,onFrame:r}){let i=(0,T.useRef)(null),[a,o]=(0,T.useState)(0),[s,c]=(0,T.useState)(void 0),l=`/browser/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,[u,d]=(0,T.useState)(l);u!==l&&(d(l),o(0),c(void 0));let f=`${l}#${a}`,p=s===f;(0,T.useEffect)(()=>{if(!r)return;let e=setInterval(()=>{let e=i.current;if(!(!e||!e.naturalWidth))try{let t=document.createElement(`canvas`);t.width=e.naturalWidth,t.height=e.naturalHeight;let n=t.getContext(`2d`);if(!n)return;n.drawImage(e,0,0),r(t.toDataURL(`image/jpeg`,.7))}catch{}},2e3);return()=>clearInterval(e)},[r]);let m=e=>{let t=e.currentTarget,n=t.getBoundingClientRect();return{x:Math.round((e.clientX-n.left)/n.width*(t.naturalWidth||n.width)),y:Math.round((e.clientY-n.top)/n.height*(t.naturalHeight||n.height))}},h=e=>{fetch(`${l}/input`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}).catch(()=>{})};return p?(0,J.jsxs)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:[(0,J.jsx)(`p`,{className:`mb-2`,children:`The preview is not reachable. It ends with the session, and a session only has one when it was started with Browser on. If it just started, the stream may not be up yet.`}),(0,J.jsx)(Y,{variant:`outline`,size:`xs`,onClick:()=>o(e=>e+1),children:`Retry`})]}):(0,J.jsxs)(`div`,{className:n?`flex h-full min-h-0 w-full flex-col`:`flex min-h-0 flex-auto flex-col`,children:[(0,J.jsx)(`div`,{className:n?`flex min-h-0 flex-1 items-center justify-center overflow-hidden`:`min-h-0 flex-auto overflow-auto p-2`,children:(0,J.jsx)(`img`,{ref:i,src:`${l}/stream?r=${a}`,alt:`The session's browser`,tabIndex:0,className:`cursor-crosshair focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] ${n?`max-h-full max-w-full`:`w-full rounded border border-border bg-muted`}`,onError:()=>c(f),onClick:e=>h({type:`click`,...m(e)}),onWheel:e=>h({type:`scroll`,...m(e),deltaY:e.deltaY}),onKeyDown:e=>{e.key.length!==1||e.metaKey||e.ctrlKey||(e.preventDefault(),h({type:`key`,text:e.key}))}})}),!n&&(0,J.jsx)(`p`,{className:`border-t border-border p-2 text-xs text-muted-foreground`,children:`Click the frame, then type. Chrome only sends a frame when the page changes, so this stays blank until the agent opens something.`})]})}function rY({projectId:e,runId:t,url:n,live:r}){let[i,a]=(0,T.useState)(void 0);return!r&&i===void 0?(0,J.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`browser · `,n]}):(0,J.jsx)(`div`,{className:`relative aspect-[16/10] max-h-96 w-full overflow-hidden rounded-md border border-border bg-muted`,children:r?(0,J.jsx)(nY,{inline:!0,projectId:e,runId:t,onFrame:a}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`img`,{src:i,alt:`The browser's last frame`,className:`h-full w-full object-contain`}),(0,J.jsx)(`p`,{className:`absolute inset-x-0 bottom-0 bg-background/80 px-2 py-1 text-[11px] text-muted-foreground`,children:`preview ended — session finished`})]})})}function iY({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=aY(oY(r,i),t);if(!n)return T.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!T.isValidElement(n))return null;let o=n.props,s={...aY(a,o),ref:lY(a.ref,o.ref)};return T.cloneElement(n,s)}function aY(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=lY(i,r):cY(n)&&typeof i==`function`&&typeof r==`function`?t[n]=sY(r,i):t[n]=r}}return t}function oY(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function sY(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function cY(e){return/^on[A-Z]/.test(e)}function lY(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var uY=8,dY=64,fY=0,pY=.5,mY=180,hY=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),gY={start:!1,end:!1},_Y={currentAnchorId:null,visibleMessageIds:[]};function vY({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return gY;let i=AY({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function yY({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return _Y;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of bY(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+pY&&(u=e)}return l.length===0&&u===null?_Y:{currentAnchorId:u,visibleMessageIds:l}}function bY(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function xY(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function SY(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function CY(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function wY(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function TY({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of bY(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function EY({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=DY(t,i),o=t.getBoundingClientRect().height,s=NY(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function DY(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function OY(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function kY({content:e,scrollTop:t,spacer:n,viewport:r}){let i=AY({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function AY({content:e,spacer:t,viewport:n}){let r=bY(e,t),i=MY(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function jY(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function MY(e){let t=window.getComputedStyle(e);return{end:FY(t.paddingBlockEnd||t.paddingBottom),start:FY(t.paddingBlockStart||t.paddingTop)}}function NY(e){let t=e?.parentElement;return t?MY(t):{end:0,start:0}}function PY(e){if(!e)return 0;let t=window.getComputedStyle(e);return FY(t.rowGap===`normal`?t.gap:t.rowGap)}function FY(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function IY({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=T.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},mY))},[t]),S=T.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=T.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=pY){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=T.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),E=T.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(jY(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),D=T.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=EY({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l}),d=kY({content:s,scrollTop:u,spacer:y.current,viewport:l});return S(d),m.current={element:e,viewportTop:OY(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),O=T.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:D(e,{align:`start`},{keepPreviousPeek:!0})},[D]),k=T.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,D(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[D]);return{flushPendingScrollToMessage:T.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!D(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[D]),reanchorToAnchoredMessage:O,scrollToElement:D,scrollToEnd:E,scrollToMessage:k,scrollToStart:w}}function LY(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function RY(e,t){return LY(e,t)}function zY(){return LY(_Y,VY)}function BY(e,t){return e.start===t.start&&e.end===t.end}function VY(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function HY({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=T.useRef(e),a=T.useRef(!1),o=T.useRef(null),s=T.useRef(!1),c=T.useRef(t),l=T.useRef(0),u=T.useRef(null),d=T.useRef(0),f=T.useRef(e?`following-bottom`:`free-scrolling`),p=T.useRef(new Map),m=T.useRef(null),h=T.useRef(null),g=T.useRef(null),_=T.useRef(r),v=T.useRef(!0),y=T.useRef(null),b=T.useRef(n),x=T.useRef(null),S=T.useRef(0),C=T.useRef(0),w=T.useRef(null),E=T.useRef(null),D=T.useRef(null),O=T.useRef(null),k=T.useRef(null),A=T.useRef(null),j=T.useRef(null),M=T.useRef(null),N=T.useRef(new Set),P=T.useRef(new WeakSet);return D.current===null&&(D.current=RY(gY,BY)),M.current===null&&(M.current=zY()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:O,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:E,stateStore:D.current,viewportRef:k,visibilityFrameRef:A,visibilityObserverRef:j,visibilityStore:M.current,visibleMessageIdsRef:N,handledScrollAnchorsRef:P}}function UY(e,t){return T.useCallback(n=>{e.current=n,n&&t()},[e,t])}function WY({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=uY,scrollPreviousItemPeek:r=dY,scrollMargin:i=fY}){let a=HY({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:E,spacerHeightRef:D,spacerRef:O,stateFrameRef:k,stateStore:A,viewportRef:j,visibilityFrameRef:M,visibilityObserverRef:N,visibilityStore:P,visibleMessageIdsRef:F,handledScrollAnchorsRef:I}=a,L=T.useRef(t);L.current!==t&&(L.current=t,d.current=!1);let R=T.useCallback(e=>{let t=x.current,n=j.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),z=T.useCallback(e=>{let t=j.current?.scrollTop??0,n=t<m.current-pY;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),B=T.useCallback(()=>{let e=vY({content:u.current,scrollEdgeThreshold:S.current,spacer:O.current,viewport:j.current});z(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;R(t),A.setSnapshot(t)},[z,A,R]),ee=T.useCallback(()=>{k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,B()}))},[B]),V=T.useCallback(()=>{P.hasListeners()&&M.current===null&&(M.current=window.requestAnimationFrame(()=>{M.current=null,P.hasListeners()&&P.setSnapshot(yY({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:O.current,viewport:j.current,visibleMessageIds:F.current}))}))},[P]),{flushPendingScrollToMessage:H,reanchorToAnchoredMessage:te,scrollToElement:U,scrollToEnd:W,scrollToMessage:ne,scrollToStart:re}=IY({refs:a,commitScrollState:B,scheduleStateCommit:ee,scheduleVisibilitySync:V}),ie=T.useCallback(()=>{let e=y.current,t=j.current;if(!e||!t||!e.element.isConnected)return!1;let n=OY(e.element,t)-e.viewportTop;return Math.abs(n)<=pY?!1:(t.scrollTop+=n,e.viewportTop=OY(e.element,t),ee(),V(),!0)},[ee,V]),ae=T.useCallback(()=>{let e=u.current,t=j.current;if(!e||!t){y.current=null;return}let n=TY({content:e,spacer:O.current,viewport:t});y.current=n?{element:n,viewportTop:OY(n,t)}:null},[]),oe=T.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,H()&&ae()}))},[ae,H]),se=T.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=j.current,r=t&&n?wY(bY(t,O.current)):null;if(!t||!n||!r)e=W({behavior:`auto`});else{let i=DY(r,n);e=AY({content:t,spacer:O.current,viewport:n})-i<=n.clientHeight?W({behavior:`auto`}):U(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?W({behavior:`auto`}):re({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,U,W,re]),ce=T.useCallback(()=>{let e=u.current;if(!e)return;let t=bY(e,O.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(H())return;if(n===0){if(se()||t.length>0&&s.current&&W({behavior:`auto`}))return;B(),V();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){ie();return}if(t.length>n){let e=xY(t,n);if(e){if(s.current&&g.current===`following-bottom`&&CY(t,n)){W({behavior:`auto`});return}U(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}if(t.length===n){let e=SY(t,I.current);if(e){U(e,{align:`start`},{keepPreviousPeek:!0}),I.current.add(e);return}}g.current===`following-bottom`&&s.current?W({behavior:`auto`}):(B(),V())})(),ae()},[se,ae,B,H,ie,V,U,W]),le=T.useCallback(()=>{if(g.current===`following-bottom`&&s.current){W({behavior:`auto`});return}let e=D.current;if(te()){s.current&&e>0&&D.current===0&&W({behavior:`auto`});return}ee(),V()},[te,ee,V,W]),ue=T.useCallback(()=>{let e=j.current;if(!(!e||!P.hasListeners())){if(typeof IntersectionObserver>`u`){V();return}N.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?F.current.add(e):F.current.delete(e))}V()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{N.current?.observe(e)}),V()}},[V,P]),de=T.useCallback(()=>{M.current!==null&&(window.cancelAnimationFrame(M.current),M.current=null),N.current?.disconnect(),N.current=null,F.current.clear(),P.setSnapshot(_Y)},[P]),fe=T.useCallback((e,t,n)=>{if(t){h.current.set(e,t),N.current?.observe(t),V(),v.current?.messageId===e&&oe();return}n&&h.current.get(e)===n&&(h.current.delete(e),F.current.delete(e),N.current?.unobserve(n),V())},[oe,V]),pe=T.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),me=T.useCallback(()=>R(A.getSnapshot()),[A,R]),he=UY(x,me),ge=UY(j,me),_e=T.useCallback(e=>{u.current=e},[]),ve=T.useCallback(e=>{O.current=e,E.current=PY(e?.parentElement??null)},[]),ye=T.useCallback(()=>{B(),V(),ae()},[ae,B,V]),be=T.useMemo(()=>({handleContentChange:ce,handleResize:le,observeVisibility:ue,preserveScrollOnPrependRef:b,scrollToEnd:W,scrollToMessage:ne,scrollToStart:re,setContentElement:_e,setRootElement:he,setSpacerElement:ve,setViewportElement:ge,stateStore:A,syncAfterScroll:ye,unobserveVisibility:de,userScrollIntent:pe,viewportRef:j,visibilityStore:P}),[ce,le,ue,W,ne,re,_e,he,ve,ge,A,ye,de,pe,P]);return T.useLayoutEffect(()=>{se()},[se]),T.useEffect(()=>()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),M.current!==null&&(window.cancelAnimationFrame(M.current),M.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),N.current?.disconnect(),N.current=null},[]),T.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){W({behavior:`auto`});return}B()},[e,B,W]),{context:be,registerMessage:fe}}function GY(e){let t=T.useRef(e);return t.current=e,t}var KY=T.createContext(null),qY=T.createContext(null);function JY(){let e=T.useContext(KY);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function YY(){let e=T.useContext(qY);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function XY({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=WY({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,J.jsx)(KY.Provider,{value:o,children:(0,J.jsx)(qY.Provider,{value:s,children:t})})}function ZY({children:e,...t}){let{setRootElement:n}=JY();return(0,J.jsx)(`div`,{ref:n,...t,children:e})}function QY({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=JY();f.current=o;let _=T.useCallback(e=>{p(e),lY(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){hY.has(e.key)&&h(),n?.(e)}return T.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,J.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function $Y({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=JY(),u=T.useRef(null),d=T.useCallback(e=>{u.current=e,c(e),lY(n)?.(e)},[n,c]);return T.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),T.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,J.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,J.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function eX({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=YY(),a=T.useRef(null);return(0,J.jsx)(`div`,{ref:T.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),lY(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function tX({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=JY(),d=GY(r),f=T.useCallback(e=>u.subscribe(e),[u]),p=T.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=T.useSyncExternalStore(f,p,p),h=T.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return iY({defaultTagName:`button`,props:aY({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,J.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var nX={Provider:XY,Root:ZY,Viewport:QY,Content:$Y,Item:eX,Button:tX},rX=nX.Provider;function iX({className:e,...t}){return(0,J.jsx)(nX.Root,{"data-slot":`message-scroller`,className:q(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function aX({className:e,...t}){return(0,J.jsx)(nX.Viewport,{"data-slot":`message-scroller-viewport`,className:q(`size-full min-h-0 min-w-0 overflow-y-auto overscroll-contain`,`scroll-fade-b scrollbar-thin scrollbar-gutter-stable data-autoscrolling:scrollbar-quiet`,e),...t})}function oX({className:e,...t}){return(0,J.jsx)(nX.Content,{"data-slot":`message-scroller-content`,className:q(`flex h-max min-h-full flex-col`,e),...t})}function sX({className:e,scrollAnchor:t=!1,...n}){return(0,J.jsx)(nX.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:q(`min-w-0 shrink-0`,e),...n})}function cX({direction:e=`end`,className:t,children:n,...r}){return(0,J.jsx)(nX.Button,{"data-slot":`message-scroller-button`,"data-direction":e,direction:e,className:q(`absolute left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-full border border-border bg-background/90 px-3 py-1 text-xs text-foreground shadow-sm backdrop-blur transition-[translate,scale,opacity] duration-200 hover:bg-accent`,`data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0`,`data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100`,`data-[direction=end]:bottom-3 data-[direction=end]:data-[active=false]:translate-y-full`,`data-[direction=start]:top-3 data-[direction=start]:data-[active=false]:-translate-y-full`,t),...r,children:n??(0,J.jsxs)(J.Fragment,{children:[`Jump to latest`,(0,J.jsx)(Na,{className:`size-3.5`,"aria-hidden":!0})]})})}function lX(e){return e.kind===`system-prompt`?{text:e.text,label:`system prompt sent`}:null}function uX(e){return e.kind===`driver`?e.event.type===`start`?e.event.prompt:e.event.type===`text`?e.event.text:null:null}function dX(e){return e.replace(/\s+/g,` `).trim().length>100}function fX(e){return e.kind===`driver`?e.event.type===`start`?`you`:`agent`:e.kind}function pX(e){return e.kind===`driver`&&e.event.type===`start`?`you`:QJ(e.kind)}function mX(e){return e.kind===`driver`&&e.event.type===`start`}function hX(e){return e.kind===`driver`?e.event.type===`error`:e.kind===`end`&&!e.ok&&!e.stopped}function gX(e){return hX(e)?`text-danger`:e.kind===`driver`&&e.event.type===`start`?`text-info`:``}function _X(e){return gX(e)||(e.kind===`choice`||e.kind===`choice-resolved`?`text-warning`:e.kind===`end`&&e.ok||e.kind===`ready-for-merge`?`text-success`:e.kind===`view`||e.kind===`browser-stream`||e.kind===`browser`||e.kind===`preview`?`text-primary`:``)}function vX(e){return hX(e)?`bg-danger/10`:e.kind===`driver`&&e.event.type===`start`?`bg-info/10`:e.kind===`end`&&e.ok||e.kind===`ready-for-merge`?`bg-success/10`:``}function yX(e){let t=e.findIndex(mX);return t<=0?e:[e[t],...e.slice(0,t),...e.slice(t+1)]}function bX(e){return new Date(e).toLocaleTimeString()}function xX(e){let t=new Map,n=new Set,r=new Map,i=new Map;e.forEach((e,t)=>{e.kind===`choice`?r.set(e.id,{e,at:t}):e.kind===`choice-resolved`&&i.set(e.id,{e,at:t})});let a=new Set(Al(e).map(e=>e.id)),o;for(let[e,t]of r)a.has(e)&&(o=t.e);for(let[e,s]of r){let{kind:r,...c}=s.e,l=i.get(e);a.has(e)?t.set(s.e,{render:`open`,choice:c,active:s.e===o}):l&&l.at>s.at&&(t.set(s.e,{render:`answered`,choice:c,pick:l.e.picked}),n.add(l.e))}return{rows:t,hidden:n}}function SX(e){let t=new Map,n=new Set,r,i=!1;for(let a of e)if(a.kind===`browser`){let e=t.get(a.url);e&&n.add(e),t.set(a.url,a),r=a,i=!0}else a.kind===`end`&&(i=!1);return{pane:r,live:i,hidden:n}}function CX({text:e}){let[t,n]=(0,T.useState)(!1);return dX(e)?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,"aria-label":t?`Collapse message`:`Expand message`,className:`shrink-0 select-none text-muted-foreground transition-transform ${t?`rotate-90`:``}`,children:`›`}),(0,J.jsx)(`div`,{className:t?`min-w-0 flex-1`:`max-h-[1.35rem] min-w-0 flex-1 cursor-pointer overflow-hidden`,onClick:t?void 0:()=>n(!0),children:(0,J.jsx)(xG,{text:e,compact:!0})})]}):(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(xG,{text:e,compact:!0})})}function wX({events:e,stick:t=!0,openAt:n,tail:r,projectId:i,runId:a}){let o=(0,T.useMemo)(()=>i?xX(e):void 0,[i,e]),s=(0,T.useMemo)(()=>i&&a?SX(e):void 0,[i,a,e]),c=yX(e).filter(e=>!o?.hidden.has(e)&&!s?.hidden.has(e));return(0,J.jsx)(rX,{autoScroll:t,defaultScrollPosition:n??(t?`end`:`start`),children:(0,J.jsxs)(iX,{className:`flex-1`,children:[(0,J.jsx)(aX,{"aria-label":`Session output`,children:(0,J.jsxs)(oX,{className:`gap-1 p-4 font-mono text-xs`,children:[c.map((e,t,n)=>{let r=lX(e),c=uX(e),l=o?.rows.get(e),u=t>0?n[t-1]:void 0,d=!u||fX(u)!==fX(e),f=tY(e);return(0,J.jsxs)(sX,{messageId:String(t),scrollAnchor:mX(e),className:`-mx-1.5 flex items-start gap-2 rounded-sm px-1.5 ${vX(e)}`,children:[(0,J.jsx)(`span`,{className:`w-28 shrink-0`,children:d&&(0,J.jsx)(kl,{className:`mt-0.5 text-[10px] uppercase ${_X(e)||`text-muted-foreground`}`,children:pX(e)})}),r?(0,J.jsxs)(`details`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer text-foreground marker:text-muted-foreground`,children:[r.label,` (`,r.text.length.toLocaleString(),` chars)`]}),(0,J.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 text-foreground`,children:r.text})]}):c===null?l&&i?(0,J.jsx)(`div`,{className:`min-w-0 flex-1 font-sans`,children:l.render===`open`?(0,J.jsx)(gG,{inline:!0,projectId:i,runId:a,choice:l.choice,active:l.active},l.choice.id):(0,J.jsx)(hG,{choice:l.choice,pick:l.pick})}):e.kind===`browser`&&e===s?.pane&&i&&a?(0,J.jsx)(`div`,{className:`min-w-0 flex-1 font-sans`,children:(0,J.jsx)(rY,{projectId:i,runId:a,url:e.url,live:s.live})}):(0,J.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words ${gX(e)||`text-foreground`}`,children:(Bo(e)??``).trim()}):(0,J.jsx)(CX,{text:c}),d&&f!==void 0&&(0,J.jsxs)(Q,{children:[(0,J.jsx)(Ox,{render:(0,J.jsx)(`span`,{className:`ml-auto shrink-0 pt-0.5 text-[10px] tabular-nums text-muted-foreground`}),children:bX(f)}),(0,J.jsx)(kx,{children:new Date(f).toLocaleString()})]})]},t)}),r]})}),(0,J.jsx)(cX,{})]})})}function TX({events:e,showSessionLink:t=!0,showName:n=!0,showStatus:r=!0,showLoop:i=!0,lost:a=!1,stick:o=!0,openAt:s,emptyLabel:c=`Waiting for the session to start…`,tail:l,projectId:u,runId:d}){let f=a&&(0,J.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border bg-warning/10 px-4 py-2 text-xs text-warning`,children:[(0,J.jsx)(No,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),`Live stream lost — reconnecting. The session keeps running; this view may be behind.`]});return e.length===0?(0,J.jsxs)(J.Fragment,{children:[f,(0,J.jsx)(`div`,{className:`grid flex-1 place-items-center text-sm text-muted-foreground`,children:c})]}):(0,J.jsxs)(J.Fragment,{children:[f,(0,J.jsx)(mG,{events:e,showSessionLink:t,showName:n,showStatus:r,showLoop:i}),(0,J.jsx)(wX,{events:e,stick:o,...s?{openAt:s}:{},...l?{tail:l}:{},...u?{projectId:u,runId:d}:{}})]})}function EX({target:e,events:t,live:n}){if(e!==`actions`)return null;let r=Ll(t);return(0,J.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(so,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Running on GitHub Actions`,n?` — updates arrive when the run finishes.`:`.`]}),r&&(0,J.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-primary hover:underline`,children:[`View the Actions run`,(0,J.jsx)(Za,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})]})}var DX=4e3;function OX({target:e,events:t}){let n=e===`web`?Rl(t):void 0,r=IX(n?.id),i=FX(n?.id);return e===`web`?(0,J.jsxs)(`div`,{className:`border-b border-border bg-muted/40`,children:[(0,J.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 px-4 py-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(qa,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:n?`Running as a Claude Code cloud session. It asks its questions and opens its own pull request over there, not here.`:`Starting a Claude Code cloud session…`}),n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,J.jsxs)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:[`claude --teleport `,n.id]}),(0,J.jsx)(RK,{text:`claude --teleport ${n.id}`,label:`Copy the command that continues this session here`})]}),(0,J.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-primary hover:underline`,children:[`Open the session`,(0,J.jsx)(Za,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})]})]}),r&&n&&(!i||i.state===`failed`)&&(0,J.jsx)(kX,{question:r,url:n.url,sessionId:n.id,failure:i?.state===`failed`?i:void 0}),i&&n&&i.state!==`failed`&&(0,J.jsx)(AX,{answer:i,url:n.url,sessionId:n.id})]}):null}function kX({question:e,url:t,sessionId:n,failure:r}){let[i,a]=(0,T.useState)(void 0),[o,s]=(0,T.useState)(void 0);return(0,J.jsxs)(`div`,{className:`flex gap-2 border-t border-border px-4 py-2.5 text-xs`,children:[(0,J.jsx)(vo,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`font-medium text-foreground`,children:e.title}),(0,J.jsx)(`div`,{className:`mt-1.5 flex flex-col items-start gap-1`,children:e.options.map(t=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>a(t.label),"aria-pressed":i===t.label,className:`rounded border px-2 py-1 text-left transition-colors ${i===t.label?`border-primary bg-primary/10 text-foreground`:`border-border text-muted-foreground hover:border-primary/50 hover:text-foreground`}`,children:[t.label,t.label===e.recommended&&(0,J.jsx)(`span`,{className:`ml-1.5 text-[10px] uppercase tracking-wide text-primary`,children:`recommended`}),t.detail&&(0,J.jsx)(`span`,{className:`ml-1.5 opacity-70`,children:t.detail})]},t.label))}),r&&(0,J.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1 text-destructive`,children:[(0,J.jsx)(No,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),`Sending “`,r.label,`” failed`,r.note?`: ${r.note}`:``,`. Pick again, or answer in the session.`]}),o&&(0,J.jsx)(`p`,{className:`mt-1.5 text-destructive`,children:o}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>{i&&nT(n,i).then(e=>{e.ok||s(e.error??`could not queue the answer`)}).catch(()=>s(`could not reach the daemon`))},disabled:!i,className:`rounded bg-primary px-2.5 py-1 font-medium text-primary-foreground disabled:cursor-not-allowed disabled:opacity-50`,children:i?`Send “${i}”`:`Pick an answer`}),(0,J.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[`Answer it in the session`,(0,J.jsx)(Za,{className:`h-3 w-3`,"aria-hidden":!0})]})]})]})]})}function AX({answer:e,url:t,sessionId:n}){return(0,J.jsx)(`div`,{className:`flex items-center gap-2 border-t border-border px-4 py-2.5 text-xs text-muted-foreground`,children:e.state===`queued`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(go,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-primary`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Sending “`,e.label,`” through your Claude web tab… It goes out the next time the extension checks in.`]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void rT(n).catch(()=>{}),className:`shrink-0 rounded border border-border px-2 py-1 hover:border-primary/50 hover:text-foreground`,children:`Cancel`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Va,{className:`h-3.5 w-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Answered “`,e.label,`”. The session continues over there and its transcript above follows along.`]}),(0,J.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-primary hover:underline`,children:[`Open the session`,(0,J.jsx)(Za,{className:`h-3 w-3`,"aria-hidden":!0})]})]})})}var jX=[/^Arrow keys move the tile/i,/^Show message actions$/i,/^(Claude\s+)?(Fable|Opus|Sonnet|Haiku)(\s+\d[\d.]*)?$/i];function MX(e){return e.split(`
`).filter(e=>!jX.some(t=>t.test(e.trim()))).join(`
`).replace(/\n{3,}/g,`

`).trim()}function NX({target:e,events:t}){let n=e===`web`?Rl(t):void 0,r=PX(n?.id);if(e!==`web`||!n)return null;let i=r.map(e=>MX(e.text)).filter(Boolean);return(0,J.jsxs)(`div`,{role:`status`,"aria-label":`Cloud session mirror`,className:`mt-2 rounded-md border border-border bg-muted/40 font-sans`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,J.jsx)(qa,{className:`h-3 w-3 shrink-0 text-primary`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:`Cloud session mirror`}),(0,J.jsx)(`span`,{className:`opacity-70`,children:`a best-effort view of the Claude tab, not the run's own log`})]}),i.length>0?(0,J.jsx)(`div`,{className:`max-h-80 space-y-2 overflow-y-auto px-3 py-2 text-xs`,children:i.map((e,t)=>(0,J.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:e},t))}):(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(go,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-primary`,"aria-hidden":!0}),`Connecting to the cloud session…`]})]})}function PX(e){let[t,n]=(0,T.useState)([]);return(0,T.useEffect)(()=>{if(!e){n([]);return}let t=!0,r=()=>{ya(e).then(e=>{t&&n(e)}).catch(()=>{})};r();let i=setInterval(r,DX);return()=>{t=!1,clearInterval(i)}},[e]),t}function FX(e){let[t,n]=(0,T.useState)(void 0);return(0,T.useEffect)(()=>{if(!e){n(void 0);return}let t=!0,r=()=>{ba(e).then(e=>{t&&n(e??void 0)}).catch(()=>{})};r();let i=setInterval(r,DX);return()=>{t=!1,clearInterval(i)}},[e]),t}function IX(e){let[t,n]=(0,T.useState)(void 0);return(0,T.useEffect)(()=>{if(!e){n(void 0);return}let t=!0,r=()=>{ga(e).then(e=>{t&&n(e??void 0)}).catch(()=>{})};r();let i=setInterval(r,DX);return()=>{t=!1,clearInterval(i)}},[e]),t}function LX({device:e}){return e?(0,J.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(yo,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Running on `,e,`. Its worktree, diff, and pull request live on the device; the browser preview is not available for remote runs yet.`]})]}):null}var RX=T.createContext(void 0);function zX(){let e=T.useContext(RX);if(e===void 0)throw Error(Ou(50));return e}function BX(e,t={}){let n=e.useState(`domReferenceElement`),r=e.context.dataRef,{delay:i}=t,a=wp(),o=T.useRef(!1);T.useEffect(()=>{let t=dd(n);function r(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&hd(t)&&t===Wp(Yp(t))&&(o.current=!0)}return t.addEventListener(`blur`,r),()=>{t.removeEventListener(`blur`,r)}},[e,n]);let s=T.useMemo(()=>({onFocus(t){let{nativeEvent:n}=t,r=typeof i==`function`?i():i;a.start(r??0,()=>{e.setOpen(!0,yf(rf,n))})},onBlur(t){o.current=!1;let{relatedTarget:n,nativeEvent:i}=t;a.start(0,()=>{let t=e.select(`domReferenceElement`),a=Wp(t?t.ownerDocument:document);!n&&a===t||Gp(r.current.floatingContext?.refs.floating.current,a)||Gp(t,a)||e.setOpen(!1,yf(rf,i))})}}),[i,e,r,a]);return T.useMemo(()=>({reference:s}),[s])}function VX(e){let{open:t,defaultOpen:n,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a}=e,o=T.useRef(600),s=T.useRef(300),c=X(e=>{o.current=e.delay??600,s.current=e.closeDelay??300}),[l,u]=T.useState(null),[d,f]=T.useState(null),[p,m]=T.useState(),h=T.useRef(null),[g,_]=lu({controlled:t,default:n,name:`PreviewCard`,state:`open`}),v=X(r),{mounted:y,setMounted:b,transitionStatus:x}=Ff(g),S=X(()=>{b(!1),i?.(!1)});Pf({enabled:!a,open:g,ref:h,onComplete(){g||S()}}),T.useImperativeHandle(a,()=>({unmount:S}),[S]);let C=X((e,t)=>{let n=t.reason===nf,r=e&&t.reason===`trigger-focus`,i=!e&&(t.reason===`trigger-press`||t.reason===`escape-key`);if(v(e,t),t.isCanceled)return;function a(){_(e)}n?Kd.flushSync(a):a(),r||i?m(r?`focus`:`dismiss`):t.reason===`trigger-hover`&&m(void 0)}),w=Dv({elements:{reference:l,floating:d},open:g,onOpenChange:C}),E=p,D=()=>o.current,O=()=>s.current,{getReferenceProps:k,getFloatingProps:A}=Hv([qh(w,{mouseOnly:!0,move:!1,handleClose:ry(),restMs:D,delay:()=>({close:O()})}),BX(w,{delay:D}),R_(w)]),j=T.useMemo(()=>({open:g,setOpen:C,mounted:y,setMounted:b,setTriggerElement:u,positionerElement:d,setPositionerElement:f,popupRef:h,triggerProps:k(),popupProps:A(),floatingRootContext:w,instantType:E,transitionStatus:x,onOpenChangeComplete:i,writeDelayRefs:c}),[g,C,y,b,d,k,A,w,E,x,i,c]);return(0,J.jsx)(RX.Provider,{value:j,children:e.children})}var HX=T.createContext(void 0);function UX(){let e=T.useContext(HX);if(e===void 0)throw Error(Ou(48));return e}var WX=T.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{mounted:i}=zX();return i||n?(0,J.jsx)(HX.Provider,{value:n,children:(0,J.jsx)(hx,{ref:t,...r})}):null}),GX=T.forwardRef(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,...o}=e,{open:s,triggerProps:c,setTriggerElement:l,writeDelayRefs:u}=zX();Z(()=>{u({delay:i,closeDelay:a})});let d=T.useMemo(()=>({open:s}),[s]);return $u(`a`,e,{ref:[l,t],state:d,props:[c,o],stateAttributesMapping:ep})}),KX=T.createContext(void 0);function qX(){let e=T.useContext(KX);if(e===void 0)throw Error(Ou(49));return e}var JX=T.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Zu,...g}=e,{open:_,mounted:v,floatingRootContext:y,setPositionerElement:b}=zX(),x=Ay({anchor:i,floatingRootContext:y,positionMethod:a,mounted:v,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:UX(),collisionAvoidance:h}),S=T.useMemo(()=>{let e={};return _||(e.pointerEvents=`none`),{role:`presentation`,hidden:!v,style:{...x.positionerStyles,...e}}},[_,v,x.positionerStyles]),C=T.useMemo(()=>({open:_,side:x.side,align:x.align,anchorHidden:x.anchorHidden}),[_,x.side,x.align,x.anchorHidden]),w=T.useMemo(()=>({side:x.side,align:x.align,arrowRef:x.arrowRef,arrowUncentered:x.arrowUncentered,arrowStyles:x.arrowStyles}),[x.side,x.align,x.arrowRef,x.arrowUncentered,x.arrowStyles]),E=$u(`div`,e,{state:C,ref:[b,t],props:[S,g],stateAttributesMapping:np});return(0,J.jsx)(KX.Provider,{value:w,children:E})}),YX={...np,...zf},XX=T.forwardRef(function(e,t){let{className:n,render:r,...i}=e,{open:a,transitionStatus:o,popupRef:s,onOpenChangeComplete:c,popupProps:l}=zX(),{side:u,align:d}=qX();Pf({open:a,ref:s,onComplete(){a&&c?.(!0)}});let f=T.useMemo(()=>({open:a,side:u,align:d,transitionStatus:o}),[a,u,d,o]);return $u(`div`,e,{ref:[s,t],state:f,props:[l,my(o),i],stateAttributesMapping:YX})});function ZX(){return(0,J.jsx)(`p`,{className:`px-2 py-1 text-[10px] italic text-muted-foreground`,children:`Cut here. The rest is in the worktree.`})}function QX(){return(0,J.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`Binary file, nothing to show.`})}function $X({added:e,removed:t,className:n}){return(0,J.jsxs)(`span`,{className:q(`shrink-0 font-mono text-[10px] tabular-nums`,n),children:[e>0&&(0,J.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),e>0&&t>0&&` `,t>0&&(0,J.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function eZ(e){return e.startsWith(`+++`)||e.startsWith(`---`)?`text-muted-foreground`:e.startsWith(`@@`)?`text-primary`:e.startsWith(`+`)?`bg-success/10 text-success`:e.startsWith(`-`)?`bg-danger/10 text-danger`:`text-muted-foreground`}function tZ({diff:e,className:t}){return e.binary?(0,J.jsx)(QX,{}):(0,J.jsxs)(`div`,{className:q(`overflow-auto font-mono text-[11px] leading-[1.45]`,t),children:[e.patch.split(`
`).map((e,t)=>(0,J.jsx)(`div`,{className:q(`whitespace-pre px-2`,eZ(e)),children:e||` `},t)),e.truncated&&(0,J.jsx)(ZX,{})]})}function nZ({content:e,className:t}){if(e.binary)return(0,J.jsx)(QX,{});if(!e.text)return(0,J.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`Empty file.`});let n=e.text.split(`
`),r=`${String(n.length).length+1}ch`;return(0,J.jsxs)(`div`,{className:q(`overflow-auto font-mono text-[11px] leading-[1.45]`,t),children:[n.map((e,t)=>(0,J.jsxs)(`div`,{className:`flex whitespace-pre px-2 text-foreground`,children:[(0,J.jsx)(`span`,{className:`shrink-0 select-none pr-3 text-right tabular-nums text-muted-foreground/60`,style:{width:r},children:t+1}),(0,J.jsx)(`span`,{children:e||` `})]},t)),e.truncated&&(0,J.jsx)(ZX,{})]})}function rZ(e){return`patch`in e}function iZ({projectId:e,runId:t,path:n,changed:r=!0}){let{value:i,loaded:a}=rC(()=>r?aa(e,n,t??void 0):sa(e,n,t??void 0),null,5e3,[e,t,n,r]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border px-2 py-1.5`,children:[(0,J.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:n}),i&&rZ(i)&&(0,J.jsx)($X,{added:i.added,removed:i.removed,className:`ml-auto`})]}),a?i?rZ(i)?(0,J.jsx)(tZ,{diff:i,className:`py-1`}):(0,J.jsx)(nZ,{content:i,className:`py-1`}):(0,J.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:r?`No change to show.`:`Nothing to show.`}):(0,J.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:r?`Reading the diff…`:`Reading the file…`})]})}function aZ({projectId:e,runId:t,path:n,changed:r=!0,children:i}){return(0,J.jsxs)(VX,{children:[(0,J.jsx)(GX,{delay:350,closeDelay:150,render:(0,J.jsx)(`div`,{className:`pointer-events-auto`}),children:i}),(0,J.jsx)(WX,{children:(0,J.jsx)(JX,{side:`left`,align:`start`,sideOffset:8,children:(0,J.jsx)(XX,{className:`z-50 flex max-h-[70vh] w-[42rem] max-w-[80vw] flex-col overflow-hidden rounded-md border border-border bg-card text-card-foreground shadow-lg`,children:(0,J.jsx)(iZ,{projectId:e,runId:t,path:n,changed:r})})})})]})}var oZ=[],sZ={untracked:`new`,modified:`modified`,deleted:`deleted`},cZ={untracked:`text-success`,modified:`text-warning`,deleted:`text-danger`};function lZ({projectId:e,runId:t,change:n}){let[r,i]=(0,T.useState)(!1),a=n.path.slice(0,n.path.lastIndexOf(`/`)+1),o=n.path.slice(n.path.lastIndexOf(`/`)+1);return(0,J.jsxs)(`li`,{className:`border-t border-border first:border-t-0`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-accent`,children:[(0,J.jsx)(Ua,{className:q(`size-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:a}),(0,J.jsx)(`span`,{className:q(n.status===`deleted`&&`line-through`),children:o})]}),(0,J.jsx)(`span`,{className:q(`shrink-0 text-[10px] uppercase tracking-wide`,cZ[n.status]),children:sZ[n.status]}),!n.binary&&(0,J.jsx)($X,{added:n.added,removed:n.removed})]}),r&&(0,J.jsx)(`div`,{className:`border-t border-border bg-muted/30`,children:(0,J.jsx)(iZ,{projectId:e,runId:t,path:n.path})})]})}function uZ({count:e,added:t,removed:n}){return e===0?null:(0,J.jsxs)(`span`,{className:`flex items-center gap-x-2 text-muted-foreground`,children:[(0,J.jsxs)(`span`,{children:[e,` `,e===1?`file`:`files`]}),(0,J.jsx)($X,{added:t,removed:n,className:`text-xs`})]})}function dZ({projectId:e,runId:t,open:n=!0,onSummary:r}){let{value:i}=rC(()=>oa(e,t),oZ,8e3,[e,t]),a=i.reduce((e,t)=>e+t.added,0),o=i.reduce((e,t)=>e+t.removed,0),s=(0,T.useRef)(r);return s.current=r,(0,T.useEffect)(()=>s.current?.(i.length,a,o),[i.length,a,o]),i.length===0||!n?null:(0,J.jsx)(`section`,{className:`border-b border-border`,"aria-label":`Changed files`,children:(0,J.jsx)(`ul`,{className:`max-h-80 overflow-auto`,children:i.map(n=>(0,J.jsx)(lZ,{projectId:e,runId:t,change:n},n.path))})})}var fZ=6,pZ=10;function mZ(e){return!!(e&&e.exists&&(!e.empty||e.pendingFiles?.length))}function hZ({handoff:e}){if(!e)return null;if(!e.exists)return(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`branch gone`});if(e.empty)return(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`no changes`});let t=`${e.commits.length} commit${e.commits.length===1?``:`s`}`,n=`${e.files.length} file${e.files.length===1?``:`s`}`;return(0,J.jsxs)(`span`,{className:`flex items-center gap-x-2 whitespace-nowrap text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:t}),(0,J.jsx)(`span`,{children:`·`}),(0,J.jsx)(`span`,{children:n}),(0,J.jsx)($X,{added:e.insertions,removed:e.deletions,className:`text-xs`}),e.pushed&&!e.pr&&(0,J.jsx)(`span`,{children:`· pushed`}),e.merged&&(0,J.jsx)(`span`,{children:`· merged`})]})}function gZ({projectId:e,runId:t,state:n}){let[r,i]=(0,T.useState)(!1),[a,o]=(0,T.useState)(null),s=a??n;(0,T.useEffect)(()=>{a&&a.push===n.push&&a.pr===n.pr&&o(null)},[a,n.push,n.pr]);let c=n=>{o(n),i(!0),aT(e,t,n.push,n.pr).catch(()=>o(null)).finally(()=>i(!1))},l=s.push&&!s.pr,u=n.merge&&!l;return(0,J.jsx)(`div`,{className:`flex items-center gap-x-3 whitespace-nowrap text-xs text-muted-foreground`,children:(0,J.jsx)(_Z,{label:l?`Push branch`:u?`Open PR & merge`:`Open PR`,title:l?`Push this session's branch to origin when it finishes. Set to push only, so no pull request is opened.`:u?`Open a pull request when this session finishes and merge it once it is open, pushing the branch on the way.`:`Open a draft pull request when this session finishes, pushing the branch on the way.`,checked:s.pr||l,disabled:r,onChange:e=>c(e?{push:!0,pr:!0}:{push:!1,pr:!1})})})}function _Z({label:e,title:t,checked:n,disabled:r,onChange:i}){return(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(`label`,{className:`flex cursor-pointer items-center gap-x-1.5 select-none`}),children:[(0,J.jsx)(Vf,{checked:n,disabled:r,onCheckedChange:e=>i(e===!0)}),e]}),(0,J.jsx)(kx,{className:`max-w-[22rem]`,children:t})]})}function vZ({projectId:e,runId:t,state:n}){let{handoff:r,busy:i,pending:a,act:o}=n;if(!r||r.prPending)return null;if(r.pr)return r.pr.state!==`OPEN`||r.merged?null:(0,J.jsxs)(Y,{size:`xs`,disabled:i,onClick:()=>o(`merge`,()=>gT(e,t),`Could not merge the pull request.`),children:[(0,J.jsx)(ao,{className:`h-3.5 w-3.5`}),a===`merge`?`Merging…`:`Merge PR`]});if(!r.exists)return(0,J.jsx)(bZ,{children:`Branch gone — nothing to open a PR from.`});if(r.empty){let e=r.pendingFiles??[];return e.length===0?(0,J.jsx)(bZ,{children:`Nothing committed — no PR to open.`}):(0,J.jsxs)(bZ,{title:e.join(`
`),children:[`Nothing committed — `,yZ(e),` left uncommitted.`]})}return r.hasRemote?(0,J.jsxs)(Y,{size:`xs`,disabled:i,onClick:()=>o(`pr`,()=>hT(e,t),`Could not open the pull request.`),children:[(0,J.jsx)(oo,{className:`h-3.5 w-3.5`}),a===`pr`?`Opening PR…`:`Open PR`]}):(0,J.jsx)(bZ,{children:`No remote to push to.`})}function yZ(e){let t=e.slice(0,2).join(`, `),n=e.length-Math.min(e.length,2);return n>0?`${t} and ${n} more`:t}function bZ({children:e,title:t}){return(0,J.jsx)(`span`,{className:`inline-block max-w-[24rem] truncate align-middle text-xs text-muted-foreground`,...t?{title:t}:{},children:e})}function xZ({handoff:e}){if(!mZ(e)||!e)return null;let t=e.pendingFiles??[],n=[e.commits.length>0,e.files.length>0,t.length>0].filter(Boolean).length;return(0,J.jsxs)(`section`,{className:q(`grid gap-3 border-b border-border px-4 py-3 text-xs`,n>1&&`sm:grid-cols-2`),"aria-label":`Session handoff`,children:[e.commits.length>0&&(0,J.jsx)(SZ,{handoff:e}),e.files.length>0&&(0,J.jsx)(wZ,{handoff:e}),t.length>0&&(0,J.jsx)(CZ,{paths:t})]})}function SZ({handoff:e}){let t=e.commits.slice(0,fZ),n=e.commits.length-t.length;return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`mb-1.5 text-muted-foreground`,children:`Commits`}),(0,J.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,J.jsxs)(`li`,{className:`flex gap-2`,children:[(0,J.jsx)(`code`,{className:`shrink-0 text-muted-foreground`,children:e.short}),(0,J.jsx)(`span`,{className:`truncate`,title:e.subject,children:e.subject})]},e.sha))}),n>0&&(0,J.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`and `,n,` more`]})]})}function CZ({paths:e}){let t=e.slice(0,pZ),n=e.length-t.length;return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`mb-1.5 text-muted-foreground`,children:`Uncommitted files`}),(0,J.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,J.jsx)(`li`,{className:`truncate`,title:e,children:e},e))}),n>0&&(0,J.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`and `,n,` more`]})]})}function wZ({handoff:e}){let t=e.files.slice(0,pZ),n=e.files.length-t.length;return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`mb-1.5 text-muted-foreground`,children:`Changed files`}),(0,J.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate`,title:e.path,children:e.path}),(0,J.jsx)(`span`,{className:`ml-auto shrink-0 text-muted-foreground`,children:e.binary?`binary`:(0,J.jsx)($X,{added:e.insertions,removed:e.deletions,className:`text-xs`})})]},e.path))}),n>0&&(0,J.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`and `,n,` more`]})]})}function TZ(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.kind===`usage`)return n}}function EZ(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function DZ({label:e,value:t}){return(0,J.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground/70`,children:e}),(0,J.jsx)(`span`,{className:`tabular-nums text-foreground`,children:t})]})}function OZ({events:e}){let t=ns(e),n=Ro(t?.driver),r=n?Lo[n]:t?.driver??`Agent`,i=TZ(e);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border-b border-border px-4 py-2 text-xs`,children:[(0,J.jsx)(DZ,{label:`Agent`,value:r}),t?.model&&(0,J.jsx)(DZ,{label:`Model`,value:t.model}),i?(0,J.jsxs)(J.Fragment,{children:[i.costUsd!==void 0&&(0,J.jsx)(DZ,{label:`Spent`,value:`$${i.costUsd.toFixed(2)}`}),(0,J.jsx)(DZ,{label:`Tokens`,value:`${EZ(i.inputTokens)} in / ${EZ(i.outputTokens)} out`}),(i.cacheReadTokens>0||i.cacheCreationTokens>0)&&(0,J.jsx)(DZ,{label:`Cache`,value:`${EZ(i.cacheReadTokens)} read / ${EZ(i.cacheCreationTokens)} write`}),(0,J.jsx)(DZ,{label:`Turns`,value:String(i.turns)})]}):(0,J.jsx)(`span`,{className:`text-muted-foreground/70`,children:`No spend reported yet`})]})}function kZ({projectId:e,runId:t,events:n,live:r,label:i,projectName:a,target:o,remoteLabel:s,files:c,addContext:l,removeContext:u,lost:d=!1,armedDefault:f,onRunStarted:p,onDeleted:m,onLoopStatus:h}){let[g,_]=(0,T.useState)(0),v=nC(!r&&t?()=>Wi(e,t):null,null,[e,t,r,g]),y=nC(!r&&t?()=>fa(e):null,[],[e,t,r]),[b,x]=(0,T.useState)(!1),S=(0,T.useCallback)(()=>x(!0),[]),C=!r&&!b&&t!=null&&y.includes(t),w=r&&!Nl(n),E=VJ(e,t??null,!w),[D,O]=(0,T.useState)({count:0,added:0,removed:0}),[k,A]=(0,T.useState)(!1),j=(0,T.useCallback)((e,t,n)=>{O(r=>r.count===e&&r.added===t&&r.removed===n?r:{count:e,added:t,removed:n})},[]),M=(0,T.useCallback)(()=>A(e=>!e),[]),N=(!v?.length||n.length===0||JSON.stringify(n[0])===JSON.stringify(v[0]))&&n.length>(v?.length??0),P=r?n:v?.length&&!N?v:n;(0,T.useEffect)(()=>{!r&&v!==null&&N&&_(n.length)},[r,v,N,n.length]);let F=r||N&&Ml(n),I=ns(P),L=es(P),R=r?void 0:Pl(P),z=ts(P,f),B=Qo(P);(0,T.useEffect)(()=>{h?.(B)},[B?[B.pass,B.passing,B.productionGrade,B.finished,...B.blockers].join(`\0`):``,h]),(0,T.useEffect)(()=>()=>h?.(null),[h]);let ee=!w&&E.loaded;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(KJ,{projectId:e,runId:t,events:P,label:i??L.sessionName,projectName:a,retainedWorktree:C,onWorktreeRemoved:S,onDeleted:m,summary:ee?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(hZ,{handoff:E.handoff}),z.result?.outcome===`failed`&&(0,J.jsxs)(`span`,{className:`text-danger`,children:[`auto-handoff failed: `,z.result.error]}),E.error&&(0,J.jsx)(`span`,{className:`text-danger`,children:E.error})]}):(0,J.jsx)(uZ,{...D}),expanded:k,onToggle:M,actions:t?w?(0,J.jsx)(gZ,{projectId:e,runId:t,state:z}):(0,J.jsx)(vZ,{projectId:e,runId:t,state:E}):void 0}),k&&(0,J.jsx)(OZ,{events:P}),w&&t&&(0,J.jsx)(dZ,{projectId:e,runId:t,open:k,onSummary:j}),!w&&k&&(0,J.jsx)(xZ,{handoff:E.handoff}),(0,J.jsx)(EX,{target:o,events:P,live:r}),(0,J.jsx)(OX,{target:o,events:P}),(0,J.jsx)(LX,{device:s}),!r&&v===null&&P.length===0?(0,J.jsx)(`div`,{className:`grid flex-1 place-items-center text-sm text-muted-foreground`,children:`Loading session…`}):(0,J.jsx)(TX,{events:P,projectId:e,runId:t,showSessionLink:!1,showName:!1,showStatus:!1,showLoop:!1,lost:d,...F?{}:{stick:!1,openAt:`end`,emptyLabel:`This session has no events.`},tail:(0,J.jsx)(NX,{target:o,events:P})}),(0,J.jsx)(JJ,{projectId:e,runId:t,live:F,sessionId:I?.sessionId,driver:I?.driver,files:c,addContext:l,removeContext:u,sessionName:L.sessionName,onRunStarted:p,outcome:R})]})}function AZ({views:e}){let[t,n]=(0,T.useState)(0),r=(0,T.useRef)(new Set);(0,T.useEffect)(()=>{let t=e.findIndex(e=>!r.current.has(e.id));for(let t of e)r.current.add(t.id);t>=0&&n(t)},[e]);let i=e[Math.min(t,e.length-1)],a=(0,T.useRef)(null);return i?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col`,children:[e.length>1&&(0,J.jsx)(`nav`,{className:`sticky top-0 z-10 flex flex-wrap gap-1 border-b border-border bg-background/95 p-2 backdrop-blur`,children:e.map((e,r)=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>n(r),title:e.title,className:q(`max-w-[10rem] truncate rounded px-2 py-0.5 text-xs`,r===t?`bg-accent text-accent-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),children:e.title},e.id))}),(0,J.jsx)(Bb,{viewportRef:a,className:`min-h-0 flex-auto`,children:(0,J.jsxs)(`div`,{className:`p-4`,children:[(0,J.jsxs)(`h2`,{className:`mb-2 flex items-center gap-1.5 text-sm font-semibold`,children:[i.title,(0,J.jsx)(RK,{text:i.markdown,label:`Copy this view as markdown`})]}),(0,J.jsx)(xG,{text:i.markdown})]})})]}):(0,J.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:`No views yet.`})}var jZ=(0,T.createContext)({});function MZ(e){let t=(0,T.useRef)(null);return t.current===null&&(t.current=e()),t.current}var NZ=typeof window<`u`?T.useLayoutEffect:T.useEffect,PZ=(0,T.createContext)(null);function FZ(e,t){e.indexOf(t)===-1&&e.push(t)}function IZ(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var LZ=(e,t,n)=>n>t?t:n<e?e:n,RZ={},zZ=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),BZ=e=>typeof e==`object`&&!!e,VZ=e=>/^0[^.\s]+$/u.test(e);function HZ(e){let t;return()=>(t===void 0&&(t=e()),t)}var UZ=e=>e,WZ=(...e)=>e.reduce((e,t)=>n=>t(e(n))),GZ=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},KZ=class{constructor(){this.subscriptions=[]}add(e){return FZ(this.subscriptions,e),()=>IZ(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},qZ=e=>e*1e3,JZ=e=>e/1e3,YZ=(e,t)=>t?1e3/t*e:0,XZ=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,ZZ=1e-7,QZ=12;function $Z(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=XZ(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>ZZ&&++s<QZ);return o}function eQ(e,t,n,r){if(e===t&&n===r)return UZ;let i=t=>$Z(t,0,1,e,n);return e=>e===0||e===1?e:XZ(i(e),t,r)}var tQ=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,nQ=e=>t=>1-e(1-t),rQ=eQ(.33,1.53,.69,.99),iQ=nQ(rQ),aQ=tQ(iQ),oQ=e=>e>=1?1:(e*=2)<1?.5*iQ(e):.5*(2-2**(-10*(e-1))),sQ=e=>1-Math.sin(Math.acos(e)),cQ=nQ(sQ),lQ=tQ(sQ),uQ=eQ(.42,0,1,1),dQ=eQ(0,0,.58,1),fQ=eQ(.42,0,.58,1),pQ=e=>Array.isArray(e)&&typeof e[0]!=`number`,mQ=e=>Array.isArray(e)&&typeof e[0]==`number`,hQ={linear:UZ,easeIn:uQ,easeInOut:fQ,easeOut:dQ,circIn:sQ,circInOut:lQ,circOut:cQ,backIn:iQ,backInOut:aQ,backOut:rQ,anticipate:oQ},gQ=e=>typeof e==`string`,_Q=e=>{if(mQ(e)){e.length;let[t,n,r,i]=e;return eQ(t,n,r,i)}else if(gQ(e))return hQ[e],`${e}`,hQ[e];return e},vQ=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function yQ(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var bQ=40;function xQ(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=vQ.reduce((e,t)=>(e[t]=yQ(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=RZ.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,bQ),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:vQ.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<vQ.length;t++)o[vQ[t]].cancel(e)},state:i,steps:o}}var{schedule:SQ,cancel:CQ,state:wQ,steps:TQ}=xQ(typeof requestAnimationFrame<`u`?requestAnimationFrame:UZ,!0),EQ;function DQ(){EQ=void 0}var OQ={now:()=>(EQ===void 0&&OQ.set(wQ.isProcessing||RZ.useManualTiming?wQ.timestamp:performance.now()),EQ),set:e=>{EQ=e,queueMicrotask(DQ)}},kQ=e=>t=>typeof t==`string`&&t.startsWith(e),AQ=kQ(`--`),jQ=kQ(`var(--`),MQ=e=>jQ(e)?NQ.test(e.split(`/*`)[0].trim()):!1,NQ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function PQ(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var FQ={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},IQ={...FQ,transform:e=>LZ(0,1,e)},LQ={...FQ,default:1},RQ=e=>Math.round(e*1e5)/1e5,zQ=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function BQ(e){return e==null}var VQ=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,HQ=(e,t)=>n=>!!(typeof n==`string`&&VQ.test(n)&&n.startsWith(e)||t&&!BQ(n)&&Object.prototype.hasOwnProperty.call(n,t)),UQ=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(zQ);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},WQ=e=>LZ(0,255,e),GQ={...FQ,transform:e=>Math.round(WQ(e))},KQ={test:HQ(`rgb`,`red`),parse:UQ(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+GQ.transform(e)+`, `+GQ.transform(t)+`, `+GQ.transform(n)+`, `+RQ(IQ.transform(r))+`)`};function qQ(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var JQ={test:HQ(`#`),parse:qQ,transform:KQ.transform},YQ=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),XQ=YQ(`deg`),ZQ=YQ(`%`),QQ=YQ(`px`),$Q=YQ(`vh`),e$=YQ(`vw`),t$={...ZQ,parse:e=>ZQ.parse(e)/100,transform:e=>ZQ.transform(e*100)},n$={test:HQ(`hsl`,`hue`),parse:UQ(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+ZQ.transform(RQ(t))+`, `+ZQ.transform(RQ(n))+`, `+RQ(IQ.transform(r))+`)`},r$={test:e=>KQ.test(e)||JQ.test(e)||n$.test(e),parse:e=>KQ.test(e)?KQ.parse(e):n$.test(e)?n$.parse(e):JQ.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?KQ.transform(e):n$.transform(e),getAnimatableNone:e=>{let t=r$.parse(e);return t.alpha=0,r$.transform(t)}},i$=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function a$(e){return isNaN(e)&&typeof e==`string`&&(e.match(zQ)?.length||0)+(e.match(i$)?.length||0)>0}var o$=`number`,s$=`color`,c$=`var`,l$=`var(`,u$="${}",d$=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function f$(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(d$,e=>(r$.test(e)?(r.color.push(a),i.push(s$),n.push(r$.parse(e))):e.startsWith(l$)?(r.var.push(a),i.push(c$),n.push(e)):(r.number.push(a),i.push(o$),n.push(parseFloat(e))),++a,u$)).split(u$),indexes:r,types:i}}function p$(e){return f$(e).values}function m$({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===o$?i+=RQ(r[a]):e===s$?i+=r$.transform(r[a]):i+=r[a]}return i}}function h$(e){return m$(f$(e))}var g$=e=>typeof e==`number`?0:r$.test(e)?r$.getAnimatableNone(e):e,_$=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:g$(e);function v$(e){let t=f$(e);return m$(t)(t.values.map((e,n)=>_$(e,t.split[n])))}var y$={test:a$,parse:p$,createTransformer:h$,getAnimatableNone:v$};function b$(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function x$({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=b$(s,r,e+1/3),a=b$(s,r,e),o=b$(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function S$(e,t){return n=>n>0?t:e}var C$=(e,t,n)=>e+(t-e)*n,w$=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},T$=[JQ,KQ,n$],E$=e=>T$.find(t=>t.test(e));function D$(e){let t=E$(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===n$&&(n=x$(n)),n}var O$=(e,t)=>{let n=D$(e),r=D$(t);if(!n||!r)return S$(e,t);let i={...n};return e=>(i.red=w$(n.red,r.red,e),i.green=w$(n.green,r.green,e),i.blue=w$(n.blue,r.blue,e),i.alpha=C$(n.alpha,r.alpha,e),KQ.transform(i))},k$=new Set([`none`,`hidden`]);function A$(e,t){return k$.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function j$(e,t){return n=>C$(e,t,n)}function M$(e){return typeof e==`number`?j$:typeof e==`string`?MQ(e)?S$:r$.test(e)?O$:I$:Array.isArray(e)?N$:typeof e==`object`?r$.test(e)?O$:P$:S$}function N$(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>M$(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function P$(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=M$(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function F$(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var I$=(e,t)=>{let n=y$.createTransformer(t),r=f$(e),i=f$(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?k$.has(e)&&!i.values.length||k$.has(t)&&!r.values.length?A$(e,t):WZ(N$(F$(r,i),i.values),n):(`${e}${t}`,S$(e,t))};function L$(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?C$(e,t,n):M$(e)(e,t)}var R$=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>SQ.update(t,e),stop:()=>CQ(t),now:()=>wQ.isProcessing?wQ.timestamp:OQ.now()}},z$=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},B$=2e4;function V$(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function H$(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(V$(r),B$);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:JZ(i)}}var U$={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function W$(e,t){return e*Math.sqrt(1-t*t)}var G$=12;function K$(e,t,n){let r=n;for(let n=1;n<G$;n++)r-=e(r)/t(r);return r}var q$=.001;function J$({duration:e=U$.duration,bounce:t=U$.bounce,velocity:n=U$.velocity,mass:r=U$.mass}){let i,a;U$.maxDuration;let o=1-t;o=LZ(U$.minDamping,U$.maxDamping,o),e=LZ(U$.minDuration,U$.maxDuration,JZ(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=W$(t,o),c=Math.exp(-i);return q$-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=W$(t**2,o);return(-i(t)+q$>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=K$(i,a,s);if(e=qZ(e),isNaN(c))return{stiffness:U$.stiffness,damping:U$.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Y$=[`duration`,`bounce`],X$=[`stiffness`,`damping`,`mass`];function Z$(e,t){return t.some(t=>e[t]!==void 0)}function Q$(e){let t={velocity:U$.velocity,stiffness:U$.stiffness,damping:U$.damping,mass:U$.mass,isResolvedFromDuration:!1,...e};if(!Z$(e,X$)&&Z$(e,Y$))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*LZ(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:U$.mass,stiffness:i,damping:a}}else{let n=J$({...e,velocity:0});t={...t,...n,mass:U$.mass},t.isResolvedFromDuration=!0}return t}function $$(e=U$.visualDuration,t=U$.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Q$({...n,velocity:-JZ(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=JZ(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?U$.restSpeed.granular:U$.restSpeed.default,i||=v?U$.restDelta.granular:U$.restDelta.default;let y,b,x,S,C,w;if(h<1)x=W$(_,h),S=(m+h*_*g)/x,y=e=>{let t=Math.exp(-h*_*e);return o-t*(S*Math.sin(x*e)+g*Math.cos(x*e))},C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>qZ(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=qZ(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=qZ(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(V$(T),B$),t=z$(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}$$.applyToOptions=e=>{let t=H$(e,100,$$);return e.ease=t.ease,e.duration=qZ(t.duration),e.type=`keyframes`,e};var e1=5;function t1(e,t,n){let r=Math.max(t-e1,0);return YZ(n-e(r),t-r)}function n1({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=$$({keyframes:[f.value,m(f.value)],velocity:t1(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function r1(e,t,n){let r=[],i=n||RZ.mix||L$,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=WZ(Array.isArray(t)?t[n]||UZ:t,a)),r.push(a)}return r}function i1(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=r1(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=GZ(e[r],e[r+1],n);return s[r](i)};return n?t=>l(LZ(e[0],e[a-1],t)):l}function a1(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=GZ(0,t,r);e.push(C$(n,1,i))}}function o1(e){let t=[0];return a1(t,e.length-1),t}function s1(e,t){return e.map(e=>e*t)}function c1(e,t){return e.map(()=>t||fQ).splice(0,e.length-1)}function l1({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=pQ(r)?r.map(_Q):_Q(r),a={done:!1,value:t[0]},o=i1(s1(n&&n.length===t.length?n:o1(t),e),t,{ease:Array.isArray(i)?i:c1(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var u1=e=>e!==null;function d1(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(u1),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var f1={decay:n1,inertia:n1,tween:l1,keyframes:l1,spring:$$};function p1(e){typeof e.type==`string`&&(e.type=f1[e.type])}var m1=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},h1=e=>e/100,g1=class extends m1{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==OQ.now()&&this.tick(OQ.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;p1(e);let{type:t=l1,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||l1;s!==l1&&typeof o[0]!=`number`&&(this.mixKeyframes=WZ(h1,L$(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=V$(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=LZ(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==n1&&(b.value=d1(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return JZ(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+JZ(e)}get time(){return JZ(this.currentTime)}set time(e){e=qZ(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return t1(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(OQ.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=JZ(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=R$,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(OQ.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function _1(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var v1=e=>e*180/Math.PI,y1=e=>x1(v1(Math.atan2(e[1],e[0]))),b1={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:y1,rotateZ:y1,skewX:e=>v1(Math.atan(e[1])),skewY:e=>v1(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},x1=e=>(e%=360,e<0&&(e+=360),e),S1=y1,C1=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),w1=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),T1={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:C1,scaleY:w1,scale:e=>(C1(e)+w1(e))/2,rotateX:e=>x1(v1(Math.atan2(e[6],e[5]))),rotateY:e=>x1(v1(Math.atan2(-e[2],e[0]))),rotateZ:S1,rotate:S1,skewX:e=>v1(Math.atan(e[4])),skewY:e=>v1(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function E1(e){return+!!e.includes(`scale`)}function D1(e,t){if(!e||e===`none`)return E1(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=T1,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=b1,i=t}if(!i)return E1(t);let a=r[t],o=i[1].split(`,`).map(k1);return typeof a==`function`?a(o):o[a]}var O1=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return D1(n,t)};function k1(e){return parseFloat(e.trim())}var A1=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],j1=new Set([...A1,`pathRotation`]),M1=e=>e===FQ||e===QQ,N1=new Set([`x`,`y`,`z`]),P1=A1.filter(e=>!N1.has(e));function F1(e){let t=[];return P1.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var I1={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>D1(t,`x`),y:(e,{transform:t})=>D1(t,`y`)};I1.translateX=I1.x,I1.translateY=I1.y;var L1=new Set,R1=!1,z1=!1,B1=!1;function V1(){if(z1){let e=Array.from(L1).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=F1(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}z1=!1,R1=!1,L1.forEach(e=>e.complete(B1)),L1.clear()}function H1(){L1.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(z1=!0)})}function U1(){B1=!0,H1(),V1(),B1=!1}var W1=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(L1.add(this),R1||(R1=!0,SQ.read(H1),SQ.resolveKeyframes(V1))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}_1(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),L1.delete(this)}cancel(){this.state===`scheduled`&&(L1.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},G1=e=>e.startsWith(`--`);function K1(e,t,n){G1(t)?e.style.setProperty(t,n):e.style[t]=n}var q1={};function J1(e,t){let n=HZ(e);return()=>q1[t]??n()}var Y1=J1(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),X1=J1(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Z1=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Q1={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Z1([0,.65,.55,1]),circOut:Z1([.55,0,1,.45]),backIn:Z1([.31,.01,.66,-.59]),backOut:Z1([.33,1.53,.69,.99])};function $1(e,t){if(e)return typeof e==`function`?X1()?z$(e,t):`ease-out`:mQ(e)?Z1(e):Array.isArray(e)?e.map(e=>$1(e,t)||Q1.easeOut):Q1[e]}function e0(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=$1(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function t0(e){return typeof e==`function`&&`applyToOptions`in e}function n0({type:e,...t}){return t0(e)&&X1()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var r0=class extends m1{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=n0(e);this.animation=e0(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=d1(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),K1(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return JZ(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+JZ(e)}get time(){return JZ(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=qZ(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Y1()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),UZ):r(this)}},i0={anticipate:oQ,backInOut:aQ,circInOut:lQ};function a0(e){return e in i0}function o0(e){typeof e.ease==`string`&&a0(e.ease)&&(e.ease=i0[e.ease])}var s0=10,c0=class extends r0{constructor(e){o0(e),p1(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new g1({...a,autoplay:!1}),s=Math.max(s0,OQ.now()-this.startTime),c=LZ(0,s0,s-s0),l=o.sample(s).value,{name:u}=this.options;i&&u&&K1(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},l0=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(y$.test(e)||e===`0`)&&!e.startsWith(`url(`));function u0(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function d0(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=l0(i,t),s=l0(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:u0(e)||(n===`spring`||t0(n))&&r}function f0(e){e.duration=0,e.type=`keyframes`}var p0=new Set([`opacity`,`clipPath`,`filter`,`transform`]),m0=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function h0(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&m0.test(e[t]))return!0;return!1}var g0=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),_0=HZ(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function v0(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return _0()&&n&&(p0.has(n)||g0.has(n)&&h0(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var y0=40,b0=class extends m1{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=OQ.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||W1;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=OQ.now();let u=!0;d0(e,i,a,o)||(u=!1,(RZ.instantAnimations||!s)&&l?.(d1(e,n,t)),e[0]=e[e.length-1],f0(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>y0?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&v0(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new c0({...d,element:p})}catch{m=new g1(d)}else m=new g1(d);m.finished.then(()=>{this.notifyFinished()}).catch(UZ),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),U1()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function x0(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var S0=30,C0=e=>!isNaN(parseFloat(e)),w0={current:void 0},T0=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=OQ.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=OQ.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=C0(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new KZ);let n=this.events[e].add(t);return e===`change`?()=>{n(),SQ.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return w0.current&&w0.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=OQ.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>S0)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,S0);return YZ(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function E0(e,t){return new T0(e,t)}function D0(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function O0(e,t){let n=e?.[t]??e?.default??e;return n===e?n:D0(n,e)}var k0={type:`spring`,stiffness:500,damping:25,restSpeed:10},A0=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),j0={type:`keyframes`,duration:.8},M0={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},N0=(e,{keyframes:t})=>t.length>2?j0:j1.has(e)?e.startsWith(`scale`)?A0(t[1]):k0:M0,P0=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function F0(e){for(let t in e)if(!P0.has(t))return!0;return!1}var I0=(e,t,n,r={},i,a)=>o=>{let s=O0(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=qZ(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};F0(s)||Object.assign(u,N0(e,u)),u.duration&&=qZ(u.duration),u.repeatDelay&&=qZ(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(f0(u),u.delay===0&&(d=!0)),(RZ.instantAnimations||RZ.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,f0(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=d1(u.keyframes,s);if(e!==void 0){SQ.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new g1(u):new b0(u)},L0=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function R0(e){let t=L0.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function z0(e,t,n=1){`${e}`;let[r,i]=R0(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return zZ(e)?parseFloat(e):e}return MQ(i)?z0(i,t,n+1):i}function B0(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function V0(e,t,n,r){if(typeof t==`function`){let[i,a]=B0(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=B0(r);t=t(n===void 0?e.custom:n,i,a)}return t}function H0(e,t,n){let r=e.getProps();return V0(r,t,n===void 0?r.custom:n,e)}var U0=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...A1]),W0=e=>Array.isArray(e);function G0(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,E0(n))}function K0(e){return W0(e)?e[e.length-1]||0:e}function q0(e,t){let{transitionEnd:n={},transition:r={},...i}=H0(e,t)||{};i={...i,...n};for(let t in i)G0(e,t,K0(i[t]))}var J0=e=>!!(e&&e.getVelocity);function Y0(e){return!!(J0(e)&&e.add)}function X0(e,t){let n=e.getValue(`willChange`);if(Y0(n))return n.add(t);if(!n&&RZ.WillChange){let n=new RZ.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Z0(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Q0=`data-`+Z0(`framerAppearId`);function $0(e){return e.props[Q0]}function e2({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function t2(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?D0(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&e2(f,t))continue;let o={delay:n,...O0(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){SQ.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=$0(e);if(n){let e=window.MotionHandoffAnimation(n,t,SQ);e!==null&&(o.startTime=e,p=!0)}}X0(e,t);let m=l??e.shouldReduceMotion;r.start(I0(t,r,i,m&&U0.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>SQ.update(()=>{o&&q0(e,o)});d.length?Promise.all(d).then(t):t()}return d}function n2(e,t,n={}){let r=H0(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(t2(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return r2(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function r2(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(n2(c,t,{...o,delay:n+(typeof r==`function`?0:r)+x0(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function i2(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>n2(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=n2(e,t,n);else{let i=typeof t==`function`?H0(e,t,n.custom):t;r=Promise.all(t2(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var a2={test:e=>e===`auto`,parse:e=>e},o2=e=>t=>t.test(e),s2=[FQ,QQ,ZQ,XQ,e$,$Q,a2],c2=e=>s2.find(o2(e));function l2(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||VZ(e)}var u2=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function d2(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(zQ)||[];if(!r)return e;let i=n.replace(r,``),a=+!!u2.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var f2=/\b([a-z-]*)\(.*?\)/gu,p2={...y$,getAnimatableNone:e=>{let t=e.match(f2);return t?t.map(d2).join(` `):e}},m2={...y$,getAnimatableNone:e=>{let t=y$.parse(e);return y$.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},h2={...FQ,transform:Math.round},g2={borderWidth:QQ,borderTopWidth:QQ,borderRightWidth:QQ,borderBottomWidth:QQ,borderLeftWidth:QQ,borderRadius:QQ,borderTopLeftRadius:QQ,borderTopRightRadius:QQ,borderBottomRightRadius:QQ,borderBottomLeftRadius:QQ,width:QQ,maxWidth:QQ,height:QQ,maxHeight:QQ,top:QQ,right:QQ,bottom:QQ,left:QQ,inset:QQ,insetBlock:QQ,insetBlockStart:QQ,insetBlockEnd:QQ,insetInline:QQ,insetInlineStart:QQ,insetInlineEnd:QQ,padding:QQ,paddingTop:QQ,paddingRight:QQ,paddingBottom:QQ,paddingLeft:QQ,paddingBlock:QQ,paddingBlockStart:QQ,paddingBlockEnd:QQ,paddingInline:QQ,paddingInlineStart:QQ,paddingInlineEnd:QQ,margin:QQ,marginTop:QQ,marginRight:QQ,marginBottom:QQ,marginLeft:QQ,marginBlock:QQ,marginBlockStart:QQ,marginBlockEnd:QQ,marginInline:QQ,marginInlineStart:QQ,marginInlineEnd:QQ,fontSize:QQ,backgroundPositionX:QQ,backgroundPositionY:QQ,rotate:XQ,pathRotation:XQ,rotateX:XQ,rotateY:XQ,rotateZ:XQ,scale:LQ,scaleX:LQ,scaleY:LQ,scaleZ:LQ,skew:XQ,skewX:XQ,skewY:XQ,distance:QQ,translateX:QQ,translateY:QQ,translateZ:QQ,x:QQ,y:QQ,z:QQ,perspective:QQ,transformPerspective:QQ,opacity:IQ,originX:t$,originY:t$,originZ:QQ,zIndex:h2,fillOpacity:IQ,strokeOpacity:IQ,numOctaves:h2},_2={...g2,color:r$,backgroundColor:r$,outlineColor:r$,fill:r$,stroke:r$,borderColor:r$,borderTopColor:r$,borderRightColor:r$,borderBottomColor:r$,borderLeftColor:r$,filter:p2,WebkitFilter:p2,mask:m2,WebkitMask:m2},v2=e=>_2[e],y2=new Set([p2,m2]);function b2(e,t){let n=v2(e);return y2.has(n)||(n=y$),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var x2=new Set([`auto`,`none`,`0`]);function S2(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!x2.has(t)&&f$(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=b2(n,i)}var C2=class extends W1{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),MQ(r))){let i=z0(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!U0.has(n)||e.length!==2)return;let[r,i]=e,a=c2(r),o=c2(i);if(PQ(r)!==PQ(i)&&I1[n]){this.needsMeasurement=!0;return}if(a!==o)if(M1(a)&&M1(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else I1[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||l2(e[t]))&&n.push(t);n.length&&S2(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=I1[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=I1[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},w2=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function T2(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var E2=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function D2(e){return BZ(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:O2,cancel:ree}=xQ(queueMicrotask,!1),k2={x:!1,y:!1};function A2(){return k2.x||k2.y}function j2(e){return e===`x`||e===`y`?k2[e]?null:(k2[e]=!0,()=>{k2[e]=!1}):k2.x||k2.y?null:(k2.x=k2.y=!0,()=>{k2.x=k2.y=!1})}function M2(e,t){let n=T2(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function N2(e){return!(e.pointerType===`touch`||A2())}function P2(e,t,n={}){let[r,i,a]=M2(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!N2(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var F2=(e,t)=>t?e===t||F2(e,t.parentElement):!1,I2=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,L2=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function R2(e){return L2.has(e.tagName)||e.isContentEditable===!0}var z2=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function B2(e){return z2.has(e.tagName)||e.isContentEditable===!0}var V2=new WeakSet;function H2(e){return t=>{t.key===`Enter`&&e(t)}}function U2(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var W2=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=H2(()=>{if(V2.has(n))return;U2(n,`down`);let e=H2(()=>{U2(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>U2(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function G2(e){return I2(e)&&!A2()}var K2=new WeakSet;function q2(e,t,n={}){let[r,i,a]=M2(e,n),o=e=>{let r=e.currentTarget;if(!G2(e)||K2.has(e))return;V2.add(r),n.stopPropagation&&K2.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),V2.has(r)&&V2.delete(r),G2(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||F2(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),D2(e)&&(e.addEventListener(`focus`,e=>W2(e,i)),!R2(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function J2(e){return BZ(e)&&`ownerSVGElement`in e}var Y2=new WeakMap,X2,Z2=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:J2(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Q2=Z2(`inline`,`width`,`offsetWidth`),$2=Z2(`block`,`height`,`offsetHeight`);function e4({target:e,borderBoxSize:t}){Y2.get(e)?.forEach(n=>{n(e,{get width(){return Q2(e,t)},get height(){return $2(e,t)}})})}function t4(e){e.forEach(e4)}function n4(){typeof ResizeObserver>`u`||(X2=new ResizeObserver(t4))}function r4(e,t){X2||n4();let n=T2(e);return n.forEach(e=>{let n=Y2.get(e);n||(n=new Set,Y2.set(e,n)),n.add(t),X2?.observe(e)}),()=>{n.forEach(e=>{let n=Y2.get(e);n?.delete(t),n?.size||X2?.unobserve(e)})}}var i4=new Set,a4;function o4(){a4=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};i4.forEach(t=>t(e))},window.addEventListener(`resize`,a4)}function s4(e){return i4.add(e),a4||o4(),()=>{i4.delete(e),!i4.size&&typeof a4==`function`&&(window.removeEventListener(`resize`,a4),a4=void 0)}}function c4(e,t){return typeof e==`function`?s4(e):r4(e,t)}var l4={value:null,addProjectionMetrics:null};function u4(e){return J2(e)&&e.tagName===`svg`}var d4=[...s2,r$,y$],f4=e=>d4.find(o2(e)),p4=()=>({translate:0,scale:1,origin:0,originPoint:0}),m4=()=>({x:p4(),y:p4()}),h4=()=>({min:0,max:0}),g4=()=>({x:h4(),y:h4()}),_4=new WeakMap;function v4(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function y4(e){return typeof e==`string`||Array.isArray(e)}var b4=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],x4=[`initial`,...b4];function S4(e){return v4(e.animate)||x4.some(t=>y4(e[t]))}function C4(e){return!!(S4(e)||e.variants)}function w4(e,t,n){for(let r in t){let i=t[r],a=n[r];if(J0(i))e.addValue(r,i);else if(J0(a))e.addValue(r,E0(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,E0(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var T4={current:null},E4={current:!1},D4=typeof window<`u`;function O4(){if(E4.current=!0,D4)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>T4.current=e.matches;e.addEventListener(`change`,t),t()}else T4.current=!1}var k4=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],A4={};function j4(e){A4=e}function M4(){return A4}var N4=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=W1,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=OQ.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,SQ.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=S4(t),this.isVariantNode=C4(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&J0(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,_4.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(E4.current||O4(),this.shouldReduceMotion=T4.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),CQ(this.notifyUpdate),CQ(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&p0.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new r0({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:qZ(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=j1.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&SQ.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in A4){let t=A4[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):g4()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<k4.length;t++){let n=k4[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=w4(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=E0(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(zZ(n)||VZ(n))?n=parseFloat(n):!f4(n)&&y$.test(t)&&(n=b2(e,t)),this.setBaseTarget(e,J0(n)?n.get():n)),J0(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=V0(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!J0(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new KZ),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){O2.render(this.render)}},P4=class extends N4{constructor(){super(...arguments),this.KeyframeResolver=C2}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;J0(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},F4=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function I4({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function L4({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function R4(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function z4(e){return e===void 0||e===1}function B4({scale:e,scaleX:t,scaleY:n}){return!z4(e)||!z4(t)||!z4(n)}function V4(e){return B4(e)||H4(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function H4(e){return U4(e.x)||U4(e.y)}function U4(e){return e&&e!==`0%`}function W4(e,t,n){return n+t*(e-n)}function G4(e,t,n,r,i){return i!==void 0&&(e=W4(e,i,r)),W4(e,n,r)+t}function K4(e,t=0,n=1,r,i){e.min=G4(e.min,t,n,r,i),e.max=G4(e.max,t,n,r,i)}function q4(e,{x:t,y:n}){K4(e.x,t.translate,t.scale,t.originPoint),K4(e.y,n.translate,n.scale,n.originPoint)}var J4=.999999999999,Y4=1.0000000000001;function X4(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Z4(e.x,-a.scroll.offset.x),Z4(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,q4(e,o)),r&&V4(a.latestValues)&&e3(e,a.latestValues,a.layout?.layoutBox))}t.x<Y4&&t.x>J4&&(t.x=1),t.y<Y4&&t.y>J4&&(t.y=1)}function Z4(e,t){e.min+=t,e.max+=t}function Q4(e,t,n,r,i=.5){K4(e,t,n,C$(e.min,e.max,i),r)}function $4(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function e3(e,t,n){let r=n??e;Q4(e.x,$4(t.x,r.x),t.scaleX,t.scale,t.originX),Q4(e.y,$4(t.y,r.y),t.scaleY,t.scale,t.originY)}function t3(e,t){return I4(R4(e.getBoundingClientRect(),t))}function n3(e,t,n){let r=t3(e,n),{scroll:i}=t;return i&&(Z4(r.x,i.offset.x),Z4(r.y,i.offset.y)),r}var r3={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},i3=A1.length;function a3(e,t,n){let r=``,i=!0;for(let a=0;a<i3;a++){let o=A1[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=E2(s,g2[o]);if(!c){i=!1;let t=r3[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${E2(a,g2.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function o3(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(j1.has(e)){o=!0;continue}else if(AQ(e)){i[e]=n;continue}else{let t=E2(n,g2[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=a3(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function s3(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function c3(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var l3={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(QQ.test(e))e=parseFloat(e);else return e;return`${c3(e,t.target.x)}% ${c3(e,t.target.y)}%`}},u3={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=y$.parse(e);if(i.length>5)return r;let a=y$.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=C$(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},d3={borderRadius:{...l3,applyTo:[...w2]},borderTopLeftRadius:l3,borderTopRightRadius:l3,borderBottomLeftRadius:l3,borderBottomRightRadius:l3,boxShadow:u3};function f3(e,{layout:t,layoutId:n}){return j1.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!d3[e]||e===`opacity`)}function p3(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(J0(r[t])||i&&J0(i[t])||f3(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function m3(e){return window.getComputedStyle(e)}var h3=class extends P4{constructor(){super(...arguments),this.type=`html`,this.renderInstance=s3}readValueFromInstance(e,t){if(j1.has(t))return this.projection?.isProjecting?E1(t):O1(e,t);{let n=m3(e),r=(AQ(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return t3(e,t)}build(e,t,n){o3(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return p3(e,t,n)}},g3={offset:`stroke-dashoffset`,array:`stroke-dasharray`},_3={offset:`strokeDashoffset`,array:`strokeDasharray`};function v3(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?g3:_3;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var y3=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function b3(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(o3(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of y3)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&v3(d,i,a,o,!1)}var x3=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),S3=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function C3(e,t,n,r){s3(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(x3.has(n)?n:Z0(n),t.attrs[n])}function w3(e,t,n){let r=p3(e,t,n);for(let n in e)if(J0(e[n])||J0(t[n])){let t=A1.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var T3=class extends P4{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=g4}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(j1.has(t)){let e=v2(t);return e&&e.default||0}return t=x3.has(t)?t:Z0(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return w3(e,t,n)}build(e,t,n){b3(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){C3(e,t,n,r)}mount(e){this.isSVGTag=S3(e.tagName),super.mount(e)}},E3=x4.length;function D3(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&D3(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<E3;n++){let r=x4[n],i=e.props[r];(y4(i)||i===!1)&&(t[r]=i)}return t}function O3(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var k3=[...b4].reverse(),A3=b4.length;function j3(e){return t=>Promise.all(t.map(({animation:t,options:n})=>i2(e,t,n)))}function M3(e){let t=j3(e),n=F3(),r=!0,i=!1,a=t=>(n,r)=>{let i=H0(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=D3(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<A3;t++){let p=k3[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=y4(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||v4(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=N3(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=W0(t)&&W0(n)?!O3(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=H0(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=x0(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=H0(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=F3(),i=!0}}}function N3(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!O3(t,e):!1}function P3(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function F3(){return{animate:P3(!0),whileInView:P3(),whileHover:P3(),whileTap:P3(),whileDrag:P3(),whileFocus:P3(),exit:P3()}}function I3(e,t){e.min=t.min,e.max=t.max}function L3(e,t){I3(e.x,t.x),I3(e.y,t.y)}function R3(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var z3=.9999,B3=1.0001,V3=-.01,H3=.01;function U3(e){return e.max-e.min}function W3(e,t,n){return Math.abs(e-t)<=n}function G3(e,t,n,r=.5){e.origin=r,e.originPoint=C$(t.min,t.max,e.origin),e.scale=U3(n)/U3(t),e.translate=C$(n.min,n.max,e.origin)-e.originPoint,(e.scale>=z3&&e.scale<=B3||isNaN(e.scale))&&(e.scale=1),(e.translate>=V3&&e.translate<=H3||isNaN(e.translate))&&(e.translate=0)}function K3(e,t,n,r){G3(e.x,t.x,n.x,r?r.originX:void 0),G3(e.y,t.y,n.y,r?r.originY:void 0)}function q3(e,t,n,r=0){e.min=(r?C$(n.min,n.max,r):n.min)+t.min,e.max=e.min+U3(t)}function J3(e,t,n,r){q3(e.x,t.x,n.x,r?.x),q3(e.y,t.y,n.y,r?.y)}function Y3(e,t,n,r=0){let i=r?C$(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+U3(t)}function X3(e,t,n,r){Y3(e.x,t.x,n.x,r?.x),Y3(e.y,t.y,n.y,r?.y)}function Z3(e,t,n,r,i){return e-=t,e=W4(e,1/n,r),i!==void 0&&(e=W4(e,1/i,r)),e}function Q3(e,t=0,n=1,r=.5,i,a=e,o=e){if(ZQ.test(t)&&(t=parseFloat(t),t=C$(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=C$(a.min,a.max,r);e===a&&(s-=t),e.min=Z3(e.min,t,n,s,i),e.max=Z3(e.max,t,n,s,i)}function $3(e,t,[n,r,i],a,o){Q3(e,t[n],t[r],t[i],t.scale,a,o)}var e6=[`x`,`scaleX`,`originX`],t6=[`y`,`scaleY`,`originY`];function n6(e,t,n,r){$3(e.x,t,e6,n?n.x:void 0,r?r.x:void 0),$3(e.y,t,t6,n?n.y:void 0,r?r.y:void 0)}function r6(e){return e.translate===0&&e.scale===1}function i6(e){return r6(e.x)&&r6(e.y)}function a6(e,t){return e.min===t.min&&e.max===t.max}function o6(e,t){return a6(e.x,t.x)&&a6(e.y,t.y)}function s6(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function c6(e,t){return s6(e.x,t.x)&&s6(e.y,t.y)}function l6(e){return U3(e.x)/U3(e.y)}function u6(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function d6(e){return[e(`x`),e(`y`)]}function f6(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var p6=w2.length,m6=e=>typeof e==`string`?parseFloat(e):e,h6=e=>typeof e==`number`||QQ.test(e);function g6(e,t,n,r,i,a){i?(e.opacity=C$(0,n.opacity??1,v6(r)),e.opacityExit=C$(t.opacity??1,0,y6(r))):a&&(e.opacity=C$(t.opacity??1,n.opacity??1,r));for(let i=0;i<p6;i++){let a=w2[i],o=_6(t,a),s=_6(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||h6(o)===h6(s)?(e[a]=Math.max(C$(m6(o),m6(s),r),0),(ZQ.test(s)||ZQ.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=C$(t.rotate||0,n.rotate||0,r))}function _6(e,t){return e[t]===void 0?e.borderRadius:e[t]}var v6=b6(0,.5,cQ),y6=b6(.5,.95,UZ);function b6(e,t,n){return r=>r<e?0:r>t?1:n(GZ(e,t,r))}function x6(e,t,n){let r=J0(e)?e:E0(e);return r.start(I0(``,r,t,n)),r.animation}function S6(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var C6=(e,t)=>e.depth-t.depth,w6=class{constructor(){this.children=[],this.isDirty=!1}add(e){FZ(this.children,e),this.isDirty=!0}remove(e){IZ(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(C6),this.isDirty=!1,this.children.forEach(e)}};function T6(e,t){let n=OQ.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(CQ(r),e(a-t))};return SQ.setup(r,!0),()=>CQ(r)}function E6(e){return J0(e)?e.get():e}var D6=class{constructor(){this.members=[]}add(e){FZ(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(IZ(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(IZ(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},O6={hasAnimatedSinceResize:!0,hasEverUpdated:!1},k6={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},A6=[``,`X`,`Y`,`Z`],j6=1e3,M6=0;function N6(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function P6(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=$0(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,SQ,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&P6(r)}function F6({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=M6++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,l4.value&&(k6.nodes=k6.calculatedTargetDeltas=k6.calculatedProjections=0),this.nodes.forEach(R6),this.nodes.forEach(q6),this.nodes.forEach(J6),this.nodes.forEach(z6),l4.addProjectionMetrics&&l4.addProjectionMetrics(k6)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new w6)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new KZ),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=J2(t)&&!u4(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;SQ.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=T6(i,250),O6.hasAnimatedSinceResize&&(O6.hasAnimatedSinceResize=!1,this.nodes.forEach(K6)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||t8,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!c6(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...O0(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||K6(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),CQ(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Y6),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&P6(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(H6),this.nodes.forEach(V6);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(U6);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(W6),this.nodes.forEach(G6),this.nodes.forEach(I6),this.nodes.forEach(L6)):this.nodes.forEach(U6),this.clearAllSnapshots();let e=OQ.now();wQ.delta=LZ(0,1e3/60,e-wQ.timestamp),wQ.timestamp=e,wQ.isProcessing=!0,TQ.update.process(wQ),TQ.preRender.process(wQ),TQ.render.process(wQ),wQ.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,O2.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(B6),this.sharedNodes.forEach(X6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,SQ.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){SQ.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!U3(this.snapshot.measuredBox.x)&&!U3(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=g4(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!i6(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||V4(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),a8(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return g4();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(s8))){let{scroll:e}=this.root;e&&(Z4(t.x,e.offset.x),Z4(t.y,e.offset.y))}return t}removeElementScroll(e){let t=g4();if(L3(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&L3(t,e),Z4(t.x,i.offset.x),Z4(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||g4();L3(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(Z4(r.x,-n.scroll.offset.x),Z4(r.y,-n.scroll.offset.y)),V4(n.latestValues)&&e3(r,n.latestValues,n.layout?.layoutBox)}return V4(this.latestValues)&&e3(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=g4();L3(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!V4(n.latestValues))continue;let r;n.instance&&(B4(n.latestValues)&&n.updateSnapshot(),r=g4(),L3(r,n.measurePageBox())),n6(t,n.latestValues,n.snapshot?.layoutBox,r)}return V4(this.latestValues)&&n6(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==wQ.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=wQ.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=g4(),this.targetWithTransforms=g4()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),J3(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):L3(this.target,this.layout.layoutBox),q4(this.target,this.targetDelta)):L3(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),l4.value&&k6.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||B4(this.parent.latestValues)||H4(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=g4(),this.relativeTargetOrigin=g4(),X3(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),L3(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===wQ.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;L3(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;X4(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=g4());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(R3(this.prevProjectionDelta.x,this.projectionDelta.x),R3(this.prevProjectionDelta.y,this.projectionDelta.y)),K3(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!u6(this.projectionDelta.x,this.prevProjectionDelta.x)||!u6(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),l4.value&&k6.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=m4(),this.projectionDelta=m4(),this.projectionDeltaWithTransform=m4()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=m4();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=g4(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(e8));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=C$(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=C$(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(Z6(o.x,e.x,n),Z6(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(X3(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),$6(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&o6(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=g4(),L3(f,this.relativeTarget)),c&&(this.animationValues=a,g6(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(CQ(this.pendingAnimation),void 0),this.pendingAnimation=SQ.update(()=>{O6.hasAnimatedSinceResize=!0,this.motionValue||=E0(0),this.motionValue.jump(0,!1),this.currentAnimation=x6(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(j6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&o8(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||g4();let t=U3(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=U3(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}L3(t,n),e3(t,i),K3(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new D6),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&N6(`z`,e,r,this.animationValues);for(let t=0;t<A6.length;t++)N6(`rotate${A6[t]}`,e,r,this.animationValues),N6(`skew${A6[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=E6(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=E6(t?.pointerEvents)||``),this.hasProjected&&!V4(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=f6(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in d3){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=d3[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?E6(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(V6),this.root.sharedNodes.clear()}}}function I6(e){e.updateLayout()}function L6(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)d6(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=U3(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;I3(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else o8(i,t.layoutBox,n)&&d6(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=U3(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=m4();K3(o,n,t.layoutBox);let s=m4();a?K3(s,e.applyTransform(r,!0),t.measuredBox):K3(s,n,t.layoutBox);let c=!i6(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=g4();X3(s,t.layoutBox,i.layoutBox,o);let c=g4();X3(c,n,a.layoutBox,o),c6(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function R6(e){l4.value&&k6.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function z6(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function B6(e){e.clearSnapshot()}function V6(e){e.clearMeasurements()}function H6(e){e.isLayoutDirty=!0,e.updateLayout()}function U6(e){e.isLayoutDirty=!1}function W6(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function G6(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function K6(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function q6(e){e.resolveTargetDelta()}function J6(e){e.calcProjection()}function Y6(e){e.resetSkewAndRotation()}function X6(e){e.removeLeadSnapshot()}function Z6(e,t,n){e.translate=C$(t.translate,0,n),e.scale=C$(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Q6(e,t,n,r){e.min=C$(t.min,n.min,r),e.max=C$(t.max,n.max,r)}function $6(e,t,n,r){Q6(e.x,t.x,n.x,r),Q6(e.y,t.y,n.y,r)}function e8(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var t8={duration:.45,ease:[.4,0,.1,1]},n8=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),r8=n8(`applewebkit/`)&&!n8(`chrome/`)?Math.round:UZ;function i8(e){e.min=r8(e.min),e.max=r8(e.max)}function a8(e){i8(e.x),i8(e.y)}function o8(e,t,n){return e===`position`||e===`preserve-aspect`&&!W3(l6(t),l6(n),.2)}function s8(e){return e!==e.root&&e.scroll?.wasRoot}var c8=F6({attachResizeListener:(e,t)=>S6(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),l8={current:void 0},u8=F6({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!l8.current){let e=new c8({});e.mount(window),e.setOptions({layoutScroll:!0}),l8.current=e}return l8.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),d8=(0,T.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function f8(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function p8(...e){return t=>{let n=!1,r=e.map(e=>{let r=f8(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():f8(e[t],null)}}}}function m8(...e){return T.useCallback(p8(...e),e)}var h8=class extends T.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(D2(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=D2(e)&&e.offsetWidth||0,r=D2(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function g8({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,T.useId)(),s=(0,T.useRef)(null),c=(0,T.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,T.useContext)(d8),u=m8(s,e.props?.ref??e?.ref);return(0,T.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
          [data-motion-pop-id="${o}"] {
            position: absolute !important;
            width: ${e}px !important;
            height: ${u}px !important;
            ${_}px !important;
            ${v}px !important;
          }
        `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,J.jsx)(h8,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:T.cloneElement(e,{ref:u})})}var _8=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=MZ(v8),d=(0,T.useId)(),f=(0,T.useRef)(n),p=(0,T.useRef)(r);NZ(()=>{f.current=n,p.current=r});let m=!0,h=(0,T.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,T.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),T.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,J.jsx)(g8,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,J.jsx)(PZ.Provider,{value:h,children:e})};function v8(){return new Map}function y8(e=!0){let t=(0,T.useContext)(PZ);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,T.useId)();(0,T.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,T.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var b8=e=>e.key||``;function x8(e){let t=[];return T.Children.forEach(e,e=>{(0,T.isValidElement)(e)&&t.push(e)}),t}var S8=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=y8(o),f=(0,T.useMemo)(()=>x8(e),[e]),p=o&&!u?[]:f.map(b8),m=(0,T.useRef)(!0),h=(0,T.useRef)(f),g=MZ(()=>new Map),_=(0,T.useRef)(new Set),[v,y]=(0,T.useState)(f),[b,x]=(0,T.useState)(f);NZ(()=>{m.current=!1,h.current=f;for(let e=0;e<b.length;e++){let t=b8(b[e]);p.includes(t)?(g.delete(t),_.current.delete(t)):g.get(t)!==!0&&g.set(t,!1)}},[b,p.length,p.join(`-`)]);let S=[];if(f!==v){let e=[...f];for(let t=0;t<b.length;t++){let n=b[t],r=b8(n);p.includes(r)||(e.splice(t,0,n),S.push(n))}return a===`wait`&&S.length&&(e=S),x(x8(e)),y(f),null}let{forceRender:C}=(0,T.useContext)(jZ);return(0,J.jsx)(J.Fragment,{children:b.map(e=>{let v=b8(e),y=o&&!u?!1:f===b||p.includes(v);return(0,J.jsx)(_8,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(g.has(v))_.current.add(v),g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(C?.(),x(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},C8=(0,T.createContext)({strict:!1}),w8={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},T8=!1;function E8(){if(T8)return;let e={};for(let t in w8)e[t]={isEnabled:e=>w8[t].some(t=>!!e[t])};j4(e),T8=!0}function D8(){return E8(),M4()}function O8(e){let t=D8();for(let n in e)t[n]={...t[n],...e[n]};j4(t)}var k8=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function A8(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||k8.has(e)}var j8=n({default:()=>M8}),M8,N8=t((()=>{throw M8={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),P8=e=>!A8(e);function F8(e){typeof e==`function`&&(P8=t=>t.startsWith(`on`)?!A8(t):e(t))}try{F8((N8(),c(j8)).default)}catch{}function I8(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||J0(e[i])||(P8(i)||n===!0&&A8(i)||!t&&!A8(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var L8=(0,T.createContext)({});function R8(e,t){if(S4(e)){let{initial:t,animate:n}=e;return{initial:t===!1||y4(t)?t:void 0,animate:y4(n)?n:void 0}}return e.inherit===!1?{}:t}function z8(e){let{initial:t,animate:n}=R8(e,(0,T.useContext)(L8));return(0,T.useMemo)(()=>({initial:t,animate:n}),[B8(t),B8(n)])}function B8(e){return Array.isArray(e)?e.join(` `):e}var V8=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function H8(e,t,n){for(let r in t)!J0(t[r])&&!f3(r,n)&&(e[r]=t[r])}function U8({transformTemplate:e},t){return(0,T.useMemo)(()=>{let n=V8();return o3(n,t,e),Object.assign({},n.vars,n.style)},[t])}function W8(e,t){let n=e.style||{},r={};return H8(r,n,e),Object.assign(r,U8(e,t)),r}function G8(e,t){let n={},r=W8(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var K8=()=>({...V8(),attrs:{}});function q8(e,t,n,r){let i=(0,T.useMemo)(()=>{let n=K8();return b3(n,t,S3(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};H8(t,e.style,e),i.style={...t,...i.style}}return i}var J8=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Y8(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(J8.indexOf(e)>-1||/[A-Z]/u.test(e))}function X8(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??Y8(e)?q8:G8)(t,r,i,e),c=I8(t,typeof e==`string`,a),l=e===T.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,T.useMemo)(()=>J0(u)?u.get():u,[u]);return(0,T.createElement)(e,{...l,children:d})}function Z8({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Q8(n,r,i,e),renderState:t()}}function Q8(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=E6(a[e]);let{initial:o,animate:s}=e,c=S4(e),l=C4(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!v4(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=V0(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var $8=e=>(t,n)=>{let r=(0,T.useContext)(L8),i=(0,T.useContext)(PZ),a=()=>Z8(e,t,r,i);return n?a():MZ(a)},e5=$8({scrapeMotionValuesFromProps:p3,createRenderState:V8}),t5=$8({scrapeMotionValuesFromProps:w3,createRenderState:K8}),n5=Symbol.for(`motionComponentSymbol`);function r5(e,t,n){let r=(0,T.useRef)(n);(0,T.useInsertionEffect)(()=>{r.current=n});let i=(0,T.useRef)(null);return(0,T.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var i5=(0,T.createContext)({});function a5(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function o5(e,t,n,r,i,a){let{visualElement:o}=(0,T.useContext)(L8),s=(0,T.useContext)(C8),c=(0,T.useContext)(PZ),l=(0,T.useContext)(d8),u=l.reducedMotion,d=l.skipAnimations,f=(0,T.useRef)(null),p=(0,T.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,T.useContext)(i5);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&s5(f.current,n,i,h);let g=(0,T.useRef)(!1);(0,T.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[Q0],v=(0,T.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return NZ(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,T.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function s5(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:c5(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&a5(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function c5(e){if(e)return e.options.allowProjection===!1?c5(e.parent):e.projection}function l5(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&O8(r);let a=n?n===`svg`:Y8(e),o=a?t5:e5;function s(n,s){let c,l={...(0,T.useContext)(d8),...n,layoutId:u5(n)},{isStatic:u}=l,d=z8(n),f=o(n,u);if(!u&&typeof window<`u`){d5(l,r);let t=f5(l);c=t.MeasureLayout,d.visualElement=o5(e,f,l,i,t.ProjectionNode,a)}return(0,J.jsxs)(L8.Provider,{value:d,children:[c&&d.visualElement?(0,J.jsx)(c,{visualElement:d.visualElement,...l}):null,X8(e,n,r5(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,T.forwardRef)(s);return c[n5]=e,c}function u5({layoutId:e}){let t=(0,T.useContext)(jZ).id;return t&&e!==void 0?t+`-`+e:e}function d5(e,t){(0,T.useContext)(C8).strict}function f5(e){let{drag:t,layout:n}=D8();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function p5(e,t){if(typeof Proxy>`u`)return l5;let n=new Map,r=(n,r)=>l5(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,l5(a,void 0,e,t)),n.get(a))})}var m5=(e,t)=>t.isSVG??Y8(e)?new T3(t):new h3(t,{allowProjection:e!==T.Fragment}),h5=class extends F4{constructor(e){super(e),e.animationState||=M3(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();v4(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},g5=0,_5={animation:{Feature:h5},exit:{Feature:class extends F4{constructor(){super(...arguments),this.id=g5++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=H0(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function v5(e){return{point:{x:e.pageX,y:e.pageY}}}var y5=e=>t=>I2(t)&&e(t,v5(t));function b5(e,t,n,r){return S6(e,t,y5(n),r)}var x5=({current:e})=>e?e.ownerDocument.defaultView:null,S5=(e,t)=>Math.abs(e-t);function C5(e,t){let n=S5(e.x,t.x),r=S5(e.y,t.y);return Math.sqrt(n**2+r**2)}var w5=new Set([`auto`,`scroll`]),T5=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=E5(this.lastRawMoveEventInfo,this.transformPagePoint));let e=O5(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=C5(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=wQ;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=E5(t,this.transformPagePoint),SQ.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=O5(e.type===`pointercancel`?this.lastMoveEventInfo:E5(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!I2(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=E5(v5(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=wQ;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,O5(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=WZ(b5(this.contextWindow,`pointermove`,this.handlePointerMove,d),b5(this.contextWindow,`pointerup`,this.handlePointerUp,d),b5(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(w5.has(e.overflowX)||w5.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),SQ.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),CQ(this.updatePoint)}};function E5(e,t){return t?{point:t(e.point)}:e}function D5(e,t){return{x:e.x-t.x,y:e.y-t.y}}function O5({point:e},t){return{point:e,delta:D5(e,A5(t)),offset:D5(e,k5(t)),velocity:j5(t,.1)}}function k5(e){return e[0]}function A5(e){return e[e.length-1]}function j5(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=A5(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>qZ(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>qZ(t)*2&&(r=e[1]);let a=JZ(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function M5(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?C$(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?C$(n,e,r.max):Math.min(e,n)),e}function N5(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function P5(e,{top:t,left:n,bottom:r,right:i}){return{x:N5(e.x,n,i),y:N5(e.y,t,r)}}function F5(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function I5(e,t){return{x:F5(e.x,t.x),y:F5(e.y,t.y)}}function L5(e,t){let n=.5,r=U3(e),i=U3(t);return i>r?n=GZ(t.min,t.max-r,e.min):r>i&&(n=GZ(e.min,e.max-i,t.min)),LZ(0,1,n)}function R5(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var z5=.35;function B5(e=z5){return e===!1?e=0:e===!0&&(e=z5),{x:V5(e,`left`,`right`),y:V5(e,`top`,`bottom`)}}function V5(e,t,n){return{min:H5(e,t),max:H5(e,n)}}function H5(e,t){return typeof e==`number`?e:e[t]||0}var U5=new WeakMap,W5=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=g4(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(v5(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=j2(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),d6(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ZQ.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=U3(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&SQ.update(()=>i(e,t),!1,!0),X0(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=J5(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&SQ.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new T5(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:x5(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&SQ.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!q5(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=M5(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&a5(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=P5(n.layoutBox,e):this.constraints=!1,this.elastic=B5(t),r!==this.constraints&&!a5(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&d6(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=R5(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!a5(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=n3(n,r.root,this.visualElement.getTransformPagePoint()),a=I5(r.layout.layoutBox,i);if(t){let e=t(L4(a));this.hasMutatedConstraints=!!e,e&&(a=I4(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=d6(o=>{if(!q5(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return X0(this.visualElement,e),n.start(I0(e,n,0,t,this.visualElement,!1))}stopAnimation(){d6(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){d6(t=>{let{drag:n}=this.getProps();if(!q5(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-C$(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!a5(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};d6(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=L5({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),d6(t=>{if(!q5(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(C$(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;U5.set(this.visualElement,this);let e=this.visualElement.current,t=b5(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&B2(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();a5(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=K5(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),SQ.read(r);let o=S6(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(d6(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=z5,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function G5(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function K5(e,t,n){let r=c4(e,G5(n)),i=c4(t,G5(n));return()=>{r(),i()}}function q5(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function J5(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Y5=class extends F4{constructor(e){super(e),this.removeGroupControls=UZ,this.removeListeners=UZ,this.controls=new W5(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||UZ}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},X5=e=>(t,n)=>{e&&SQ.update(()=>e(t,n),!1,!0)},Z5=class extends F4{constructor(){super(...arguments),this.removePointerDownListener=UZ}onPointerDown(e){this.session=new T5(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:x5(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:X5(e),onStart:X5(t),onMove:X5(n),onEnd:(e,t)=>{delete this.session,r&&SQ.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=b5(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Q5=!1,$5=class extends T.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Q5&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),O6.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Q5=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||SQ.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),O2.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Q5=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function e7(e){let[t,n]=y8(),r=(0,T.useContext)(jZ);return(0,J.jsx)($5,{...e,layoutGroup:r,switchLayoutGroup:(0,T.useContext)(i5),isPresent:t,safeToRemove:n})}var t7={pan:{Feature:Z5},drag:{Feature:Y5,ProjectionNode:u8,MeasureLayout:e7}};function n7(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&SQ.postRender(()=>i(t,v5(t)))}var r7=class extends F4{mount(){let{current:e}=this.node;e&&(this.unmount=P2(e,(e,t)=>(n7(this.node,t,`Start`),e=>n7(this.node,e,`End`))))}unmount(){}},i7=class extends F4{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=WZ(S6(this.node.current,`focus`,()=>this.onFocus()),S6(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function a7(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&SQ.postRender(()=>i(t,v5(t)))}var o7=class extends F4{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=q2(e,(e,t)=>(a7(this.node,t,`Start`),(e,{success:t})=>a7(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},s7=new WeakMap,c7=new WeakMap,l7=e=>{let t=s7.get(e.target);t&&t(e)},u7=e=>{e.forEach(l7)};function d7({root:e,...t}){let n=e||document;c7.has(n)||c7.set(n,{});let r=c7.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(u7,{root:e,...t})),r[i]}function f7(e,t,n){let r=d7(t);return s7.set(e,n),r.observe(e),()=>{s7.delete(e),r.unobserve(e)}}var p7={some:0,all:1},m7=class extends F4{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:p7[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=f7(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(h7(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function h7({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var g7={inView:{Feature:m7},tap:{Feature:o7},focus:{Feature:i7},hover:{Feature:r7}},_7={layout:{ProjectionNode:u8,MeasureLayout:e7}},v7=p5({..._5,...g7,...t7,..._7},m5),y7={top:0,left:0,width:0,height:0},b7=T.createContext(void 0);function x7(){let e=T.useContext(b7);if(!e)throw Error(`useHighlight must be used within a HighlightProvider`);return e}function S7({ref:e,...t}){let{as:n=`div`,children:r,value:i,defaultValue:a,onValueChange:o,className:s,style:c,transition:l={type:`spring`,stiffness:350,damping:35},hover:u=!1,click:d=!0,enabled:f=!0,controlledItems:p,disabled:m=!1,exitDelay:h=200,mode:g=`children`}=t,_=T.useRef(null);T.useImperativeHandle(e,()=>_.current);let v=t?.boundsOffset??y7,y=v.top??0,b=v.left??0,x=v.width??0,S=v.height??0,C=T.useRef({top:y,left:b,width:x,height:S});T.useEffect(()=>{C.current={top:y,left:b,width:x,height:S}},[y,b,x,S]);let[w,E]=T.useState(i??a??null),[D,O]=T.useState(null),[k,A]=T.useState(``),j=e=>{E(t=>t===e?t:(o?.(e),e))},M=T.useRef(void 0);T.useEffect(()=>{M.current=e=>{if(!_.current)return;let t=_.current.getBoundingClientRect(),n=C.current,r={top:e.top-t.top+n.top,left:e.left-t.left+n.left,width:e.width+n.width,height:e.height+n.height};O(e=>e&&e.top===r.top&&e.left===r.left&&e.width===r.width&&e.height===r.height?e:r)}});let N=e=>{M.current?.(e)},P=T.useCallback(()=>{O(e=>e===null?e:null)},[]);T.useEffect(()=>{i===void 0?a!==void 0&&E(a):E(i)},[i,a]);let F=T.useId();return T.useEffect(()=>{if(g!==`parent`)return;let e=_.current;if(!e)return;let t=()=>{if(!w)return;let t=e.querySelector(`[data-value="${w}"][data-highlight="true"]`);t&&M.current?.(t.getBoundingClientRect())};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[g,w]),(0,J.jsx)(b7.Provider,{value:{mode:g,activeValue:w,setActiveValue:j,id:F,hover:u,click:d,className:s,style:c,transition:l,disabled:m,enabled:f,exitDelay:h,setBounds:N,clearBounds:P,activeClassName:k,setActiveClassName:A,forceUpdateBounds:t?.forceUpdateBounds},children:f?(e=>g===`parent`?(0,J.jsxs)(n,{ref:_,"data-slot":`motion-highlight-container`,style:{position:`relative`,zIndex:1},className:t?.containerClassName,children:[(0,J.jsx)(S8,{initial:!1,mode:`wait`,children:D&&(0,J.jsx)(v7.div,{"data-slot":`motion-highlight`,animate:{top:D.top,left:D.left,width:D.width,height:D.height,opacity:1},initial:{top:D.top,left:D.left,width:D.width,height:D.height,opacity:0},exit:{opacity:0,transition:{...l,delay:(l?.delay??0)+(h??0)/1e3}},transition:l,style:{position:`absolute`,zIndex:0,...c},className:q(s,k)})}),e]}):e)(p?r:T.Children.map(r,(e,n)=>(0,J.jsx)(w7,{className:t?.itemsClassName,children:e},n))):r})}function C7(e,t){return Object.keys(t).reduce((n,r)=>(e.props[r]===void 0&&(n[r]=t[r]),n),{})}function w7({ref:e,as:t,children:n,id:r,value:i,className:a,style:o,transition:s,disabled:c=!1,activeClassName:l,exitDelay:u,asChild:d=!1,forceUpdateBounds:f,...p}){let m=T.useId(),{activeValue:h,setActiveValue:g,mode:_,setBounds:v,clearBounds:y,hover:b,click:x,enabled:S,className:C,style:w,transition:E,id:D,disabled:O,exitDelay:k,forceUpdateBounds:A,setActiveClassName:j}=x7(),M=t??`div`,N=n,P=r??i??N.props?.[`data-value`]??N.props?.id??m,F=h===P,I=c===void 0?O:c,L=s??E,R=T.useRef(null);T.useImperativeHandle(e,()=>R.current);let z=T.useCallback(e=>{R.current=e},[]);if(T.useEffect(()=>{if(_!==`parent`)return;let e,t=null,n=f===!0||A&&f!==!1,r=()=>{if(!R.current)return;let i=R.current.getBoundingClientRect();if(n){if(t&&t.top===i.top&&t.left===i.left&&t.width===i.width&&t.height===i.height){e=requestAnimationFrame(r);return}t=i,e=requestAnimationFrame(r)}v(i)};if(F?(r(),j(l??``)):h||y(),n)return()=>cancelAnimationFrame(e)},[_,F,h,v,y,l,j,f,A]),!T.isValidElement(n))return n;let B={"data-active":F?`true`:`false`,"aria-selected":F,"data-disabled":I,"data-value":P,"data-highlight":!0},ee=b?{onMouseEnter:e=>{g(P),N.props.onMouseEnter?.(e)},onMouseLeave:e=>{g(null),N.props.onMouseLeave?.(e)}}:x?{onClick:e=>{g(P),N.props.onClick?.(e)}}:{};return d?_===`children`?T.cloneElement(N,{key:P,ref:z,className:q(`relative`,N.props.className),...C7(N,{...B,"data-slot":`motion-highlight-item-container`}),...ee,...p},(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S8,{initial:!1,mode:`wait`,children:F&&!I&&(0,J.jsx)(v7.div,{layoutId:`transition-background-${D}`,"data-slot":`motion-highlight`,style:{position:`absolute`,zIndex:0,...w,...o},className:q(C,l),transition:L,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{...L,delay:(L?.delay??0)+(u??k??0)/1e3}},...B})}),(0,J.jsx)(M,{"data-slot":`motion-highlight-item`,style:{position:`relative`,zIndex:1},className:a,...B,children:n})]})):T.cloneElement(N,{ref:z,...C7(N,{...B,"data-slot":`motion-highlight-item`}),...ee}):S?(0,J.jsxs)(M,{ref:R,"data-slot":`motion-highlight-item-container`,className:q(_===`children`&&`relative`,a),...B,...p,...ee,children:[_===`children`&&(0,J.jsx)(S8,{initial:!1,mode:`wait`,children:F&&!I&&(0,J.jsx)(v7.div,{layoutId:`transition-background-${D}`,"data-slot":`motion-highlight`,style:{position:`absolute`,zIndex:0,...w,...o},className:q(C,l),transition:L,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{...L,delay:(L?.delay??0)+(u??k??0)/1e3}},...B})}),T.cloneElement(N,{style:{position:`relative`,zIndex:1},className:N.props.className,...C7(N,{...B,"data-slot":`motion-highlight-item`})})]},P):n}var T7=T.createContext(void 0);function E7(){let e=T.useContext(T7);if(e===void 0)throw Error(Ou(10));return e}var D7={value:()=>null},O7=T.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,hiddenUntilFound:a,keepMounted:o,loopFocus:s=!0,onValueChange:c,multiple:l=!1,orientation:u=`vertical`,value:d,defaultValue:f,...p}=e,m=Sy(),h=T.useMemo(()=>{if(d===void 0)return f??[]},[d,f]),g=X(c),_=T.useRef([]),[v,y]=lu({controlled:d,default:h,name:`Accordion`,state:`value`}),b=X((e,t)=>{let n=yf(ef);if(!l){let t=v[0]===e?[]:[e];if(g(t,n),n.isCanceled)return;y(t)}else if(t){let t=v.slice();if(t.push(e),g(t,n),n.isCanceled)return;y(t)}else{let t=v.filter(t=>t!==e);if(g(t,n),n.isCanceled)return;y(t)}}),x=T.useMemo(()=>({value:v,disabled:i,orientation:u}),[v,i,u]),S=T.useMemo(()=>({accordionItemRefs:_,direction:m,disabled:i,handleValueChange:b,hiddenUntilFound:a??!1,keepMounted:o??!1,loopFocus:s,orientation:u,state:x,value:v}),[m,i,b,a,o,s,u,x,v]),C=$u(`div`,e,{state:x,ref:t,props:[{dir:m,role:`region`},p],stateAttributesMapping:D7});return(0,J.jsx)(T7.Provider,{value:S,children:(0,J.jsx)(My,{elementsRef:_,children:C})})});function k7(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=lu({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=Ff(o,!0,!0),[d,f]=T.useState(o),[{height:p,width:m},h]=T.useState({height:void 0,width:void 0}),g=cd(),[_,v]=T.useState(),y=_??g,[b,x]=T.useState(!1),[S,C]=T.useState(!1),w=T.useRef(null),E=T.useRef(null),D=T.useRef(null),O=T.useRef(null),k=Nf(O,!1),A=X(e=>{let t=!o,n=yf(tf,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!b&&!S&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return Z(()=>{a&&E.current===`none`&&!S&&!o&&l(!1)},[a,S,o,t,l]),T.useMemo(()=>({abortControllerRef:w,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:x,setKeepMounted:C,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[w,E,i,A,p,c,o,y,O,k,h,x,C,l,s,f,D,u,d,m])}var A7=T.createContext(void 0);function j7(){let e=T.useContext(A7);if(e===void 0)throw Error(Ou(15));return e}var M7=T.createContext(void 0);function N7(){let e=T.useContext(M7);if(e===void 0)throw Error(Ou(9));return e}var P7=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=If.startingStyle]=`startingStyle`,e[e.endingStyle=If.endingStyle]=`endingStyle`,e}({}),F7=function(e){return e.panelOpen=`data-panel-open`,e}({}),I7={[P7.open]:``},L7={[P7.closed]:``},R7={open(e){return e?{[F7.panelOpen]:``}:null}},z7={open(e){return e?I7:L7}},B7=function(e){return e.index=`data-index`,e.disabled=`data-disabled`,e.open=`data-open`,e}({}),V7={...z7,index:e=>Number.isInteger(e)?{[B7.index]:String(e)}:null,...zf,value:()=>null},H7=T.forwardRef(function(e,t){let{className:n,disabled:r=!1,onOpenChange:i,render:a,value:o,...s}=e,{ref:c,index:l}=fp(),u=gu(t,c),{disabled:d,handleValueChange:f,state:p,value:m}=E7(),h=cd(),g=o??h,_=r||d,v=T.useMemo(()=>{if(!m)return!1;for(let e=0;e<m.length;e+=1)if(m[e]===g)return!0;return!1},[m,g]),y=X((e,t)=>{i?.(e,t),!t.isCanceled&&f(g,e)}),b=k7({open:v,onOpenChange:y,disabled:_}),x=T.useMemo(()=>({open:b.open,disabled:b.disabled,hidden:!b.mounted,transitionStatus:b.transitionStatus}),[b.open,b.disabled,b.mounted,b.transitionStatus]),S=T.useMemo(()=>({...b,onOpenChange:y,state:x}),[b,x,y]),C=T.useMemo(()=>({...p,index:l,disabled:_,open:v}),[_,l,v,p]),[w,E]=T.useState(cd()),D=T.useMemo(()=>({open:v,state:C,setTriggerId:E,triggerId:w}),[v,C,E,w]),O=$u(`div`,e,{state:C,ref:u,props:s,stateAttributesMapping:V7});return(0,J.jsx)(A7.Provider,{value:S,children:(0,J.jsx)(M7.Provider,{value:D,children:O})})}),U7=T.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=N7();return $u(`h3`,e,{state:a,ref:t,props:i,stateAttributesMapping:V7})});function W7(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var G7=new Set([sy,oy,ly,cy,uy,`End`]);function K7(e){let{current:t}=e,n=[];for(let e=0;e<t.length;e+=1){let r=t[e];if(!W7(r)){let e=r?.querySelector(`[type="button"]`);W7(e)||n.push(e)}}return n}var q7=T.forwardRef(function(e,t){let{disabled:n,className:r,id:i,render:a,nativeButton:o=!0,...s}=e,{panelId:c,open:l,handleTrigger:u,disabled:d}=j7(),f=n??d,{getButtonProps:p,buttonRef:m}=Ld({disabled:f,focusableWhenDisabled:!0,native:o}),{accordionItemRefs:h,direction:g,loopFocus:_,orientation:v}=E7(),y=g===`rtl`,b=v===`horizontal`,{state:x,setTriggerId:S,triggerId:C}=N7();Z(()=>(i&&S(i),()=>{S(void 0)}),[i,S]);let w=T.useMemo(()=>({"aria-controls":l?c:void 0,"aria-expanded":l,disabled:f,id:C,onClick:u,onKeyDown(e){if(!G7.has(e.key))return;nm(e);let t=K7(h),n=t.length-1,r=-1,i=t.indexOf(e.target);function a(){r=_?i+1>n?0:i+1:Math.min(i+1,n)}function o(){r=_&&i===0?n:i-1}switch(e.key){case sy:b||a();break;case oy:b||o();break;case ly:b&&(y?o():a());break;case cy:b&&(y?a():o());break;case`Home`:r=0;break;case`End`:r=n;break;default:break}r>-1&&t[r].focus()}}),[h,f,u,C,b,y,_,l,c]);return $u(`button`,e,{state:x,ref:[t,m],props:[w,s,p],stateAttributesMapping:R7})}),J7=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function Y7(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,b=T.useRef(!1),x=T.useRef(null),S=T.useRef(u),C=T.useRef(u),w=jf(),E=T.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=gu(r,d,X(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(J7.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),C.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=Af.request(()=>{C.current=!1,r=Af.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{Af.cancel(t),Af.cancel(r)}}));return Z(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!C.current&&!o&&e.setAttribute(P7.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=Af.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=P7.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),w.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{Af.cancel(r)}},[t,n,w,a,o,c,u,d,f,p,m]),Z(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(x.current=e.style.animationName||x.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!S.current&&!b.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Df(()=>{let e=Af.request(()=>{S.current=!1});return()=>Af.cancel(e)}),Z(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&b.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=Af.request(()=>{b.current=!1,n=Af.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{Af.cancel(t),Af.cancel(n)}},[a,u,d,p]),Z(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(P7.startingStyle,``))},[a,E,n,d]),T.useEffect(function(){let e=d.current;if(!e)return;function t(e){b.current=!0,h(!0),l(!0,yf(ef,e))}return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},[l,d,h]),T.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var X7=function(e){return e.accordionPanelHeight=`--accordion-panel-height`,e.accordionPanelWidth=`--accordion-panel-width`,e}({}),Z7=T.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,id:a,render:o,...s}=e,{hiddenUntilFound:c,keepMounted:l}=E7(),{abortControllerRef:u,animationTypeRef:d,height:f,mounted:p,onOpenChange:m,open:h,panelId:g,panelRef:_,runOnceAnimationsFinish:v,setDimensions:y,setHiddenUntilFound:b,setKeepMounted:x,setMounted:S,setOpen:C,setVisible:w,transitionDimensionRef:E,visible:D,width:O,setPanelIdState:k,transitionStatus:A}=j7(),j=r??c,M=i??l;Z(()=>{if(a)return k(a),()=>{k(void 0)}},[a,k]),Z(()=>{b(j)},[b,j]),Z(()=>{x(M)},[x,M]),Pf({open:h&&A===`idle`,ref:_,onComplete(){h&&y({width:void 0,height:void 0})}});let{props:N}=Y7({abortControllerRef:u,animationTypeRef:d,externalRef:t,height:f,hiddenUntilFound:j,id:a??g,keepMounted:M,mounted:p,onOpenChange:m,open:h,panelRef:_,runOnceAnimationsFinish:v,setDimensions:y,setMounted:S,setOpen:C,setVisible:w,transitionDimensionRef:E,visible:D,width:O}),{state:P,triggerId:F}=N7(),I=$u(`div`,e,{state:T.useMemo(()=>({...P,transitionStatus:A}),[P,A]),ref:[t,_],props:[N,{"aria-labelledby":F,role:`region`,style:{[X7.accordionPanelHeight]:f===void 0?`auto`:`${f}px`,[X7.accordionPanelWidth]:O===void 0?`auto`:`${O}px`}},s],stateAttributesMapping:V7});return M||j||!M&&p?I:null});function Q7(e){let t=T.createContext(void 0);return[({value:e,children:n})=>(0,J.jsx)(t.Provider,{value:e,children:n}),()=>{let n=T.useContext(t);if(n===void 0)throw Error(`useContext must be used within ${e??`a Provider`}`);return n}]}function $7(e){let{value:t,defaultValue:n,onChange:r}=e,[i,a]=T.useState(t===void 0?n:t);return T.useEffect(()=>{t!==void 0&&a(t)},[t]),[i,T.useCallback((e,...t)=>{a(e),r?.(e,...t)},[r])]}var[e9,t9]=Q7(`AccordionContext`),[n9,r9]=Q7(`AccordionItemContext`);function i9(e){let[t,n]=$7({value:e?.value,defaultValue:e?.defaultValue,onChange:e?.onValueChange});return(0,J.jsx)(e9,{value:{value:t,setValue:n},children:(0,J.jsx)(O7,{"data-slot":`accordion`,...e,onValueChange:n})})}function a9(e){let{value:t}=t9(),[n,r]=T.useState(t?.includes(e?.value)??!1);return T.useEffect(()=>{r(t?.includes(e?.value)??!1)},[t,e?.value]),(0,J.jsx)(n9,{value:{isOpen:n,setIsOpen:r},children:(0,J.jsx)(H7,{"data-slot":`accordion-item`,...e})})}function o9(e){return(0,J.jsx)(U7,{"data-slot":`accordion-header`,...e})}function s9(e){return(0,J.jsx)(q7,{"data-slot":`accordion-trigger`,...e})}function c9({transition:e={duration:.35,ease:`easeInOut`},hiddenUntilFound:t,keepRendered:n=!1,...r}){let{isOpen:i}=r9();return(0,J.jsx)(S8,{children:n?(0,J.jsx)(Z7,{hidden:!1,hiddenUntilFound:t,keepMounted:!0,render:(0,J.jsx)(v7.div,{"data-slot":`accordion-panel`,initial:{height:0,opacity:0,"--mask-stop":`0%`,y:20},animate:i?{height:`auto`,opacity:1,"--mask-stop":`100%`,y:0}:{height:0,opacity:0,"--mask-stop":`0%`,y:20},transition:e,style:{maskImage:`linear-gradient(black var(--mask-stop), transparent var(--mask-stop))`,WebkitMaskImage:`linear-gradient(black var(--mask-stop), transparent var(--mask-stop))`,overflow:`hidden`},...r},`accordion-panel`)}):i&&(0,J.jsx)(Z7,{hidden:!1,hiddenUntilFound:t,keepMounted:!0,render:(0,J.jsx)(v7.div,{"data-slot":`accordion-panel`,initial:{height:0,opacity:0,"--mask-stop":`0%`,y:20},animate:{height:`auto`,opacity:1,"--mask-stop":`100%`,y:0},exit:{height:0,opacity:0,"--mask-stop":`0%`,y:20},transition:e,style:{maskImage:`linear-gradient(black var(--mask-stop), transparent var(--mask-stop))`,WebkitMaskImage:`linear-gradient(black var(--mask-stop), transparent var(--mask-stop))`,overflow:`hidden`},...r},`accordion-panel`)})})}var[l9,u9]=Q7(`FilesContext`),[d9,f9]=Q7(`FolderContext`);function p9({children:e,defaultOpen:t,open:n,onOpenChange:r,style:i,...a}){let[o,s]=$7({value:n,defaultValue:t,onChange:r});return(0,J.jsx)(l9,{value:{open:o??[]},children:(0,J.jsx)(i9,{"data-slot":`files`,multiple:!0,defaultValue:t,value:n,onValueChange:s,style:{position:`relative`,overflow:`auto`,...i},...a,children:e})})}function m9({hover:e=!0,...t}){return(0,J.jsx)(S7,{"data-slot":`files-highlight`,controlledItems:!0,mode:`parent`,hover:e,...t})}function h9({value:e,...t}){let{open:n}=u9();return(0,J.jsx)(d9,{value:{isOpen:n.includes(e)},children:(0,J.jsx)(a9,{"data-slot":`folder-item`,value:e,...t})})}function g9(e){return(0,J.jsx)(o9,{"data-slot":`folder-header`,...e})}function _9(e){return(0,J.jsx)(s9,{"data-slot":`folder-trigger`,...e})}function v9(e){return(0,J.jsx)(c9,{"data-slot":`folder-panel`,...e})}function y9(e){return(0,J.jsx)(w7,{"data-slot":`file-highlight`,...e})}function b9(e){return(0,J.jsx)(`div`,{"data-slot":`file`,...e})}function x9(e){return(0,J.jsx)(`span`,{"data-slot":`file-icon`,...e})}function S9(e){return(0,J.jsx)(`span`,{"data-slot":`file-label`,...e})}function C9(e){return(0,J.jsx)(w7,{"data-slot":`folder-highlight`,...e})}function w9(e){return(0,J.jsx)(`div`,{"data-slot":`folder`,...e})}function T9({closeIcon:e,openIcon:t,transition:n={duration:.15},...r}){let{isOpen:i}=f9();return(0,J.jsx)(S8,{mode:`wait`,children:(0,J.jsx)(v7.span,{"data-slot":`folder-icon`,initial:{scale:.9},animate:{scale:1},exit:{scale:.9},transition:n,...r,children:i?t:e},i?`open`:`close`)})}function E9({className:e,children:t,...n}){return(0,J.jsx)(p9,{className:q(`p-2 w-full`,e),...n,children:(0,J.jsx)(m9,{className:`bg-accent rounded-lg pointer-events-none`,children:t})})}function D9(e){return(0,J.jsx)(p9,{...e})}function O9(e){return(0,J.jsx)(h9,{...e})}function k9({children:e,className:t,gitStatus:n,...r}){return(0,J.jsx)(g9,{children:(0,J.jsx)(_9,{className:`w-full text-start`,children:(0,J.jsx)(C9,{children:(0,J.jsxs)(w9,{className:`flex items-center justify-between gap-2 p-2 pointer-events-none`,children:[(0,J.jsxs)(`div`,{className:q(`flex items-center gap-2`,n===`untracked`&&`text-success`,n===`modified`&&`text-warning`,n===`deleted`&&`text-danger`),children:[(0,J.jsx)(T9,{closeIcon:(0,J.jsx)(ro,{className:`size-4.5`}),openIcon:(0,J.jsx)(to,{className:`size-4.5`})}),(0,J.jsx)(S9,{className:q(`text-sm`,t),...r,children:e})]}),n&&(0,J.jsx)(`span`,{className:q(`rounded-full size-2`,n===`untracked`&&`bg-success`,n===`modified`&&`bg-warning`,n===`deleted`&&`bg-danger`)})]})})})})}function A9(e){return(0,J.jsx)(`div`,{className:`relative ml-6 before:absolute before:-left-2 before:inset-y-0 before:w-px before:h-full before:bg-border`,children:(0,J.jsx)(v9,{...e})})}function j9({icon:e=Qa,className:t,children:n,gitStatus:r,...i}){return(0,J.jsx)(y9,{children:(0,J.jsxs)(b9,{className:q(`flex items-center justify-between gap-2 p-2 pointer-events-none`,r===`untracked`&&`text-success`,r===`modified`&&`text-warning`,r===`deleted`&&`text-danger`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(x9,{children:(0,J.jsx)(e,{className:`size-4.5`})}),(0,J.jsx)(S9,{className:q(`text-sm`,t),...i,children:n})]}),r&&(0,J.jsxs)(`span`,{className:`text-sm font-medium`,children:[r===`untracked`&&`U`,r===`modified`&&`M`,r===`deleted`&&`D`]})]})})}var M9={};function N9(e){let t={name:``,path:``,dirs:new Map,files:[]};for(let n of e){let e=n.split(`/`),r=t;for(let t=0;t<e.length-1;t++){let n=e[t],i=r.path?`${r.path}/${n}`:n,a=r.dirs.get(n);a||(a={name:n,path:i,dirs:new Map,files:[]},r.dirs.set(n,a)),r=a}r.files.push(n)}return t}function P9(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=n.split(`/`),i=``;for(let n=0;n<e.length-1;n++){i=i?`${i}/${e[n]}`:e[n];let a=t.get(i);t.set(i,a&&a!==r?`modified`:r)}}return t}var F9=(e,t)=>e.name.localeCompare(t.name);function I9({projectId:e,runId:t,files:n,selected:r,onToggle:i}){let[a,o]=(0,T.useState)(``),{value:s}=rC(()=>ia(e,t??void 0),M9,8e3,[e,t]),c=(0,T.useMemo)(()=>P9(s),[s]),l=(0,T.useMemo)(()=>{let e=a.trim().toLowerCase();return e?n.filter(t=>t.toLowerCase().includes(e)):n},[n,a]),u=(0,T.useMemo)(()=>N9(l),[l]),d=n=>(0,J.jsxs)(J.Fragment,{children:[[...n.dirs.values()].sort(F9).map(e=>{let t=c.get(e.path);return(0,J.jsxs)(O9,{value:e.path,children:[(0,J.jsx)(k9,{...t?{gitStatus:t}:{},children:e.name}),(0,J.jsx)(A9,{children:(0,J.jsx)(D9,{children:d(e)})})]},e.path)}),[...n.files].sort((e,t)=>e.localeCompare(t)).map(n=>{let a=n.slice(n.lastIndexOf(`/`)+1),o=r.has(n),c=s[n],l=(0,J.jsx)(j9,{icon:o?Va:Qa,className:`pointer-events-auto cursor-pointer`+(o?` text-primary`:``),onClick:()=>i(n),...c?{gitStatus:c}:{},children:a});return(0,J.jsx)(aZ,{projectId:e,runId:t,path:n,changed:!!c,children:l},n)})]});return n.length===0?null:(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-auto flex-col p-2`,children:[(0,J.jsx)(`input`,{type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:`Filter files…`,"aria-label":`Filter files`,className:`mb-2 w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-[var(--color-primary)]`}),a.trim()&&l.length===0?(0,J.jsxs)(`p`,{className:`px-1 py-2 text-xs text-muted-foreground`,children:[`No files match “`,a.trim(),`”.`]}):(0,J.jsxs)(J.Fragment,{children:[a.trim()&&(0,J.jsxs)(`p`,{className:`px-1 pb-1 text-[10px] text-muted-foreground`,children:[l.length,` of `,n.length,` files`]}),(0,J.jsx)(E9,{className:`min-h-0 flex-auto overflow-y-auto p-0 text-sm`,children:d(u)})]})]})}var L9={files:{label:`Files`,help:`The project’s files — click one to add it to the next session’s context.`},views:{label:`Views`,help:`Documents the agent pushed up during the session — a plan, a summary, a writeup.`},browser:{label:`Browser`,help:`Live view of the browser this session is driving.`},docs:{label:`Docs`,help:`The PLAN/TODO markdown files at the root of the workspace.`},history:{label:`History`,help:`Every finished session in this project, from the committed .the-framework/LOGS.md — it outlives the sidebar’s recent sessions, which are local and untracked.`}};function R9({projectId:e,runId:t,views:n,files:r,context:i,toggleContext:a,hasBrowser:o=!1,target:s,loop:c,docsInMain:l=!1}){let{value:u,loaded:d}=rC(e&&!l?()=>Gi(e):null,[],4e3,[e,l]),{value:f,loaded:p}=rC(e&&!l?()=>Ki(e):null,[],1e4,[e,l]),m=!l&&(!d||u.length>0),h=!l&&(!p||f.length>0),[g,_]=(0,T.useState)(`docs`),v=(0,T.useRef)(!1),y=e=>{v.current=!0,_(e)},b=n.length>0,x=r.length>0,S=o&&s!==`actions`,C=(0,T.useRef)(!1);if((0,T.useEffect)(()=>{let e=b&&!C.current;C.current=C.current||b,e?_(`views`):!v.current&&!b&&_(x?`files`:`docs`)},[b,x]),!e)return null;let w=[...x?[`files`]:[],...b?[`views`]:[],...S&&t?[`browser`]:[],...m?[`docs`]:[],...h?[`history`]:[]];if(w.length===0)return null;let E=w.includes(g)?g:w[0],D=r.filter(e=>i.has(e)).length,O=e=>e===`views`?n.length:e===`files`?D:0;return(0,J.jsxs)(`aside`,{className:q(`flex w-[22rem] shrink-0 flex-col border-l border-border`),children:[(0,J.jsx)(`div`,{role:`tablist`,"aria-label":`Rail panels`,className:`flex flex-wrap gap-1 p-2`,children:w.map(e=>(0,J.jsxs)(Q,{children:[(0,J.jsxs)(Ox,{render:(0,J.jsx)(Y,{role:`tab`,"aria-selected":E===e,variant:`ghost`,size:`sm`,className:q(`h-7 gap-1.5 text-xs`,E===e&&`bg-accent text-accent-foreground`),onClick:()=>y(e)}),children:[L9[e].label,O(e)>0&&(0,J.jsx)(kl,{className:`border-primary/40 text-primary`,children:O(e)})]}),(0,J.jsx)(kx,{className:`max-w-64`,children:L9[e].help})]},e))}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:E===`files`&&x?(0,J.jsx)(I9,{projectId:e,runId:t,files:r,selected:i,onToggle:a}):E===`views`&&b?(0,J.jsx)(AZ,{views:n}):E===`browser`&&S&&t?(0,J.jsx)(nY,{projectId:e,runId:t}):E===`history`?(0,J.jsx)(MG,{logs:f,loaded:p}):(0,J.jsx)(kG,{docs:u,loaded:d})}),c&&(0,J.jsx)(`div`,{className:`max-h-[33%] shrink-0 overflow-y-auto px-2 pb-2`,children:(0,J.jsx)(dG,{loop:c})})]})}var z9=(...e)=>K(`/server/events.telefunc.ts`,`onEvents`,e);z9._key=`/server/events.telefunc.ts:onEvents`;var B9=[1e3,2e3,4e3,8e3];function V9(e){return B9[Math.min(e,B9.length-1)]}var H9=1500;function U9(e,t,n){let[r,i]=(0,T.useState)([]),[a,o]=(0,T.useState)(!1),[s,c]=(0,T.useState)(!1);return(0,T.useEffect)(()=>{i([])},[n]),(0,T.useEffect)(()=>{if(i([]),o(!1),c(!1),!e)return;let n,r=!1,a=0,s=!0,l,u,d=()=>{r||(o(!0),l=setTimeout(f,V9(a++)))},f=()=>{let l=!s;s=!1,z9(e,t??void 0).then(e=>{if(r){e.close();return}n=e,a=0,o(!1);let t=l?[]:void 0,s=()=>{if(r||t===void 0)return;let e=t;t=void 0,i(e)};l?u=setTimeout(s,H9):i([]),e.listen(e=>{if(e.kind===`stream-sync`){s();return}eY(e),t?t.push(e):i(t=>[...t,e])}),e.onClose(e=>{t=void 0,u&&clearTimeout(u),e?d():r||c(!0)})},d)};return f(),()=>{r=!0,l&&clearTimeout(l),u&&clearTimeout(u),n?.close()}},[e,t]),{events:(0,T.useMemo)(()=>t?r:zl(r),[r,t]),lost:a,done:s}}var W9=`/logo.svg`,G9=`/logo-animated.svg`;function K9(e){return e?G9:W9}function q9(e,t=!0){(0,T.useEffect)(()=>{if(!t||typeof document>`u`)return;let n=document.querySelector(`link[rel~="icon"]`);n||(n=document.createElement(`link`),n.rel=`icon`,document.head.appendChild(n));let r=K9(e);n.getAttribute(`href`)!==r&&n.setAttribute(`href`,r)},[e,t])}function J9({runId:e}){let{events:t,lost:n,done:r}=U9(e),i=Ml(t);return q9(i),(0,J.jsxs)(`div`,{className:`flex h-screen flex-col`,children:[(0,J.jsxs)(`header`,{className:`flex items-center gap-3 border-b border-border px-4 py-3`,children:[(0,J.jsx)(AS,{className:`h-5 w-auto shrink-0`,working:i}),(0,J.jsx)(`span`,{className:`font-semibold`,children:`The Framework`}),(0,J.jsx)(kl,{className:`text-muted-foreground`,children:`watching`}),(0,J.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`read-only shared session`})]}),(0,J.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:t.length===0&&r?(0,J.jsx)(`div`,{className:`grid flex-1 place-items-center px-6 text-center text-sm text-muted-foreground`,children:`This shared session isn’t available — it may have ended, or the link may be wrong.`}):(0,J.jsx)(TX,{events:t,lost:n})})]})}function Y9({title:e,detail:t,actionLabel:n,onAction:r}){return(0,J.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,J.jsx)(`p`,{className:`font-medium`,children:e}),(0,J.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:t}),(0,J.jsx)(Y,{variant:`outline`,onClick:r,children:n})]})}function X9(e){let{value:t,reload:n,loaded:r}=rC(e?()=>Ui(e):null,[],2e3,[e]);return{runs:t,reload:n,loaded:r}}r();async function Z9(e,t){l(e,`navigate`),d();let{keepScrollPosition:n,overwriteLastHistoryEntry:r,pageContext:i}=t??{};await o({scrollTarget:{preserveScroll:n??!1},urlOriginal:e,overwriteLastHistoryEntry:r,pageContextInitClient:i})}function iee(){let{urlPathname:e}=A();return{route:DC(e),go:(t,n)=>{let r=OC(t);r!==e&&Z9(r,n?.replace?{overwriteLastHistoryEntry:!0}:void 0)}}}function aee(){let[e,t]=(0,T.useState)(new Set);return{context:e,add:e=>t(t=>t.has(e)?t:new Set(t).add(e)),remove:e=>t(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),toggle:e=>t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),reset:()=>t(new Set)}}var oee=2;function see(e,t){if(typeof Notification>`u`||Notification.permission!==`granted`)return;let n=e[0];if(!n)return;let r=new Notification(t.title(n,e.length),{body:e.map(t.label).join(`
`)});r.onclick=()=>{let e=t.clickUrl(n);e?window.open(e,`_blank`,`noopener`):window.focus(),r.close()}}function Q9(e,t,n){let r=(0,T.useRef)(new Set),i=(0,T.useRef)(0),a=(0,T.useRef)(void 0);(0,T.useEffect)(()=>{if(e===a.current)return;a.current=e;let o=n.pickNew(r.current,e);i.current<oee?i.current+=1:t&&o.length>0&&see(o,n);for(let t of e)r.current.add(n.keyOf(t))},[e,t])}var cee={pickNew:gc,keyOf:hc,title:(e,t)=>t===1?`Human Queue · ${e.projectName}`:`${t} items in your Human Queue`,label:e=>e.kind===`awaiting`?e.title:e.kind===`unpushed`?e.commits===void 0||e.commits===0?`${e.title} — work not pushed`:`${e.title} — ${e.commits===1?`1 commit`:`${e.commits} commits`} not pushed`:`#${e.number} ${e.title}`,clickUrl:e=>e.kind===`awaiting`||e.kind===`unpushed`?void 0:e.url},lee={pickNew:vc,keyOf:_c,title:(e,t)=>t===1?`${e.kind===`started`?`Session started`:`Session finished`} · ${e.projectName}`:`${t} session updates`,label:e=>`${e.kind===`started`?`Started`:`Finished`}: ${e.title??`a session`}`,clickUrl:()=>void 0};function uee(e,t){Q9(e,t,cee)}function dee(e,t){Q9(e,t,lee)}function fee(e,t){return`${e>0?`(${e}) `:``}${t?`${t} — `:``}The Framework`}function pee(e,t){(0,T.useEffect)(()=>{typeof document>`u`||(document.title=fee(e,t))},[e,t])}var mee={active:[],queueOpen:0,recent:[]};function hee(e=!0){let{value:t}=rC(e?Ji:null,mee,5e3,[e]);return t.active.length>0}var $9=5e3;function gee(e=!0){let[t,n]=(0,T.useState)(!0);return(0,T.useEffect)(()=>{if(!e)return;let t=!1,r,i=()=>{xa().then(()=>{t||(n(!0),r=setTimeout(i,$9))},()=>{t||(n(!1),r=setTimeout(i,$9))})};return i(),()=>{t=!0,r&&clearTimeout(r)}},[e]),t}var _ee=n({default:()=>Cee}),vee=[],yee=[],bee=[],xee=[],See=[];function Cee(){let{route:e,go:t}=iee(),{view:n,projectId:r,runId:i,ticketSlug:a,plan:o}=e,[s,c]=(0,T.useState)({tick:0,intent:``,id:null}),[l,u]=(0,T.useState)(!1),{runs:d,reload:f,loaded:p}=X9(r),{context:m,add:h,remove:g,toggle:_,reset:v}=aee();(0,T.useEffect)(()=>{v()},[r]);let{value:y}=rC(r?()=>ra(r,i??void 0):null,vee,1e4,[r,i]),{value:b}=rC(Zi,bee,15e3,[]),[x,S]=(0,T.useState)(0),C=nC(xa,yee,[x]),w=r?C.find(e=>e.id===r)?.name:null;pee(b.length,w);let E=r!==null&&C.length>0&&!C.some(e=>e.id===r),D=fw();uee(b,Sw(D)&&vw(D));let O=xw(D)&&vw(D),{value:k}=rC(O?$i:null,xee,15e3,[O]);dee(k,O);let{value:A}=rC(r===null?Yi:null,See,1e4,[r]),j=(e,n,a,o)=>{let s=a!==void 0&&a===i&&e===r;c(e=>({tick:s?e.tick:e.tick+1,intent:n,id:a??null,...o?{runsOn:o}:{}})),u(a===void 0),v(),t({projectId:e,runId:a??null}),f()},M=(e,t,n)=>j(r,e,t,n);(0,T.useEffect)(()=>{if(!l)return;let e=d.find(e=>e.status===`running`);e&&(u(!1),t({projectId:r,runId:e.id},{replace:!0}))},[l,d,r]);let N=e=>{u(!1),t({projectId:r,runId:e})},P=e=>{u(!1),t({projectId:e,runId:null})},F=(e,n)=>{u(!1),t({projectId:e,runId:n})},I=e=>{u(!1),v(),t({projectId:e,runId:null})},L=()=>{u(!1),t({projectId:null,runId:null})},R=()=>{u(!1),t({view:`settings`,projectId:null,runId:null})},z=()=>{u(!1),t({view:`tickets`,projectId:null,runId:null})},B=(e,n)=>{u(!1),t({view:`tickets`,projectId:e,runId:null,ticketSlug:n})},ee=(e,n)=>{u(!1),t({view:`tickets`,projectId:e,runId:null,ticketSlug:n,plan:!0})},{events:V,lost:H}=U9(r,i,s.tick),te=zl(V),U=r?jl(te):[],[W,ne]=(0,T.useState)(null),re=typeof window>`u`?null:new URLSearchParams(window.location.search).get(`run`),ie=re===null,ae=hee(ie);q9(ae,ie);let oe=gee(ie);if(re)return(0,J.jsx)(J9,{runId:re});let se=i?d.find(e=>e.id===i):void 0;return(0,J.jsxs)(mS,{className:`h-screen flex-col overflow-hidden`,children:[!oe&&(0,J.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 border-b border-border bg-warning/10 px-4 py-2 text-xs text-warning`,children:[(0,J.jsx)(No,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),`The daemon is not answering — retrying. Everything on this page is frozen until it returns.`]}),(0,J.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:[(0,J.jsx)(Hw,{projectId:r,runs:d,selectedRunId:i,onSelect:N,recentRuns:A,onSelectRecent:F,projects:C,onNewSessionInProject:I,onProjectAdded:()=>{S(e=>e+1),f()},startTick:s.tick,startIntent:s.intent,followLive:l,working:ae,onDashboard:L,onSelectProject:P,onSettings:R,onTickets:z,ticketsActive:n===`tickets`,interventionCount:b.length}),(0,J.jsx)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:n===`settings`?(0,J.jsx)(HK,{onRunStarted:j,onDone:L}):n===`tickets`&&r&&a&&o?(0,J.jsx)(BJ,{projectId:r,slug:a,onBack:z}):n===`tickets`&&r&&a?(0,J.jsx)(LJ,{projectId:r,slug:a,onBack:z}):n===`tickets`?(0,J.jsx)(IJ,{onOpenTicket:B,onOpenTicketPlan:ee,onRunStarted:j}):r?E?(0,J.jsx)(Y9,{title:`No such project`,detail:`No project is registered as "${r}". It may have been removed, or the link may be from another machine.`,actionLabel:`Go to the Overview`,onAction:L}):i===null?l?(0,J.jsx)(kZ,{projectId:r,runId:null,events:V,live:!0,label:s.intent||void 0,projectName:w,remoteLabel:s.runsOn,files:y,addContext:h,removeContext:g,lost:H,onRunStarted:M,onLoopStatus:ne}):(0,J.jsx)(FG,{projectId:r,events:V,onRunStarted:M,files:y,context:m,addContext:h,removeContext:g,toggleContext:_,onOpenSession:F}):se?(0,J.jsx)(kZ,{projectId:r,runId:i,events:V,live:se.status===`running`,label:$l(se),projectName:w,files:y,addContext:h,removeContext:g,lost:H,target:se.target,remoteLabel:se.remoteLabel,armedDefault:se.handoff,onRunStarted:M,onLoopStatus:ne,onDeleted:()=>{N(null),f()}}):i===s.id||!p?(0,J.jsx)(kZ,{projectId:r,runId:i,events:V,live:!0,label:s.intent||void 0,projectName:w,remoteLabel:i===s.id?s.runsOn:void 0,files:y,addContext:h,removeContext:g,lost:H,onRunStarted:M,onLoopStatus:ne}):(0,J.jsx)(Y9,{title:`This session is gone`,detail:`It is not in this project's sessions. A session disappears when its worktree is removed.`,actionLabel:`Back to the project`,onAction:()=>N(null)}):(0,J.jsx)(IK,{onSelectProject:P,onSelectRun:F,onOpenTicket:B,onRunStarted:j,interventions:b})}),n!==`tickets`&&(0,J.jsx)(R9,{projectId:r,runId:i,views:U,files:y,context:m,toggleContext:_,hasBrowser:se?.status===`running`&&se.browserStreamPort!==void 0,target:se?.target,loop:W,docsInMain:n!==`settings`&&!!r&&!E&&i===null&&!l})]})]})}var wee=class extends T.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`Dashboard render error:`,e,t.componentStack)}reset=()=>this.setState({error:null});render(){let{error:e}=this.state;return e?(0,J.jsxs)(`div`,{role:`alert`,className:`flex min-h-screen flex-col items-center justify-center gap-3 bg-background p-8 text-center text-foreground`,children:[(0,J.jsx)(`p`,{className:`text-base font-medium`,children:`Something went wrong`}),(0,J.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:`The dashboard hit an error and could not finish drawing this view. Your session is safe — the daemon keeps running. Try again, or reload the page.`}),e.message&&(0,J.jsx)(`pre`,{className:`max-w-md overflow-x-auto rounded-md bg-muted px-3 py-2 text-left text-xs text-muted-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(Y,{variant:`outline`,onClick:this.reset,children:`Try again`}),(0,J.jsx)(Y,{onClick:()=>window.location.reload(),children:`Reload`})]})]}):this.props.children}};function Tee({children:e}){let t=gw(fw());return(0,T.useEffect)(()=>{let e=document.documentElement,n=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>e.classList.toggle(`dark`,_w(t,n.matches));if(r(),t===`system`)return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[t]),(0,J.jsx)(`div`,{className:`min-h-screen bg-background text-foreground`,children:(0,J.jsx)(wee,{children:e})})}var Eee={component:Dee};function Dee(){return T.createElement(T.Fragment,null,T.createElement(`div`,{style:{width:`100%`,height:`100%`,maxHeight:`100%`,background:`linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%)`,borderRadius:`5px`,backgroundSize:`200% 100%`,animation:`1.3s vike-react-loading linear infinite`,aspectRatio:`2.5/1`}}),T.createElement(`style`,{href:`vike-react-loading`,precedence:`default`},`
          @keyframes vike-react-loading {
            to {
              background-position-x: -200%;
            }
          }
        `))}var Oee={hasServerOnlyHook:{type:`computed`,definedAtData:null,valueSerialized:{type:`js-serialized`,value:!1}},isClientRuntimeLoaded:{type:`computed`,definedAtData:null,valueSerialized:{type:`js-serialized`,value:!0}},onBeforeRenderEnv:{type:`computed`,definedAtData:null,valueSerialized:{type:`js-serialized`,value:null}},dataEnv:{type:`computed`,definedAtData:null,valueSerialized:{type:`js-serialized`,value:null}},guardEnv:{type:`computed`,definedAtData:null,valueSerialized:{type:`js-serialized`,value:null}},onRenderClient:{type:`standard`,definedAtData:{filePathToShowToUser:`vike-react/__internal/integration/onRenderClient`,fileExportPathToShowToUser:[]},valueSerialized:{type:`pointer-import`,value:B}},Page:{type:`standard`,definedAtData:{filePathToShowToUser:`/pages/index/+Page.tsx`,fileExportPathToShowToUser:[]},valueSerialized:{type:`plus-file`,exportValues:_ee}},hydrationCanBeAborted:{type:`standard`,definedAtData:{filePathToShowToUser:`vike-react/config`,fileExportPathToShowToUser:[`default`,`hydrationCanBeAborted`]},valueSerialized:{type:`js-serialized`,value:!0}},Layout:{type:`cumulative`,definedAtData:[{filePathToShowToUser:`/layouts/LayoutDefault.tsx`,fileExportPathToShowToUser:[]}],valueSerialized:[{type:`pointer-import`,value:Tee}]},title:{type:`standard`,definedAtData:{filePathToShowToUser:`/pages/+config.ts`,fileExportPathToShowToUser:[`default`,`title`]},valueSerialized:{type:`js-serialized`,value:`The Framework`}},Loading:{type:`standard`,definedAtData:{filePathToShowToUser:`vike-react/__internal/integration/Loading`,fileExportPathToShowToUser:[]},valueSerialized:{type:`pointer-import`,value:Eee}}};export{Oee as configValuesSerialized};