specrails-desktop 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/client/dist/assets/{ActivityFeedPage-CzMoyXH1.js → ActivityFeedPage-BupGdGjj.js} +1 -1
  2. package/client/dist/assets/{AgentsPage-ClIs2Gio.js → AgentsPage-F3xksiLd.js} +1 -1
  3. package/client/dist/assets/{AnalyticsPage-1oKv_dqQ.js → AnalyticsPage-D6LE6wG2.js} +1 -1
  4. package/client/dist/assets/{BarChart-Cx2nKLkI.js → BarChart-B366kDEj.js} +1 -1
  5. package/client/dist/assets/{CodePage-sMBftx0a.js → CodePage-DLwCJgQ0.js} +1 -1
  6. package/client/dist/assets/{DesktopAnalyticsPage-zeI2hEc4.js → DesktopAnalyticsPage-DG5LA_WO.js} +1 -1
  7. package/client/dist/assets/{DocsDialog-DZAg7yxC.js → DocsDialog-ChQ1oXLC.js} +1 -1
  8. package/client/dist/assets/{DocsPage-Bv5oHAxO.js → DocsPage-BfGH8NUf.js} +1 -1
  9. package/client/dist/assets/{ExportDropdown-lHMFeaal.js → ExportDropdown-9tRrlfM7.js} +1 -1
  10. package/client/dist/assets/{IntegrationsPage-WQ2Tzm5R.js → IntegrationsPage-DANIzihd.js} +1 -1
  11. package/client/dist/assets/JobDetailPage-1RtejIOB.js +16 -0
  12. package/client/dist/assets/{JobsPage-CF03VyL2.js → JobsPage-NuDf5Zbx.js} +1 -1
  13. package/client/dist/assets/{dist-js-DAazzqbg.js → dist-js-BvQ52Q67.js} +1 -1
  14. package/client/dist/assets/{dist-js-DM8sRRAb.js → dist-js-XEilFTNz.js} +1 -1
  15. package/client/dist/assets/{index-D_VMXR78.js → index-CNiaj7Sj.js} +7 -7
  16. package/client/dist/assets/index-DgFfrrTX.css +2 -0
  17. package/client/dist/assets/jobs-2N3RXDAM.js +1 -0
  18. package/client/dist/assets/jobs-2f6Hdc72.js +1 -0
  19. package/client/dist/assets/jobs-3j3_npyo.js +1 -0
  20. package/client/dist/assets/jobs-BqEbCCxD.js +1 -0
  21. package/client/dist/assets/jobs-DPPT6bV6.js +1 -0
  22. package/client/dist/assets/jobs-DRzjWI9u.js +1 -0
  23. package/client/dist/assets/jobs-cHYInoau.js +1 -0
  24. package/client/dist/assets/jobs-vGfzIDQa.js +1 -0
  25. package/client/dist/assets/{lib-pFaBHHQU.js → lib-DZJmnErt.js} +1 -1
  26. package/client/dist/assets/{useProjectCache-CqO7QEtg.js → useProjectCache-H0T8Ot9j.js} +1 -1
  27. package/client/dist/index.html +3 -3
  28. package/package.json +1 -1
  29. package/client/dist/assets/JobDetailPage-D59Uhx1u.js +0 -16
  30. package/client/dist/assets/index-CimDRRi7.css +0 -2
  31. package/client/dist/assets/jobs-BE1siB0M.js +0 -1
  32. package/client/dist/assets/jobs-BHcQ_Faf.js +0 -1
  33. package/client/dist/assets/jobs-CFfc2dNX.js +0 -1
  34. package/client/dist/assets/jobs-CSi5n8X_.js +0 -1
  35. package/client/dist/assets/jobs-Dc3X86PY.js +0 -1
  36. package/client/dist/assets/jobs-De5tASex.js +0 -1
  37. package/client/dist/assets/jobs-DsoXEdo7.js +0 -1
  38. package/client/dist/assets/jobs-Wl-ApPMb.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-Dv6H7wEr.js","assets/chunk-CilyBKbf.js","assets/addspec-GWm4ffKl.js","assets/agents-CMxtJMLD.js","assets/agentstudio-CxlUllqI.js","assets/aiedit-TTwzL1TS.js","assets/analytics-DMCto-TF.js","assets/attachments-BIsSSnHJ.js","assets/browser-Qya9cARy.js","assets/chat-BsbNGPW9.js","assets/code-D3zVVQTj.js","assets/commands-IXMOKBYt.js","assets/common-wA36jmj1.js","assets/dashboard-Duo4DDCW.js","assets/explore-hFc3HFcp.js","assets/integrations-D28q1kF6.js","assets/jobs-DsoXEdo7.js","assets/nav-BEL3MTwK.js","assets/settings-DDcfx_ca.js","assets/setup-BqYA02rS.js","assets/specs-cKEh2LXt.js","assets/terminal-CSONJOex.js","assets/tickets-DucYgtdl.js","assets/addon-image-3WCl5Vhd.js","assets/addon-ligatures-C5OdliKs.js","assets/addon-webgl-BbX6pSjl.js","assets/JobDetailPage-D59Uhx1u.js","assets/lib-pFaBHHQU.js","assets/format-command-CwGuwzGA.js","assets/JobsPage-CF03VyL2.js","assets/ExportDropdown-lHMFeaal.js","assets/useProjectCache-CqO7QEtg.js","assets/AnalyticsPage-1oKv_dqQ.js","assets/BarChart-Cx2nKLkI.js","assets/clsx-DnqN-uhr.js","assets/ActivityFeedPage-CzMoyXH1.js","assets/AgentsPage-ClIs2Gio.js","assets/CodePage-sMBftx0a.js","assets/preload-helper-DSXbuxSR.js","assets/IntegrationsPage-WQ2Tzm5R.js","assets/DesktopAnalyticsPage-zeI2hEc4.js","assets/DocsPage-Bv5oHAxO.js","assets/atom-one-dark-B-oHczHB.css","assets/DocsDialog-DZAg7yxC.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./chunk-CilyBKbf.js";import{t as r}from"./preload-helper-DSXbuxSR.js";import{t as i}from"./activity-Dv6H7wEr.js";import{t as a}from"./addspec-GWm4ffKl.js";import{t as o}from"./agents-CMxtJMLD.js";import{t as s}from"./agentstudio-CxlUllqI.js";import{t as c}from"./aiedit-TTwzL1TS.js";import{t as l}from"./analytics-DMCto-TF.js";import{t as u}from"./attachments-BIsSSnHJ.js";import{t as d}from"./browser-Qya9cARy.js";import{t as f}from"./chat-BsbNGPW9.js";import{t as p}from"./code-D3zVVQTj.js";import{t as m}from"./commands-IXMOKBYt.js";import{t as h}from"./common-wA36jmj1.js";import{t as g}from"./dashboard-Duo4DDCW.js";import{t as _}from"./explore-hFc3HFcp.js";import{t as v}from"./integrations-D28q1kF6.js";import{t as y}from"./jobs-DsoXEdo7.js";import{t as b}from"./nav-BEL3MTwK.js";import{t as x}from"./settings-DDcfx_ca.js";import{t as S}from"./setup-BqYA02rS.js";import{t as C}from"./specs-cKEh2LXt.js";import{t as w}from"./terminal-CSONJOex.js";import{t as T}from"./tickets-DucYgtdl.js";import{t as E}from"./clsx-DnqN-uhr.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var D=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function 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.4`})),O=n(((e,t)=>{t.exports=D()})),k=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),A=n(((e,t)=>{t.exports=k()})),j=n((e=>{var t=O();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.4`})),M=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=j()})),N=n((e=>{var t=A(),n=O(),r=M();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||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 g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case T: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,ee={pending:!1,data:null,method:null,action:null},R=[],te=-1;function z(e){return{current:e}}function B(e){0>te||(e.current=R[te],R[te]=null,te--)}function V(e,t){te++,R[te]=e.current,e.current=t}var H=z(null),U=z(null),ne=z(null),W=z(null);function re(e,t){switch(V(ne,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function ie(){B(H),B(U),B(ne)}function ae(e){e.memoizedState!==null&&V(W,e);var t=H.current,n=Kd(t,e.type);t!==n&&(V(U,e),V(H,n))}function oe(e){U.current===e&&(B(H),B(U)),W.current===e&&(B(W),np._currentValue=ee)}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(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-Dv6H7wEr.js","assets/chunk-CilyBKbf.js","assets/addspec-GWm4ffKl.js","assets/agents-CMxtJMLD.js","assets/agentstudio-CxlUllqI.js","assets/aiedit-TTwzL1TS.js","assets/analytics-DMCto-TF.js","assets/attachments-BIsSSnHJ.js","assets/browser-Qya9cARy.js","assets/chat-BsbNGPW9.js","assets/code-D3zVVQTj.js","assets/commands-IXMOKBYt.js","assets/common-wA36jmj1.js","assets/dashboard-Duo4DDCW.js","assets/explore-hFc3HFcp.js","assets/integrations-D28q1kF6.js","assets/jobs-cHYInoau.js","assets/nav-BEL3MTwK.js","assets/settings-DDcfx_ca.js","assets/setup-BqYA02rS.js","assets/specs-cKEh2LXt.js","assets/terminal-CSONJOex.js","assets/tickets-DucYgtdl.js","assets/addon-image-3WCl5Vhd.js","assets/addon-ligatures-C5OdliKs.js","assets/addon-webgl-BbX6pSjl.js","assets/JobDetailPage-1RtejIOB.js","assets/lib-DZJmnErt.js","assets/format-command-CwGuwzGA.js","assets/JobsPage-NuDf5Zbx.js","assets/ExportDropdown-9tRrlfM7.js","assets/useProjectCache-H0T8Ot9j.js","assets/AnalyticsPage-D6LE6wG2.js","assets/BarChart-B366kDEj.js","assets/clsx-DnqN-uhr.js","assets/ActivityFeedPage-BupGdGjj.js","assets/AgentsPage-F3xksiLd.js","assets/CodePage-DLwCJgQ0.js","assets/preload-helper-DSXbuxSR.js","assets/IntegrationsPage-DANIzihd.js","assets/DesktopAnalyticsPage-DG5LA_WO.js","assets/DocsPage-BfGH8NUf.js","assets/atom-one-dark-B-oHczHB.css","assets/DocsDialog-ChQ1oXLC.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./chunk-CilyBKbf.js";import{t as r}from"./preload-helper-DSXbuxSR.js";import{t as i}from"./activity-Dv6H7wEr.js";import{t as a}from"./addspec-GWm4ffKl.js";import{t as o}from"./agents-CMxtJMLD.js";import{t as s}from"./agentstudio-CxlUllqI.js";import{t as c}from"./aiedit-TTwzL1TS.js";import{t as l}from"./analytics-DMCto-TF.js";import{t as u}from"./attachments-BIsSSnHJ.js";import{t as d}from"./browser-Qya9cARy.js";import{t as f}from"./chat-BsbNGPW9.js";import{t as p}from"./code-D3zVVQTj.js";import{t as m}from"./commands-IXMOKBYt.js";import{t as h}from"./common-wA36jmj1.js";import{t as g}from"./dashboard-Duo4DDCW.js";import{t as _}from"./explore-hFc3HFcp.js";import{t as v}from"./integrations-D28q1kF6.js";import{t as y}from"./jobs-cHYInoau.js";import{t as b}from"./nav-BEL3MTwK.js";import{t as x}from"./settings-DDcfx_ca.js";import{t as S}from"./setup-BqYA02rS.js";import{t as C}from"./specs-cKEh2LXt.js";import{t as w}from"./terminal-CSONJOex.js";import{t as T}from"./tickets-DucYgtdl.js";import{t as E}from"./clsx-DnqN-uhr.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var D=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function 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.4`})),O=n(((e,t)=>{t.exports=D()})),k=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),A=n(((e,t)=>{t.exports=k()})),j=n((e=>{var t=O();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.4`})),M=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=j()})),N=n((e=>{var t=A(),n=O(),r=M();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||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 g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case T: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,ee={pending:!1,data:null,method:null,action:null},R=[],te=-1;function z(e){return{current:e}}function B(e){0>te||(e.current=R[te],R[te]=null,te--)}function V(e,t){te++,R[te]=e.current,e.current=t}var H=z(null),U=z(null),ne=z(null),W=z(null);function re(e,t){switch(V(ne,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function ie(){B(H),B(U),B(ne)}function ae(e){e.memoizedState!==null&&V(W,e);var t=H.current,n=Kd(t,e.type);t!==n&&(V(U,e),V(H,n))}function oe(e){U.current===e&&(B(H),B(U)),W.current===e&&(B(W),np._currentValue=ee)}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(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+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(`
5
5
  `),l=s.split(`
@@ -13,7 +13,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
13
13
  To pick up a draggable item, press the space bar.
14
14
  While dragging, use the arrow keys to move the item.
15
15
  Press space again to drop the item in its new position, or press escape to cancel.
16
- `},ao={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function oo(e){let{announcements:t=ao,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=io}=e,{announce:a,announcement:o}=eo(),s=Ba(`DndLiveRegion`),[c,l]=(0,F.useState)(!1);if((0,F.useEffect)(()=>{l(!0)},[]),no((0,F.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=F.createElement(F.Fragment,null,F.createElement(Qa,{id:r,value:i.draggable}),F.createElement($a,{id:s,announcement:o}));return n?(0,Zn.createPortal)(u,n):u}var so;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(so||={});function co(){}function lo(e,t){return(0,F.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function uo(){var e=[...arguments];return(0,F.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var fo=Object.freeze({x:0,y:0});function po(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function mo(e,t){let n=qa(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function ho(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function go(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _o(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function vo(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function yo(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var bo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=yo(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=po(yo(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ho)},xo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=_o(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=_o(r),o=i.reduce((e,t,r)=>e+po(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ho)};function So(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Co=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=So(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(go)};function wo(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var To=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&wo(r,a)){let n=_o(a).reduce((e,t)=>e+po(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(ho)};function Eo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Do(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:fo}function Oo(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ko=Oo(1);function Ao(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function jo(e,t,n){let r=Ao(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Mo={ignoreTransform:!1};function No(e,t){t===void 0&&(t=Mo);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Da(e).getComputedStyle(e);t&&(n=jo(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Po(e){return No(e,{ignoreTransform:!0})}function Fo(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Io(e,t){return t===void 0&&(t=Da(e).getComputedStyle(e)),t.position===`fixed`}function Lo(e,t){t===void 0&&(t=Da(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Ro(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Oa(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ka(i)||Aa(i)||n.includes(i))return n;let a=Da(e).getComputedStyle(i);return i!==e&&Lo(i,a)&&n.push(i),Io(i,a)?n:r(i.parentNode)}return e?r(e):n}function zo(e){let[t]=Ro(e,1);return t??null}function Bo(e){return!wa||!e?null:Ta(e)?e:Ea(e)?Oa(e)||e===ja(e).scrollingElement?window:ka(e)?e:null:null}function Vo(e){return Ta(e)?e.scrollX:e.scrollLeft}function Ho(e){return Ta(e)?e.scrollY:e.scrollTop}function Uo(e){return{x:Vo(e),y:Ho(e)}}var Wo;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Wo||={});function Go(e){return!wa||!e?!1:e===document.scrollingElement}function Ko(e){let t={x:0,y:0},n=Go(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var qo={x:.2,y:.2};function Jo(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=qo);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ko(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Wo.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Wo.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Wo.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Wo.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Yo(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Xo(e){return e.reduce((e,t)=>Ha(e,Uo(t)),fo)}function Zo(e){return e.reduce((e,t)=>e+Vo(t),0)}function Qo(e){return e.reduce((e,t)=>e+Ho(t),0)}function $o(e,t){if(t===void 0&&(t=No),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);zo(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var es=[[`x`,[`left`,`right`],Zo],[`y`,[`top`,`bottom`],Qo]],ts=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Ro(t),r=Xo(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of es)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},ns=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function rs(e){let{EventTarget:t}=Da(e);return e instanceof t?e:ja(e)}function is(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var as;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(as||={});function os(e){e.preventDefault()}function ss(e){e.stopPropagation()}var cs;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(cs||={});var ls={start:[cs.Space,cs.Enter],cancel:[cs.Esc],end:[cs.Space,cs.Enter,cs.Tab]},us=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case cs.Right:return{...n,x:n.x+25};case cs.Left:return{...n,x:n.x-25};case cs.Down:return{...n,y:n.y+25};case cs.Up:return{...n,y:n.y-25}}},ds=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new ns(ja(t)),this.windowListeners=new ns(Da(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(as.Resize,this.handleCancel),this.windowListeners.add(as.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(as.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&$o(n),t(fo)}handleKeyDown(e){if(Ga(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=ls,coordinateGetter:a=us,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:fo;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ua(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ko(n),p=Yo(n),m={x:Math.min(i===cs.Right?p.right-p.width/2:p.right,Math.max(i===cs.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===cs.Down?p.bottom-p.height/2:p.bottom,Math.max(i===cs.Down?p.top:p.top+p.height/2,u.y))},h=i===cs.Right&&!s||i===cs.Left&&!c,g=i===cs.Down&&!l||i===cs.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===cs.Right&&e<=d.x||i===cs.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===cs.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===cs.Down&&e<=d.y||i===cs.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===cs.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Ha(Ua(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};ds.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=ls,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function fs(e){return!!(e&&`distance`in e)}function ps(e){return!!(e&&`delay`in e)}var ms=class{constructor(e,t,n){n===void 0&&(n=rs(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=ja(i),this.documentListeners=new ns(this.document),this.listeners=new ns(n),this.windowListeners=new ns(Da(i)),this.initialCoordinates=qa(r)??fo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(as.Resize,this.handleCancel),this.windowListeners.add(as.DragStart,os),this.windowListeners.add(as.VisibilityChange,this.handleCancel),this.windowListeners.add(as.ContextMenu,os),this.documentListeners.add(as.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ps(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(fs(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(as.Click,ss,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(as.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=qa(e)??fo,s=Ua(n,o);if(!t&&a){if(fs(a)){if(a.tolerance!=null&&is(s,a.tolerance))return this.handleCancel();if(is(s,a.distance))return this.handleStart()}if(ps(a)&&is(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===cs.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},hs={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},gs=class extends ms{constructor(e){let{event:t}=e,n=ja(t.target);super(e,hs,n)}};gs.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var _s={move:{name:`mousemove`},end:{name:`mouseup`}},vs;(function(e){e[e.RightClick=2]=`RightClick`})(vs||={});var ys=class extends ms{constructor(e){super(e,_s,ja(e.event.target))}};ys.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===vs.RightClick?!1:(r?.({event:n}),!0)}}];var bs={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},xs=class extends ms{constructor(e){super(e,bs)}static setup(){return window.addEventListener(bs.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(bs.move.name,e)};function e(){}}};xs.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Ss;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Ss||={});var Cs;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Cs||={});function ws(e){let{acceleration:t,activator:n=Ss.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Cs.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Es({delta:d,disabled:!a}),[m,h]=Pa(),g=(0,F.useRef)({x:0,y:0}),_=(0,F.useRef)({x:0,y:0}),v=(0,F.useMemo)(()=>{switch(n){case Ss.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ss.DraggableRect:return i}},[n,i,c]),y=(0,F.useRef)(null),b=(0,F.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,F.useMemo)(()=>s===Cs.TreeOrder?[...l].reverse():l,[s,l]);(0,F.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Jo(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Ts={x:{[Wo.Backward]:!1,[Wo.Forward]:!1},y:{[Wo.Backward]:!1,[Wo.Forward]:!1}};function Es(e){let{delta:t,disabled:n}=e,r=Ra(t);return Ia(e=>{if(n||!r||!e)return Ts;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wo.Backward]:e.x[Wo.Backward]||i.x===-1,[Wo.Forward]:e.x[Wo.Forward]||i.x===1},y:{[Wo.Backward]:e.y[Wo.Backward]||i.y===-1,[Wo.Forward]:e.y[Wo.Forward]||i.y===1}}},[n,t,r])}function Ds(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Ia(e=>t==null?null:r??e??null,[r,t])}function Os(e,t){return(0,F.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ks;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ks||={});var As;(function(e){e.Optimized=`optimized`})(As||={});var js=new Map;function Ms(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,F.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,F.useRef)(e),d=g(),f=Fa(d),p=(0,F.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,F.useRef)(null),h=Ia(t=>{if(d&&!n)return js;if(!t||t===js||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new ts(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,F.useEffect)(()=>{u.current=e},[e]),(0,F.useEffect)(()=>{d||p()},[n,d]),(0,F.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,F.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case ks.Always:return!1;case ks.BeforeDragging:return n;default:return!n}}}function Ns(e,t){return Ia(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Ps(e,t){return Ns(e,t)}function Fs(e){let{callback:t,disabled:n}=e,r=Na(t),i=(0,F.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,F.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Is(e){let{callback:t,disabled:n}=e,r=Na(t),i=(0,F.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,F.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ls(e){return new ts(No(e),e)}function Rs(e,t,n){t===void 0&&(t=Ls);let[r,i]=(0,F.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Fs({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Is({callback:a});return Ma(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function zs(e){return Do(e,Ns(e))}var Bs=[];function Vs(e){let t=(0,F.useRef)(e),n=Ia(n=>e?n&&n!==Bs&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ro(e):Bs,[e]);return(0,F.useEffect)(()=>{t.current=e},[e]),n}function Hs(e){let[t,n]=(0,F.useState)(null),r=(0,F.useRef)(e),i=(0,F.useCallback)(e=>{let t=Bo(e.target);t&&n(e=>e?(e.set(t,Uo(t)),new Map(e)):null)},[]);return(0,F.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Bo(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Uo(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Bo(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,F.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Ha(e,t),fo):Xo(e):fo,[e,t])}function Us(e,t){t===void 0&&(t=[]);let n=(0,F.useRef)(null);return(0,F.useEffect)(()=>{n.current=null},t),(0,F.useEffect)(()=>{let t=e!==fo;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ua(e,n.current):fo}function Ws(e){(0,F.useEffect)(()=>{if(!wa)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Gs(e,t){return(0,F.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Ks(e){return(0,F.useMemo)(()=>e?Fo(e):null,[e])}var qs=[];function Js(e,t){t===void 0&&(t=No);let[n]=e,r=Ks(n?Da(n):null),[i,a]=(0,F.useState)(qs);function o(){a(()=>e.length?e.map(e=>Go(e)?r:new ts(t(e),e)):qs)}let s=Is({callback:o});return Ma(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ys(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ka(t)?t:e}function Xs(e){let{measure:t}=e,[n,r]=(0,F.useState)(null),i=Is({callback:(0,F.useCallback)(e=>{for(let{target:n}of e)if(ka(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=La((0,F.useCallback)(e=>{let n=Ys(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,F.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Zs=[{sensor:gs,options:{}},{sensor:ds,options:{}}],Qs={current:{}},$s={draggable:{measure:Po},droppable:{measure:Po,strategy:ks.WhileDragging,frequency:As.Optimized},dragOverlay:{measure:No}},ec=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},tc={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ec,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:co},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$s,measureDroppableContainers:co,windowRect:null,measuringScheduled:!1},nc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:co,draggableNodes:new Map,over:null,measureDroppableContainers:co},rc=(0,F.createContext)(nc),ic=(0,F.createContext)(tc);function ac(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ec}}}function oc(e,t){switch(t.type){case so.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case so.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case so.DragEnd:case so.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case so.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new ec(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case so.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new ec(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case so.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new ec(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sc(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,F.useContext)(rc),a=Ra(r),o=Ra(n?.id);return(0,F.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ga(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Xa(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function cc(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function lc(e){return(0,F.useMemo)(()=>({draggable:{...$s.draggable,...e?.draggable},droppable:{...$s.droppable,...e?.droppable},dragOverlay:{...$s.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function uc(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,F.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Ma(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Do(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=zo(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var dc=(0,F.createContext)({...fo,scaleX:1,scaleY:1}),fc;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(fc||={});var pc=(0,F.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Zs,collisionDetection:o=Co,measuring:s,modifiers:c,...l}=e,[u,d]=(0,F.useReducer)(oc,void 0,ac),[f,p]=ro(),[m,h]=(0,F.useState)(fc.Uninitialized),g=m===fc.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,F.useRef)({initial:null,translated:null}),C=(0,F.useMemo)(()=>_==null?null:{id:_,data:x?.data??Qs,rect:S},[_,x]),w=(0,F.useRef)(null),[T,E]=(0,F.useState)(null),[D,O]=(0,F.useState)(null),k=Fa(l,Object.values(l)),A=Ba(`DndDescribedBy`,t),j=(0,F.useMemo)(()=>b.getEnabled(),[b]),M=lc(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:I}=Ms(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),L=Ds(v,_),ee=(0,F.useMemo)(()=>D?qa(D):null,[D]),R=Te(),te=Ps(L,M.draggable.measure);uc({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:te,measure:M.draggable.measure});let z=Rs(L,M.draggable.measure,te),B=Rs(L?L.parentElement:null),V=(0,F.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),H=b.getNodeFor(V.current.over?.id),U=Xs({measure:M.dragOverlay.measure}),ne=U.nodeRef.current??L,W=g?U.rect??z:null,re=!!(U.nodeRef.current&&U.rect),ie=zs(re?null:z),ae=Ks(ne?Da(ne):null),oe=Vs(g?H??L:null),se=Js(oe),ce=cc(c,{transform:{x:y.x-ie.x,y:y.y-ie.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:W,over:V.current.over,overlayNodeRect:U.rect,scrollableAncestors:oe,scrollableAncestorRects:se,windowRect:ae}),le=ee?Ha(ee,y):null,ue=Hs(oe),de=Us(ue),fe=Us(ue,[z]),pe=Ha(ce,de),me=W?ko(W,ce):null,he=C&&me?o({active:C,collisionRect:me,droppableRects:N,droppableContainers:j,pointerCoordinates:le}):null,ge=vo(he,`id`),[_e,ve]=(0,F.useState)(null),ye=Eo(re?ce:Ha(ce,fe),_e?.rect??null,z),be=(0,F.useRef)(null),xe=(0,F.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:w.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Zn.unstable_batchedUpdates)(()=>{r?.(i),h(fc.Initializing),d({type:so.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(be.current),O(a)})},onMove(e){d({type:so.DragMove,coordinates:e})},onEnd:o(so.DragEnd),onCancel:o(so.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===so.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=so.DragCancel)}w.current=null,(0,Zn.unstable_batchedUpdates)(()=>{d({type:e}),h(fc.Uninitialized),ve(null),E(null),O(null),be.current=null;let t=e===so.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=Os(a,(0,F.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,xe(n,t))},[v,xe]));Ws(a),Ma(()=>{z&&m===fc.Initializing&&h(fc.Initialized)},[z,m]),(0,F.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:i};(0,Zn.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[pe.x,pe.y]),(0,F.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Zn.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),Ma(()=>{V.current={activatorEvent:D,active:C,activeNode:L,collisionRect:me,collisions:he,droppableRects:N,draggableNodes:v,draggingNode:ne,draggingNodeRect:W,droppableContainers:b,over:_e,scrollableAncestors:oe,scrollAdjustedTranslate:pe},S.current={initial:W,translated:me}},[C,L,he,me,v,ne,W,N,b,_e,oe,pe]),ws({...R,delta:y,draggingRect:me,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:se});let Ce=(0,F.useMemo)(()=>({active:C,activeNode:L,activeNodeRect:z,activatorEvent:D,collisions:he,containerNodeRect:B,dragOverlay:U,draggableNodes:v,droppableContainers:b,droppableRects:N,over:_e,measureDroppableContainers:P,scrollableAncestors:oe,scrollableAncestorRects:se,measuringConfiguration:M,measuringScheduled:I,windowRect:ae}),[C,L,z,D,he,B,U,v,b,N,_e,P,oe,se,M,I,ae]),we=(0,F.useMemo)(()=>({activatorEvent:D,activators:Se,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:P}),[D,Se,C,z,d,A,v,_e,P]);return F.createElement(to.Provider,{value:p},F.createElement(rc.Provider,{value:we},F.createElement(ic.Provider,{value:Ce},F.createElement(dc.Provider,{value:ye},i)),F.createElement(sc,{disabled:n?.restoreFocus===!1})),F.createElement(oo,{...n,hiddenTextDescribedById:A}));function Te(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),mc=(0,F.createContext)(null),hc=`button`,gc=`Draggable`;function _c(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ba(gc),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,F.useContext)(rc),{role:p=hc,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,F.useContext)(g?dc:mc),[v,y]=La(),[b,x]=La(),S=Gs(o,t),C=Fa(n);return Ma(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,F.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===hc?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function vc(){return(0,F.useContext)(ic)}var yc=`Droppable`,bc={timeout:25};function xc(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ba(yc),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,F.useContext)(rc),u=(0,F.useRef)({disabled:n}),d=(0,F.useRef)(!1),f=(0,F.useRef)(null),p=(0,F.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...bc,...i},_=Fa(h??r),v=Is({callback:(0,F.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=La((0,F.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Fa(t);return(0,F.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,F.useEffect)(()=>(s({type:so.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:so.UnregisterDroppable,key:a,id:r})),[r]),(0,F.useEffect)(()=>{n!==u.current.disabled&&(s({type:so.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Sc(e){let{animation:t,children:n}=e,[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(null),s=Ra(n);return!n&&!r&&s&&i(s),Ma(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),F.createElement(F.Fragment,null,n,r?(0,F.cloneElement)(r,{ref:o}):null)}var Cc={x:0,y:0,scaleX:1,scaleY:1};function wc(e){let{children:t}=e;return F.createElement(rc.Provider,{value:nc},F.createElement(dc.Provider,{value:Cc},t))}var Tc={position:`fixed`,touchAction:`none`},Ec=e=>Ga(e)?`transform 250ms ease`:void 0,Dc=(0,F.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Ec}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Tc,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ja.Transform.toString(d),transformOrigin:i&&r?mo(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return F.createElement(n,{className:o,style:f,ref:t},a)}),Oc={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ja.Transform.toString(t)},{transform:Ja.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function kc(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Na((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Ys(a);if(!c)return;let{transform:l}=Da(a).getComputedStyle(a),u=Ao(l);if(!u)return;let d=typeof t==`function`?t:Ac(t);return $o(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Ac(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Oc,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var jc=0;function Mc(e){return(0,F.useMemo)(()=>{if(e!=null)return jc++,jc},[e])}var Nc=F.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=vc(),S=(0,F.useContext)(dc),C=Mc(d?.id),w=cc(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=Ns(f),E=kc({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return F.createElement(wc,null,F.createElement(Sc,{animation:E},d&&C?F.createElement(Dc,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function Pc(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fc(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Ic(e){return e!==null&&e>=0}function Lc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Rc(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var zc=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Pc(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Bc={scaleX:1,scaleY:1},Vc=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...Bc}:null}let s=Hc(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Bc}:r<t&&r>=a?{x:0,y:o.height+s,...Bc}:{x:0,y:0,...Bc}};function Hc(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Uc=`Sortable`,Wc=F.createContext({activeIndex:-1,containerId:Uc,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zc,disabled:{draggable:!1,droppable:!1}});function Gc(e){let{children:t,id:n,items:r,strategy:i=zc,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=vc(),d=Ba(Uc,n),f=s.rect!==null,p=(0,F.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,F.useRef)(p),v=!Lc(p,_.current),y=g!==-1&&h===-1||v,b=Rc(a);Ma(()=>{v&&m&&u(p)},[v,p,m,u]),(0,F.useEffect)(()=>{_.current=p},[p]);let x=(0,F.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:Fc(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return F.createElement(Wc.Provider,{value:x},t)}var Kc=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Pc(n,r,i).indexOf(t)},qc=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Jc={duration:200,easing:`ease`},Yc=`transform`,Xc=Ja.Transition.toString({property:Yc,duration:0,easing:`linear`}),Zc={roleDescription:`sortable`};function Qc(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,F.useState)(null),s=(0,F.useRef)(n);return Ma(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=No(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,F.useEffect)(()=>{a&&o(null)},[a]),a}function $c(e){let{animateLayoutChanges:t=qc,attributes:n,disabled:r,data:i,getNewIndex:a=Kc,id:o,strategy:s,resizeObserverConfig:c,transition:l=Jc}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,F.useContext)(Wc),y=el(r,p),b=u.indexOf(o),x=(0,F.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,F.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=xc({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:I,transform:L}=_c({id:o,data:x,attributes:{...Zc,...n},disabled:y.draggable}),ee=Ca(E,j),R=!!D,te=R&&!m&&Ic(f)&&Ic(g),z=!_&&N,B=te?(z&&te?L:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,V=Ic(f)&&Ic(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,H=D?.id,U=(0,F.useRef)({activeId:H,items:u,newIndex:V,containerId:d}),ne=u!==U.current.items,W=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:l,wasDragging:U.current.activeId!=null}),re=Qc({disabled:!W,index:b,node:w,rect:C});return(0,F.useEffect)(()=>{R&&U.current.newIndex!==V&&(U.current.newIndex=V),d!==U.current.containerId&&(U.current.containerId=d),u!==U.current.items&&(U.current.items=u)},[R,V,d,u]),(0,F.useEffect)(()=>{if(H===U.current.activeId)return;if(H!=null&&U.current.activeId==null){U.current.activeId=H;return}let e=setTimeout(()=>{U.current.activeId=H},50);return()=>clearTimeout(e)},[H]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:V,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:I,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:re??B,transition:ie()};function ie(){if(re||ne&&U.current.newIndex===b)return Xc;if(!(z&&!Ga(O)||!l)&&(R||W))return Ja.Transition.toString({...l,property:Yc})}}function el(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function tl(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var nl=[cs.Down,cs.Right,cs.Up,cs.Left],rl=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(nl.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case cs.Down:r.top<a.top&&t.push(n);break;case cs.Up:r.top>a.top&&t.push(n);break;case cs.Left:r.left>a.left&&t.push(n);break;case cs.Right:r.left<a.left&&t.push(n);break}});let c=xo({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=vo(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Ro(c).some((e,t)=>s[t]!==e),i=il(e,t),a=al(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Ua(u,l)}}}};function il(e,t){return!tl(e)||!tl(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function al(e,t){return!tl(e)||!tl(t)||!il(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var ol=(()=>{if(typeof window>`u`)return``;if(`__TAURI_INTERNALS__`in window)return`http://localhost:4200`;let e=window.location.protocol;return e!==`http:`&&e!==`https:`?`http://localhost:4200`:``})(),sl=null;function cl(e){sl=e}function ll(){if(!sl)throw Error(`getApiBase called with no active project — call setActiveProjectId first`);return`${ol}/api/projects/${sl}`}var ul=null;async function dl(){for(let e=0;e<20;e++){try{let e=await fetch(`${ol}/api/token`);if(e.ok){ul=(await e.json()).token??null;return}}catch{}await new Promise(e=>setTimeout(e,300))}}function fl(){return ul}function pl(){return ul?`desktop-token.${ul}`:void 0}function ml(){let e=window.fetch.bind(window),t=typeof window<`u`?window.location.protocol:``,n=typeof window<`u`&&`__TAURI_INTERNALS__`in window||t!==``&&t!==`http:`&&t!==`https:`;window.fetch=function(t,r={}){let i=typeof t==`string`?t:t instanceof URL?t.href:t.url;if(n&&i.startsWith(`/`)&&(i=`http://localhost:4200${i}`,t=i),(()=>{if(i.startsWith(`/`))return!0;try{let e=new URL(i),t=ol?new URL(ol).origin:window.location.origin;return e.origin===t}catch{return!1}})()&&ul){let n=new Headers(r.headers);return n.has(`X-Desktop-Token`)||n.set(`X-Desktop-Token`,ul),e(t,{...r,headers:n})}return e(t,r)}}var hl=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),gl=n(((e,t)=>{t.exports=hl()})),q=gl(),_l=[1e3,2e3,4e3,8e3,16e3],vl=(0,F.createContext)(null);function yl({url:e,children:t}){let[n,r]=(0,F.useState)(`connecting`),i=(0,F.useRef)(new Map),a=(0,F.useRef)(null),o=(0,F.useRef)(0),s=(0,F.useRef)(null);(0,F.useEffect)(()=>{let t=!1;function n(){if(t)return;let c=pl(),l=c?new WebSocket(e,[`specrails-desktop`,c]):new WebSocket(e);a.current=l,r(`connecting`),l.onopen=()=>{if(t){l.close();return}o.current=0,r(`connected`)},l.onmessage=e=>{if(t)return;let n;try{n=JSON.parse(e.data)}catch{return}for(let e of i.current.values())e(n)},l.onclose=()=>{if(t)return;a.current=null;let e=o.current;if(e>=_l.length){r(`connecting`),s.current=setTimeout(n,3e4);return}r(`connecting`);let i=_l[e];o.current+=1,s.current=setTimeout(n,i)}}return n(),()=>{t=!0,s.current&&clearTimeout(s.current);let e=a.current;if(e)if(e.onmessage=null,e.onclose=null,e.onerror=null,e.readyState===WebSocket.CONNECTING)e.onopen=()=>{try{e.close()}catch{}};else{e.onopen=null;try{e.close()}catch{}}}},[e]);let c=(0,F.useCallback)((e,t)=>{i.current.set(e,t)},[]),l=(0,F.useCallback)(e=>{i.current.delete(e)},[]),u=(0,F.useMemo)(()=>({registerHandler:c,unregisterHandler:l,connectionStatus:n}),[c,l,n]);return(0,q.jsx)(vl.Provider,{value:u,children:t})}function bl(){let e=(0,F.useContext)(vl);if(!e)throw Error(`useSharedWebSocket must be used within SharedWebSocketProvider`);return e}function xl(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function Sl(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}function Cl(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Tl(s,e=>e.test(o)):wl(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function wl(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Tl(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function El(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Dl=365.2425,Ol=6048e5,kl=864e5,Al=43200,jl=1440,Ml=3600*24;Ml*7,Ml*Dl/12*3;var Nl=Symbol.for(`constructDateFrom`);function Pl(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Nl in e?e[Nl](t):e instanceof Date?new e.constructor(t):new Date(t)}function Fl(e,...t){let n=Pl.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}var Il={};function Ll(){return Il}function Rl(e,t){return Pl(t||e,e)}function zl(e,t){let n=Ll(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Rl(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Bl(e,t,n){let[r,i]=Fl(n?.in,e,t);return+zl(r,n)==+zl(i,n)}var Vl={lessThanXSeconds:{standalone:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`},withPreposition:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`}},xSeconds:{standalone:{one:`1 Sekunde`,other:`{{count}} Sekunden`},withPreposition:{one:`1 Sekunde`,other:`{{count}} Sekunden`}},halfAMinute:{standalone:`eine halbe Minute`,withPreposition:`einer halben Minute`},lessThanXMinutes:{standalone:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`},withPreposition:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`}},xMinutes:{standalone:{one:`1 Minute`,other:`{{count}} Minuten`},withPreposition:{one:`1 Minute`,other:`{{count}} Minuten`}},aboutXHours:{standalone:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`},withPreposition:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`}},xHours:{standalone:{one:`1 Stunde`,other:`{{count}} Stunden`},withPreposition:{one:`1 Stunde`,other:`{{count}} Stunden`}},xDays:{standalone:{one:`1 Tag`,other:`{{count}} Tage`},withPreposition:{one:`1 Tag`,other:`{{count}} Tagen`}},aboutXWeeks:{standalone:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`},withPreposition:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`}},xWeeks:{standalone:{one:`1 Woche`,other:`{{count}} Wochen`},withPreposition:{one:`1 Woche`,other:`{{count}} Wochen`}},aboutXMonths:{standalone:{one:`etwa 1 Monat`,other:`etwa {{count}} Monate`},withPreposition:{one:`etwa 1 Monat`,other:`etwa {{count}} Monaten`}},xMonths:{standalone:{one:`1 Monat`,other:`{{count}} Monate`},withPreposition:{one:`1 Monat`,other:`{{count}} Monaten`}},aboutXYears:{standalone:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahre`},withPreposition:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahren`}},xYears:{standalone:{one:`1 Jahr`,other:`{{count}} Jahre`},withPreposition:{one:`1 Jahr`,other:`{{count}} Jahren`}},overXYears:{standalone:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahre`},withPreposition:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahren`}},almostXYears:{standalone:{one:`fast 1 Jahr`,other:`fast {{count}} Jahre`},withPreposition:{one:`fast 1 Jahr`,other:`fast {{count}} Jahren`}}},Hl=(e,t,n)=>{let r,i=n?.addSuffix?Vl[e].withPreposition:Vl[e].standalone;return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:`vor `+r:r},Ul={date:xl({formats:{full:`EEEE, do MMMM y`,long:`do MMMM y`,medium:`do MMM y`,short:`dd.MM.y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'um' {{time}}`,long:`{{date}} 'um' {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Wl={lastWeek:`'letzten' eeee 'um' p`,yesterday:`'gestern um' p`,today:`'heute um' p`,tomorrow:`'morgen um' p`,nextWeek:`eeee 'um' p`,other:`P`},Gl=(e,t,n,r)=>Wl[e],Kl={narrow:[`v.Chr.`,`n.Chr.`],abbreviated:[`v.Chr.`,`n.Chr.`],wide:[`vor Christus`,`nach Christus`]},ql={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1. Quartal`,`2. Quartal`,`3. Quartal`,`4. Quartal`]},Jl={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mär`,`Apr`,`Mai`,`Jun`,`Jul`,`Aug`,`Sep`,`Okt`,`Nov`,`Dez`],wide:[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]},Yl={narrow:Jl.narrow,abbreviated:[`Jan.`,`Feb.`,`März`,`Apr.`,`Mai`,`Juni`,`Juli`,`Aug.`,`Sep.`,`Okt.`,`Nov.`,`Dez.`],wide:Jl.wide},Xl={code:`de`,formatDistance:Hl,formatLong:Ul,formatRelative:Gl,localize:{ordinalNumber:e=>Number(e)+`.`,era:Sl({values:Kl,defaultWidth:`wide`}),quarter:Sl({values:ql,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:Jl,formattingValues:Yl,defaultWidth:`wide`}),day:Sl({values:{narrow:[`S`,`M`,`D`,`M`,`D`,`F`,`S`],short:[`So`,`Mo`,`Di`,`Mi`,`Do`,`Fr`,`Sa`],abbreviated:[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`],wide:[`Sonntag`,`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachm.`,evening:`Abend`,night:`Nacht`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachm.`,evening:`abends`,night:`nachts`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(\.)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:Cl({matchPatterns:{narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^v/i,/^n/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},defaultMatchWidth:`wide`,parsePatterns:{any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Zl={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Ql=(e,t,n)=>{let r,i=Zl[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r},$l={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},eu=(e,t,n,r)=>$l[e],tu={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Sl({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})},nu={ordinalNumber:El({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},ru={code:`en-US`,formatDistance:Ql,formatLong:{date:xl({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:xl({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},formatRelative:eu,localize:tu,match:nu,options:{weekStartsOn:0,firstWeekContainsDate:1}},iu={lessThanXSeconds:{one:`menos de un segundo`,other:`menos de {{count}} segundos`},xSeconds:{one:`1 segundo`,other:`{{count}} segundos`},halfAMinute:`medio minuto`,lessThanXMinutes:{one:`menos de un minuto`,other:`menos de {{count}} minutos`},xMinutes:{one:`1 minuto`,other:`{{count}} minutos`},aboutXHours:{one:`alrededor de 1 hora`,other:`alrededor de {{count}} horas`},xHours:{one:`1 hora`,other:`{{count}} horas`},xDays:{one:`1 día`,other:`{{count}} días`},aboutXWeeks:{one:`alrededor de 1 semana`,other:`alrededor de {{count}} semanas`},xWeeks:{one:`1 semana`,other:`{{count}} semanas`},aboutXMonths:{one:`alrededor de 1 mes`,other:`alrededor de {{count}} meses`},xMonths:{one:`1 mes`,other:`{{count}} meses`},aboutXYears:{one:`alrededor de 1 año`,other:`alrededor de {{count}} años`},xYears:{one:`1 año`,other:`{{count}} años`},overXYears:{one:`más de 1 año`,other:`más de {{count}} años`},almostXYears:{one:`casi 1 año`,other:`casi {{count}} años`}},au=(e,t,n)=>{let r,i=iu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`en `+r:`hace `+r:r},ou={date:xl({formats:{full:`EEEE, d 'de' MMMM 'de' y`,long:`d 'de' MMMM 'de' y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'a las' {{time}}`,long:`{{date}} 'a las' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},su={lastWeek:`'el' eeee 'pasado a la' p`,yesterday:`'ayer a la' p`,today:`'hoy a la' p`,tomorrow:`'mañana a la' p`,nextWeek:`eeee 'a la' p`,other:`P`},cu={lastWeek:`'el' eeee 'pasado a las' p`,yesterday:`'ayer a las' p`,today:`'hoy a las' p`,tomorrow:`'mañana a las' p`,nextWeek:`eeee 'a las' p`,other:`P`},lu={code:`es`,formatDistance:au,formatLong:ou,formatRelative:(e,t,n,r)=>t.getHours()===1?su[e]:cu[e],localize:{ordinalNumber:(e,t)=>Number(e)+`º`,era:Sl({values:{narrow:[`AC`,`DC`],abbreviated:[`AC`,`DC`],wide:[`antes de cristo`,`después de cristo`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>Number(e)-1}),month:Sl({values:{narrow:[`e`,`f`,`m`,`a`,`m`,`j`,`j`,`a`,`s`,`o`,`n`,`d`],abbreviated:[`ene`,`feb`,`mar`,`abr`,`may`,`jun`,`jul`,`ago`,`sep`,`oct`,`nov`,`dic`],wide:[`enero`,`febrero`,`marzo`,`abril`,`mayo`,`junio`,`julio`,`agosto`,`septiembre`,`octubre`,`noviembre`,`diciembre`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`d`,`l`,`m`,`m`,`j`,`v`,`s`],short:[`do`,`lu`,`ma`,`mi`,`ju`,`vi`,`sá`],abbreviated:[`dom`,`lun`,`mar`,`mié`,`jue`,`vie`,`sáb`],wide:[`domingo`,`lunes`,`martes`,`miércoles`,`jueves`,`viernes`,`sábado`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`a`,pm:`p`,midnight:`mn`,noon:`md`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`},abbreviated:{am:`AM`,pm:`PM`,midnight:`medianoche`,noon:`mediodia`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`medianoche`,noon:`mediodia`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mn`,noon:`md`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`},abbreviated:{am:`AM`,pm:`PM`,midnight:`medianoche`,noon:`mediodia`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`medianoche`,noon:`mediodia`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Cl({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:1}},uu={lessThanXSeconds:{one:`moins d’une seconde`,other:`moins de {{count}} secondes`},xSeconds:{one:`1 seconde`,other:`{{count}} secondes`},halfAMinute:`30 secondes`,lessThanXMinutes:{one:`moins d’une minute`,other:`moins de {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`environ 1 heure`,other:`environ {{count}} heures`},xHours:{one:`1 heure`,other:`{{count}} heures`},xDays:{one:`1 jour`,other:`{{count}} jours`},aboutXWeeks:{one:`environ 1 semaine`,other:`environ {{count}} semaines`},xWeeks:{one:`1 semaine`,other:`{{count}} semaines`},aboutXMonths:{one:`environ 1 mois`,other:`environ {{count}} mois`},xMonths:{one:`1 mois`,other:`{{count}} mois`},aboutXYears:{one:`environ 1 an`,other:`environ {{count}} ans`},xYears:{one:`1 an`,other:`{{count}} ans`},overXYears:{one:`plus d’un an`,other:`plus de {{count}} ans`},almostXYears:{one:`presqu’un an`,other:`presque {{count}} ans`}},du=(e,t,n)=>{let r,i=uu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`dans `+r:`il y a `+r:r},fu={date:xl({formats:{full:`EEEE d MMMM y`,long:`d MMMM y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'à' {{time}}`,long:`{{date}} 'à' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},pu={lastWeek:`eeee 'dernier à' p`,yesterday:`'hier à' p`,today:`'aujourd’hui à' p`,tomorrow:`'demain à' p'`,nextWeek:`eeee 'prochain à' p`,other:`P`},mu=(e,t,n,r)=>pu[e],hu={narrow:[`av. J.-C`,`ap. J.-C`],abbreviated:[`av. J.-C`,`ap. J.-C`],wide:[`avant Jésus-Christ`,`après Jésus-Christ`]},gu={narrow:[`T1`,`T2`,`T3`,`T4`],abbreviated:[`1er trim.`,`2ème trim.`,`3ème trim.`,`4ème trim.`],wide:[`1er trimestre`,`2ème trimestre`,`3ème trimestre`,`4ème trimestre`]},_u={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`janv.`,`févr.`,`mars`,`avr.`,`mai`,`juin`,`juil.`,`août`,`sept.`,`oct.`,`nov.`,`déc.`],wide:[`janvier`,`février`,`mars`,`avril`,`mai`,`juin`,`juillet`,`août`,`septembre`,`octobre`,`novembre`,`décembre`]},vu={narrow:[`D`,`L`,`M`,`M`,`J`,`V`,`S`],short:[`di`,`lu`,`ma`,`me`,`je`,`ve`,`sa`],abbreviated:[`dim.`,`lun.`,`mar.`,`mer.`,`jeu.`,`ven.`,`sam.`],wide:[`dimanche`,`lundi`,`mardi`,`mercredi`,`jeudi`,`vendredi`,`samedi`]},yu={narrow:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`mat.`,afternoon:`ap.m.`,evening:`soir`,night:`mat.`},abbreviated:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`matin`,afternoon:`après-midi`,evening:`soir`,night:`matin`},wide:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`du matin`,afternoon:`de l’après-midi`,evening:`du soir`,night:`du matin`}},bu=(e,t)=>{let n=Number(e),r=t?.unit;if(n===0)return`0`;let i=[`year`,`week`,`hour`,`minute`,`second`],a;return a=n===1?r&&i.includes(r)?`ère`:`er`:`ème`,n+a},xu=[`MMM`,`MMMM`],Su={code:`fr`,formatDistance:du,formatLong:fu,formatRelative:mu,localize:{preprocessor:(e,t)=>e.getDate()===1||!t.some(e=>e.isToken&&xu.includes(e.value))?t:t.map(e=>e.isToken&&e.value===`do`?{isToken:!0,value:`d`}:e),ordinalNumber:bu,era:Sl({values:hu,defaultWidth:`wide`}),quarter:Sl({values:gu,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:_u,defaultWidth:`wide`}),day:Sl({values:vu,defaultWidth:`wide`}),dayPeriod:Sl({values:yu,defaultWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:Cl({matchPatterns:{narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^av/i,/^ap/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Cu={lessThanXSeconds:{one:`meno di un secondo`,other:`meno di {{count}} secondi`},xSeconds:{one:`un secondo`,other:`{{count}} secondi`},halfAMinute:`alcuni secondi`,lessThanXMinutes:{one:`meno di un minuto`,other:`meno di {{count}} minuti`},xMinutes:{one:`un minuto`,other:`{{count}} minuti`},aboutXHours:{one:`circa un'ora`,other:`circa {{count}} ore`},xHours:{one:`un'ora`,other:`{{count}} ore`},xDays:{one:`un giorno`,other:`{{count}} giorni`},aboutXWeeks:{one:`circa una settimana`,other:`circa {{count}} settimane`},xWeeks:{one:`una settimana`,other:`{{count}} settimane`},aboutXMonths:{one:`circa un mese`,other:`circa {{count}} mesi`},xMonths:{one:`un mese`,other:`{{count}} mesi`},aboutXYears:{one:`circa un anno`,other:`circa {{count}} anni`},xYears:{one:`un anno`,other:`{{count}} anni`},overXYears:{one:`più di un anno`,other:`più di {{count}} anni`},almostXYears:{one:`quasi un anno`,other:`quasi {{count}} anni`}},wu=(e,t,n)=>{let r,i=Cu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`tra `+r:r+` fa`:r},Tu={date:xl({formats:{full:`EEEE d MMMM y`,long:`d MMMM y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Eu=[`domenica`,`lunedì`,`martedì`,`mercoledì`,`giovedì`,`venerdì`,`sabato`];function Du(e){switch(e){case 0:return`'domenica scorsa alle' p`;default:return`'`+Eu[e]+` scorso alle' p`}}function Ou(e){return`'`+Eu[e]+` alle' p`}function ku(e){switch(e){case 0:return`'domenica prossima alle' p`;default:return`'`+Eu[e]+` prossimo alle' p`}}var Au={lastWeek:(e,t,n)=>{let r=e.getDay();return Bl(e,t,n)?Ou(r):Du(r)},yesterday:`'ieri alle' p`,today:`'oggi alle' p`,tomorrow:`'domani alle' p`,nextWeek:(e,t,n)=>{let r=e.getDay();return Bl(e,t,n)?Ou(r):ku(r)},other:`P`},ju={code:`it`,formatDistance:wu,formatLong:Tu,formatRelative:(e,t,n,r)=>{let i=Au[e];return typeof i==`function`?i(t,n,r):i},localize:{ordinalNumber:(e,t)=>{let n=Number(e);return String(n)},era:Sl({values:{narrow:[`aC`,`dC`],abbreviated:[`a.C.`,`d.C.`],wide:[`avanti Cristo`,`dopo Cristo`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`G`,`F`,`M`,`A`,`M`,`G`,`L`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`gen`,`feb`,`mar`,`apr`,`mag`,`giu`,`lug`,`ago`,`set`,`ott`,`nov`,`dic`],wide:[`gennaio`,`febbraio`,`marzo`,`aprile`,`maggio`,`giugno`,`luglio`,`agosto`,`settembre`,`ottobre`,`novembre`,`dicembre`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`D`,`L`,`M`,`M`,`G`,`V`,`S`],short:[`dom`,`lun`,`mar`,`mer`,`gio`,`ven`,`sab`],abbreviated:[`dom`,`lun`,`mar`,`mer`,`gio`,`ven`,`sab`],wide:[`domenica`,`lunedì`,`martedì`,`mercoledì`,`giovedì`,`venerdì`,`sabato`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`m.`,pm:`p.`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`},abbreviated:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`},wide:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`m.`,pm:`p.`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`},abbreviated:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`},wide:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^a/i,/^(d|e)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Mu={lessThanXSeconds:{one:`1秒未満`,other:`{{count}}秒未満`,oneWithSuffix:`約1秒`,otherWithSuffix:`約{{count}}秒`},xSeconds:{one:`1秒`,other:`{{count}}秒`},halfAMinute:`30秒`,lessThanXMinutes:{one:`1分未満`,other:`{{count}}分未満`,oneWithSuffix:`約1分`,otherWithSuffix:`約{{count}}分`},xMinutes:{one:`1分`,other:`{{count}}分`},aboutXHours:{one:`約1時間`,other:`約{{count}}時間`},xHours:{one:`1時間`,other:`{{count}}時間`},xDays:{one:`1日`,other:`{{count}}日`},aboutXWeeks:{one:`約1週間`,other:`約{{count}}週間`},xWeeks:{one:`1週間`,other:`{{count}}週間`},aboutXMonths:{one:`約1か月`,other:`約{{count}}か月`},xMonths:{one:`1か月`,other:`{{count}}か月`},aboutXYears:{one:`約1年`,other:`約{{count}}年`},xYears:{one:`1年`,other:`{{count}}年`},overXYears:{one:`1年以上`,other:`{{count}}年以上`},almostXYears:{one:`1年近く`,other:`{{count}}年近く`}},Nu=(e,t,n)=>{n||={};let r,i=Mu[e];return r=typeof i==`string`?i:t===1?n.addSuffix&&i.oneWithSuffix?i.oneWithSuffix:i.one:n.addSuffix&&i.otherWithSuffix?i.otherWithSuffix.replace(`{{count}}`,String(t)):i.other.replace(`{{count}}`,String(t)),n.addSuffix?n.comparison&&n.comparison>0?r+`後`:r+`前`:r},Pu={date:xl({formats:{full:`y年M月d日EEEE`,long:`y年M月d日`,medium:`y/MM/dd`,short:`y/MM/dd`},defaultWidth:`full`}),time:xl({formats:{full:`H時mm分ss秒 zzzz`,long:`H:mm:ss z`,medium:`H:mm:ss`,short:`H:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Fu={lastWeek:`先週のeeeeのp`,yesterday:`昨日のp`,today:`今日のp`,tomorrow:`明日のp`,nextWeek:`翌週のeeeeのp`,other:`P`},Iu={code:`ja`,formatDistance:Nu,formatLong:Pu,formatRelative:(e,t,n,r)=>Fu[e],localize:{ordinalNumber:(e,t)=>{let n=Number(e);switch(String(t?.unit)){case`year`:return`${n}年`;case`quarter`:return`第${n}四半期`;case`month`:return`${n}月`;case`week`:return`第${n}週`;case`date`:return`${n}日`;case`hour`:return`${n}時`;case`minute`:return`${n}分`;case`second`:return`${n}秒`;default:return`${n}`}},era:Sl({values:{narrow:[`BC`,`AC`],abbreviated:[`紀元前`,`西暦`],wide:[`紀元前`,`西暦`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`第1四半期`,`第2四半期`,`第3四半期`,`第4四半期`]},defaultWidth:`wide`,argumentCallback:e=>Number(e)-1}),month:Sl({values:{narrow:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`],abbreviated:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],wide:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],short:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],abbreviated:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],wide:[`日曜日`,`月曜日`,`火曜日`,`水曜日`,`木曜日`,`金曜日`,`土曜日`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},abbreviated:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},wide:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},abbreviated:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},wide:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Cl({matchPatterns:{narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},defaultMatchWidth:`wide`,parsePatterns:{any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Lu={lessThanXSeconds:{one:`menos de um segundo`,other:`menos de {{count}} segundos`},xSeconds:{one:`1 segundo`,other:`{{count}} segundos`},halfAMinute:`meio minuto`,lessThanXMinutes:{one:`menos de um minuto`,other:`menos de {{count}} minutos`},xMinutes:{one:`1 minuto`,other:`{{count}} minutos`},aboutXHours:{one:`aproximadamente 1 hora`,other:`aproximadamente {{count}} horas`},xHours:{one:`1 hora`,other:`{{count}} horas`},xDays:{one:`1 dia`,other:`{{count}} dias`},aboutXWeeks:{one:`aproximadamente 1 semana`,other:`aproximadamente {{count}} semanas`},xWeeks:{one:`1 semana`,other:`{{count}} semanas`},aboutXMonths:{one:`aproximadamente 1 mês`,other:`aproximadamente {{count}} meses`},xMonths:{one:`1 mês`,other:`{{count}} meses`},aboutXYears:{one:`aproximadamente 1 ano`,other:`aproximadamente {{count}} anos`},xYears:{one:`1 ano`,other:`{{count}} anos`},overXYears:{one:`mais de 1 ano`,other:`mais de {{count}} anos`},almostXYears:{one:`quase 1 ano`,other:`quase {{count}} anos`}},Ru=(e,t,n)=>{let r,i=Lu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`daqui a `+r:`há `+r:r},zu={date:xl({formats:{full:`EEEE, d 'de' MMMM 'de' y`,long:`d 'de' MMMM 'de' y`,medium:`d 'de' MMM 'de' y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'às' {{time}}`,long:`{{date}} 'às' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Bu={lastWeek:e=>{let t=e.getDay();return`'`+(t===0||t===6?`último`:`última`)+`' eeee 'às' p`},yesterday:`'ontem às' p`,today:`'hoje às' p`,tomorrow:`'amanhã às' p`,nextWeek:`eeee 'às' p`,other:`P`},Vu={code:`pt`,formatDistance:Ru,formatLong:zu,formatRelative:(e,t,n,r)=>{let i=Bu[e];return typeof i==`function`?i(t):i},localize:{ordinalNumber:(e,t)=>Number(e)+`º`,era:Sl({values:{narrow:[`aC`,`dC`],abbreviated:[`a.C.`,`d.C.`],wide:[`antes de Cristo`,`depois de Cristo`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`j`,`f`,`m`,`a`,`m`,`j`,`j`,`a`,`s`,`o`,`n`,`d`],abbreviated:[`jan`,`fev`,`mar`,`abr`,`mai`,`jun`,`jul`,`ago`,`set`,`out`,`nov`,`dez`],wide:[`janeiro`,`fevereiro`,`março`,`abril`,`maio`,`junho`,`julho`,`agosto`,`setembro`,`outubro`,`novembro`,`dezembro`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`d`,`s`,`t`,`q`,`q`,`s`,`s`],short:[`dom`,`seg`,`ter`,`qua`,`qui`,`sex`,`sáb`],abbreviated:[`dom`,`seg`,`ter`,`qua`,`qui`,`sex`,`sáb`],wide:[`domingo`,`segunda-feira`,`terça-feira`,`quarta-feira`,`quinta-feira`,`sexta-feira`,`sábado`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`},abbreviated:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`},wide:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`},abbreviated:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`},wide:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(º|ª)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Hu={lessThanXSeconds:{one:`不到 1 秒`,other:`不到 {{count}} 秒`},xSeconds:{one:`1 秒`,other:`{{count}} 秒`},halfAMinute:`半分钟`,lessThanXMinutes:{one:`不到 1 分钟`,other:`不到 {{count}} 分钟`},xMinutes:{one:`1 分钟`,other:`{{count}} 分钟`},xHours:{one:`1 小时`,other:`{{count}} 小时`},aboutXHours:{one:`大约 1 小时`,other:`大约 {{count}} 小时`},xDays:{one:`1 天`,other:`{{count}} 天`},aboutXWeeks:{one:`大约 1 个星期`,other:`大约 {{count}} 个星期`},xWeeks:{one:`1 个星期`,other:`{{count}} 个星期`},aboutXMonths:{one:`大约 1 个月`,other:`大约 {{count}} 个月`},xMonths:{one:`1 个月`,other:`{{count}} 个月`},aboutXYears:{one:`大约 1 年`,other:`大约 {{count}} 年`},xYears:{one:`1 年`,other:`{{count}} 年`},overXYears:{one:`超过 1 年`,other:`超过 {{count}} 年`},almostXYears:{one:`将近 1 年`,other:`将近 {{count}} 年`}},Uu=(e,t,n)=>{let r,i=Hu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+`内`:r+`前`:r},Wu={date:xl({formats:{full:`y'年'M'月'd'日' EEEE`,long:`y'年'M'月'd'日'`,medium:`yyyy-MM-dd`,short:`yy-MM-dd`},defaultWidth:`full`}),time:xl({formats:{full:`zzzz a h:mm:ss`,long:`z a h:mm:ss`,medium:`a h:mm:ss`,short:`a h:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})};function Gu(e,t,n){let r=`eeee p`;return Bl(e,t,n)?r:e.getTime()>t.getTime()?`'下个'`+r:`'上个'`+r}var Ku={lastWeek:Gu,yesterday:`'昨天' p`,today:`'今天' p`,tomorrow:`'明天' p`,nextWeek:Gu,other:`PP p`},qu={code:`zh-CN`,formatDistance:Uu,formatLong:Wu,formatRelative:(e,t,n,r)=>{let i=Ku[e];return typeof i==`function`?i(t,n,r):i},localize:{ordinalNumber:(e,t)=>{let n=Number(e);switch(t?.unit){case`date`:return n.toString()+`日`;case`hour`:return n.toString()+`时`;case`minute`:return n.toString()+`分`;case`second`:return n.toString()+`秒`;default:return`第 `+n.toString()}},era:Sl({values:{narrow:[`前`,`公元`],abbreviated:[`前`,`公元`],wide:[`公元前`,`公元`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`第一季`,`第二季`,`第三季`,`第四季`],wide:[`第一季度`,`第二季度`,`第三季度`,`第四季度`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`一`,`二`,`三`,`四`,`五`,`六`,`七`,`八`,`九`,`十`,`十一`,`十二`],abbreviated:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],wide:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],short:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],abbreviated:[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],wide:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`上`,pm:`下`,midnight:`凌晨`,noon:`午`,morning:`早`,afternoon:`下午`,evening:`晚`,night:`夜`},abbreviated:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`},wide:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`上`,pm:`下`,midnight:`凌晨`,noon:`午`,morning:`早`,afternoon:`下午`,evening:`晚`,night:`夜`},abbreviated:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`},wide:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(第\s*)?\d+(日|时|分|秒)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^(前)/i,/^(公元)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Ju=[`en`,`es`,`fr`,`de`,`pt`,`it`,`zh`,`ja`],Yu={en:{id:`en`,nativeName:`English`,englishName:`English`},es:{id:`es`,nativeName:`Español`,englishName:`Spanish`},fr:{id:`fr`,nativeName:`Français`,englishName:`French`},de:{id:`de`,nativeName:`Deutsch`,englishName:`German`},pt:{id:`pt`,nativeName:`Português`,englishName:`Portuguese`},it:{id:`it`,nativeName:`Italiano`,englishName:`Italian`},zh:{id:`zh`,nativeName:`中文`,englishName:`Chinese`},ja:{id:`ja`,nativeName:`日本語`,englishName:`Japanese`}},Xu=`specrails-desktop:ui-language`;function Zu(e){return typeof e==`string`&&Ju.includes(e)}function Qu(e){return e.split(`/`).pop().replace(/\.json$/,``)}var $u=Object.assign({"../locales/en/activity.json":i,"../locales/en/addspec.json":a,"../locales/en/agents.json":o,"../locales/en/agentstudio.json":s,"../locales/en/aiedit.json":c,"../locales/en/analytics.json":l,"../locales/en/attachments.json":u,"../locales/en/browser.json":d,"../locales/en/chat.json":f,"../locales/en/code.json":p,"../locales/en/commands.json":m,"../locales/en/common.json":h,"../locales/en/dashboard.json":g,"../locales/en/explore.json":_,"../locales/en/integrations.json":v,"../locales/en/jobs.json":y,"../locales/en/nav.json":b,"../locales/en/settings.json":x,"../locales/en/setup.json":S,"../locales/en/specs.json":C,"../locales/en/terminal.json":w,"../locales/en/tickets.json":T}),ed=Object.assign({"../locales/de/activity.json":()=>r(()=>import(`./activity-BdrPln96.js`),[]),"../locales/de/addspec.json":()=>r(()=>import(`./addspec-D33ocMxf.js`),[]),"../locales/de/agents.json":()=>r(()=>import(`./agents-TeOSy-ax.js`),[]),"../locales/de/agentstudio.json":()=>r(()=>import(`./agentstudio-BADhZ41e.js`),[]),"../locales/de/aiedit.json":()=>r(()=>import(`./aiedit-D2ji6Qy0.js`),[]),"../locales/de/analytics.json":()=>r(()=>import(`./analytics-C9Zc-rkM.js`),[]),"../locales/de/attachments.json":()=>r(()=>import(`./attachments-COcrGRFz.js`),[]),"../locales/de/browser.json":()=>r(()=>import(`./browser-5ErDlJoR.js`),[]),"../locales/de/chat.json":()=>r(()=>import(`./chat-BQNMD0PL.js`),[]),"../locales/de/code.json":()=>r(()=>import(`./code-C0FTS3ew.js`),[]),"../locales/de/commands.json":()=>r(()=>import(`./commands-BDDp6xFG.js`),[]),"../locales/de/common.json":()=>r(()=>import(`./common-Dmm1GhdD.js`),[]),"../locales/de/dashboard.json":()=>r(()=>import(`./dashboard-CoTpMOBM.js`),[]),"../locales/de/explore.json":()=>r(()=>import(`./explore-BV5Xxlsn.js`),[]),"../locales/de/integrations.json":()=>r(()=>import(`./integrations-DaC4SzzL.js`),[]),"../locales/de/jobs.json":()=>r(()=>import(`./jobs-Wl-ApPMb.js`),[]),"../locales/de/nav.json":()=>r(()=>import(`./nav-CtYwmMgu.js`),[]),"../locales/de/settings.json":()=>r(()=>import(`./settings-BgPqg2nv.js`),[]),"../locales/de/setup.json":()=>r(()=>import(`./setup-B19ZpBNi.js`),[]),"../locales/de/specs.json":()=>r(()=>import(`./specs-DaUTrNF9.js`),[]),"../locales/de/terminal.json":()=>r(()=>import(`./terminal-YOlsJCQj.js`),[]),"../locales/de/tickets.json":()=>r(()=>import(`./tickets-DlpC_iTg.js`),[]),"../locales/en/activity.json":()=>r(()=>import(`./activity-Dv6H7wEr.js`).then(e=>e.t),__vite__mapDeps([0,1])),"../locales/en/addspec.json":()=>r(()=>import(`./addspec-GWm4ffKl.js`).then(e=>e.t),__vite__mapDeps([2,1])),"../locales/en/agents.json":()=>r(()=>import(`./agents-CMxtJMLD.js`).then(e=>e.t),__vite__mapDeps([3,1])),"../locales/en/agentstudio.json":()=>r(()=>import(`./agentstudio-CxlUllqI.js`).then(e=>e.t),__vite__mapDeps([4,1])),"../locales/en/aiedit.json":()=>r(()=>import(`./aiedit-TTwzL1TS.js`).then(e=>e.t),__vite__mapDeps([5,1])),"../locales/en/analytics.json":()=>r(()=>import(`./analytics-DMCto-TF.js`).then(e=>e.t),__vite__mapDeps([6,1])),"../locales/en/attachments.json":()=>r(()=>import(`./attachments-BIsSSnHJ.js`).then(e=>e.t),__vite__mapDeps([7,1])),"../locales/en/browser.json":()=>r(()=>import(`./browser-Qya9cARy.js`).then(e=>e.t),__vite__mapDeps([8,1])),"../locales/en/chat.json":()=>r(()=>import(`./chat-BsbNGPW9.js`).then(e=>e.t),__vite__mapDeps([9,1])),"../locales/en/code.json":()=>r(()=>import(`./code-D3zVVQTj.js`).then(e=>e.t),__vite__mapDeps([10,1])),"../locales/en/commands.json":()=>r(()=>import(`./commands-IXMOKBYt.js`).then(e=>e.t),__vite__mapDeps([11,1])),"../locales/en/common.json":()=>r(()=>import(`./common-wA36jmj1.js`).then(e=>e.t),__vite__mapDeps([12,1])),"../locales/en/dashboard.json":()=>r(()=>import(`./dashboard-Duo4DDCW.js`).then(e=>e.t),__vite__mapDeps([13,1])),"../locales/en/explore.json":()=>r(()=>import(`./explore-hFc3HFcp.js`).then(e=>e.t),__vite__mapDeps([14,1])),"../locales/en/integrations.json":()=>r(()=>import(`./integrations-D28q1kF6.js`).then(e=>e.t),__vite__mapDeps([15,1])),"../locales/en/jobs.json":()=>r(()=>import(`./jobs-DsoXEdo7.js`).then(e=>e.t),__vite__mapDeps([16,1])),"../locales/en/nav.json":()=>r(()=>import(`./nav-BEL3MTwK.js`).then(e=>e.t),__vite__mapDeps([17,1])),"../locales/en/settings.json":()=>r(()=>import(`./settings-DDcfx_ca.js`).then(e=>e.t),__vite__mapDeps([18,1])),"../locales/en/setup.json":()=>r(()=>import(`./setup-BqYA02rS.js`).then(e=>e.t),__vite__mapDeps([19,1])),"../locales/en/specs.json":()=>r(()=>import(`./specs-cKEh2LXt.js`).then(e=>e.t),__vite__mapDeps([20,1])),"../locales/en/terminal.json":()=>r(()=>import(`./terminal-CSONJOex.js`).then(e=>e.t),__vite__mapDeps([21,1])),"../locales/en/tickets.json":()=>r(()=>import(`./tickets-DucYgtdl.js`).then(e=>e.t),__vite__mapDeps([22,1])),"../locales/es/activity.json":()=>r(()=>import(`./activity-BEIp_Y1A.js`),[]),"../locales/es/addspec.json":()=>r(()=>import(`./addspec-DFswZ0jK.js`),[]),"../locales/es/agents.json":()=>r(()=>import(`./agents-1nCDWRmP.js`),[]),"../locales/es/agentstudio.json":()=>r(()=>import(`./agentstudio-DuH9TogZ.js`),[]),"../locales/es/aiedit.json":()=>r(()=>import(`./aiedit-BWxHGsYA.js`),[]),"../locales/es/analytics.json":()=>r(()=>import(`./analytics-CVx3YOc0.js`),[]),"../locales/es/attachments.json":()=>r(()=>import(`./attachments-Bke8sCU4.js`),[]),"../locales/es/browser.json":()=>r(()=>import(`./browser-DGITz3fC.js`),[]),"../locales/es/chat.json":()=>r(()=>import(`./chat-yoXwguQu.js`),[]),"../locales/es/code.json":()=>r(()=>import(`./code-C0BKpkht.js`),[]),"../locales/es/commands.json":()=>r(()=>import(`./commands-B772IyDa.js`),[]),"../locales/es/common.json":()=>r(()=>import(`./common-GbpxfPG8.js`),[]),"../locales/es/dashboard.json":()=>r(()=>import(`./dashboard-C7SK6xu5.js`),[]),"../locales/es/explore.json":()=>r(()=>import(`./explore-B9A3iN2W.js`),[]),"../locales/es/integrations.json":()=>r(()=>import(`./integrations-Cr6hH7XR.js`),[]),"../locales/es/jobs.json":()=>r(()=>import(`./jobs-De5tASex.js`),[]),"../locales/es/nav.json":()=>r(()=>import(`./nav-ClzOE4mA.js`),[]),"../locales/es/settings.json":()=>r(()=>import(`./settings-BSze3_9q.js`),[]),"../locales/es/setup.json":()=>r(()=>import(`./setup--FMCsnQS.js`),[]),"../locales/es/specs.json":()=>r(()=>import(`./specs-Dyc5hYeE.js`),[]),"../locales/es/terminal.json":()=>r(()=>import(`./terminal-80yDMgMF.js`),[]),"../locales/es/tickets.json":()=>r(()=>import(`./tickets-DYvafSaY.js`),[]),"../locales/fr/activity.json":()=>r(()=>import(`./activity-DOUVEjJi.js`),[]),"../locales/fr/addspec.json":()=>r(()=>import(`./addspec-BEeF5-zc.js`),[]),"../locales/fr/agents.json":()=>r(()=>import(`./agents-iTqjRajS.js`),[]),"../locales/fr/agentstudio.json":()=>r(()=>import(`./agentstudio-BSnWLR63.js`),[]),"../locales/fr/aiedit.json":()=>r(()=>import(`./aiedit-DvrcbwGv.js`),[]),"../locales/fr/analytics.json":()=>r(()=>import(`./analytics-BIdr0YfL.js`),[]),"../locales/fr/attachments.json":()=>r(()=>import(`./attachments-DYHGA2Dj.js`),[]),"../locales/fr/browser.json":()=>r(()=>import(`./browser-Bc-YdlVg.js`),[]),"../locales/fr/chat.json":()=>r(()=>import(`./chat-DwUm6W9z.js`),[]),"../locales/fr/code.json":()=>r(()=>import(`./code-D3ryDniw.js`),[]),"../locales/fr/commands.json":()=>r(()=>import(`./commands-CJxCry-o.js`),[]),"../locales/fr/common.json":()=>r(()=>import(`./common-DCr6VzJ7.js`),[]),"../locales/fr/dashboard.json":()=>r(()=>import(`./dashboard-BZBADHSj.js`),[]),"../locales/fr/explore.json":()=>r(()=>import(`./explore-A8Ltoblq.js`),[]),"../locales/fr/integrations.json":()=>r(()=>import(`./integrations-Cublz3m6.js`),[]),"../locales/fr/jobs.json":()=>r(()=>import(`./jobs-CFfc2dNX.js`),[]),"../locales/fr/nav.json":()=>r(()=>import(`./nav-0fwkrgHt.js`),[]),"../locales/fr/settings.json":()=>r(()=>import(`./settings-CTcwN9RE.js`),[]),"../locales/fr/setup.json":()=>r(()=>import(`./setup-fnfEbwlv.js`),[]),"../locales/fr/specs.json":()=>r(()=>import(`./specs-CZ1PsXsC.js`),[]),"../locales/fr/terminal.json":()=>r(()=>import(`./terminal-Bje4ziIa.js`),[]),"../locales/fr/tickets.json":()=>r(()=>import(`./tickets-CB7N30gm.js`),[]),"../locales/it/activity.json":()=>r(()=>import(`./activity-CpkRS8Sx.js`),[]),"../locales/it/addspec.json":()=>r(()=>import(`./addspec-Fkv91Opc.js`),[]),"../locales/it/agents.json":()=>r(()=>import(`./agents-Bm9rPqnt.js`),[]),"../locales/it/agentstudio.json":()=>r(()=>import(`./agentstudio-Kw88_dUF.js`),[]),"../locales/it/aiedit.json":()=>r(()=>import(`./aiedit-DJMny-D5.js`),[]),"../locales/it/analytics.json":()=>r(()=>import(`./analytics-CYj0tfj7.js`),[]),"../locales/it/attachments.json":()=>r(()=>import(`./attachments-BW4L3l2L.js`),[]),"../locales/it/browser.json":()=>r(()=>import(`./browser-JsAIGCEW.js`),[]),"../locales/it/chat.json":()=>r(()=>import(`./chat-BEW60P_u.js`),[]),"../locales/it/code.json":()=>r(()=>import(`./code-exI0G5Wd.js`),[]),"../locales/it/commands.json":()=>r(()=>import(`./commands-DLrvnPNg.js`),[]),"../locales/it/common.json":()=>r(()=>import(`./common-DeDELLZJ.js`),[]),"../locales/it/dashboard.json":()=>r(()=>import(`./dashboard-C1MfeUHs.js`),[]),"../locales/it/explore.json":()=>r(()=>import(`./explore-4mFpnrKU.js`),[]),"../locales/it/integrations.json":()=>r(()=>import(`./integrations-DmQYCUvN.js`),[]),"../locales/it/jobs.json":()=>r(()=>import(`./jobs-BHcQ_Faf.js`),[]),"../locales/it/nav.json":()=>r(()=>import(`./nav-D2bOGSEg.js`),[]),"../locales/it/settings.json":()=>r(()=>import(`./settings-Bg0A3zoS.js`),[]),"../locales/it/setup.json":()=>r(()=>import(`./setup-BZPmkjSN.js`),[]),"../locales/it/specs.json":()=>r(()=>import(`./specs-k0PyLDVt.js`),[]),"../locales/it/terminal.json":()=>r(()=>import(`./terminal-lkZYR4wJ.js`),[]),"../locales/it/tickets.json":()=>r(()=>import(`./tickets-clefmXLv.js`),[]),"../locales/ja/activity.json":()=>r(()=>import(`./activity-DKCpESPt.js`),[]),"../locales/ja/addspec.json":()=>r(()=>import(`./addspec-DVZ15Jp8.js`),[]),"../locales/ja/agents.json":()=>r(()=>import(`./agents-Q6Ldfpxx.js`),[]),"../locales/ja/agentstudio.json":()=>r(()=>import(`./agentstudio-BdidyBzZ.js`),[]),"../locales/ja/aiedit.json":()=>r(()=>import(`./aiedit-DAhZTvtk.js`),[]),"../locales/ja/analytics.json":()=>r(()=>import(`./analytics-CrPCZRJ-.js`),[]),"../locales/ja/attachments.json":()=>r(()=>import(`./attachments-DzdU6DV6.js`),[]),"../locales/ja/browser.json":()=>r(()=>import(`./browser-BlYF4OOq.js`),[]),"../locales/ja/chat.json":()=>r(()=>import(`./chat-CboQguCi.js`),[]),"../locales/ja/code.json":()=>r(()=>import(`./code-AL1rVIMb.js`),[]),"../locales/ja/commands.json":()=>r(()=>import(`./commands-sqrqsxyE.js`),[]),"../locales/ja/common.json":()=>r(()=>import(`./common-Dard9UNH.js`),[]),"../locales/ja/dashboard.json":()=>r(()=>import(`./dashboard-CB6Le1yN.js`),[]),"../locales/ja/explore.json":()=>r(()=>import(`./explore-D2EFgt8J.js`),[]),"../locales/ja/integrations.json":()=>r(()=>import(`./integrations-DRdbki5W.js`),[]),"../locales/ja/jobs.json":()=>r(()=>import(`./jobs-Dc3X86PY.js`),[]),"../locales/ja/nav.json":()=>r(()=>import(`./nav-C2YXcbZS.js`),[]),"../locales/ja/settings.json":()=>r(()=>import(`./settings-D_dujJZI.js`),[]),"../locales/ja/setup.json":()=>r(()=>import(`./setup-D2n9jMfM.js`),[]),"../locales/ja/specs.json":()=>r(()=>import(`./specs-BFfu3u-a.js`),[]),"../locales/ja/terminal.json":()=>r(()=>import(`./terminal-DEqzGtcr.js`),[]),"../locales/ja/tickets.json":()=>r(()=>import(`./tickets-DNOANUXr.js`),[]),"../locales/pt/activity.json":()=>r(()=>import(`./activity-DcDQ7tjw.js`),[]),"../locales/pt/addspec.json":()=>r(()=>import(`./addspec-B5yl4Loj.js`),[]),"../locales/pt/agents.json":()=>r(()=>import(`./agents-s87sMGzL.js`),[]),"../locales/pt/agentstudio.json":()=>r(()=>import(`./agentstudio-D3I62TLJ.js`),[]),"../locales/pt/aiedit.json":()=>r(()=>import(`./aiedit-DOcxERkU.js`),[]),"../locales/pt/analytics.json":()=>r(()=>import(`./analytics-CnY4kNG3.js`),[]),"../locales/pt/attachments.json":()=>r(()=>import(`./attachments-Dd92KpUH.js`),[]),"../locales/pt/browser.json":()=>r(()=>import(`./browser-CT-ReZGt.js`),[]),"../locales/pt/chat.json":()=>r(()=>import(`./chat-DRCa9pOt.js`),[]),"../locales/pt/code.json":()=>r(()=>import(`./code-PCmfS3dn.js`),[]),"../locales/pt/commands.json":()=>r(()=>import(`./commands-UD1NzmwX.js`),[]),"../locales/pt/common.json":()=>r(()=>import(`./common-DltqHaAe.js`),[]),"../locales/pt/dashboard.json":()=>r(()=>import(`./dashboard-I19DXBxw.js`),[]),"../locales/pt/explore.json":()=>r(()=>import(`./explore-BrBJvfjP.js`),[]),"../locales/pt/integrations.json":()=>r(()=>import(`./integrations-HIlUxXVs.js`),[]),"../locales/pt/jobs.json":()=>r(()=>import(`./jobs-BE1siB0M.js`),[]),"../locales/pt/nav.json":()=>r(()=>import(`./nav-iH1V5j6o.js`),[]),"../locales/pt/settings.json":()=>r(()=>import(`./settings-CSJ0ahZ8.js`),[]),"../locales/pt/setup.json":()=>r(()=>import(`./setup-P3r6YP1D.js`),[]),"../locales/pt/specs.json":()=>r(()=>import(`./specs-B__C8-8a.js`),[]),"../locales/pt/terminal.json":()=>r(()=>import(`./terminal-DeWzh6ys.js`),[]),"../locales/pt/tickets.json":()=>r(()=>import(`./tickets-DU1aqsbr.js`),[]),"../locales/zh/activity.json":()=>r(()=>import(`./activity-DRwkql_y.js`),[]),"../locales/zh/addspec.json":()=>r(()=>import(`./addspec-DRE-jZv7.js`),[]),"../locales/zh/agents.json":()=>r(()=>import(`./agents-DK-Dlc0i.js`),[]),"../locales/zh/agentstudio.json":()=>r(()=>import(`./agentstudio-B6Wb59E7.js`),[]),"../locales/zh/aiedit.json":()=>r(()=>import(`./aiedit-WBSjT_C1.js`),[]),"../locales/zh/analytics.json":()=>r(()=>import(`./analytics-C6EzgtdE.js`),[]),"../locales/zh/attachments.json":()=>r(()=>import(`./attachments-Bcf6BG6V.js`),[]),"../locales/zh/browser.json":()=>r(()=>import(`./browser-M5-rbPlw.js`),[]),"../locales/zh/chat.json":()=>r(()=>import(`./chat-BEGuC03z.js`),[]),"../locales/zh/code.json":()=>r(()=>import(`./code-CPcHxzxw.js`),[]),"../locales/zh/commands.json":()=>r(()=>import(`./commands-CfgY-_of.js`),[]),"../locales/zh/common.json":()=>r(()=>import(`./common-DnjcgkPH.js`),[]),"../locales/zh/dashboard.json":()=>r(()=>import(`./dashboard-B4ixDVk8.js`),[]),"../locales/zh/explore.json":()=>r(()=>import(`./explore-C3FSE42C.js`),[]),"../locales/zh/integrations.json":()=>r(()=>import(`./integrations-C3p12Ms6.js`),[]),"../locales/zh/jobs.json":()=>r(()=>import(`./jobs-CSi5n8X_.js`),[]),"../locales/zh/nav.json":()=>r(()=>import(`./nav-B_G-TJDW.js`),[]),"../locales/zh/settings.json":()=>r(()=>import(`./settings-DYIV89nV.js`),[]),"../locales/zh/setup.json":()=>r(()=>import(`./setup-ChKQDHN9.js`),[]),"../locales/zh/specs.json":()=>r(()=>import(`./specs-D2FzlLn9.js`),[]),"../locales/zh/terminal.json":()=>r(()=>import(`./terminal-C2WYcFHF.js`),[]),"../locales/zh/tickets.json":()=>r(()=>import(`./tickets-CF2PYelu.js`),[])}),td={};for(let[e,t]of Object.entries($u))td[Qu(e)]=t.default;var nd=Object.keys(td),rd=new Set([`en`]);function id(){if(typeof navigator<`u`){let e=navigator.languages&&navigator.languages.length>0?navigator.languages:[navigator.language];for(let t of e){if(!t)continue;let e=t.toLowerCase().split(`-`)[0];if(Zu(e))return e}}return`en`}function ad(){if(typeof localStorage<`u`)try{let e=localStorage.getItem(Xu);if(Zu(e))return e}catch{}return id()}qr.use(Ii).init({lng:`en`,fallbackLng:`en`,defaultNS:`common`,ns:nd,resources:{en:td},interpolation:{escapeValue:!1},returnNull:!1});async function od(e){if(rd.has(e))return;let t=Object.entries(ed).filter(([t])=>t.includes(`/locales/${e}/`)),n=await Promise.all(t.map(async([e,t])=>[Qu(e),(await t()).default]));for(let[t,r]of n)qr.addResourceBundle(e,t,r,!0,!0);rd.add(e)}async function sd(e){await od(e),await qr.changeLanguage(e),typeof document<`u`&&(document.documentElement.lang=e)}async function cd(){let e=ad();if(e!==`en`)try{await sd(e)}catch{}}function ld(){return Zu(qr.language)?qr.language:`en`}var ud={en:ru,es:lu,fr:Su,de:Xl,pt:Vu,it:ju,zh:qu,ja:Iu};function dd(e){let t=e??qr.language;return ud[Zu(t)?t:`en`]}var J=qr;function fd(e){return e.providers&&e.providers.length>0?e.providers:[e.provider]}var pd=(0,F.createContext)(null),md=`specrails-desktop:activeProjectId`;function hd(e){try{e?localStorage.setItem(md,e):localStorage.removeItem(md)}catch{}}function gd(){try{return localStorage.getItem(md)}catch{return null}}function _d({children:e}){let[t,n]=(0,F.useState)([]),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(!0),[s,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(new Set),d=(0,F.useRef)(null),f=(0,F.useCallback)(e=>{hd(e),cl(e),i(t=>(t!==null&&t!==e&&(d.current&&clearTimeout(d.current),c(!0),d.current=setTimeout(()=>c(!1),400)),e))},[]),{registerHandler:p,unregisterHandler:m}=bl();(0,F.useEffect)(()=>{async function e(){try{let e=await fetch(`${ol}/api/projects`);if(!e.ok)return;let t=await e.json();n(t.projects),t.setupProjectIds&&t.setupProjectIds.length>0&&u(new Set(t.setupProjectIds))}catch{}finally{o(!1)}}e()},[]);let h=(0,F.useCallback)(e=>{let t=e;if(typeof t.type==`string`){if(t.type===`desktop.projects`){let e=t.projects;n(e),i(t=>{let n;if(t&&e.find(e=>e.id===t))n=t;else{let t=gd();n=t&&e.find(e=>e.id===t)?t:e.length>0?e[0].id:null}return hd(n),cl(n),n}),o(!1)}else if(t.type===`desktop.project_added`){let e=t.project;n(t=>t.find(t=>t.id===e.id)?t:[...t,e]),K.success(J.t(`nav:projects.added`,{name:e.name})),f(e.id)}else if(t.type===`desktop.project_removed`){let e=t.projectId;K.success(J.t(`nav:projects.removed`)),n(t=>t.filter(t=>t.id!==e)),i(t=>t===e?(hd(null),cl(null),null):t)}}},[]);(0,F.useLayoutEffect)(()=>(p(`desktop`,h),()=>m(`desktop`)),[h,p,m]);let g=(0,F.useCallback)(async(e,t,r=[`claude`])=>{try{let i={path:e,providers:r.length>0?r:[`claude`]};t&&(i.name=t);let a=await fetch(`/api/projects`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});if(!a.ok){let e=await a.json();throw Error(e.error??`HTTP ${a.status}`)}let o=await a.json();return n(e=>e.find(e=>e.id===o.project.id)?e:[...e,o.project]),f(o.project.id),o}catch(e){throw console.error(`[useDesktop] addProject error:`,e),e}},[f]),_=(0,F.useCallback)(async e=>{try{let t=await fetch(`${ol}/api/projects/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}n(t=>t.filter(t=>t.id!==e)),u(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),i(t=>t===e?(hd(null),cl(null),null):t)}catch(e){throw console.error(`[useDesktop] removeProject error:`,e),e}},[]),v=(0,F.useCallback)(e=>{u(t=>new Set([...t,e]))},[]),y=(0,F.useCallback)(e=>{u(t=>{let n=new Set(t);return n.delete(e),n})},[]),b=(0,F.useMemo)(()=>({projects:t,activeProjectId:r,setActiveProjectId:f,addProject:g,removeProject:_,isLoading:a,isSwitchingProject:s,setupProjectIds:l,startSetupWizard:v,completeSetupWizard:y}),[t,r,f,g,_,a,s,l,v,y]);return(0,q.jsx)(pd.Provider,{value:b,children:e})}var vd={projects:[],activeProjectId:null,setActiveProjectId:()=>{},addProject:async()=>null,removeProject:async()=>{},isLoading:!1,isSwitchingProject:!1,setupProjectIds:new Set,startSetupWizard:()=>{},completeSetupWizard:()=>{}};function yd(){return(0,F.useContext)(pd)??vd}var bd=new Map,xd=2e3;function Sd(e){bd.set(e,(bd.get(e)??0)+1)}function Cd(e){(bd.get(e)??0)<=0||setTimeout(()=>{let t=(bd.get(e)??0)-1;t<=0?bd.delete(e):bd.set(e,t)},xd)}function wd(e){return e?(bd.get(e)??0)>0:!1}var Td=3e3,Ed=`
16
+ `},ao={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function oo(e){let{announcements:t=ao,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=io}=e,{announce:a,announcement:o}=eo(),s=Ba(`DndLiveRegion`),[c,l]=(0,F.useState)(!1);if((0,F.useEffect)(()=>{l(!0)},[]),no((0,F.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=F.createElement(F.Fragment,null,F.createElement(Qa,{id:r,value:i.draggable}),F.createElement($a,{id:s,announcement:o}));return n?(0,Zn.createPortal)(u,n):u}var so;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(so||={});function co(){}function lo(e,t){return(0,F.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function uo(){var e=[...arguments];return(0,F.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var fo=Object.freeze({x:0,y:0});function po(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function mo(e,t){let n=qa(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function ho(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function go(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _o(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function vo(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function yo(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var bo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=yo(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=po(yo(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ho)},xo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=_o(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=_o(r),o=i.reduce((e,t,r)=>e+po(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ho)};function So(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Co=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=So(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(go)};function wo(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var To=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&wo(r,a)){let n=_o(a).reduce((e,t)=>e+po(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(ho)};function Eo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Do(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:fo}function Oo(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ko=Oo(1);function Ao(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function jo(e,t,n){let r=Ao(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Mo={ignoreTransform:!1};function No(e,t){t===void 0&&(t=Mo);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Da(e).getComputedStyle(e);t&&(n=jo(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function Po(e){return No(e,{ignoreTransform:!0})}function Fo(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Io(e,t){return t===void 0&&(t=Da(e).getComputedStyle(e)),t.position===`fixed`}function Lo(e,t){t===void 0&&(t=Da(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Ro(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Oa(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ka(i)||Aa(i)||n.includes(i))return n;let a=Da(e).getComputedStyle(i);return i!==e&&Lo(i,a)&&n.push(i),Io(i,a)?n:r(i.parentNode)}return e?r(e):n}function zo(e){let[t]=Ro(e,1);return t??null}function Bo(e){return!wa||!e?null:Ta(e)?e:Ea(e)?Oa(e)||e===ja(e).scrollingElement?window:ka(e)?e:null:null}function Vo(e){return Ta(e)?e.scrollX:e.scrollLeft}function Ho(e){return Ta(e)?e.scrollY:e.scrollTop}function Uo(e){return{x:Vo(e),y:Ho(e)}}var Wo;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Wo||={});function Go(e){return!wa||!e?!1:e===document.scrollingElement}function Ko(e){let t={x:0,y:0},n=Go(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var qo={x:.2,y:.2};function Jo(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=qo);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ko(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Wo.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Wo.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Wo.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Wo.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Yo(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Xo(e){return e.reduce((e,t)=>Ha(e,Uo(t)),fo)}function Zo(e){return e.reduce((e,t)=>e+Vo(t),0)}function Qo(e){return e.reduce((e,t)=>e+Ho(t),0)}function $o(e,t){if(t===void 0&&(t=No),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);zo(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var es=[[`x`,[`left`,`right`],Zo],[`y`,[`top`,`bottom`],Qo]],ts=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Ro(t),r=Xo(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of es)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},ns=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function rs(e){let{EventTarget:t}=Da(e);return e instanceof t?e:ja(e)}function is(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var as;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(as||={});function os(e){e.preventDefault()}function ss(e){e.stopPropagation()}var cs;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(cs||={});var ls={start:[cs.Space,cs.Enter],cancel:[cs.Esc],end:[cs.Space,cs.Enter,cs.Tab]},us=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case cs.Right:return{...n,x:n.x+25};case cs.Left:return{...n,x:n.x-25};case cs.Down:return{...n,y:n.y+25};case cs.Up:return{...n,y:n.y-25}}},ds=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new ns(ja(t)),this.windowListeners=new ns(Da(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(as.Resize,this.handleCancel),this.windowListeners.add(as.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(as.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&$o(n),t(fo)}handleKeyDown(e){if(Ga(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=ls,coordinateGetter:a=us,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:fo;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ua(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ko(n),p=Yo(n),m={x:Math.min(i===cs.Right?p.right-p.width/2:p.right,Math.max(i===cs.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===cs.Down?p.bottom-p.height/2:p.bottom,Math.max(i===cs.Down?p.top:p.top+p.height/2,u.y))},h=i===cs.Right&&!s||i===cs.Left&&!c,g=i===cs.Down&&!l||i===cs.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===cs.Right&&e<=d.x||i===cs.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===cs.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===cs.Down&&e<=d.y||i===cs.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===cs.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Ha(Ua(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};ds.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=ls,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function fs(e){return!!(e&&`distance`in e)}function ps(e){return!!(e&&`delay`in e)}var ms=class{constructor(e,t,n){n===void 0&&(n=rs(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=ja(i),this.documentListeners=new ns(this.document),this.listeners=new ns(n),this.windowListeners=new ns(Da(i)),this.initialCoordinates=qa(r)??fo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(as.Resize,this.handleCancel),this.windowListeners.add(as.DragStart,os),this.windowListeners.add(as.VisibilityChange,this.handleCancel),this.windowListeners.add(as.ContextMenu,os),this.documentListeners.add(as.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ps(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(fs(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(as.Click,ss,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(as.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=qa(e)??fo,s=Ua(n,o);if(!t&&a){if(fs(a)){if(a.tolerance!=null&&is(s,a.tolerance))return this.handleCancel();if(is(s,a.distance))return this.handleStart()}if(ps(a)&&is(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===cs.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},hs={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},gs=class extends ms{constructor(e){let{event:t}=e,n=ja(t.target);super(e,hs,n)}};gs.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var _s={move:{name:`mousemove`},end:{name:`mouseup`}},vs;(function(e){e[e.RightClick=2]=`RightClick`})(vs||={});var ys=class extends ms{constructor(e){super(e,_s,ja(e.event.target))}};ys.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===vs.RightClick?!1:(r?.({event:n}),!0)}}];var bs={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},xs=class extends ms{constructor(e){super(e,bs)}static setup(){return window.addEventListener(bs.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(bs.move.name,e)};function e(){}}};xs.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Ss;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Ss||={});var Cs;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Cs||={});function ws(e){let{acceleration:t,activator:n=Ss.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Cs.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Es({delta:d,disabled:!a}),[m,h]=Pa(),g=(0,F.useRef)({x:0,y:0}),_=(0,F.useRef)({x:0,y:0}),v=(0,F.useMemo)(()=>{switch(n){case Ss.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ss.DraggableRect:return i}},[n,i,c]),y=(0,F.useRef)(null),b=(0,F.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,F.useMemo)(()=>s===Cs.TreeOrder?[...l].reverse():l,[s,l]);(0,F.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Jo(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Ts={x:{[Wo.Backward]:!1,[Wo.Forward]:!1},y:{[Wo.Backward]:!1,[Wo.Forward]:!1}};function Es(e){let{delta:t,disabled:n}=e,r=Ra(t);return Ia(e=>{if(n||!r||!e)return Ts;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wo.Backward]:e.x[Wo.Backward]||i.x===-1,[Wo.Forward]:e.x[Wo.Forward]||i.x===1},y:{[Wo.Backward]:e.y[Wo.Backward]||i.y===-1,[Wo.Forward]:e.y[Wo.Forward]||i.y===1}}},[n,t,r])}function Ds(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Ia(e=>t==null?null:r??e??null,[r,t])}function Os(e,t){return(0,F.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ks;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ks||={});var As;(function(e){e.Optimized=`optimized`})(As||={});var js=new Map;function Ms(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,F.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,F.useRef)(e),d=g(),f=Fa(d),p=(0,F.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,F.useRef)(null),h=Ia(t=>{if(d&&!n)return js;if(!t||t===js||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new ts(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,F.useEffect)(()=>{u.current=e},[e]),(0,F.useEffect)(()=>{d||p()},[n,d]),(0,F.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,F.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case ks.Always:return!1;case ks.BeforeDragging:return n;default:return!n}}}function Ns(e,t){return Ia(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Ps(e,t){return Ns(e,t)}function Fs(e){let{callback:t,disabled:n}=e,r=Na(t),i=(0,F.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,F.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Is(e){let{callback:t,disabled:n}=e,r=Na(t),i=(0,F.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,F.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ls(e){return new ts(No(e),e)}function Rs(e,t,n){t===void 0&&(t=Ls);let[r,i]=(0,F.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Fs({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Is({callback:a});return Ma(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function zs(e){return Do(e,Ns(e))}var Bs=[];function Vs(e){let t=(0,F.useRef)(e),n=Ia(n=>e?n&&n!==Bs&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ro(e):Bs,[e]);return(0,F.useEffect)(()=>{t.current=e},[e]),n}function Hs(e){let[t,n]=(0,F.useState)(null),r=(0,F.useRef)(e),i=(0,F.useCallback)(e=>{let t=Bo(e.target);t&&n(e=>e?(e.set(t,Uo(t)),new Map(e)):null)},[]);return(0,F.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Bo(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Uo(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Bo(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,F.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Ha(e,t),fo):Xo(e):fo,[e,t])}function Us(e,t){t===void 0&&(t=[]);let n=(0,F.useRef)(null);return(0,F.useEffect)(()=>{n.current=null},t),(0,F.useEffect)(()=>{let t=e!==fo;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ua(e,n.current):fo}function Ws(e){(0,F.useEffect)(()=>{if(!wa)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Gs(e,t){return(0,F.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Ks(e){return(0,F.useMemo)(()=>e?Fo(e):null,[e])}var qs=[];function Js(e,t){t===void 0&&(t=No);let[n]=e,r=Ks(n?Da(n):null),[i,a]=(0,F.useState)(qs);function o(){a(()=>e.length?e.map(e=>Go(e)?r:new ts(t(e),e)):qs)}let s=Is({callback:o});return Ma(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ys(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ka(t)?t:e}function Xs(e){let{measure:t}=e,[n,r]=(0,F.useState)(null),i=Is({callback:(0,F.useCallback)(e=>{for(let{target:n}of e)if(ka(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=La((0,F.useCallback)(e=>{let n=Ys(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,F.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Zs=[{sensor:gs,options:{}},{sensor:ds,options:{}}],Qs={current:{}},$s={draggable:{measure:Po},droppable:{measure:Po,strategy:ks.WhileDragging,frequency:As.Optimized},dragOverlay:{measure:No}},ec=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},tc={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ec,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:co},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:$s,measureDroppableContainers:co,windowRect:null,measuringScheduled:!1},nc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:co,draggableNodes:new Map,over:null,measureDroppableContainers:co},rc=(0,F.createContext)(nc),ic=(0,F.createContext)(tc);function ac(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ec}}}function oc(e,t){switch(t.type){case so.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case so.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case so.DragEnd:case so.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case so.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new ec(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case so.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new ec(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case so.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new ec(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function sc(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,F.useContext)(rc),a=Ra(r),o=Ra(n?.id);return(0,F.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ga(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Xa(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function cc(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function lc(e){return(0,F.useMemo)(()=>({draggable:{...$s.draggable,...e?.draggable},droppable:{...$s.droppable,...e?.droppable},dragOverlay:{...$s.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function uc(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,F.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Ma(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Do(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=zo(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var dc=(0,F.createContext)({...fo,scaleX:1,scaleY:1}),fc;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(fc||={});var pc=(0,F.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Zs,collisionDetection:o=Co,measuring:s,modifiers:c,...l}=e,[u,d]=(0,F.useReducer)(oc,void 0,ac),[f,p]=ro(),[m,h]=(0,F.useState)(fc.Uninitialized),g=m===fc.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,F.useRef)({initial:null,translated:null}),C=(0,F.useMemo)(()=>_==null?null:{id:_,data:x?.data??Qs,rect:S},[_,x]),w=(0,F.useRef)(null),[T,E]=(0,F.useState)(null),[D,O]=(0,F.useState)(null),k=Fa(l,Object.values(l)),A=Ba(`DndDescribedBy`,t),j=(0,F.useMemo)(()=>b.getEnabled(),[b]),M=lc(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:I}=Ms(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),L=Ds(v,_),ee=(0,F.useMemo)(()=>D?qa(D):null,[D]),R=Te(),te=Ps(L,M.draggable.measure);uc({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:te,measure:M.draggable.measure});let z=Rs(L,M.draggable.measure,te),B=Rs(L?L.parentElement:null),V=(0,F.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),H=b.getNodeFor(V.current.over?.id),U=Xs({measure:M.dragOverlay.measure}),ne=U.nodeRef.current??L,W=g?U.rect??z:null,re=!!(U.nodeRef.current&&U.rect),ie=zs(re?null:z),ae=Ks(ne?Da(ne):null),oe=Vs(g?H??L:null),se=Js(oe),ce=cc(c,{transform:{x:y.x-ie.x,y:y.y-ie.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:B,draggingNodeRect:W,over:V.current.over,overlayNodeRect:U.rect,scrollableAncestors:oe,scrollableAncestorRects:se,windowRect:ae}),le=ee?Ha(ee,y):null,ue=Hs(oe),de=Us(ue),fe=Us(ue,[z]),pe=Ha(ce,de),me=W?ko(W,ce):null,he=C&&me?o({active:C,collisionRect:me,droppableRects:N,droppableContainers:j,pointerCoordinates:le}):null,ge=vo(he,`id`),[_e,ve]=(0,F.useState)(null),ye=Eo(re?ce:Ha(ce,fe),_e?.rect??null,z),be=(0,F.useRef)(null),xe=(0,F.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:w.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Zn.unstable_batchedUpdates)(()=>{r?.(i),h(fc.Initializing),d({type:so.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(be.current),O(a)})},onMove(e){d({type:so.DragMove,coordinates:e})},onEnd:o(so.DragEnd),onCancel:o(so.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===so.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=so.DragCancel)}w.current=null,(0,Zn.unstable_batchedUpdates)(()=>{d({type:e}),h(fc.Uninitialized),ve(null),E(null),O(null),be.current=null;let t=e===so.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=Os(a,(0,F.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,xe(n,t))},[v,xe]));Ws(a),Ma(()=>{z&&m===fc.Initializing&&h(fc.Initialized)},[z,m]),(0,F.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:i};(0,Zn.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[pe.x,pe.y]),(0,F.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Zn.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),Ma(()=>{V.current={activatorEvent:D,active:C,activeNode:L,collisionRect:me,collisions:he,droppableRects:N,draggableNodes:v,draggingNode:ne,draggingNodeRect:W,droppableContainers:b,over:_e,scrollableAncestors:oe,scrollAdjustedTranslate:pe},S.current={initial:W,translated:me}},[C,L,he,me,v,ne,W,N,b,_e,oe,pe]),ws({...R,delta:y,draggingRect:me,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:se});let Ce=(0,F.useMemo)(()=>({active:C,activeNode:L,activeNodeRect:z,activatorEvent:D,collisions:he,containerNodeRect:B,dragOverlay:U,draggableNodes:v,droppableContainers:b,droppableRects:N,over:_e,measureDroppableContainers:P,scrollableAncestors:oe,scrollableAncestorRects:se,measuringConfiguration:M,measuringScheduled:I,windowRect:ae}),[C,L,z,D,he,B,U,v,b,N,_e,P,oe,se,M,I,ae]),we=(0,F.useMemo)(()=>({activatorEvent:D,activators:Se,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:P}),[D,Se,C,z,d,A,v,_e,P]);return F.createElement(to.Provider,{value:p},F.createElement(rc.Provider,{value:we},F.createElement(ic.Provider,{value:Ce},F.createElement(dc.Provider,{value:ye},i)),F.createElement(sc,{disabled:n?.restoreFocus===!1})),F.createElement(oo,{...n,hiddenTextDescribedById:A}));function Te(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),mc=(0,F.createContext)(null),hc=`button`,gc=`Draggable`;function _c(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ba(gc),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,F.useContext)(rc),{role:p=hc,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,F.useContext)(g?dc:mc),[v,y]=La(),[b,x]=La(),S=Gs(o,t),C=Fa(n);return Ma(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,F.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===hc?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function vc(){return(0,F.useContext)(ic)}var yc=`Droppable`,bc={timeout:25};function xc(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ba(yc),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,F.useContext)(rc),u=(0,F.useRef)({disabled:n}),d=(0,F.useRef)(!1),f=(0,F.useRef)(null),p=(0,F.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...bc,...i},_=Fa(h??r),v=Is({callback:(0,F.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=La((0,F.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Fa(t);return(0,F.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,F.useEffect)(()=>(s({type:so.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:so.UnregisterDroppable,key:a,id:r})),[r]),(0,F.useEffect)(()=>{n!==u.current.disabled&&(s({type:so.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Sc(e){let{animation:t,children:n}=e,[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(null),s=Ra(n);return!n&&!r&&s&&i(s),Ma(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),F.createElement(F.Fragment,null,n,r?(0,F.cloneElement)(r,{ref:o}):null)}var Cc={x:0,y:0,scaleX:1,scaleY:1};function wc(e){let{children:t}=e;return F.createElement(rc.Provider,{value:nc},F.createElement(dc.Provider,{value:Cc},t))}var Tc={position:`fixed`,touchAction:`none`},Ec=e=>Ga(e)?`transform 250ms ease`:void 0,Dc=(0,F.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Ec}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Tc,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ja.Transform.toString(d),transformOrigin:i&&r?mo(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return F.createElement(n,{className:o,style:f,ref:t},a)}),Oc={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ja.Transform.toString(t)},{transform:Ja.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function kc(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Na((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Ys(a);if(!c)return;let{transform:l}=Da(a).getComputedStyle(a),u=Ao(l);if(!u)return;let d=typeof t==`function`?t:Ac(t);return $o(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Ac(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Oc,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var jc=0;function Mc(e){return(0,F.useMemo)(()=>{if(e!=null)return jc++,jc},[e])}var Nc=F.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=vc(),S=(0,F.useContext)(dc),C=Mc(d?.id),w=cc(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=Ns(f),E=kc({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return F.createElement(wc,null,F.createElement(Sc,{animation:E},d&&C?F.createElement(Dc,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function Pc(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fc(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Ic(e){return e!==null&&e>=0}function Lc(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Rc(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var zc=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Pc(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Bc={scaleX:1,scaleY:1},Vc=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...Bc}:null}let s=Hc(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Bc}:r<t&&r>=a?{x:0,y:o.height+s,...Bc}:{x:0,y:0,...Bc}};function Hc(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Uc=`Sortable`,Wc=F.createContext({activeIndex:-1,containerId:Uc,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zc,disabled:{draggable:!1,droppable:!1}});function Gc(e){let{children:t,id:n,items:r,strategy:i=zc,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=vc(),d=Ba(Uc,n),f=s.rect!==null,p=(0,F.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,F.useRef)(p),v=!Lc(p,_.current),y=g!==-1&&h===-1||v,b=Rc(a);Ma(()=>{v&&m&&u(p)},[v,p,m,u]),(0,F.useEffect)(()=>{_.current=p},[p]);let x=(0,F.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:Fc(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return F.createElement(Wc.Provider,{value:x},t)}var Kc=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Pc(n,r,i).indexOf(t)},qc=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Jc={duration:200,easing:`ease`},Yc=`transform`,Xc=Ja.Transition.toString({property:Yc,duration:0,easing:`linear`}),Zc={roleDescription:`sortable`};function Qc(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,F.useState)(null),s=(0,F.useRef)(n);return Ma(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=No(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,F.useEffect)(()=>{a&&o(null)},[a]),a}function $c(e){let{animateLayoutChanges:t=qc,attributes:n,disabled:r,data:i,getNewIndex:a=Kc,id:o,strategy:s,resizeObserverConfig:c,transition:l=Jc}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,F.useContext)(Wc),y=el(r,p),b=u.indexOf(o),x=(0,F.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,F.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=xc({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:I,transform:L}=_c({id:o,data:x,attributes:{...Zc,...n},disabled:y.draggable}),ee=Ca(E,j),R=!!D,te=R&&!m&&Ic(f)&&Ic(g),z=!_&&N,B=te?(z&&te?L:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,V=Ic(f)&&Ic(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,H=D?.id,U=(0,F.useRef)({activeId:H,items:u,newIndex:V,containerId:d}),ne=u!==U.current.items,W=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:l,wasDragging:U.current.activeId!=null}),re=Qc({disabled:!W,index:b,node:w,rect:C});return(0,F.useEffect)(()=>{R&&U.current.newIndex!==V&&(U.current.newIndex=V),d!==U.current.containerId&&(U.current.containerId=d),u!==U.current.items&&(U.current.items=u)},[R,V,d,u]),(0,F.useEffect)(()=>{if(H===U.current.activeId)return;if(H!=null&&U.current.activeId==null){U.current.activeId=H;return}let e=setTimeout(()=>{U.current.activeId=H},50);return()=>clearTimeout(e)},[H]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:V,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:ee,setActivatorNodeRef:I,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:re??B,transition:ie()};function ie(){if(re||ne&&U.current.newIndex===b)return Xc;if(!(z&&!Ga(O)||!l)&&(R||W))return Ja.Transition.toString({...l,property:Yc})}}function el(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function tl(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var nl=[cs.Down,cs.Right,cs.Up,cs.Left],rl=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(nl.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case cs.Down:r.top<a.top&&t.push(n);break;case cs.Up:r.top>a.top&&t.push(n);break;case cs.Left:r.left>a.left&&t.push(n);break;case cs.Right:r.left<a.left&&t.push(n);break}});let c=xo({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=vo(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Ro(c).some((e,t)=>s[t]!==e),i=il(e,t),a=al(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Ua(u,l)}}}};function il(e,t){return!tl(e)||!tl(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function al(e,t){return!tl(e)||!tl(t)||!il(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var ol=(()=>{if(typeof window>`u`)return``;if(`__TAURI_INTERNALS__`in window)return`http://localhost:4200`;let e=window.location.protocol;return e!==`http:`&&e!==`https:`?`http://localhost:4200`:``})(),sl=null;function cl(e){sl=e}function ll(){if(!sl)throw Error(`getApiBase called with no active project — call setActiveProjectId first`);return`${ol}/api/projects/${sl}`}var ul=null;async function dl(){for(let e=0;e<20;e++){try{let e=await fetch(`${ol}/api/token`);if(e.ok){ul=(await e.json()).token??null;return}}catch{}await new Promise(e=>setTimeout(e,300))}}function fl(){return ul}function pl(){return ul?`desktop-token.${ul}`:void 0}function ml(){let e=window.fetch.bind(window),t=typeof window<`u`?window.location.protocol:``,n=typeof window<`u`&&`__TAURI_INTERNALS__`in window||t!==``&&t!==`http:`&&t!==`https:`;window.fetch=function(t,r={}){let i=typeof t==`string`?t:t instanceof URL?t.href:t.url;if(n&&i.startsWith(`/`)&&(i=`http://localhost:4200${i}`,t=i),(()=>{if(i.startsWith(`/`))return!0;try{let e=new URL(i),t=ol?new URL(ol).origin:window.location.origin;return e.origin===t}catch{return!1}})()&&ul){let n=new Headers(r.headers);return n.has(`X-Desktop-Token`)||n.set(`X-Desktop-Token`,ul),e(t,{...r,headers:n})}return e(t,r)}}var hl=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),gl=n(((e,t)=>{t.exports=hl()})),q=gl(),_l=[1e3,2e3,4e3,8e3,16e3],vl=(0,F.createContext)(null);function yl({url:e,children:t}){let[n,r]=(0,F.useState)(`connecting`),i=(0,F.useRef)(new Map),a=(0,F.useRef)(null),o=(0,F.useRef)(0),s=(0,F.useRef)(null);(0,F.useEffect)(()=>{let t=!1;function n(){if(t)return;let c=pl(),l=c?new WebSocket(e,[`specrails-desktop`,c]):new WebSocket(e);a.current=l,r(`connecting`),l.onopen=()=>{if(t){l.close();return}o.current=0,r(`connected`)},l.onmessage=e=>{if(t)return;let n;try{n=JSON.parse(e.data)}catch{return}for(let e of i.current.values())e(n)},l.onclose=()=>{if(t)return;a.current=null;let e=o.current;if(e>=_l.length){r(`connecting`),s.current=setTimeout(n,3e4);return}r(`connecting`);let i=_l[e];o.current+=1,s.current=setTimeout(n,i)}}return n(),()=>{t=!0,s.current&&clearTimeout(s.current);let e=a.current;if(e)if(e.onmessage=null,e.onclose=null,e.onerror=null,e.readyState===WebSocket.CONNECTING)e.onopen=()=>{try{e.close()}catch{}};else{e.onopen=null;try{e.close()}catch{}}}},[e]);let c=(0,F.useCallback)((e,t)=>{i.current.set(e,t)},[]),l=(0,F.useCallback)(e=>{i.current.delete(e)},[]),u=(0,F.useMemo)(()=>({registerHandler:c,unregisterHandler:l,connectionStatus:n}),[c,l,n]);return(0,q.jsx)(vl.Provider,{value:u,children:t})}function bl(){let e=(0,F.useContext)(vl);if(!e)throw Error(`useSharedWebSocket must be used within SharedWebSocketProvider`);return e}function xl(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function Sl(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}function Cl(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Tl(s,e=>e.test(o)):wl(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function wl(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Tl(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function El(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Dl=365.2425,Ol=6048e5,kl=864e5,Al=43200,jl=1440,Ml=3600*24;Ml*7,Ml*Dl/12*3;var Nl=Symbol.for(`constructDateFrom`);function Pl(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Nl in e?e[Nl](t):e instanceof Date?new e.constructor(t):new Date(t)}function Fl(e,...t){let n=Pl.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}var Il={};function Ll(){return Il}function Rl(e,t){return Pl(t||e,e)}function zl(e,t){let n=Ll(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Rl(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Bl(e,t,n){let[r,i]=Fl(n?.in,e,t);return+zl(r,n)==+zl(i,n)}var Vl={lessThanXSeconds:{standalone:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`},withPreposition:{one:`weniger als 1 Sekunde`,other:`weniger als {{count}} Sekunden`}},xSeconds:{standalone:{one:`1 Sekunde`,other:`{{count}} Sekunden`},withPreposition:{one:`1 Sekunde`,other:`{{count}} Sekunden`}},halfAMinute:{standalone:`eine halbe Minute`,withPreposition:`einer halben Minute`},lessThanXMinutes:{standalone:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`},withPreposition:{one:`weniger als 1 Minute`,other:`weniger als {{count}} Minuten`}},xMinutes:{standalone:{one:`1 Minute`,other:`{{count}} Minuten`},withPreposition:{one:`1 Minute`,other:`{{count}} Minuten`}},aboutXHours:{standalone:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`},withPreposition:{one:`etwa 1 Stunde`,other:`etwa {{count}} Stunden`}},xHours:{standalone:{one:`1 Stunde`,other:`{{count}} Stunden`},withPreposition:{one:`1 Stunde`,other:`{{count}} Stunden`}},xDays:{standalone:{one:`1 Tag`,other:`{{count}} Tage`},withPreposition:{one:`1 Tag`,other:`{{count}} Tagen`}},aboutXWeeks:{standalone:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`},withPreposition:{one:`etwa 1 Woche`,other:`etwa {{count}} Wochen`}},xWeeks:{standalone:{one:`1 Woche`,other:`{{count}} Wochen`},withPreposition:{one:`1 Woche`,other:`{{count}} Wochen`}},aboutXMonths:{standalone:{one:`etwa 1 Monat`,other:`etwa {{count}} Monate`},withPreposition:{one:`etwa 1 Monat`,other:`etwa {{count}} Monaten`}},xMonths:{standalone:{one:`1 Monat`,other:`{{count}} Monate`},withPreposition:{one:`1 Monat`,other:`{{count}} Monaten`}},aboutXYears:{standalone:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahre`},withPreposition:{one:`etwa 1 Jahr`,other:`etwa {{count}} Jahren`}},xYears:{standalone:{one:`1 Jahr`,other:`{{count}} Jahre`},withPreposition:{one:`1 Jahr`,other:`{{count}} Jahren`}},overXYears:{standalone:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahre`},withPreposition:{one:`mehr als 1 Jahr`,other:`mehr als {{count}} Jahren`}},almostXYears:{standalone:{one:`fast 1 Jahr`,other:`fast {{count}} Jahre`},withPreposition:{one:`fast 1 Jahr`,other:`fast {{count}} Jahren`}}},Hl=(e,t,n)=>{let r,i=n?.addSuffix?Vl[e].withPreposition:Vl[e].standalone;return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:`vor `+r:r},Ul={date:xl({formats:{full:`EEEE, do MMMM y`,long:`do MMMM y`,medium:`do MMM y`,short:`dd.MM.y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'um' {{time}}`,long:`{{date}} 'um' {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Wl={lastWeek:`'letzten' eeee 'um' p`,yesterday:`'gestern um' p`,today:`'heute um' p`,tomorrow:`'morgen um' p`,nextWeek:`eeee 'um' p`,other:`P`},Gl=(e,t,n,r)=>Wl[e],Kl={narrow:[`v.Chr.`,`n.Chr.`],abbreviated:[`v.Chr.`,`n.Chr.`],wide:[`vor Christus`,`nach Christus`]},ql={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1. Quartal`,`2. Quartal`,`3. Quartal`,`4. Quartal`]},Jl={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mär`,`Apr`,`Mai`,`Jun`,`Jul`,`Aug`,`Sep`,`Okt`,`Nov`,`Dez`],wide:[`Januar`,`Februar`,`März`,`April`,`Mai`,`Juni`,`Juli`,`August`,`September`,`Oktober`,`November`,`Dezember`]},Yl={narrow:Jl.narrow,abbreviated:[`Jan.`,`Feb.`,`März`,`Apr.`,`Mai`,`Juni`,`Juli`,`Aug.`,`Sep.`,`Okt.`,`Nov.`,`Dez.`],wide:Jl.wide},Xl={code:`de`,formatDistance:Hl,formatLong:Ul,formatRelative:Gl,localize:{ordinalNumber:e=>Number(e)+`.`,era:Sl({values:Kl,defaultWidth:`wide`}),quarter:Sl({values:ql,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:Jl,formattingValues:Yl,defaultWidth:`wide`}),day:Sl({values:{narrow:[`S`,`M`,`D`,`M`,`D`,`F`,`S`],short:[`So`,`Mo`,`Di`,`Mi`,`Do`,`Fr`,`Sa`],abbreviated:[`So.`,`Mo.`,`Di.`,`Mi.`,`Do.`,`Fr.`,`Sa.`],wide:[`Sonntag`,`Montag`,`Dienstag`,`Mittwoch`,`Donnerstag`,`Freitag`,`Samstag`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachm.`,evening:`Abend`,night:`Nacht`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`Morgen`,afternoon:`Nachmittag`,evening:`Abend`,night:`Nacht`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`vm.`,pm:`nm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachm.`,evening:`abends`,night:`nachts`},abbreviated:{am:`vorm.`,pm:`nachm.`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`},wide:{am:`vormittags`,pm:`nachmittags`,midnight:`Mitternacht`,noon:`Mittag`,morning:`morgens`,afternoon:`nachmittags`,evening:`abends`,night:`nachts`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(\.)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:Cl({matchPatterns:{narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^v/i,/^n/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},defaultMatchWidth:`wide`,parsePatterns:{any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Zl={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Ql=(e,t,n)=>{let r,i=Zl[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r},$l={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},eu=(e,t,n,r)=>$l[e],tu={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Sl({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})},nu={ordinalNumber:El({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},ru={code:`en-US`,formatDistance:Ql,formatLong:{date:xl({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:xl({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},formatRelative:eu,localize:tu,match:nu,options:{weekStartsOn:0,firstWeekContainsDate:1}},iu={lessThanXSeconds:{one:`menos de un segundo`,other:`menos de {{count}} segundos`},xSeconds:{one:`1 segundo`,other:`{{count}} segundos`},halfAMinute:`medio minuto`,lessThanXMinutes:{one:`menos de un minuto`,other:`menos de {{count}} minutos`},xMinutes:{one:`1 minuto`,other:`{{count}} minutos`},aboutXHours:{one:`alrededor de 1 hora`,other:`alrededor de {{count}} horas`},xHours:{one:`1 hora`,other:`{{count}} horas`},xDays:{one:`1 día`,other:`{{count}} días`},aboutXWeeks:{one:`alrededor de 1 semana`,other:`alrededor de {{count}} semanas`},xWeeks:{one:`1 semana`,other:`{{count}} semanas`},aboutXMonths:{one:`alrededor de 1 mes`,other:`alrededor de {{count}} meses`},xMonths:{one:`1 mes`,other:`{{count}} meses`},aboutXYears:{one:`alrededor de 1 año`,other:`alrededor de {{count}} años`},xYears:{one:`1 año`,other:`{{count}} años`},overXYears:{one:`más de 1 año`,other:`más de {{count}} años`},almostXYears:{one:`casi 1 año`,other:`casi {{count}} años`}},au=(e,t,n)=>{let r,i=iu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`en `+r:`hace `+r:r},ou={date:xl({formats:{full:`EEEE, d 'de' MMMM 'de' y`,long:`d 'de' MMMM 'de' y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'a las' {{time}}`,long:`{{date}} 'a las' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},su={lastWeek:`'el' eeee 'pasado a la' p`,yesterday:`'ayer a la' p`,today:`'hoy a la' p`,tomorrow:`'mañana a la' p`,nextWeek:`eeee 'a la' p`,other:`P`},cu={lastWeek:`'el' eeee 'pasado a las' p`,yesterday:`'ayer a las' p`,today:`'hoy a las' p`,tomorrow:`'mañana a las' p`,nextWeek:`eeee 'a las' p`,other:`P`},lu={code:`es`,formatDistance:au,formatLong:ou,formatRelative:(e,t,n,r)=>t.getHours()===1?su[e]:cu[e],localize:{ordinalNumber:(e,t)=>Number(e)+`º`,era:Sl({values:{narrow:[`AC`,`DC`],abbreviated:[`AC`,`DC`],wide:[`antes de cristo`,`después de cristo`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>Number(e)-1}),month:Sl({values:{narrow:[`e`,`f`,`m`,`a`,`m`,`j`,`j`,`a`,`s`,`o`,`n`,`d`],abbreviated:[`ene`,`feb`,`mar`,`abr`,`may`,`jun`,`jul`,`ago`,`sep`,`oct`,`nov`,`dic`],wide:[`enero`,`febrero`,`marzo`,`abril`,`mayo`,`junio`,`julio`,`agosto`,`septiembre`,`octubre`,`noviembre`,`diciembre`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`d`,`l`,`m`,`m`,`j`,`v`,`s`],short:[`do`,`lu`,`ma`,`mi`,`ju`,`vi`,`sá`],abbreviated:[`dom`,`lun`,`mar`,`mié`,`jue`,`vie`,`sáb`],wide:[`domingo`,`lunes`,`martes`,`miércoles`,`jueves`,`viernes`,`sábado`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`a`,pm:`p`,midnight:`mn`,noon:`md`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`},abbreviated:{am:`AM`,pm:`PM`,midnight:`medianoche`,noon:`mediodia`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`medianoche`,noon:`mediodia`,morning:`mañana`,afternoon:`tarde`,evening:`tarde`,night:`noche`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mn`,noon:`md`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`},abbreviated:{am:`AM`,pm:`PM`,midnight:`medianoche`,noon:`mediodia`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`medianoche`,noon:`mediodia`,morning:`de la mañana`,afternoon:`de la tarde`,evening:`de la tarde`,night:`de la noche`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Cl({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:1}},uu={lessThanXSeconds:{one:`moins d’une seconde`,other:`moins de {{count}} secondes`},xSeconds:{one:`1 seconde`,other:`{{count}} secondes`},halfAMinute:`30 secondes`,lessThanXMinutes:{one:`moins d’une minute`,other:`moins de {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`environ 1 heure`,other:`environ {{count}} heures`},xHours:{one:`1 heure`,other:`{{count}} heures`},xDays:{one:`1 jour`,other:`{{count}} jours`},aboutXWeeks:{one:`environ 1 semaine`,other:`environ {{count}} semaines`},xWeeks:{one:`1 semaine`,other:`{{count}} semaines`},aboutXMonths:{one:`environ 1 mois`,other:`environ {{count}} mois`},xMonths:{one:`1 mois`,other:`{{count}} mois`},aboutXYears:{one:`environ 1 an`,other:`environ {{count}} ans`},xYears:{one:`1 an`,other:`{{count}} ans`},overXYears:{one:`plus d’un an`,other:`plus de {{count}} ans`},almostXYears:{one:`presqu’un an`,other:`presque {{count}} ans`}},du=(e,t,n)=>{let r,i=uu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`dans `+r:`il y a `+r:r},fu={date:xl({formats:{full:`EEEE d MMMM y`,long:`d MMMM y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'à' {{time}}`,long:`{{date}} 'à' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},pu={lastWeek:`eeee 'dernier à' p`,yesterday:`'hier à' p`,today:`'aujourd’hui à' p`,tomorrow:`'demain à' p'`,nextWeek:`eeee 'prochain à' p`,other:`P`},mu=(e,t,n,r)=>pu[e],hu={narrow:[`av. J.-C`,`ap. J.-C`],abbreviated:[`av. J.-C`,`ap. J.-C`],wide:[`avant Jésus-Christ`,`après Jésus-Christ`]},gu={narrow:[`T1`,`T2`,`T3`,`T4`],abbreviated:[`1er trim.`,`2ème trim.`,`3ème trim.`,`4ème trim.`],wide:[`1er trimestre`,`2ème trimestre`,`3ème trimestre`,`4ème trimestre`]},_u={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`janv.`,`févr.`,`mars`,`avr.`,`mai`,`juin`,`juil.`,`août`,`sept.`,`oct.`,`nov.`,`déc.`],wide:[`janvier`,`février`,`mars`,`avril`,`mai`,`juin`,`juillet`,`août`,`septembre`,`octobre`,`novembre`,`décembre`]},vu={narrow:[`D`,`L`,`M`,`M`,`J`,`V`,`S`],short:[`di`,`lu`,`ma`,`me`,`je`,`ve`,`sa`],abbreviated:[`dim.`,`lun.`,`mar.`,`mer.`,`jeu.`,`ven.`,`sam.`],wide:[`dimanche`,`lundi`,`mardi`,`mercredi`,`jeudi`,`vendredi`,`samedi`]},yu={narrow:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`mat.`,afternoon:`ap.m.`,evening:`soir`,night:`mat.`},abbreviated:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`matin`,afternoon:`après-midi`,evening:`soir`,night:`matin`},wide:{am:`AM`,pm:`PM`,midnight:`minuit`,noon:`midi`,morning:`du matin`,afternoon:`de l’après-midi`,evening:`du soir`,night:`du matin`}},bu=(e,t)=>{let n=Number(e),r=t?.unit;if(n===0)return`0`;let i=[`year`,`week`,`hour`,`minute`,`second`],a;return a=n===1?r&&i.includes(r)?`ère`:`er`:`ème`,n+a},xu=[`MMM`,`MMMM`],Su={code:`fr`,formatDistance:du,formatLong:fu,formatRelative:mu,localize:{preprocessor:(e,t)=>e.getDate()===1||!t.some(e=>e.isToken&&xu.includes(e.value))?t:t.map(e=>e.isToken&&e.value===`do`?{isToken:!0,value:`d`}:e),ordinalNumber:bu,era:Sl({values:hu,defaultWidth:`wide`}),quarter:Sl({values:gu,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:_u,defaultWidth:`wide`}),day:Sl({values:vu,defaultWidth:`wide`}),dayPeriod:Sl({values:yu,defaultWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(ième|ère|ème|er|e)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e)}),era:Cl({matchPatterns:{narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^av/i,/^ap/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Cu={lessThanXSeconds:{one:`meno di un secondo`,other:`meno di {{count}} secondi`},xSeconds:{one:`un secondo`,other:`{{count}} secondi`},halfAMinute:`alcuni secondi`,lessThanXMinutes:{one:`meno di un minuto`,other:`meno di {{count}} minuti`},xMinutes:{one:`un minuto`,other:`{{count}} minuti`},aboutXHours:{one:`circa un'ora`,other:`circa {{count}} ore`},xHours:{one:`un'ora`,other:`{{count}} ore`},xDays:{one:`un giorno`,other:`{{count}} giorni`},aboutXWeeks:{one:`circa una settimana`,other:`circa {{count}} settimane`},xWeeks:{one:`una settimana`,other:`{{count}} settimane`},aboutXMonths:{one:`circa un mese`,other:`circa {{count}} mesi`},xMonths:{one:`un mese`,other:`{{count}} mesi`},aboutXYears:{one:`circa un anno`,other:`circa {{count}} anni`},xYears:{one:`un anno`,other:`{{count}} anni`},overXYears:{one:`più di un anno`,other:`più di {{count}} anni`},almostXYears:{one:`quasi un anno`,other:`quasi {{count}} anni`}},wu=(e,t,n)=>{let r,i=Cu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`tra `+r:r+` fa`:r},Tu={date:xl({formats:{full:`EEEE d MMMM y`,long:`d MMMM y`,medium:`d MMM y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Eu=[`domenica`,`lunedì`,`martedì`,`mercoledì`,`giovedì`,`venerdì`,`sabato`];function Du(e){switch(e){case 0:return`'domenica scorsa alle' p`;default:return`'`+Eu[e]+` scorso alle' p`}}function Ou(e){return`'`+Eu[e]+` alle' p`}function ku(e){switch(e){case 0:return`'domenica prossima alle' p`;default:return`'`+Eu[e]+` prossimo alle' p`}}var Au={lastWeek:(e,t,n)=>{let r=e.getDay();return Bl(e,t,n)?Ou(r):Du(r)},yesterday:`'ieri alle' p`,today:`'oggi alle' p`,tomorrow:`'domani alle' p`,nextWeek:(e,t,n)=>{let r=e.getDay();return Bl(e,t,n)?Ou(r):ku(r)},other:`P`},ju={code:`it`,formatDistance:wu,formatLong:Tu,formatRelative:(e,t,n,r)=>{let i=Au[e];return typeof i==`function`?i(t,n,r):i},localize:{ordinalNumber:(e,t)=>{let n=Number(e);return String(n)},era:Sl({values:{narrow:[`aC`,`dC`],abbreviated:[`a.C.`,`d.C.`],wide:[`avanti Cristo`,`dopo Cristo`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`G`,`F`,`M`,`A`,`M`,`G`,`L`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`gen`,`feb`,`mar`,`apr`,`mag`,`giu`,`lug`,`ago`,`set`,`ott`,`nov`,`dic`],wide:[`gennaio`,`febbraio`,`marzo`,`aprile`,`maggio`,`giugno`,`luglio`,`agosto`,`settembre`,`ottobre`,`novembre`,`dicembre`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`D`,`L`,`M`,`M`,`G`,`V`,`S`],short:[`dom`,`lun`,`mar`,`mer`,`gio`,`ven`,`sab`],abbreviated:[`dom`,`lun`,`mar`,`mer`,`gio`,`ven`,`sab`],wide:[`domenica`,`lunedì`,`martedì`,`mercoledì`,`giovedì`,`venerdì`,`sabato`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`m.`,pm:`p.`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`},abbreviated:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`},wide:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`mattina`,afternoon:`pomeriggio`,evening:`sera`,night:`notte`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`m.`,pm:`p.`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`},abbreviated:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`},wide:{am:`AM`,pm:`PM`,midnight:`mezzanotte`,noon:`mezzogiorno`,morning:`di mattina`,afternoon:`del pomeriggio`,evening:`di sera`,night:`di notte`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^a/i,/^(d|e)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Mu={lessThanXSeconds:{one:`1秒未満`,other:`{{count}}秒未満`,oneWithSuffix:`約1秒`,otherWithSuffix:`約{{count}}秒`},xSeconds:{one:`1秒`,other:`{{count}}秒`},halfAMinute:`30秒`,lessThanXMinutes:{one:`1分未満`,other:`{{count}}分未満`,oneWithSuffix:`約1分`,otherWithSuffix:`約{{count}}分`},xMinutes:{one:`1分`,other:`{{count}}分`},aboutXHours:{one:`約1時間`,other:`約{{count}}時間`},xHours:{one:`1時間`,other:`{{count}}時間`},xDays:{one:`1日`,other:`{{count}}日`},aboutXWeeks:{one:`約1週間`,other:`約{{count}}週間`},xWeeks:{one:`1週間`,other:`{{count}}週間`},aboutXMonths:{one:`約1か月`,other:`約{{count}}か月`},xMonths:{one:`1か月`,other:`{{count}}か月`},aboutXYears:{one:`約1年`,other:`約{{count}}年`},xYears:{one:`1年`,other:`{{count}}年`},overXYears:{one:`1年以上`,other:`{{count}}年以上`},almostXYears:{one:`1年近く`,other:`{{count}}年近く`}},Nu=(e,t,n)=>{n||={};let r,i=Mu[e];return r=typeof i==`string`?i:t===1?n.addSuffix&&i.oneWithSuffix?i.oneWithSuffix:i.one:n.addSuffix&&i.otherWithSuffix?i.otherWithSuffix.replace(`{{count}}`,String(t)):i.other.replace(`{{count}}`,String(t)),n.addSuffix?n.comparison&&n.comparison>0?r+`後`:r+`前`:r},Pu={date:xl({formats:{full:`y年M月d日EEEE`,long:`y年M月d日`,medium:`y/MM/dd`,short:`y/MM/dd`},defaultWidth:`full`}),time:xl({formats:{full:`H時mm分ss秒 zzzz`,long:`H:mm:ss z`,medium:`H:mm:ss`,short:`H:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},Fu={lastWeek:`先週のeeeeのp`,yesterday:`昨日のp`,today:`今日のp`,tomorrow:`明日のp`,nextWeek:`翌週のeeeeのp`,other:`P`},Iu={code:`ja`,formatDistance:Nu,formatLong:Pu,formatRelative:(e,t,n,r)=>Fu[e],localize:{ordinalNumber:(e,t)=>{let n=Number(e);switch(String(t?.unit)){case`year`:return`${n}年`;case`quarter`:return`第${n}四半期`;case`month`:return`${n}月`;case`week`:return`第${n}週`;case`date`:return`${n}日`;case`hour`:return`${n}時`;case`minute`:return`${n}分`;case`second`:return`${n}秒`;default:return`${n}`}},era:Sl({values:{narrow:[`BC`,`AC`],abbreviated:[`紀元前`,`西暦`],wide:[`紀元前`,`西暦`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`第1四半期`,`第2四半期`,`第3四半期`,`第4四半期`]},defaultWidth:`wide`,argumentCallback:e=>Number(e)-1}),month:Sl({values:{narrow:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`],abbreviated:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],wide:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],short:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],abbreviated:[`日`,`月`,`火`,`水`,`木`,`金`,`土`],wide:[`日曜日`,`月曜日`,`火曜日`,`水曜日`,`木曜日`,`金曜日`,`土曜日`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},abbreviated:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},wide:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},abbreviated:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`},wide:{am:`午前`,pm:`午後`,midnight:`深夜`,noon:`正午`,morning:`朝`,afternoon:`午後`,evening:`夜`,night:`深夜`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Cl({matchPatterns:{narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},defaultMatchWidth:`wide`,parsePatterns:{any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},Lu={lessThanXSeconds:{one:`menos de um segundo`,other:`menos de {{count}} segundos`},xSeconds:{one:`1 segundo`,other:`{{count}} segundos`},halfAMinute:`meio minuto`,lessThanXMinutes:{one:`menos de um minuto`,other:`menos de {{count}} minutos`},xMinutes:{one:`1 minuto`,other:`{{count}} minutos`},aboutXHours:{one:`aproximadamente 1 hora`,other:`aproximadamente {{count}} horas`},xHours:{one:`1 hora`,other:`{{count}} horas`},xDays:{one:`1 dia`,other:`{{count}} dias`},aboutXWeeks:{one:`aproximadamente 1 semana`,other:`aproximadamente {{count}} semanas`},xWeeks:{one:`1 semana`,other:`{{count}} semanas`},aboutXMonths:{one:`aproximadamente 1 mês`,other:`aproximadamente {{count}} meses`},xMonths:{one:`1 mês`,other:`{{count}} meses`},aboutXYears:{one:`aproximadamente 1 ano`,other:`aproximadamente {{count}} anos`},xYears:{one:`1 ano`,other:`{{count}} anos`},overXYears:{one:`mais de 1 ano`,other:`mais de {{count}} anos`},almostXYears:{one:`quase 1 ano`,other:`quase {{count}} anos`}},Ru=(e,t,n)=>{let r,i=Lu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?`daqui a `+r:`há `+r:r},zu={date:xl({formats:{full:`EEEE, d 'de' MMMM 'de' y`,long:`d 'de' MMMM 'de' y`,medium:`d 'de' MMM 'de' y`,short:`dd/MM/y`},defaultWidth:`full`}),time:xl({formats:{full:`HH:mm:ss zzzz`,long:`HH:mm:ss z`,medium:`HH:mm:ss`,short:`HH:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} 'às' {{time}}`,long:`{{date}} 'às' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Bu={lastWeek:e=>{let t=e.getDay();return`'`+(t===0||t===6?`último`:`última`)+`' eeee 'às' p`},yesterday:`'ontem às' p`,today:`'hoje às' p`,tomorrow:`'amanhã às' p`,nextWeek:`eeee 'às' p`,other:`P`},Vu={code:`pt`,formatDistance:Ru,formatLong:zu,formatRelative:(e,t,n,r)=>{let i=Bu[e];return typeof i==`function`?i(t):i},localize:{ordinalNumber:(e,t)=>Number(e)+`º`,era:Sl({values:{narrow:[`aC`,`dC`],abbreviated:[`a.C.`,`d.C.`],wide:[`antes de Cristo`,`depois de Cristo`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`T1`,`T2`,`T3`,`T4`],wide:[`1º trimestre`,`2º trimestre`,`3º trimestre`,`4º trimestre`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`j`,`f`,`m`,`a`,`m`,`j`,`j`,`a`,`s`,`o`,`n`,`d`],abbreviated:[`jan`,`fev`,`mar`,`abr`,`mai`,`jun`,`jul`,`ago`,`set`,`out`,`nov`,`dez`],wide:[`janeiro`,`fevereiro`,`março`,`abril`,`maio`,`junho`,`julho`,`agosto`,`setembro`,`outubro`,`novembro`,`dezembro`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`d`,`s`,`t`,`q`,`q`,`s`,`s`],short:[`dom`,`seg`,`ter`,`qua`,`qui`,`sex`,`sáb`],abbreviated:[`dom`,`seg`,`ter`,`qua`,`qui`,`sex`,`sáb`],wide:[`domingo`,`segunda-feira`,`terça-feira`,`quarta-feira`,`quinta-feira`,`sexta-feira`,`sábado`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`},abbreviated:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`},wide:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`manhã`,afternoon:`tarde`,evening:`noite`,night:`madrugada`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`},abbreviated:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`},wide:{am:`AM`,pm:`PM`,midnight:`meia-noite`,noon:`meio-dia`,morning:`da manhã`,afternoon:`da tarde`,evening:`da noite`,night:`da madrugada`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(\d+)(º|ª)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Hu={lessThanXSeconds:{one:`不到 1 秒`,other:`不到 {{count}} 秒`},xSeconds:{one:`1 秒`,other:`{{count}} 秒`},halfAMinute:`半分钟`,lessThanXMinutes:{one:`不到 1 分钟`,other:`不到 {{count}} 分钟`},xMinutes:{one:`1 分钟`,other:`{{count}} 分钟`},xHours:{one:`1 小时`,other:`{{count}} 小时`},aboutXHours:{one:`大约 1 小时`,other:`大约 {{count}} 小时`},xDays:{one:`1 天`,other:`{{count}} 天`},aboutXWeeks:{one:`大约 1 个星期`,other:`大约 {{count}} 个星期`},xWeeks:{one:`1 个星期`,other:`{{count}} 个星期`},aboutXMonths:{one:`大约 1 个月`,other:`大约 {{count}} 个月`},xMonths:{one:`1 个月`,other:`{{count}} 个月`},aboutXYears:{one:`大约 1 年`,other:`大约 {{count}} 年`},xYears:{one:`1 年`,other:`{{count}} 年`},overXYears:{one:`超过 1 年`,other:`超过 {{count}} 年`},almostXYears:{one:`将近 1 年`,other:`将近 {{count}} 年`}},Uu=(e,t,n)=>{let r,i=Hu[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+`内`:r+`前`:r},Wu={date:xl({formats:{full:`y'年'M'月'd'日' EEEE`,long:`y'年'M'月'd'日'`,medium:`yyyy-MM-dd`,short:`yy-MM-dd`},defaultWidth:`full`}),time:xl({formats:{full:`zzzz a h:mm:ss`,long:`z a h:mm:ss`,medium:`a h:mm:ss`,short:`a h:mm`},defaultWidth:`full`}),dateTime:xl({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})};function Gu(e,t,n){let r=`eeee p`;return Bl(e,t,n)?r:e.getTime()>t.getTime()?`'下个'`+r:`'上个'`+r}var Ku={lastWeek:Gu,yesterday:`'昨天' p`,today:`'今天' p`,tomorrow:`'明天' p`,nextWeek:Gu,other:`PP p`},qu={code:`zh-CN`,formatDistance:Uu,formatLong:Wu,formatRelative:(e,t,n,r)=>{let i=Ku[e];return typeof i==`function`?i(t,n,r):i},localize:{ordinalNumber:(e,t)=>{let n=Number(e);switch(t?.unit){case`date`:return n.toString()+`日`;case`hour`:return n.toString()+`时`;case`minute`:return n.toString()+`分`;case`second`:return n.toString()+`秒`;default:return`第 `+n.toString()}},era:Sl({values:{narrow:[`前`,`公元`],abbreviated:[`前`,`公元`],wide:[`公元前`,`公元`]},defaultWidth:`wide`}),quarter:Sl({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`第一季`,`第二季`,`第三季`,`第四季`],wide:[`第一季度`,`第二季度`,`第三季度`,`第四季度`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Sl({values:{narrow:[`一`,`二`,`三`,`四`,`五`,`六`,`七`,`八`,`九`,`十`,`十一`,`十二`],abbreviated:[`1月`,`2月`,`3月`,`4月`,`5月`,`6月`,`7月`,`8月`,`9月`,`10月`,`11月`,`12月`],wide:[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`]},defaultWidth:`wide`}),day:Sl({values:{narrow:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],short:[`日`,`一`,`二`,`三`,`四`,`五`,`六`],abbreviated:[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],wide:[`星期日`,`星期一`,`星期二`,`星期三`,`星期四`,`星期五`,`星期六`]},defaultWidth:`wide`}),dayPeriod:Sl({values:{narrow:{am:`上`,pm:`下`,midnight:`凌晨`,noon:`午`,morning:`早`,afternoon:`下午`,evening:`晚`,night:`夜`},abbreviated:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`},wide:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`上`,pm:`下`,midnight:`凌晨`,noon:`午`,morning:`早`,afternoon:`下午`,evening:`晚`,night:`夜`},abbreviated:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`},wide:{am:`上午`,pm:`下午`,midnight:`凌晨`,noon:`中午`,morning:`早晨`,afternoon:`中午`,evening:`晚上`,night:`夜间`}},defaultFormattingWidth:`wide`})},match:{ordinalNumber:El({matchPattern:/^(第\s*)?\d+(日|时|分|秒)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Cl({matchPatterns:{narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^(前)/i,/^(公元)/i]},defaultParseWidth:`any`}),quarter:Cl({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Cl({matchPatterns:{narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},defaultParseWidth:`any`}),day:Cl({matchPatterns:{narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},defaultParseWidth:`any`}),dayPeriod:Cl({matchPatterns:{any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},defaultParseWidth:`any`})},options:{weekStartsOn:1,firstWeekContainsDate:4}},Ju=[`en`,`es`,`fr`,`de`,`pt`,`it`,`zh`,`ja`],Yu={en:{id:`en`,nativeName:`English`,englishName:`English`},es:{id:`es`,nativeName:`Español`,englishName:`Spanish`},fr:{id:`fr`,nativeName:`Français`,englishName:`French`},de:{id:`de`,nativeName:`Deutsch`,englishName:`German`},pt:{id:`pt`,nativeName:`Português`,englishName:`Portuguese`},it:{id:`it`,nativeName:`Italiano`,englishName:`Italian`},zh:{id:`zh`,nativeName:`中文`,englishName:`Chinese`},ja:{id:`ja`,nativeName:`日本語`,englishName:`Japanese`}},Xu=`specrails-desktop:ui-language`;function Zu(e){return typeof e==`string`&&Ju.includes(e)}function Qu(e){return e.split(`/`).pop().replace(/\.json$/,``)}var $u=Object.assign({"../locales/en/activity.json":i,"../locales/en/addspec.json":a,"../locales/en/agents.json":o,"../locales/en/agentstudio.json":s,"../locales/en/aiedit.json":c,"../locales/en/analytics.json":l,"../locales/en/attachments.json":u,"../locales/en/browser.json":d,"../locales/en/chat.json":f,"../locales/en/code.json":p,"../locales/en/commands.json":m,"../locales/en/common.json":h,"../locales/en/dashboard.json":g,"../locales/en/explore.json":_,"../locales/en/integrations.json":v,"../locales/en/jobs.json":y,"../locales/en/nav.json":b,"../locales/en/settings.json":x,"../locales/en/setup.json":S,"../locales/en/specs.json":C,"../locales/en/terminal.json":w,"../locales/en/tickets.json":T}),ed=Object.assign({"../locales/de/activity.json":()=>r(()=>import(`./activity-BdrPln96.js`),[]),"../locales/de/addspec.json":()=>r(()=>import(`./addspec-D33ocMxf.js`),[]),"../locales/de/agents.json":()=>r(()=>import(`./agents-TeOSy-ax.js`),[]),"../locales/de/agentstudio.json":()=>r(()=>import(`./agentstudio-BADhZ41e.js`),[]),"../locales/de/aiedit.json":()=>r(()=>import(`./aiedit-D2ji6Qy0.js`),[]),"../locales/de/analytics.json":()=>r(()=>import(`./analytics-C9Zc-rkM.js`),[]),"../locales/de/attachments.json":()=>r(()=>import(`./attachments-COcrGRFz.js`),[]),"../locales/de/browser.json":()=>r(()=>import(`./browser-5ErDlJoR.js`),[]),"../locales/de/chat.json":()=>r(()=>import(`./chat-BQNMD0PL.js`),[]),"../locales/de/code.json":()=>r(()=>import(`./code-C0FTS3ew.js`),[]),"../locales/de/commands.json":()=>r(()=>import(`./commands-BDDp6xFG.js`),[]),"../locales/de/common.json":()=>r(()=>import(`./common-Dmm1GhdD.js`),[]),"../locales/de/dashboard.json":()=>r(()=>import(`./dashboard-CoTpMOBM.js`),[]),"../locales/de/explore.json":()=>r(()=>import(`./explore-BV5Xxlsn.js`),[]),"../locales/de/integrations.json":()=>r(()=>import(`./integrations-DaC4SzzL.js`),[]),"../locales/de/jobs.json":()=>r(()=>import(`./jobs-2f6Hdc72.js`),[]),"../locales/de/nav.json":()=>r(()=>import(`./nav-CtYwmMgu.js`),[]),"../locales/de/settings.json":()=>r(()=>import(`./settings-BgPqg2nv.js`),[]),"../locales/de/setup.json":()=>r(()=>import(`./setup-B19ZpBNi.js`),[]),"../locales/de/specs.json":()=>r(()=>import(`./specs-DaUTrNF9.js`),[]),"../locales/de/terminal.json":()=>r(()=>import(`./terminal-YOlsJCQj.js`),[]),"../locales/de/tickets.json":()=>r(()=>import(`./tickets-DlpC_iTg.js`),[]),"../locales/en/activity.json":()=>r(()=>import(`./activity-Dv6H7wEr.js`).then(e=>e.t),__vite__mapDeps([0,1])),"../locales/en/addspec.json":()=>r(()=>import(`./addspec-GWm4ffKl.js`).then(e=>e.t),__vite__mapDeps([2,1])),"../locales/en/agents.json":()=>r(()=>import(`./agents-CMxtJMLD.js`).then(e=>e.t),__vite__mapDeps([3,1])),"../locales/en/agentstudio.json":()=>r(()=>import(`./agentstudio-CxlUllqI.js`).then(e=>e.t),__vite__mapDeps([4,1])),"../locales/en/aiedit.json":()=>r(()=>import(`./aiedit-TTwzL1TS.js`).then(e=>e.t),__vite__mapDeps([5,1])),"../locales/en/analytics.json":()=>r(()=>import(`./analytics-DMCto-TF.js`).then(e=>e.t),__vite__mapDeps([6,1])),"../locales/en/attachments.json":()=>r(()=>import(`./attachments-BIsSSnHJ.js`).then(e=>e.t),__vite__mapDeps([7,1])),"../locales/en/browser.json":()=>r(()=>import(`./browser-Qya9cARy.js`).then(e=>e.t),__vite__mapDeps([8,1])),"../locales/en/chat.json":()=>r(()=>import(`./chat-BsbNGPW9.js`).then(e=>e.t),__vite__mapDeps([9,1])),"../locales/en/code.json":()=>r(()=>import(`./code-D3zVVQTj.js`).then(e=>e.t),__vite__mapDeps([10,1])),"../locales/en/commands.json":()=>r(()=>import(`./commands-IXMOKBYt.js`).then(e=>e.t),__vite__mapDeps([11,1])),"../locales/en/common.json":()=>r(()=>import(`./common-wA36jmj1.js`).then(e=>e.t),__vite__mapDeps([12,1])),"../locales/en/dashboard.json":()=>r(()=>import(`./dashboard-Duo4DDCW.js`).then(e=>e.t),__vite__mapDeps([13,1])),"../locales/en/explore.json":()=>r(()=>import(`./explore-hFc3HFcp.js`).then(e=>e.t),__vite__mapDeps([14,1])),"../locales/en/integrations.json":()=>r(()=>import(`./integrations-D28q1kF6.js`).then(e=>e.t),__vite__mapDeps([15,1])),"../locales/en/jobs.json":()=>r(()=>import(`./jobs-cHYInoau.js`).then(e=>e.t),__vite__mapDeps([16,1])),"../locales/en/nav.json":()=>r(()=>import(`./nav-BEL3MTwK.js`).then(e=>e.t),__vite__mapDeps([17,1])),"../locales/en/settings.json":()=>r(()=>import(`./settings-DDcfx_ca.js`).then(e=>e.t),__vite__mapDeps([18,1])),"../locales/en/setup.json":()=>r(()=>import(`./setup-BqYA02rS.js`).then(e=>e.t),__vite__mapDeps([19,1])),"../locales/en/specs.json":()=>r(()=>import(`./specs-cKEh2LXt.js`).then(e=>e.t),__vite__mapDeps([20,1])),"../locales/en/terminal.json":()=>r(()=>import(`./terminal-CSONJOex.js`).then(e=>e.t),__vite__mapDeps([21,1])),"../locales/en/tickets.json":()=>r(()=>import(`./tickets-DucYgtdl.js`).then(e=>e.t),__vite__mapDeps([22,1])),"../locales/es/activity.json":()=>r(()=>import(`./activity-BEIp_Y1A.js`),[]),"../locales/es/addspec.json":()=>r(()=>import(`./addspec-DFswZ0jK.js`),[]),"../locales/es/agents.json":()=>r(()=>import(`./agents-1nCDWRmP.js`),[]),"../locales/es/agentstudio.json":()=>r(()=>import(`./agentstudio-DuH9TogZ.js`),[]),"../locales/es/aiedit.json":()=>r(()=>import(`./aiedit-BWxHGsYA.js`),[]),"../locales/es/analytics.json":()=>r(()=>import(`./analytics-CVx3YOc0.js`),[]),"../locales/es/attachments.json":()=>r(()=>import(`./attachments-Bke8sCU4.js`),[]),"../locales/es/browser.json":()=>r(()=>import(`./browser-DGITz3fC.js`),[]),"../locales/es/chat.json":()=>r(()=>import(`./chat-yoXwguQu.js`),[]),"../locales/es/code.json":()=>r(()=>import(`./code-C0BKpkht.js`),[]),"../locales/es/commands.json":()=>r(()=>import(`./commands-B772IyDa.js`),[]),"../locales/es/common.json":()=>r(()=>import(`./common-GbpxfPG8.js`),[]),"../locales/es/dashboard.json":()=>r(()=>import(`./dashboard-C7SK6xu5.js`),[]),"../locales/es/explore.json":()=>r(()=>import(`./explore-B9A3iN2W.js`),[]),"../locales/es/integrations.json":()=>r(()=>import(`./integrations-Cr6hH7XR.js`),[]),"../locales/es/jobs.json":()=>r(()=>import(`./jobs-3j3_npyo.js`),[]),"../locales/es/nav.json":()=>r(()=>import(`./nav-ClzOE4mA.js`),[]),"../locales/es/settings.json":()=>r(()=>import(`./settings-BSze3_9q.js`),[]),"../locales/es/setup.json":()=>r(()=>import(`./setup--FMCsnQS.js`),[]),"../locales/es/specs.json":()=>r(()=>import(`./specs-Dyc5hYeE.js`),[]),"../locales/es/terminal.json":()=>r(()=>import(`./terminal-80yDMgMF.js`),[]),"../locales/es/tickets.json":()=>r(()=>import(`./tickets-DYvafSaY.js`),[]),"../locales/fr/activity.json":()=>r(()=>import(`./activity-DOUVEjJi.js`),[]),"../locales/fr/addspec.json":()=>r(()=>import(`./addspec-BEeF5-zc.js`),[]),"../locales/fr/agents.json":()=>r(()=>import(`./agents-iTqjRajS.js`),[]),"../locales/fr/agentstudio.json":()=>r(()=>import(`./agentstudio-BSnWLR63.js`),[]),"../locales/fr/aiedit.json":()=>r(()=>import(`./aiedit-DvrcbwGv.js`),[]),"../locales/fr/analytics.json":()=>r(()=>import(`./analytics-BIdr0YfL.js`),[]),"../locales/fr/attachments.json":()=>r(()=>import(`./attachments-DYHGA2Dj.js`),[]),"../locales/fr/browser.json":()=>r(()=>import(`./browser-Bc-YdlVg.js`),[]),"../locales/fr/chat.json":()=>r(()=>import(`./chat-DwUm6W9z.js`),[]),"../locales/fr/code.json":()=>r(()=>import(`./code-D3ryDniw.js`),[]),"../locales/fr/commands.json":()=>r(()=>import(`./commands-CJxCry-o.js`),[]),"../locales/fr/common.json":()=>r(()=>import(`./common-DCr6VzJ7.js`),[]),"../locales/fr/dashboard.json":()=>r(()=>import(`./dashboard-BZBADHSj.js`),[]),"../locales/fr/explore.json":()=>r(()=>import(`./explore-A8Ltoblq.js`),[]),"../locales/fr/integrations.json":()=>r(()=>import(`./integrations-Cublz3m6.js`),[]),"../locales/fr/jobs.json":()=>r(()=>import(`./jobs-BqEbCCxD.js`),[]),"../locales/fr/nav.json":()=>r(()=>import(`./nav-0fwkrgHt.js`),[]),"../locales/fr/settings.json":()=>r(()=>import(`./settings-CTcwN9RE.js`),[]),"../locales/fr/setup.json":()=>r(()=>import(`./setup-fnfEbwlv.js`),[]),"../locales/fr/specs.json":()=>r(()=>import(`./specs-CZ1PsXsC.js`),[]),"../locales/fr/terminal.json":()=>r(()=>import(`./terminal-Bje4ziIa.js`),[]),"../locales/fr/tickets.json":()=>r(()=>import(`./tickets-CB7N30gm.js`),[]),"../locales/it/activity.json":()=>r(()=>import(`./activity-CpkRS8Sx.js`),[]),"../locales/it/addspec.json":()=>r(()=>import(`./addspec-Fkv91Opc.js`),[]),"../locales/it/agents.json":()=>r(()=>import(`./agents-Bm9rPqnt.js`),[]),"../locales/it/agentstudio.json":()=>r(()=>import(`./agentstudio-Kw88_dUF.js`),[]),"../locales/it/aiedit.json":()=>r(()=>import(`./aiedit-DJMny-D5.js`),[]),"../locales/it/analytics.json":()=>r(()=>import(`./analytics-CYj0tfj7.js`),[]),"../locales/it/attachments.json":()=>r(()=>import(`./attachments-BW4L3l2L.js`),[]),"../locales/it/browser.json":()=>r(()=>import(`./browser-JsAIGCEW.js`),[]),"../locales/it/chat.json":()=>r(()=>import(`./chat-BEW60P_u.js`),[]),"../locales/it/code.json":()=>r(()=>import(`./code-exI0G5Wd.js`),[]),"../locales/it/commands.json":()=>r(()=>import(`./commands-DLrvnPNg.js`),[]),"../locales/it/common.json":()=>r(()=>import(`./common-DeDELLZJ.js`),[]),"../locales/it/dashboard.json":()=>r(()=>import(`./dashboard-C1MfeUHs.js`),[]),"../locales/it/explore.json":()=>r(()=>import(`./explore-4mFpnrKU.js`),[]),"../locales/it/integrations.json":()=>r(()=>import(`./integrations-DmQYCUvN.js`),[]),"../locales/it/jobs.json":()=>r(()=>import(`./jobs-DPPT6bV6.js`),[]),"../locales/it/nav.json":()=>r(()=>import(`./nav-D2bOGSEg.js`),[]),"../locales/it/settings.json":()=>r(()=>import(`./settings-Bg0A3zoS.js`),[]),"../locales/it/setup.json":()=>r(()=>import(`./setup-BZPmkjSN.js`),[]),"../locales/it/specs.json":()=>r(()=>import(`./specs-k0PyLDVt.js`),[]),"../locales/it/terminal.json":()=>r(()=>import(`./terminal-lkZYR4wJ.js`),[]),"../locales/it/tickets.json":()=>r(()=>import(`./tickets-clefmXLv.js`),[]),"../locales/ja/activity.json":()=>r(()=>import(`./activity-DKCpESPt.js`),[]),"../locales/ja/addspec.json":()=>r(()=>import(`./addspec-DVZ15Jp8.js`),[]),"../locales/ja/agents.json":()=>r(()=>import(`./agents-Q6Ldfpxx.js`),[]),"../locales/ja/agentstudio.json":()=>r(()=>import(`./agentstudio-BdidyBzZ.js`),[]),"../locales/ja/aiedit.json":()=>r(()=>import(`./aiedit-DAhZTvtk.js`),[]),"../locales/ja/analytics.json":()=>r(()=>import(`./analytics-CrPCZRJ-.js`),[]),"../locales/ja/attachments.json":()=>r(()=>import(`./attachments-DzdU6DV6.js`),[]),"../locales/ja/browser.json":()=>r(()=>import(`./browser-BlYF4OOq.js`),[]),"../locales/ja/chat.json":()=>r(()=>import(`./chat-CboQguCi.js`),[]),"../locales/ja/code.json":()=>r(()=>import(`./code-AL1rVIMb.js`),[]),"../locales/ja/commands.json":()=>r(()=>import(`./commands-sqrqsxyE.js`),[]),"../locales/ja/common.json":()=>r(()=>import(`./common-Dard9UNH.js`),[]),"../locales/ja/dashboard.json":()=>r(()=>import(`./dashboard-CB6Le1yN.js`),[]),"../locales/ja/explore.json":()=>r(()=>import(`./explore-D2EFgt8J.js`),[]),"../locales/ja/integrations.json":()=>r(()=>import(`./integrations-DRdbki5W.js`),[]),"../locales/ja/jobs.json":()=>r(()=>import(`./jobs-2N3RXDAM.js`),[]),"../locales/ja/nav.json":()=>r(()=>import(`./nav-C2YXcbZS.js`),[]),"../locales/ja/settings.json":()=>r(()=>import(`./settings-D_dujJZI.js`),[]),"../locales/ja/setup.json":()=>r(()=>import(`./setup-D2n9jMfM.js`),[]),"../locales/ja/specs.json":()=>r(()=>import(`./specs-BFfu3u-a.js`),[]),"../locales/ja/terminal.json":()=>r(()=>import(`./terminal-DEqzGtcr.js`),[]),"../locales/ja/tickets.json":()=>r(()=>import(`./tickets-DNOANUXr.js`),[]),"../locales/pt/activity.json":()=>r(()=>import(`./activity-DcDQ7tjw.js`),[]),"../locales/pt/addspec.json":()=>r(()=>import(`./addspec-B5yl4Loj.js`),[]),"../locales/pt/agents.json":()=>r(()=>import(`./agents-s87sMGzL.js`),[]),"../locales/pt/agentstudio.json":()=>r(()=>import(`./agentstudio-D3I62TLJ.js`),[]),"../locales/pt/aiedit.json":()=>r(()=>import(`./aiedit-DOcxERkU.js`),[]),"../locales/pt/analytics.json":()=>r(()=>import(`./analytics-CnY4kNG3.js`),[]),"../locales/pt/attachments.json":()=>r(()=>import(`./attachments-Dd92KpUH.js`),[]),"../locales/pt/browser.json":()=>r(()=>import(`./browser-CT-ReZGt.js`),[]),"../locales/pt/chat.json":()=>r(()=>import(`./chat-DRCa9pOt.js`),[]),"../locales/pt/code.json":()=>r(()=>import(`./code-PCmfS3dn.js`),[]),"../locales/pt/commands.json":()=>r(()=>import(`./commands-UD1NzmwX.js`),[]),"../locales/pt/common.json":()=>r(()=>import(`./common-DltqHaAe.js`),[]),"../locales/pt/dashboard.json":()=>r(()=>import(`./dashboard-I19DXBxw.js`),[]),"../locales/pt/explore.json":()=>r(()=>import(`./explore-BrBJvfjP.js`),[]),"../locales/pt/integrations.json":()=>r(()=>import(`./integrations-HIlUxXVs.js`),[]),"../locales/pt/jobs.json":()=>r(()=>import(`./jobs-DRzjWI9u.js`),[]),"../locales/pt/nav.json":()=>r(()=>import(`./nav-iH1V5j6o.js`),[]),"../locales/pt/settings.json":()=>r(()=>import(`./settings-CSJ0ahZ8.js`),[]),"../locales/pt/setup.json":()=>r(()=>import(`./setup-P3r6YP1D.js`),[]),"../locales/pt/specs.json":()=>r(()=>import(`./specs-B__C8-8a.js`),[]),"../locales/pt/terminal.json":()=>r(()=>import(`./terminal-DeWzh6ys.js`),[]),"../locales/pt/tickets.json":()=>r(()=>import(`./tickets-DU1aqsbr.js`),[]),"../locales/zh/activity.json":()=>r(()=>import(`./activity-DRwkql_y.js`),[]),"../locales/zh/addspec.json":()=>r(()=>import(`./addspec-DRE-jZv7.js`),[]),"../locales/zh/agents.json":()=>r(()=>import(`./agents-DK-Dlc0i.js`),[]),"../locales/zh/agentstudio.json":()=>r(()=>import(`./agentstudio-B6Wb59E7.js`),[]),"../locales/zh/aiedit.json":()=>r(()=>import(`./aiedit-WBSjT_C1.js`),[]),"../locales/zh/analytics.json":()=>r(()=>import(`./analytics-C6EzgtdE.js`),[]),"../locales/zh/attachments.json":()=>r(()=>import(`./attachments-Bcf6BG6V.js`),[]),"../locales/zh/browser.json":()=>r(()=>import(`./browser-M5-rbPlw.js`),[]),"../locales/zh/chat.json":()=>r(()=>import(`./chat-BEGuC03z.js`),[]),"../locales/zh/code.json":()=>r(()=>import(`./code-CPcHxzxw.js`),[]),"../locales/zh/commands.json":()=>r(()=>import(`./commands-CfgY-_of.js`),[]),"../locales/zh/common.json":()=>r(()=>import(`./common-DnjcgkPH.js`),[]),"../locales/zh/dashboard.json":()=>r(()=>import(`./dashboard-B4ixDVk8.js`),[]),"../locales/zh/explore.json":()=>r(()=>import(`./explore-C3FSE42C.js`),[]),"../locales/zh/integrations.json":()=>r(()=>import(`./integrations-C3p12Ms6.js`),[]),"../locales/zh/jobs.json":()=>r(()=>import(`./jobs-vGfzIDQa.js`),[]),"../locales/zh/nav.json":()=>r(()=>import(`./nav-B_G-TJDW.js`),[]),"../locales/zh/settings.json":()=>r(()=>import(`./settings-DYIV89nV.js`),[]),"../locales/zh/setup.json":()=>r(()=>import(`./setup-ChKQDHN9.js`),[]),"../locales/zh/specs.json":()=>r(()=>import(`./specs-D2FzlLn9.js`),[]),"../locales/zh/terminal.json":()=>r(()=>import(`./terminal-C2WYcFHF.js`),[]),"../locales/zh/tickets.json":()=>r(()=>import(`./tickets-CF2PYelu.js`),[])}),td={};for(let[e,t]of Object.entries($u))td[Qu(e)]=t.default;var nd=Object.keys(td),rd=new Set([`en`]);function id(){if(typeof navigator<`u`){let e=navigator.languages&&navigator.languages.length>0?navigator.languages:[navigator.language];for(let t of e){if(!t)continue;let e=t.toLowerCase().split(`-`)[0];if(Zu(e))return e}}return`en`}function ad(){if(typeof localStorage<`u`)try{let e=localStorage.getItem(Xu);if(Zu(e))return e}catch{}return id()}qr.use(Ii).init({lng:`en`,fallbackLng:`en`,defaultNS:`common`,ns:nd,resources:{en:td},interpolation:{escapeValue:!1},returnNull:!1});async function od(e){if(rd.has(e))return;let t=Object.entries(ed).filter(([t])=>t.includes(`/locales/${e}/`)),n=await Promise.all(t.map(async([e,t])=>[Qu(e),(await t()).default]));for(let[t,r]of n)qr.addResourceBundle(e,t,r,!0,!0);rd.add(e)}async function sd(e){await od(e),await qr.changeLanguage(e),typeof document<`u`&&(document.documentElement.lang=e)}async function cd(){let e=ad();if(e!==`en`)try{await sd(e)}catch{}}function ld(){return Zu(qr.language)?qr.language:`en`}var ud={en:ru,es:lu,fr:Su,de:Xl,pt:Vu,it:ju,zh:qu,ja:Iu};function dd(e){let t=e??qr.language;return ud[Zu(t)?t:`en`]}var J=qr;function fd(e){return e.providers&&e.providers.length>0?e.providers:[e.provider]}var pd=(0,F.createContext)(null),md=`specrails-desktop:activeProjectId`;function hd(e){try{e?localStorage.setItem(md,e):localStorage.removeItem(md)}catch{}}function gd(){try{return localStorage.getItem(md)}catch{return null}}function _d({children:e}){let[t,n]=(0,F.useState)([]),[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(!0),[s,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(new Set),d=(0,F.useRef)(null),f=(0,F.useCallback)(e=>{hd(e),cl(e),i(t=>(t!==null&&t!==e&&(d.current&&clearTimeout(d.current),c(!0),d.current=setTimeout(()=>c(!1),400)),e))},[]),{registerHandler:p,unregisterHandler:m}=bl();(0,F.useEffect)(()=>{async function e(){try{let e=await fetch(`${ol}/api/projects`);if(!e.ok)return;let t=await e.json();n(t.projects),t.setupProjectIds&&t.setupProjectIds.length>0&&u(new Set(t.setupProjectIds))}catch{}finally{o(!1)}}e()},[]);let h=(0,F.useCallback)(e=>{let t=e;if(typeof t.type==`string`){if(t.type===`desktop.projects`){let e=t.projects;n(e),i(t=>{let n;if(t&&e.find(e=>e.id===t))n=t;else{let t=gd();n=t&&e.find(e=>e.id===t)?t:e.length>0?e[0].id:null}return hd(n),cl(n),n}),o(!1)}else if(t.type===`desktop.project_added`){let e=t.project;n(t=>t.find(t=>t.id===e.id)?t:[...t,e]),K.success(J.t(`nav:projects.added`,{name:e.name})),f(e.id)}else if(t.type===`desktop.project_removed`){let e=t.projectId;K.success(J.t(`nav:projects.removed`)),n(t=>t.filter(t=>t.id!==e)),i(t=>t===e?(hd(null),cl(null),null):t)}}},[]);(0,F.useLayoutEffect)(()=>(p(`desktop`,h),()=>m(`desktop`)),[h,p,m]);let g=(0,F.useCallback)(async(e,t,r=[`claude`])=>{try{let i={path:e,providers:r.length>0?r:[`claude`]};t&&(i.name=t);let a=await fetch(`/api/projects`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});if(!a.ok){let e=await a.json();throw Error(e.error??`HTTP ${a.status}`)}let o=await a.json();return n(e=>e.find(e=>e.id===o.project.id)?e:[...e,o.project]),f(o.project.id),o}catch(e){throw console.error(`[useDesktop] addProject error:`,e),e}},[f]),_=(0,F.useCallback)(async e=>{try{let t=await fetch(`${ol}/api/projects/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json();throw Error(e.error??`HTTP ${t.status}`)}n(t=>t.filter(t=>t.id!==e)),u(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),i(t=>t===e?(hd(null),cl(null),null):t)}catch(e){throw console.error(`[useDesktop] removeProject error:`,e),e}},[]),v=(0,F.useCallback)(e=>{u(t=>new Set([...t,e]))},[]),y=(0,F.useCallback)(e=>{u(t=>{let n=new Set(t);return n.delete(e),n})},[]),b=(0,F.useMemo)(()=>({projects:t,activeProjectId:r,setActiveProjectId:f,addProject:g,removeProject:_,isLoading:a,isSwitchingProject:s,setupProjectIds:l,startSetupWizard:v,completeSetupWizard:y}),[t,r,f,g,_,a,s,l,v,y]);return(0,q.jsx)(pd.Provider,{value:b,children:e})}var vd={projects:[],activeProjectId:null,setActiveProjectId:()=>{},addProject:async()=>null,removeProject:async()=>{},isLoading:!1,isSwitchingProject:!1,setupProjectIds:new Set,startSetupWizard:()=>{},completeSetupWizard:()=>{}};function yd(){return(0,F.useContext)(pd)??vd}var bd=new Map,xd=2e3;function Sd(e){bd.set(e,(bd.get(e)??0)+1)}function Cd(e){(bd.get(e)??0)<=0||setTimeout(()=>{let t=(bd.get(e)??0)-1;t<=0?bd.delete(e):bd.set(e,t)},xd)}function wd(e){return e?(bd.get(e)??0)>0:!1}var Td=3e3,Ed=`
17
17
 
18
18
  ---
19
19
 
@@ -118,8 +118,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
118
118
  `:`
119
119
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(e.button!==2||!this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}t&&t[0]===this._model.selectionEnd[0]&&t[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`),t.ILinkProviderService=(0,r.createDecorator)(`LinkProviderService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(`theme`,(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=g(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e!==void 0)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function g(e,t){if(e!==void 0)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=h=r([i(0,l.IOptionsService)],h)},6349:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=a},1439:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},8969:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(1480),_=n(6242),v=n(6351),y=n(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function S(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var C;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(C||(t.WindowsOptionsReportType=C={}));let w=0;class T extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new E(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})})),this._parser.setOscHandlerFallback(((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})})),this._parser.setDcsHandlerFallback(((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})})),this._parser.setPrintHandler(((e,t,n)=>this.print(e,t,n))),this._parser.registerCsiHandler({final:`@`},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:` `,final:`@`},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:`A`},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:` `,final:`A`},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:`B`},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:`C`},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:`D`},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:`E`},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:`F`},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:`G`},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:`H`},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:`I`},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:`J`},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`J`},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:`K`},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:`?`,final:`K`},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:`L`},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:`M`},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:`P`},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:`S`},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:`T`},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:`X`},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:`Z`},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:"`"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:`a`},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:`b`},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:`c`},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:`>`,final:`c`},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:`d`},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:`e`},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:`f`},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:`g`},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:`h`},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`h`},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:`l`},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:`?`,final:`l`},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:`m`},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:`n`},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:`?`,final:`n`},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:` `,final:`q`},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:`r`},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:`s`},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:`t`},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:`u`},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new _.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new _.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new _.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new _.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new _.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new _.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new _.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new _.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new _.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new _.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new _.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new _.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:`7`},(()=>this.saveCursor())),this._parser.registerEscHandler({final:`8`},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:`D`},(()=>this.index())),this._parser.registerEscHandler({final:`E`},(()=>this.nextLine())),this._parser.registerEscHandler({final:`H`},(()=>this.tabSet())),this._parser.registerEscHandler({final:`M`},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:`=`},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:`>`},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:`c`},(()=>this.fullReset())),this._parser.registerEscHandler({final:`n`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`o`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`|`},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:`}`},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:`~`},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:`%`,final:`@`},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:`%`,final:`G`},(()=>this.selectDefaultCharset()));for(let e in o.CHARSETS)this._parser.registerEscHandler({intermediates:`(`,final:e},(()=>this.selectCharset(`(`+e))),this._parser.registerEscHandler({intermediates:`)`,final:e},(()=>this.selectCharset(`)`+e))),this._parser.registerEscHandler({intermediates:`*`,final:e},(()=>this.selectCharset(`*`+e))),this._parser.registerEscHandler({intermediates:`+`,final:e},(()=>this.selectCharset(`+`+e))),this._parser.registerEscHandler({intermediates:`-`,final:e},(()=>this.selectCharset(`-`+e))),this._parser.registerEscHandler({intermediates:`.`,final:e},(()=>this.selectCharset(`.`+e))),this._parser.registerEscHandler({intermediates:`/`,final:e},(()=>this.selectCharset(`/`+e)));this._parser.registerEscHandler({intermediates:`#`,final:`8`},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(`Parsing error: `,e),e))),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new v.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 ms`)}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>x&&(a=this._parseStack.position+x)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(e.length,x))),o||this._dirtyRowTracker.clearRange(),e.length>x)for(let t=a;t<e.length;t+=x){let a=t+x<e.length?t+x:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}this._activeBuffer.x===r&&this._activeBuffer.y===i||this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(c,this._bufferService.rows-1),Math.min(s,this._bufferService.rows-1))}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let h=this._parser.precedingJoinState;for(let _=t;_<n;++_){if(r=e[_],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,h);i=g.UnicodeService.extractWidth(t);let n=g.UnicodeService.extractShouldJoin(t),v=n?g.UnicodeService.extractWidth(h):0;if(h=t,o&&this._onA11yChar.fire((0,l.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-v>s){if(c){let e=m,t=this._activeBuffer.x-v;for(this._activeBuffer.x=v,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),v>0&&m instanceof u.BufferLine&&m.copyCellsFrom(e,t,0,v,!1);t<s;)e.setCellFromCodepoint(t++,0,1,p)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-v;--e>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}else if(d&&(m.insertCells(this._activeBuffer.x,i-v,this._activeBuffer.getNullCell(p)),m.getWidth(s-1)===2&&m.setCellFromCodepoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,p)),m.setCellFromCodepoint(this._activeBuffer.x++,r,i,p),i>0)for(;--i;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=h,this._activeBuffer.x<s&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!S(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new _.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),t!==2&&t!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=g.UnicodeService.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=e=>e?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!S(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(C.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(C.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:t!==0&&t!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),t!==0&&t!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(D(n))if(r===`?`)t.push({type:0,index:n});else{let e=(0,y.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex((e=>e.startsWith(`id=`)));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=(0,y.parseColor)(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);D(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(b[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=T;let E=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(w=e,e=t,t=w),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}E=r([i(0,h.IBufferService)],E)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,`__esModule`,{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else{if(!(i<e)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new o.BufferLine(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=[],i=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u<a+l.length)continue;let d=l[l.length-1].getTrimmedLength(),f=(0,s.reflowSmallerGetNewLineLengths)(l,this._cols,e),p=f.length-l.length,m;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+p):Math.max(0,this.lines.length-this.lines.maxLength+p);let h=[];for(let e=0;e<p;e++){let e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);h.push(e)}h.length>0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t<l.length;t++)f[t]<e&&l[t].setCell(f[t],n);let b=p-m;for(;b-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(r.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,a=n-1,o=0,s=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+i-1);l>=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim((e=>{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,o.stringFromCodePoint)(n):``,t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,n,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&r?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&r)+(0,o.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[3*e+0]=r}insertCells(e,t,n){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new i.CellData;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new i.CellData;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new c(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[3*t+0],n=2097151&e,s=2097152&e?this._combined[t]:n?(0,o.stringFromCodePoint)(n):a.WHITESPACE_CELL_CHAR;if(i+=s,r)for(let e=0;e<s.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}Object.defineProperty(t,`__esModule`,{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(i>=s&&i<c){s+=u.length-1;continue}let d=0,f=n(u,d,t),p=1,m=0;for(;p<u.length;){let e=n(u,p,t),i=e-m,o=r-f,s=Math.min(i,o);u[d].copyCellsFrom(u[p],m,f,s,!1),f+=s,f===r&&(d++,f=0),m+=s,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(r-1)===2&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,a))}u[d].replaceCells(f,r,a);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}},t.reflowLargerApplyNewLayout=function(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,r){let i=[],a=e.map(((r,i)=>n(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;c<a;){if(a-c<r){i.push(a-c);break}o+=r;let l=n(e,s,t);o>l&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,(()=>this.setupTabStops())))}reset(){this._normal=new a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,`__esModule`,{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
120
120
  `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``}(n||(t.C0=n={})),function(e){e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:o.key=e.ctrlKey?`\b`:r.C0.DEL,e.altKey&&(o.key=r.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let r=n(1480),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},5981:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e=>Date.now()-n>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,r=/^[\da-f]+$/;function i(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),r.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(4095),t=Array.apply(null,Array(256)).map(((e,t)=>t)),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},(()=>!0))}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(e,t,n))}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=``,this._hitLimit=!1,e)));return this._data=``,this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}}},8771:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,n)=>t(e,n.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===1&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function l(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,(t=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n={...t.DEFAULT_OPTIONS};for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options={...n},this._setupOptions(),this.register((0,i.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((n=>{n===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((n=>{e.indexOf(n)!==-1&&t()}))}_setupOptions(){let e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(r,n))),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(o,a))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every((e=>e.line!==t))){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(n,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(u.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this.register(new s.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
121
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),jW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,`__esModule`,{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),MW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebLinksAddon=r():n.WebLinksAddon=r()})(self,(()=>(()=>{var e={6:(e,t)=>{function n(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,`__esModule`,{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=r.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map((e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e)))}};class r{static computeLink(e,t,i,a){let o=new RegExp(t.source,(t.flags||``)+`g`),[s,c]=r._getWindowedLineStrings(e-1,i),l=s.join(``),u,d=[];for(;u=o.exec(l);){let e=u[0];if(!n(e))continue;let[t,o]=r._mapStrIdx(i,c,0,u.index),[s,l]=r._mapStrIdx(i,t,o,e.length);if(t===-1||o===-1||s===-1||l===-1)continue;let f={start:{x:o+1,y:t+1},end:{x:l,y:s+1}};d.push({range:f,text:e,activate:a})}return d}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}}t.LinkComputer=r}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.WebLinksAddon=void 0;let t=n(6),i=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}e.WebLinksAddon=class{constructor(e=a,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let n=this._options,r=n.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}}})(),r})()))})),NW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.SearchAddon=r():n.SearchAddon=r()})(self,(()=>(()=>{var e={345:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,`__esModule`,{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.SearchAddon=void 0;let t=n(345),i=n(859),a=` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`;class o extends i.Disposable{constructor(e){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new i.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new i.MutableDisposable,this._onDidChangeResults=this.register(new t.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=e?.highlightLimit??1e3}activate(e){this._terminal=e,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,i.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let e=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(e,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(e){this._selectedDecoration.clear(),(0,i.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),e||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let n=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||n)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);if(!e||e.length===0)return void this.clearDecorations();t||={},this.clearDecorations(!0);let n=[],r,i=this._find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);for(let e of n){let n=this._createResultDecoration(e,t.decorations);n&&(this._highlightedLines.add(n.marker.line),this._highlightDecorations.push({decoration:n,match:e,dispose(){n.dispose()}}))}}_find(e,t,n,r){if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let a={startRow:t,startCol:n};if(i=this._findInLine(e,a,r),!i)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=n,a.startCol=0,i=this._findInLine(e,a,r),!i);n++);return i}_findNextAndSelect(e,t){if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,i=0;n&&(this._cachedSearchTerm===e?(r=n.end.x,i=n.end.y):(r=n.start.x,i=n.start.y)),this._initLinesCache();let a={startRow:i,startCol:r},o=this._findInLine(e,a,t);if(!o)for(let n=i+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=n,a.startCol=0,o=this._findInLine(e,a,t),!o);n++);if(!o&&i!==0)for(let n=0;n<i&&(a.startRow=n,a.startCol=0,o=this._findInLine(e,a,t),!o);n++);return!o&&n&&(a.startRow=n.start.y,a.startCol=0,o=this._findInLine(e,a,t)),this._selectResult(o,t?.decorations,t?.noScroll)}findPrevious(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let n=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||n)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,r}_didOptionsChange(e,t){return!!t&&(e.caseSensitive!==t.caseSensitive||e.regex!==t.regex||e.wholeWord!==t.wholeWord)}_fireResults(e){if(e?.decorations){let e=-1;if(this._selectedDecoration.value){let t=this._selectedDecoration.value.match;for(let n=0;n<this._highlightDecorations.length;n++){let r=this._highlightDecorations[n].match;if(r.row===t.row&&r.col===t.col&&r.size===t.size){e=n;break}}}this._onDidChangeResults.fire({resultIndex:e,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols;this._initLinesCache();let a={startRow:r,startCol:i},o;if(n&&(a.startRow=r=n.start.y,a.startCol=i=n.start.x,this._cachedSearchTerm!==e&&(o=this._findInLine(e,a,t,!1),o||(a.startRow=r=n.end.y,a.startCol=i=n.end.x))),o||=this._findInLine(e,a,t,!0),!o){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let n=r-1;n>=0&&(a.startRow=n,o=this._findInLine(e,a,t,!0),!o);n--);}if(!o&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=r&&(a.startRow=n,o=this._findInLine(e,a,t,!0),!o);n--);return this._selectResult(o,t?.decorations,t?.noScroll)}_initLinesCache(){let e=this._terminal;this._linesCache||(this._linesCache=Array(e.buffer.active.length),this._linesCacheDisposables.value=(0,i.getDisposeArrayDisposable)([e.onLineFeed((()=>this._destroyLinesCache())),e.onCursorMove((()=>this._destroyLinesCache())),e.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&=(window.clearTimeout(this._linesCacheTimeoutId),0)}_isWholeWord(e,t,n){return(e===0||a.includes(t[e-1]))&&(e+n.length===t.length||a.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=this._terminal,a=t.startRow,o=t.startCol;if(i.buffer.active.getLine(a)?.isWrapped)return r?void(t.startCol+=i.cols):(t.startRow--,t.startCol+=i.cols,this._findInLine(e,t,n));let s=this._linesCache?.[a];s||(s=this._translateBufferLineToStringWithWrap(a,!0),this._linesCache&&(this._linesCache[a]=s));let[c,l]=s,u=this._bufferColsToStringOffset(a,o),d=n.caseSensitive?e:e.toLowerCase(),f=n.caseSensitive?c:c.toLowerCase(),p=-1;if(n.regex){let t=RegExp(d,`g`),n;if(r)for(;n=t.exec(f.slice(0,u));)p=t.lastIndex-n[0].length,e=n[0],t.lastIndex-=e.length-1;else n=t.exec(f.slice(u)),n&&n[0].length>0&&(p=u+(t.lastIndex-n[0].length),e=n[0])}else r?u-d.length>=0&&(p=f.lastIndexOf(d,u-d.length)):p=f.indexOf(d,u);if(p>=0){if(n.wholeWord&&!this._isWholeWord(p,f,e))return;let t=0;for(;t<l.length-1&&p>=l[t+1];)t++;let r=t;for(;r<l.length-1&&p+e.length>=l[r+1];)r++;let o=p-l[t],s=p+e.length-l[r],c=this._stringLengthToBufferSize(a+t,o);return{term:e,col:c,row:a+t,size:this._stringLengthToBufferSize(a+r,s)-c+i.cols*(r-t)}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=this._terminal,r=e,i=0,a=n.buffer.active.getLine(r);for(;t>0&&a;){for(let e=0;e<t&&e<n.cols;e++){let t=a.getCell(e);if(!t)break;t.getWidth()&&(i+=t.getCode()===0?1:t.getChars().length)}if(r++,a=n.buffer.active.getLine(r),a&&!a.isWrapped)break;t-=n.cols}return i}_translateBufferLineToStringWithWrap(e,t){let n=this._terminal,r=[],i=[0],a=n.buffer.active.getLine(e);for(;a;){let o=n.buffer.active.getLine(e+1),s=!!o&&o.isWrapped,c=a.translateToString(!s&&t);if(s&&o){let e=a.getCell(a.length-1);e&&e.getCode()===0&&e.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(c=c.slice(0,-1))}if(r.push(c),!s)break;i.push(i[i.length-1]+c.length),e++,a=o}return[r.join(``),i]}_selectResult(e,t,n){let r=this._terminal;if(this._selectedDecoration.clear(),!e)return r.clearSelection(),!1;if(r.select(e.col,e.row,e.size),t){let n=r.registerMarker(-r.buffer.active.baseY-r.buffer.active.cursorY+e.row);if(n){let a=r.registerDecoration({marker:n,x:e.col,width:e.size,backgroundColor:t.activeMatchBackground,layer:`top`,overviewRulerOptions:{color:t.activeMatchColorOverviewRuler}});if(a){let r=[];r.push(n),r.push(a.onRender((e=>this._applyStyles(e,t.activeMatchBorder,!0)))),r.push(a.onDispose((()=>(0,i.disposeArray)(r)))),this._selectedDecoration.value={decoration:a,match:e,dispose(){a.dispose()}}}}}if(!n&&(e.row>=r.buffer.active.viewportY+r.rows||e.row<r.buffer.active.viewportY)){let t=e.row-r.buffer.active.viewportY;t-=Math.floor(r.rows/2),r.scrollLines(t)}return!0}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecoration(e,t){let n=this._terminal,r=n.registerMarker(-n.buffer.active.baseY-n.buffer.active.cursorY+e.row);if(!r)return;let a=n.registerDecoration({marker:r,x:e.col,width:e.size,backgroundColor:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:t.matchOverviewRuler,position:`center`}});if(a){let e=[];e.push(r),e.push(a.onRender((e=>this._applyStyles(e,t.matchBorder,!1)))),e.push(a.onDispose((()=>(0,i.disposeArray)(e))))}return a}}e.SearchAddon=o})(),r})()))})),PW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.Unicode11Addon=r():n.Unicode11Addon=r()})(e,(()=>(()=>{var e={433:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV11=void 0;let r=n(938),i=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],a=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],o=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],s=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],c;function l(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}t.UnicodeV11=class{constructor(){if(this.version=`11`,!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160);for(let e=0;e<i.length;++e)c.fill(0,i[e][0],i[e][1]+1);for(let e=0;e<o.length;++e)c.fill(2,o[e][0],o[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?c[e]:l(e,a)?0:l(e,s)?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},345:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},490:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let r=n(938),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},938:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(345),i=n(490);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Unicode11Addon=void 0;let t=n(433);e.Unicode11Addon=class{activate(e){e.unicode.register(new t.UnicodeV11)}dispose(){}}})(),r})()))})),FW=AW(),IW=jW(),LW=MW(),RW=NW(),zW=PW(),BW=new Map,VW=new Map;function HW(e){let t=BW.get(e);return t||(t={openPreExec:null,completed:[],cwd:null,promptRows:[]},BW.set(e,t)),t}function UW(e){let t=VW.get(e);if(!t)return;let n=HW(e);for(let e of t)try{e(n)}catch{}}function WW(e,t,n){let r=HW(e);switch(t.kind){case`prompt-start`:r.promptRows.push({ts:t.ts,row:n?.row??null,exitCode:null}),r.promptRows.length>1e3&&r.promptRows.shift();break;case`pre-exec`:r.openPreExec={startedAt:t.ts};break;case`post-exec`:{let e=t.payload?.exitCode??null,n=r.openPreExec?.startedAt??t.ts;r.completed.push({startedAt:n,finishedAt:t.ts,exitCode:e});let i=r.promptRows[r.promptRows.length-1];i&&(i.exitCode=e),r.openPreExec=null,r.completed.length>1e3&&r.completed.shift();break}case`cwd`:r.cwd=t.payload?.path??null;break}UW(e)}function GW(e,t){let n=VW.get(e);return n||(n=new Set,VW.set(e,n)),n.add(t),()=>{n.delete(t)}}function KW(e){return HW(e)}function qW(e){BW.delete(e),VW.delete(e)}function JW(){return typeof window<`u`&&window.__TAURI_INTERNALS__!==void 0}function YW(e){return Function(`s`,`return import(s)`)(e).catch(()=>null)}async function XW(e){if(JW()){try{let t=await YW(`@tauri-apps/plugin-opener`);if(t?.revealItemInDir){await t.revealItemInDir(e);return}}catch{}try{await(await YW(`@tauri-apps/api/shell`))?.open?.(e)}catch{}}}async function ZW(e){if(JW())try{let t=await r(()=>import(`./dist-js-DM8sRRAb.js`),[]);if(typeof t.open==`function`){await t.open(e);return}}catch(e){console.warn(`[openExternalUrl] tauri shell open failed:`,e)}try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}var QW=new Map,$W=5e3;function eG(){return typeof document<`u`&&!document.hasFocus()}async function tG(e,t){let n=`${e}:${t.command??``}`,r=Date.now();if(r-(QW.get(n)??0)<$W)return;QW.set(n,r);let i=t.command?J.t(`terminal:notifications.commandFinishedNamed`,{command:nG(t.command,50)}):J.t(`terminal:notifications.commandFinished`),a=J.t(`terminal:notifications.finishedBody`,{code:t.exitCode??`?`,elapsed:rG(t.elapsedMs)});if(JW())try{let e=await YW(`@tauri-apps/plugin-notification`);if(e?.sendNotification){let t=await e.isPermissionGranted?.()??!0;if(t||=await e.requestPermission?.()===`granted`,t){await e.sendNotification({title:i,body:a});return}}}catch{}try{if(typeof Notification>`u`||Notification.permission===`default`&&await Notification.requestPermission().catch(()=>`denied`)!==`granted`||Notification.permission!==`granted`)return;new Notification(i,{body:a})}catch{}}function nG(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}function rG(e){if(e<6e4)return J.t(`terminal:duration.seconds`,{seconds:(e/1e3).toFixed(1)});let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return J.t(`terminal:duration.minutesSeconds`,{minutes:t,seconds:n})}async function iG(e,t){await $(`plugin:clipboard-manager|write_text`,{label:t?.label,text:e})}async function aG(){return await $(`plugin:clipboard-manager|read_text`)}async function oG(){if(JW())try{let e=await aG();return typeof e==`string`?e:null}catch{return null}try{if(typeof navigator<`u`&&navigator.clipboard?.readText)return await navigator.clipboard.readText()||null}catch{}return null}async function sG(e){if(JW())try{return await iG(e),!0}catch{return!1}try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return!1}var cG=(0,F.createContext)(null);function lG(e){return`specrails-desktop:terminal-panel:${e}`}function uG(e){try{let t=localStorage.getItem(lG(e));if(!t)return null;let n=JSON.parse(t);if(!n)return null;let r=n.visibility,i=n.userHeight;return r!==`hidden`&&r!==`restored`&&r!==`maximized`||typeof i!=`number`||!Number.isFinite(i)?null:{visibility:r,userHeight:i}}catch{return null}}function dG(e,t){try{localStorage.setItem(lG(e),JSON.stringify(t))}catch{}}function fG(e){return{visibility:e?.visibility??`hidden`,userHeight:e?.userHeight??320,sessions:[],activeId:null}}function pG(){let e=document.getElementById(`specrails-terminal-host`);return e||(e=document.createElement(`div`),e.id=`specrails-terminal-host`,e.style.position=`fixed`,e.style.left=`0`,e.style.top=`0`,e.style.width=`0`,e.style.height=`0`,e.style.overflow=`hidden`,e.style.visibility=`hidden`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),document.body.appendChild(e),e)}function mG({children:e,activeProjectId:t}){let[n,r]=(0,F.useState)({}),i=(0,F.useRef)(n);i.current=n;let a=(0,F.useRef)(new Map),o=(0,F.useRef)(new Map),s=(0,F.useRef)(null);(0,F.useEffect)(()=>(s.current=pG(),()=>{for(let e of a.current.values())TG(e);a.current.clear(),o.current.clear()}),[]);let c=uH()?.theme??null;(0,F.useEffect)(()=>{if(c)for(let e of a.current.values())try{e.term.options.theme=c.xterm}catch{}},[c]);let l=(0,F.useCallback)((e,t)=>{r(n=>{let r=n[e]??fG(uG(e)),i=t(r);return i===r?n:((i.visibility!==r.visibility||i.userHeight!==r.userHeight)&&dG(e,{visibility:i.visibility,userHeight:i.userHeight}),{...n,[e]:i})})},[]),u=(0,F.useCallback)(e=>{r(t=>t[e]?t:{...t,[e]:fG(uG(e))})},[]),d=(0,F.useCallback)(e=>i.current[e]??fG(uG(e)),[]),f=(0,F.useCallback)((e,t)=>{l(e,e=>e.visibility===t?e:{...e,visibility:t})},[l]),p=(0,F.useCallback)(e=>{l(e,e=>({...e,visibility:e.visibility===`hidden`?`restored`:`hidden`}))},[l]),m=(0,F.useCallback)((e,t)=>{l(e,e=>e.userHeight===t?e:{...e,userHeight:t})},[l]),h=(0,F.useCallback)((e,t)=>{l(e,e=>e.activeId===t?e:{...e,activeId:t})},[l]),g=(0,F.useRef)(t);g.current=t,(0,F.useEffect)(()=>{if(!t)return;u(t);let e=!1;return(async()=>{try{let n=await fetch(`${ol}/api/projects/${t}/terminals`);if(!n.ok)return;let r=await n.json();if(e)return;l(t,e=>{let t=new Set(r.sessions.map(e=>e.id));for(let n of e.sessions.map(e=>e.id))if(!t.has(n)){let e=a.current.get(n);e&&(TG(e),a.current.delete(n),o.current.delete(n),qW(n))}let n=r.sessions.map(t=>{let n=e.sessions.find(e=>e.id===t.id);return n?{...n,...t}:t}),i=n.find(t=>t.id===e.activeId)?.id??n[0]?.id??null;for(let e of n)a.current.has(e.id)||bG(e.projectId,e.id,e.cols,e.rows,a.current,o.current,s.current);return{...e,sessions:n,activeId:i}})}catch{}})(),()=>{e=!0}},[t,u,l]);let _=(0,F.useCallback)(async(e,t)=>{let n=t?.cols??80,r=t?.rows??24;try{let i=await fetch(`${ol}/api/projects/${e}/terminals`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:n,rows:r,name:t?.name})});if(!i.ok){let e=``;try{e=(await i.json())?.error??``}catch{}return K.error(e===`terminal_limit_exceeded`?J.t(`terminal:errors.limitReached`,{max:10}):e===`terminal_spawn_failed`?J.t(`terminal:errors.spawnFailed`):e===`terminal_name_invalid`?J.t(`terminal:errors.invalidName`):J.t(`terminal:errors.openFailed`)),null}let c=(await i.json()).session;return bG(e,c.id,c.cols,c.rows,a.current,o.current,s.current,MV,void 0,void 0,!0),l(e,e=>({...e,sessions:[...e.sessions,c],activeId:c.id})),c}catch{return K.error(J.t(`terminal:errors.serverUnreachable`)),null}},[l]),v=(0,F.useCallback)(async(e,t,n)=>{let r=await _(e,n);if(!r)return null;let i=a.current.get(r.id);if(!i)return r;let o=()=>{let e=i.ws;if(e)try{e.send(new TextEncoder().encode(t))}catch{}};return i.ws&&i.ws.readyState===WebSocket.OPEN?setTimeout(o,50):i.ws&&i.ws.addEventListener(`open`,()=>setTimeout(o,50),{once:!0}),r},[]),y=(0,F.useCallback)((e,t)=>{let n=a.current.get(e);if(!n?.ws||n.ws.readyState!==WebSocket.OPEN)return!1;try{n.ws.send(new TextEncoder().encode(t));try{n.term.focus()}catch{}return!0}catch{return!1}},[]),b=(0,F.useCallback)(async(e,t,n)=>{try{let r=await fetch(`${ol}/api/projects/${e}/terminals/${t}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n})});if(!r.ok)return!1;let i=await r.json();return l(e,e=>({...e,sessions:e.sessions.map(e=>e.id===t?{...e,name:i.session.name}:e)})),!0}catch{return!1}},[l]),x=(0,F.useCallback)(async(e,t)=>{let n=a.current.get(t);n&&(TG(n),a.current.delete(t),o.current.delete(t),qW(t)),l(e,e=>{let n=e.sessions.filter(e=>e.id!==t),r=e.activeId===t?n[0]?.id??null:e.activeId;return{...e,sessions:n,activeId:r}});try{await fetch(`${ol}/api/projects/${e}/terminals/${t}`,{method:`DELETE`})}catch{}},[l]),S=(0,F.useCallback)(e=>{let t=i.current[e];if(!t?.activeId)return;let n=a.current.get(t.activeId);if(n?.attached)try{n.term.focus()}catch{}},[]),C=(0,F.useCallback)(e=>{for(let[t,n]of o.current.entries()){if(n!==e)continue;let r=a.current.get(t);r&&(TG(r),a.current.delete(t)),o.current.delete(t)}r(t=>{if(!t[e])return t;let{[e]:n,...r}=t;return r});try{localStorage.removeItem(lG(e))}catch{}},[]),w=(0,F.useCallback)(e=>a.current.get(e)?.container??null,[]),T=(0,F.useCallback)(e=>{let t=a.current.get(e);if(!t)return;let n=!t.term.element||t.term.element.parentElement!==t.container;if(t.attached=!0,n){try{t.term.open(t.container)}catch{}let e=t.settings.renderMode;(e===`webgl`||e===`auto`&&wG())&&!t.webgl&&CG(t.term).then(e=>{e&&(t.webgl=e)})}try{t.fit.fit()}catch{}try{t.term.focus()}catch{}let r=t.term.cols,i=t.term.rows;if(t.ws&&t.ws.readyState===WebSocket.OPEN)try{t.ws.send(JSON.stringify({type:`resize`,cols:r,rows:i}))}catch{}},[]),E=(0,F.useCallback)(e=>{let t=a.current.get(e);if(!(!t||!t.attached)){try{t.fit.fit()}catch{}if(t.ws&&t.ws.readyState===WebSocket.OPEN)try{t.ws.send(JSON.stringify({type:`resize`,cols:t.term.cols,rows:t.term.rows}))}catch{}}},[]),D=(0,F.useCallback)((e,t)=>{let n=a.current.get(e);return n?(n.markListeners.add(t),()=>{n.markListeners.delete(t)}):()=>{}},[]),O=(0,F.useCallback)(e=>a.current.get(e)?.currentCwd??null,[]),k=(0,F.useCallback)(e=>a.current.get(e)?.search??null,[]),A=(0,F.useCallback)(e=>a.current.get(e)?.term??null,[]),j=(0,F.useCallback)((e,t)=>{let n=a.current.get(e);return n?(n.openSearchListeners.add(t),()=>{n.openSearchListeners.delete(t)}):()=>{}},[]),M=(0,F.useMemo)(()=>({states:n,getState:d,ensureProject:u,setVisibility:f,togglePanel:p,setUserHeight:m,setActive:h,create:_,createAndType:v,writeToSession:y,rename:b,kill:x,focusActive:S,disposeProject:C,getContainer:w,notifyAdopted:T,refitActive:E,subscribeMarks:D,getCwd:O,getSearchAddon:k,subscribeOpenSearch:j,getTerminalInstance:A}),[n,d,u,f,p,m,h,_,v,y,b,x,S,C,w,T,E,D,O,k,j,A]);return(0,q.jsx)(cG.Provider,{value:M,children:e})}var hG={states:{},getState:e=>fG(null),ensureProject:()=>{},setVisibility:()=>{},togglePanel:()=>{},setUserHeight:()=>{},setActive:()=>{},create:async()=>null,createAndType:async()=>null,writeToSession:()=>!1,rename:async()=>!1,kill:async()=>{},focusActive:()=>{},disposeProject:()=>{},getContainer:()=>null,notifyAdopted:()=>{},refitActive:()=>{},subscribeMarks:()=>()=>{},getCwd:()=>null,getSearchAddon:()=>null,subscribeOpenSearch:()=>()=>{},getTerminalInstance:()=>null};function gG(){return(0,F.useContext)(cG)??hG}function _G(e){let t=gG();return e?t.states[e]??fG(uG(e)):fG(null)}function vG(e,t,n,r,i){let a=e.get(t);if(!a)return;let o=a.term.options.fontSize??MV.fontSize,s;if(r===`reset`)s=a.settings.fontSize,i&&i(n,{fontSize:null});else{let e=o+r;if(e<8||e>32)return;s=NV(e),i&&i(n,{fontSize:s})}if(s!==o)try{a.term.options.fontSize=s,a.fit.fit()}catch{}}function yG(e,t,n){let r=e.get(t);if(!r)return;let{promptRows:i}=KW(t);if(i.length===0)return;let a=r.term.buffer.active.viewportY,o=null;if(n===`prev`)for(let e=i.length-1;e>=0;e--){let t=i[e].row;if(t!=null&&t<a){o=t;break}}else for(let e of i){let t=e.row;if(t!=null&&t>a){o=t;break}}if(o!=null)try{r.term.scrollToLine(o)}catch{}}function bG(e,t,n,r,i,a,o,s=MV,c,l,u=!1){let d=i.get(t);if(d)return d;let f=document.createElement(`div`);f.style.width=`100%`,f.style.height=`100%`,f.className=`specrails-xterm-container`;let p=new FW.Terminal({cols:n,rows:r,fontFamily:s.fontFamily,fontSize:s.fontSize,theme:nH().xterm,cursorBlink:!0,scrollback:1e4,allowProposedApi:!0}),m=new IW.FitAddon,h=new LW.WebLinksAddon,g=new RW.SearchAddon;p.loadAddon(m),p.loadAddon(h),p.loadAddon(g),p.attachCustomKeyEventHandler(n=>{if(n.type!==`keydown`||!(typeof navigator<`u`&&/Mac/i.test(navigator.platform||``)?n.metaKey:n.ctrlKey))return!0;let r=n.key;if(r===`c`||r===`C`){let e=p.getSelection();return e.length===0?!0:(sG(e),n.preventDefault(),!1)}if(r===`v`||r===`V`)return oG().then(e=>{if(e)try{p.paste(e)}catch{}}),n.preventDefault(),!1;if(r===`k`||r===`K`){try{p.clear()}catch{}return n.preventDefault(),!1}if(r===`f`||r===`F`){n.preventDefault();let e=i.get(t);if(e)for(let t of e.openSearchListeners)try{t()}catch{}return!1}return r===`=`||r===`+`?(n.preventDefault(),vG(i,t,e,1,l),!1):r===`-`||r===`_`?(n.preventDefault(),vG(i,t,e,-1,l),!1):r===`0`?(n.preventDefault(),vG(i,t,e,`reset`,l),!1):r===`ArrowUp`||r===`ArrowDown`?(n.preventDefault(),yG(i,t,r===`ArrowUp`?`prev`:`next`),!1):!0});try{let e=new zW.Unicode11Addon;p.loadAddon(e),p.unicode.activeVersion=`11`}catch{}s.imageRendering&&xG(p),SG(p),o&&o.appendChild(f);let _=`${aD||(typeof window<`u`?`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`:`ws://localhost:4200`)}/ws/terminal/${t}?projectId=${encodeURIComponent(e)}`,v=pl(),y=v?new WebSocket(_,[`specrails-desktop`,v]):new WebSocket(_);y.binaryType=`arraybuffer`;let b=[];y.onmessage=e=>{if(typeof e.data==`string`){try{let n=JSON.parse(e.data);if(n?.type===`ready`)return;if(n?.type===`exit`){let e=i.get(t);e&&x(e,n.code??null,!!n.early);return}if(n?.type===`mark`&&typeof n.kind==`string`&&typeof n.ts==`number`){let e=i.get(t);if(e){n.kind===`cwd`&&n.payload?.path&&(e.currentCwd=n.payload.path);let r={type:`mark`,kind:n.kind,payload:n.payload,ts:n.ts,sessionId:t},i=e.term.buffer.active,a=n.kind===`prompt-start`?i.cursorY+i.viewportY:null,o=n.kind===`post-exec`?KW(t).openPreExec?.startedAt??null:null;if(WW(t,n,{row:a}),n.kind===`post-exec`&&o!=null&&eG()){let r=n.ts-o,i=e.settings.longCommandThresholdMs;e.settings.notifyOnCompletion&&r>=i&&tG(t,{command:null,exitCode:n.payload?.exitCode??null,elapsedMs:r})}for(let t of e.markListeners)try{t(r)}catch{}c&&c(r)}}}catch{}return}let n=i.get(t);n&&(n.gotData=!0);let r=new Uint8Array(e.data);try{p.write(r)}catch{}};let x=(e,t,n)=>{if(!e.exitShown){e.exitShown=!0;try{let n=t===null?J.t(`terminal:session.processExited`):J.t(`terminal:session.processExitedWithCode`,{code:t});e.term.write(`\r\n\x1b[2m${n}\x1b[0m\r\n`)}catch{}n&&!e.gotUserInput&&K.error(J.t(`terminal:errors.exitedImmediately`))}};y.onclose=e=>{let n=i.get(t);if(!n||n.disposing||n.exitShown)return;let r=(typeof e?.reason==`string`?e.reason:``)===`pty_exit_early`,a=n.openedAt>0&&Date.now()-n.openedAt<3e3&&!n.gotData&&!n.gotUserInput;x(n,null,r||a)};let S=p.onData(e=>{let n=i.get(t);if(n&&(n.gotUserInput=!0),y.readyState===WebSocket.OPEN)try{y.send(new TextEncoder().encode(e))}catch{}});b.push(()=>S.dispose());let C=null,w=()=>{if(f.isConnected){try{m.fit()}catch{return}if(y.readyState===WebSocket.OPEN)try{y.send(JSON.stringify({type:`resize`,cols:p.cols,rows:p.rows}))}catch{}}},T=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,w()},120)};y.onopen=()=>{let e=i.get(t);e&&(e.openedAt=Date.now()),w()};let E=new ResizeObserver(T);E.observe(f),b.push(()=>{C&&clearTimeout(C),E.disconnect()});let D={term:p,fit:m,webLinks:h,search:g,webgl:null,settings:s,container:f,ws:y,attached:!1,disposers:b,openedAt:0,gotData:!1,gotUserInput:!1,disposing:!1,exitShown:!1,currentCwd:null,markListeners:new Set,openSearchListeners:new Set};return i.set(t,D),a.set(t,e),D}async function xG(e){try{let n=(await r(()=>import(`./addon-image-3WCl5Vhd.js`).then(e=>t(e.default,1)),__vite__mapDeps([23,1]))).ImageAddon,i=new n({pixelLimit:8e6});e.loadAddon(i)}catch{}}async function SG(e){try{let n=(await r(()=>import(`./addon-ligatures-C5OdliKs.js`).then(e=>t(e.default,1)),__vite__mapDeps([24,1]))).LigaturesAddon;e.loadAddon(new n)}catch{}}async function CG(e){try{let n=(await r(()=>import(`./addon-webgl-BbX6pSjl.js`).then(e=>t(e.default,1)),__vite__mapDeps([25,1]))).WebglAddon,i=new n;return i.onContextLoss(()=>{try{i.dispose()}catch{}}),e.loadAddon(i),i}catch{return null}}function wG(){try{let e=document.createElement(`canvas`);return!!(e.getContext(`webgl2`)||e.getContext(`experimental-webgl2`))}catch{return!1}}function TG(e){e.disposing=!0;for(let t of e.disposers)try{t()}catch{}e.disposers=[],e.markListeners.clear(),e.openSearchListeners.clear();try{e.ws?.close(1e3,`client_dispose`)}catch{}e.ws=null;try{e.webgl?.dispose()}catch{}e.webgl=null;try{e.term.dispose()}catch{}try{e.container.remove()}catch{}}function EG(){return new kG(JU(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function DG(){return $(`plugin:webview|get_all_webviews`).then(e=>e.map(e=>new kG(new ZU(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}var OG=[`tauri://created`,`tauri://error`],kG=class{constructor(e,t,n){this.window=e,this.label=t,this.listeners=Object.create(null),n?.skip||$(`plugin:webview|create_webview`,{windowLabel:e.label,options:{...n,label:t}}).then(async()=>this.emit(`tauri://created`)).catch(async e=>this.emit(`tauri://error`,e))}static async getByLabel(e){return(await DG()).find(t=>t.label===e)??null}static getCurrent(){return EG()}static async getAll(){return DG()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:zU(e,t,{target:{kind:`Webview`,label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:BU(e,t,{target:{kind:`Webview`,label:this.label}})}async emit(e,t){if(OG.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return}return VU(e,t)}async emitTo(e,t,n){if(OG.includes(t)){for(let e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return}return HU(e,t,n)}_handleTauriEvent(e,t){return OG.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}async position(){return $(`plugin:webview|webview_position`,{label:this.label}).then(e=>new FU(e))}async size(){return $(`plugin:webview|webview_size`,{label:this.label}).then(e=>new MU(e))}async close(){return $(`plugin:webview|webview_close`,{label:this.label})}async setSize(e){return $(`plugin:webview|set_webview_size`,{label:this.label,value:e instanceof NU?e:new NU(e)})}async setPosition(e){return $(`plugin:webview|set_webview_position`,{label:this.label,value:e instanceof IU?e:new IU(e)})}async setFocus(){return $(`plugin:webview|set_webview_focus`,{label:this.label})}async setAutoResize(e){return $(`plugin:webview|set_webview_auto_resize`,{label:this.label,value:e})}async hide(){return $(`plugin:webview|webview_hide`,{label:this.label})}async show(){return $(`plugin:webview|webview_show`,{label:this.label})}async setZoom(e){return $(`plugin:webview|set_webview_zoom`,{label:this.label,value:e})}async reparent(e){return $(`plugin:webview|reparent`,{label:this.label,window:typeof e==`string`?e:e.label})}async clearAllBrowsingData(){return $(`plugin:webview|clear_all_browsing_data`)}async setBackgroundColor(e){return $(`plugin:webview|set_webview_background_color`,{color:e})}async onDragDropEvent(e){let t=await this.listen(LU.DRAG_ENTER,t=>{e({...t,payload:{type:`enter`,paths:t.payload.paths,position:new FU(t.payload.position)}})}),n=await this.listen(LU.DRAG_OVER,t=>{e({...t,payload:{type:`over`,position:new FU(t.payload.position)}})}),r=await this.listen(LU.DRAG_DROP,t=>{e({...t,payload:{type:`drop`,paths:t.payload.paths,position:new FU(t.payload.position)}})}),i=await this.listen(LU.DRAG_LEAVE,t=>{e({...t,payload:{type:`leave`}})});return()=>{t(),r(),n(),i()}}};function AG(e){return`'${e.replace(/'/g,`'\\''`)}'`}function jG(e){return`'${e.replace(/'/g,`''`)}'`}function MG(e,t){return t?jG(e):AG(e)}function NG(e,t){return e.map(e=>MG(e,t)).join(` `)}async function PG(e){if(!JW())return{dispose:()=>{}};try{let t=[],n=``,r=0,i=typeof navigator<`u`&&/Win/i.test(navigator.platform||``),a=t=>{let a=t.payload;if(!a||a.type!==`drop`)return;let o=a.paths;if(!o||o.length===0)return;let s=a.position;if(!s)return;let c=`${o.join(`\0`)}@${s.x},${s.y}`,l=Date.now();if(c===n&&l-r<250)return;n=c,r=l;let u=e();if(!u||!IG(s,u.viewportEl.getBoundingClientRect(),window.devicePixelRatio||1))return;let d=NG(o,i);try{u.writeText(d)}catch{}},o=FG((()=>{try{return EG()}catch{return null}})());o&&t.push(await o(a));let s=FG((()=>{try{return JU()}catch{return null}})());return s&&t.push(await s(a)),t.length===0?{dispose:()=>{}}:{dispose:()=>{for(let e of t)try{e()}catch{}}}}catch{return{dispose:()=>{}}}}function FG(e){let t=e?.onDragDropEvent;return typeof t==`function`?t.bind(e):null}function IG(e,t,n){if(LG(e.x,e.y,t))return!0;let r=Number.isFinite(n)&&n>0?n:1;return LG(e.x/r,e.y/r,t)}function LG(e,t,n){return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom}function RG({x:e,y:t,label:n,onSelect:r,onClose:i}){let a=(0,F.useRef)(null);return(0,F.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&i()},t=e=>{e.key===`Escape`&&i()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,q.jsx)(`div`,{ref:a,role:`menu`,"data-shortcut-context-menu":!0,style:{position:`fixed`,left:typeof window<`u`&&e+220>window.innerWidth?e-220:e,top:typeof window<`u`&&t+60>window.innerHeight?t-60:t,minWidth:200},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:(0,q.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(),i()},className:`w-full text-left px-3 py-1.5 text-[#f8f8f2] hover:bg-[#44475a]`,children:n})})}function zG({x:e,y:t,providers:n,onSelect:r,onClose:i}){let{t:a}=G(`terminal`),o=(0,F.useRef)(null);(0,F.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i()},t=e=>{e.key===`Escape`&&i()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=typeof window<`u`&&e+200>window.innerWidth?e-200:e,c=8+n.length*32;return(0,q.jsx)(`div`,{ref:o,role:`menu`,"data-cli-launch-menu":!0,style:{position:`fixed`,left:s,top:typeof window<`u`&&t+c>window.innerHeight?t-c:t,minWidth:180},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:n.map(e=>(0,q.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(e),i()},className:`w-full text-left px-3 py-1.5 text-[#f8f8f2] hover:bg-[#44475a]`,children:a(`cliMenu.open`,{name:ME(e)})},e))})}var BG=(0,F.forwardRef)(function({isOpen:e,className:t,...n},r){let{t:i}=G(`terminal`);return(0,q.jsx)(`button`,{ref:r,type:`button`,"aria-label":i(e?`panelChevron.collapse`:`panelChevron.expand`),"aria-expanded":e,className:X(`panel-chevron`,`inline-flex items-center justify-center`,`h-5 w-6 mr-1.5`,`rounded text-muted-foreground`,`hover:bg-border/40 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-primary/60`,`transition-colors duration-120`,t),...n,children:(0,q.jsxs)(`svg`,{width:`14`,height:`10`,viewBox:`0 0 14 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,q.jsx)(`rect`,{x:`1`,y:`1`,width:`12`,height:`8`,rx:`1.5`}),e?(0,q.jsx)(`path`,{d:`M5 3.5 L7 5.5 L9 3.5`}):(0,q.jsx)(`path`,{d:`M5 6.5 L7 4.5 L9 6.5`})]})})});function VG({visibility:e,canCreate:t,hasActive:n,provider:r=`claude`,providers:i,onCreate:a,onOpenCli:o,onOpenBrowser:s,onPasteScript:c,pasteScriptDisabled:l,onConfigureBrowser:u,onConfigureScript:d,onKillActive:f,onToggleMaximize:p,onCollapse:m}){let{t:h}=G(`terminal`),g=!!i&&i.length>1,_=r===`codex`?`Codex`:`Claude`,v=h(`topBar.maxTerminals`,{max:10}),y=t?g?h(`topBar.openCliMulti`):h(`topBar.openCli`,{cli:_}):v;return(0,q.jsxs)(`div`,{className:X(`flex items-center justify-between h-7 px-2 shrink-0`,`bg-background/95 backdrop-blur-sm`,`border-b border-border/40`,`text-[10px] uppercase tracking-wide text-muted-foreground select-none`),children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 pl-1`,children:(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:h(`topBar.title`)})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(HG,{label:y,disabled:!t,onClick:e=>o(e?{x:e.clientX,y:e.clientY}:void 0),children:(0,q.jsx)(Ep,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(`topBar.openInBrowser`),onClick:s,onContextMenu:e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY})},children:(0,q.jsx)(Mf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(l?`topBar.pasteScriptNoActive`:`topBar.pasteScript`),disabled:l,onClick:c,onContextMenu:e=>{e.preventDefault(),d({x:e.clientX,y:e.clientY})},children:(0,q.jsx)(uf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:t?h(`topBar.newTerminal`):v,disabled:!t,onClick:a,children:(0,q.jsx)(sp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(`topBar.killActive`),disabled:!n,onClick:f,children:(0,q.jsx)(Pp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(e===`maximized`?`topBar.restorePanel`:`topBar.maximizePanel`),onClick:p,children:e===`maximized`?(0,q.jsx)(Jf,{className:`h-3.5 w-3.5`}):(0,q.jsx)(Gf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(BG,{isOpen:!0,onClick:m})]})]})}function HG({label:e,disabled:t,onClick:n,onContextMenu:r,children:i}){return(0,q.jsx)(`button`,{type:`button`,onClick:e=>n(e),onContextMenu:r,disabled:t,title:e,"aria-label":e,className:X(`inline-flex items-center justify-center h-5 w-6 rounded`,`text-muted-foreground transition-colors duration-120`,t?`opacity-40 cursor-not-allowed`:`hover:bg-border/40 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-primary/60`),children:i})}function UG({sessions:e,activeId:t,onActivate:n,onRename:r,onKill:i}){return(0,q.jsx)(`aside`,{className:X(`w-44 shrink-0 border-l border-border/40 bg-background/70`,`overflow-y-auto`),children:(0,q.jsx)(`ul`,{className:`py-1`,children:e.map(e=>(0,q.jsx)(WG,{session:e,active:e.id===t,onActivate:()=>n(e.id),onRename:t=>r(e.id,t),onKill:()=>i(e.id)},e.id))})})}function WG({session:e,active:t,onActivate:n,onRename:r,onKill:i}){let{t:a}=G(`terminal`),[o,s]=(0,F.useState)(!1),[c,l]=(0,F.useState)(e.name),u=(0,F.useRef)(null);(0,F.useEffect)(()=>{o&&(l(e.name),queueMicrotask(()=>{u.current?.focus(),u.current?.select()}))},[o,e.name]);function d(){let t=c.trim();t&&t!==e.name&&r(t),s(!1)}function f(){s(!0)}function p(){s(!1),l(e.name)}return(0,q.jsx)(`li`,{className:`relative group px-1`,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":t,onClick:()=>{o||n()},onKeyDown:e=>{o||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},onDoubleClick:f,className:X(`flex items-center gap-2 px-2 py-1.5 rounded-md text-xs cursor-pointer select-none`,`transition-colors duration-120`,t?`bg-border/40 text-foreground border-l-2 border-accent-primary/70 pl-[calc(0.5rem-2px)]`:`text-muted-foreground hover:bg-border/20 hover:text-foreground`),children:[(0,q.jsx)(Mp,{className:`h-3 w-3 shrink-0`}),o?(0,q.jsx)(`input`,{ref:u,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d()),e.key===`Escape`&&(e.preventDefault(),p())},onBlur:d,onClick:e=>e.stopPropagation(),maxLength:64,className:X(`flex-1 min-w-0 bg-background/60 border border-border/40 rounded px-1`,`text-xs text-foreground outline-none focus:ring-1 focus:ring-accent-primary/60`)}):(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),!o&&(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`sidebar.rename`,{name:e.name}),title:a(`sidebar.rename`,{name:e.name}),onClick:e=>{e.stopPropagation(),f()},className:X(`inline-flex items-center justify-center h-4 w-4 rounded`,`text-muted-foreground opacity-0 group-hover:opacity-100`,`hover:bg-border/40 hover:text-foreground`,`transition-opacity duration-120`,t&&`opacity-70`),children:(0,q.jsx)(rp,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`sidebar.close`,{name:e.name}),title:a(`sidebar.close`,{name:e.name}),onClick:e=>{e.stopPropagation(),i()},className:X(`inline-flex items-center justify-center h-4 w-4 rounded`,`text-muted-foreground opacity-0 group-hover:opacity-100`,`hover:bg-destructive/20 hover:text-destructive`,`transition-opacity duration-120`,t&&`opacity-70`),children:(0,q.jsx)(Bp,{className:`h-3 w-3`})})]})})}function GG({search:e,onClose:t}){let{t:n}=G(`terminal`),r=(0,F.useRef)(null),[i,a]=(0,F.useState)(``),[o,s]=(0,F.useState)(!1),[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(null);(0,F.useEffect)(()=>(r.current?.focus(),()=>{try{e.clearDecorations()}catch{}}),[e]),(0,F.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);function m(){return{caseSensitive:o,regex:c,wholeWord:u,decorations:{matchBackground:`#bd93f9`,matchOverviewRuler:`#bd93f9`,activeMatchBackground:`#ff79c6`,activeMatchColorOverviewRuler:`#ff79c6`}}}function h(){if(i)try{e.findNext(i,m())}catch{}}function g(){if(i)try{e.findPrevious(i,m())}catch{}}return(0,F.useEffect)(()=>{let t=()=>{};try{let n=e.onDidChangeResults(e=>{if(!e){p(null);return}p({current:e.resultIndex+1,total:e.resultCount})});t=()=>{try{n.dispose()}catch{}}}catch{}return t},[e]),(0,q.jsxs)(`div`,{className:`absolute top-2 right-2 flex items-center gap-1 bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg px-2 py-1 z-30`,role:`search`,"data-terminal-search-overlay":!0,children:[(0,q.jsx)(`input`,{ref:r,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.shiftKey?g():h())},placeholder:n(`search.placeholder`),className:`bg-transparent text-sm outline-none text-[#f8f8f2] placeholder:text-[#6272a4] w-48`}),f&&(0,q.jsxs)(`span`,{className:`text-xs text-[#6272a4] tabular-nums`,children:[f.current,`/`,f.total]}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.previous`),onClick:g,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(tf,{size:14})}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.next`),onClick:h,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(Qd,{size:14})}),(0,q.jsx)(KG,{label:`Aa`,title:n(`search.matchCase`),active:o,onToggle:()=>s(e=>!e)}),(0,q.jsx)(KG,{label:`.*`,title:n(`search.regex`),active:c,onToggle:()=>l(e=>!e)}),(0,q.jsx)(KG,{label:`W`,title:n(`search.wholeWord`),active:u,onToggle:()=>d(e=>!e)}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.close`),onClick:t,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(Bp,{size:14})})]})}function KG({label:e,title:t,active:n,onToggle:r}){return(0,q.jsx)(`button`,{type:`button`,title:t,onClick:r,className:`text-xs px-1.5 py-0.5 rounded font-mono ${n?`bg-[#6272a4] text-white`:`text-[#f8f8f2] hover:bg-[#44475a]`}`,children:e})}function qG({x:e,y:t,term:n,cwd:r,hasReveal:i,onClose:a,onOpenSearch:o,onReveal:s,onSaveScrollback:c}){let{t:l}=G(`terminal`),u=(0,F.useRef)(null);(0,F.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let d=typeof window<`u`&&e+220>window.innerWidth?e-220:e,f=typeof window<`u`&&t+260>window.innerHeight?t-260:t,p=n.getSelection(),m=p.length>0;function h(){m&&(sG(p),a())}function g(){oG().then(e=>{if(e)try{n.paste(e)}catch{}}),a()}function _(){try{n.selectAll()}catch{}a()}function v(){try{n.clear()}catch{}a()}function y(){o(),a()}function b(){c(),a()}function x(){r&&s(r),a()}return(0,q.jsxs)(`div`,{ref:u,role:`menu`,"data-terminal-context-menu":!0,style:{position:`fixed`,left:d,top:f,minWidth:200},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:[(0,q.jsx)(JG,{onClick:h,disabled:!m,label:l(`common:actions.copy`),shortcut:`⌘C`}),(0,q.jsx)(JG,{onClick:g,label:l(`contextMenu.paste`),shortcut:`⌘V`}),(0,q.jsx)(JG,{onClick:_,label:l(`contextMenu.selectAll`),shortcut:`⌘A`}),(0,q.jsx)(YG,{}),(0,q.jsx)(JG,{onClick:v,label:l(`contextMenu.clear`),shortcut:`⌘K`}),(0,q.jsx)(JG,{onClick:y,label:l(`contextMenu.search`),shortcut:`⌘F`}),(0,q.jsx)(JG,{onClick:b,label:l(`contextMenu.saveScrollback`)}),r&&i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(YG,{}),(0,q.jsx)(JG,{onClick:x,label:l(`contextMenu.openPath`,{path:XG(r,40)})})]})]})}function JG({onClick:e,label:t,shortcut:n,disabled:r}){return(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r||e()},disabled:r,className:`w-full text-left px-3 py-1.5 flex justify-between items-center ${r?`text-[#6272a4] cursor-not-allowed`:`text-[#f8f8f2] hover:bg-[#44475a]`}`,children:[(0,q.jsx)(`span`,{children:t}),n&&(0,q.jsx)(`span`,{className:`text-xs text-[#6272a4] tabular-nums`,children:n})]})}function YG(){return(0,q.jsx)(`div`,{className:`my-1 border-t border-[#44475a]`})}function XG(e,t){return e.length<=t?e:`…`+e.slice(e.length-t+1)}async function ZG(e,t=`terminal-scrollback.txt`){let n=e.buffer.active,i=[];for(let e=0;e<n.length;e++){let t=n.getLine(e);t&&i.push(t.translateToString(!0))}let a=i.join(`
122
- `);if(JW())try{let e=await(await r(()=>import(`./dist-js-DAazzqbg.js`),[])).save({defaultPath:t});if(!e)return;try{let t=await YW(`@tauri-apps/plugin-fs`);if(t?.writeTextFile){await t.writeTextFile(e,a);return}}catch{}try{await(await YW(`@tauri-apps/api/fs`))?.writeTextFile?.({path:e,contents:a})}catch{}return}catch{}try{let e=new Blob([a],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch{}}function QG({sessionId:e}){let[t,n]=(0,F.useState)(()=>KW(e));return(0,F.useEffect)(()=>GW(e,n),[e]),t.promptRows.length===0?null:(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-prompt-gutter":!0,className:`absolute left-0 top-0 bottom-0 w-1 pointer-events-none z-10`,children:(0,q.jsx)(`div`,{className:`absolute top-0 left-0 bottom-0 w-full`,style:{backgroundImage:`linear-gradient(to bottom, rgba(189,147,249,0.2), rgba(189,147,249,0.05))`}})})}function $G({sessionId:e}){let{t}=G(`terminal`),[n,r]=(0,F.useState)(KW(e).openPreExec?.startedAt??null),[i,a]=(0,F.useState)(Date.now());if((0,F.useEffect)(()=>GW(e,e=>r(e.openPreExec?.startedAt??null)),[e]),(0,F.useEffect)(()=>{if(n==null)return;let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[n]),n==null)return null;let o=i-n;return o<500?null:(0,q.jsx)(`div`,{className:`absolute top-2 left-2 px-2 py-0.5 rounded text-xs font-mono bg-[#44475a] text-[#f8f8f2] z-10 pointer-events-none`,children:eK(o,t)})}function eK(e,t){return e<6e4?t(`terminal:duration.seconds`,{seconds:(e/1e3).toFixed(1)}):t(`terminal:duration.minutesSeconds`,{minutes:Math.floor(e/6e4),seconds:Math.floor(e%6e4/1e3)})}function tK({activeId:e}){let t=(0,F.useRef)(null),n=gG(),[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(null),s=JW();(0,F.useEffect)(()=>{if(e)return n.subscribeOpenSearch(e,()=>i(!0))},[e,n]),(0,F.useEffect)(()=>{i(!1),o(null)},[e]);let c=e?n.getSearchAddon(e):null,l=e?n.getTerminalInstance(e):null,u=e?n.getCwd(e):null,[d,f]=(0,F.useState)(!1),p=(0,F.useCallback)(t=>{if(!t)return!1;if(e&&n.writeToSession(e,t))return!0;if(!l)return!1;try{return l.paste(t),!0}catch{return!1}},[e,n,l]),m=(0,F.useCallback)(e=>{if(!l||!e||e.length===0)return!1;let t=Array.from(e).map(e=>nK(e)).filter(e=>!!e);return t.length===0?!1:p(NG(t,typeof navigator<`u`&&/Win/i.test(navigator.platform||``)))},[l,p]),h=(0,F.useCallback)(e=>{if(e.preventDefault(),!e.shiftKey&&l){let e=l.modes?.mouseTrackingMode;if(e&&e!==`none`)return}o({x:e.clientX,y:e.clientY})},[l]),g=(0,F.useCallback)(e=>{if(!l)return;if(e.clipboardData.files&&e.clipboardData.files.length>0){let t=Array.from(e.clipboardData.files).map(e=>nK(e)).filter(e=>!!e);if(t.length>0){e.preventDefault(),e.stopPropagation(),p(NG(t,typeof navigator<`u`&&/Win/i.test(navigator.platform||``)));return}}let t=e.clipboardData.getData(`text/plain`);t&&(e.preventDefault(),e.stopPropagation(),p(t))},[l,p]),_=(0,F.useCallback)(e=>{if(!l)return;let t=l.getSelection();t&&(e.clipboardData.setData(`text/plain`,t),e.preventDefault(),e.stopPropagation())},[l]),v=(0,F.useCallback)(e=>{if(l&&(typeof navigator<`u`&&/Mac/i.test(navigator.platform||``)?e.metaKey:e.ctrlKey)&&(e.key===`c`||e.key===`C`)){let t=l.getSelection();if(!t)return;e.preventDefault(),e.stopPropagation(),sG(t)}},[l]);return(0,F.useEffect)(()=>{let r=t.current;if(!r||!e)return;let i=n.getContainer(e);if(i)return r.appendChild(i),n.notifyAdopted(e),()=>{let e=document.getElementById(`specrails-terminal-host`);e&&i.parentElement===r&&e.appendChild(i)}},[e,n]),(0,F.useEffect)(()=>{let r=t.current;if(!r||!e)return;let i=[],a=r.parentElement;for(;a&&a!==document.body;)(a.tagName.toLowerCase()===`aside`||a.matches(`[data-sidebar]`))&&i.push(a),a=a.parentElement;if(i.length===0)return;let o=t=>{let r=t;r.propertyName!==`width`&&r.propertyName!==`height`||n.refitActive(e)};return i.forEach(e=>e.addEventListener(`transitionend`,o)),()=>{i.forEach(e=>e.removeEventListener(`transitionend`,o))}},[e,n]),(0,q.jsxs)(`div`,{ref:t,className:`flex-1 min-w-0 bg-background px-2 py-1 relative ${d?`outline outline-2 outline-accent-primary outline-offset-[-2px]`:``}`,role:`presentation`,"data-terminal-viewport":!0,onContextMenu:h,onPasteCapture:g,onCopyCapture:_,onKeyDownCapture:v,tabIndex:-1,onDragEnter:e=>{rK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),f(!0))},onDragOver:e=>{rK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),f(!0))},onDragLeave:()=>f(!1),onDrop:e=>{rK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),m(e.dataTransfer.files)),f(!1)},children:[e&&(0,q.jsx)(QG,{sessionId:e}),e&&(0,q.jsx)($G,{sessionId:e}),r&&c&&(0,q.jsx)(GG,{search:c,onClose:()=>i(!1)}),a&&l&&(0,q.jsx)(qG,{x:a.x,y:a.y,term:l,cwd:u,hasReveal:s,onClose:()=>o(null),onOpenSearch:()=>i(!0),onReveal:e=>{XW(e)},onSaveScrollback:()=>{l&&ZG(l)}})]})}function nK(e){let t=e.path;return typeof t==`string`&&t.length>0?t:null}function rK(e){return e?Array.from(e.types).includes(`Files`):!1}function iK({height:e,maxHeight:t,onHeightCommit:n,onHeightPreview:r,minHeight:i=120}){let{t:a}=G(`terminal`),o=(0,F.useRef)(!1),s=(0,F.useRef)(0),c=(0,F.useRef)(e),l=(0,F.useRef)(!1),u=(0,F.useRef)(e),d=(0,F.useCallback)(e=>e<i?i:e>t?t:Math.round(e),[i,t]);(0,F.useEffect)(()=>{function e(e){if(!o.current)return;let t=s.current-e.clientY;u.current=d(c.current+t),l.current||(l.current=!0,requestAnimationFrame(()=>{l.current=!1,r?.(u.current)}))}function t(){o.current&&(o.current=!1,document.body.style.userSelect=``,document.body.style.cursor=``,n(u.current))}return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[d,n,r]);function f(t){o.current=!0,s.current=t.clientY,c.current=e,u.current=e,document.body.style.userSelect=`none`,document.body.style.cursor=`row-resize`;let n=t.target;if(typeof n.setPointerCapture==`function`)try{n.setPointerCapture(t.pointerId)}catch{}}return(0,q.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`dragHandle.resize`),onPointerDown:f,className:X(`absolute top-0 left-0 right-0 h-1`,`cursor-row-resize`,`bg-transparent hover:bg-accent-primary/40`,`transition-colors duration-120`,`z-10`)})}function aK({onCreate:e}){let{t}=G(`terminal`);return(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-center px-6 bg-background-deep`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,q.jsx)(Mp,{className:`h-8 w-8 opacity-50`}),(0,q.jsx)(`p`,{className:`text-xs`,children:t(`emptyState.noTerminals`)}),(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs bg-border/30 hover:bg-border/50 hover:text-foreground transition-colors`,children:[(0,q.jsx)(sp,{className:`h-3 w-3`}),` `,t(`emptyState.newTerminal`)]})]})})}function oK({projectId:e,provider:t=`claude`,providers:n,state:r,viewportHeight:i,statusBarHeight:a}){let o=gG(),{t:s}=G(`terminal`),c=st(),l=(0,F.useRef)(null),[u,d]=(0,F.useState)(null),[f,p]=(0,F.useState)(MV),[m,h]=(0,F.useState)(null),[g,_]=(0,F.useState)(null),v=n&&n.length>0?n:[t],y=v.length>1,b=(0,F.useCallback)(async(t=()=>!1)=>{try{let n=await fetch(`/api/projects/${e}/terminal-settings`);if(!n.ok)return;let r=await n.json();!t()&&r?.resolved&&p(r.resolved)}catch{}},[e]);(0,F.useEffect)(()=>{let e=!1;return b(()=>e),()=>{e=!0}},[b]),(0,F.useEffect)(()=>{let t=t=>{let n=t.detail;n?.mode===`project`&&n.projectId!==e||b()};return window.addEventListener(PV,t),()=>window.removeEventListener(PV,t)},[b,e]);let x=Math.max(120,i-a-40),S=Math.min(Math.max(r.userHeight||320,120),x),C=r.visibility===`maximized`?Math.max(120,i-a):u??S,w=r.sessions.length<10,T=r.activeId!==null;(0,F.useEffect)(()=>{let e=!1,t=null;return PG(()=>{let e=l.current,t=r.activeId;return!e||!t||r.visibility===`hidden`?null:{viewportEl:e,writeText:e=>{if(o.writeToSession(t,e))return!0;let n=o.getTerminalInstance(t);try{return n?.paste(e),!!n}catch{return!1}}}}).then(n=>{e?n.dispose():t=n}),()=>{e=!0,t?.dispose()}},[r.activeId,r.visibility,o]);let E=(0,F.useCallback)(()=>{w&&o.create(e)},[w,e,o]),D=(0,F.useCallback)(t=>{if(!w)return;let n=t===`codex`?`codex`:`claude`,i=RegExp(`^${n} \\(\\d+\\)$`),a=r.sessions.filter(e=>e.name===n||i.test(e.name)),s=a.length===0?n:`${n} (${a.length+1})`;o.createAndType(e,`${n}\n`,{name:s})},[w,e,r.sessions,o]),O=(0,F.useCallback)(e=>{if(w){if(y&&e){_(e);return}D(t===`codex`?`codex`:`claude`)}},[w,y,t,D]),k=(0,F.useCallback)(()=>{ZW(f.browserShortcutUrl)},[f.browserShortcutUrl]),A=(0,F.useCallback)(()=>{r.activeId&&f.quickScript&&o.writeToSession(r.activeId,f.quickScript)},[f.quickScript,r.activeId,o]),j=(0,F.useCallback)(e=>{h({...e,kind:`browser`})},[]),M=(0,F.useCallback)(e=>{h({...e,kind:`script`})},[]),N=(0,F.useCallback)(e=>{c(`/settings${e===`browser`?`#terminal-browser-shortcut-url`:`#terminal-quick-script`}`)},[c]),P=(0,F.useCallback)(()=>{r.activeId&&o.kill(e,r.activeId)},[e,r.activeId,o]),I=(0,F.useCallback)(()=>{o.setVisibility(e,r.visibility===`maximized`?`restored`:`maximized`)},[e,r.visibility,o]),L=(0,F.useCallback)(()=>{o.setVisibility(e,`hidden`)},[e,o]);return(0,F.useEffect)(()=>{d(null)},[r.visibility]),r.visibility===`hidden`?null:(0,q.jsxs)(`div`,{ref:l,className:X(`relative flex flex-col shrink-0 bg-background/95`,`border-t border-border/40`),style:{height:C},"data-testid":`terminal-bottom-panel`,children:[(0,q.jsx)(iK,{height:S,maxHeight:x,onHeightPreview:e=>d(e),onHeightCommit:t=>{d(null),o.setUserHeight(e,t),r.visibility===`maximized`&&o.setVisibility(e,`restored`)}}),(0,q.jsx)(VG,{visibility:r.visibility,canCreate:w,hasActive:T,provider:t,providers:v,onCreate:E,onOpenCli:O,onOpenBrowser:k,onPasteScript:A,pasteScriptDisabled:!T||!f.quickScript,onConfigureBrowser:j,onConfigureScript:M,onKillActive:P,onToggleMaximize:I,onCollapse:L}),m&&(0,q.jsx)(RG,{x:m.x,y:m.y,label:m.kind===`browser`?s(`shortcutMenu.configureBrowserUrl`):s(`shortcutMenu.editQuickScript`),onSelect:()=>N(m.kind),onClose:()=>h(null)}),g&&(0,q.jsx)(zG,{x:g.x,y:g.y,providers:v,onSelect:e=>D(e),onClose:()=>_(null)}),(0,q.jsx)(`div`,{className:`flex-1 flex min-h-0`,children:r.sessions.length===0?(0,q.jsx)(aK,{onCreate:E}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(tK,{activeId:r.activeId}),(0,q.jsx)(UG,{sessions:r.sessions,activeId:r.activeId,onActivate:t=>o.setActive(e,t),onRename:(t,n)=>void o.rename(e,t,n),onKill:t=>void o.kill(e,t)})]})})]})}var sK=28;function cK({project:e}){let{t}=G(`nav`),{connectionStatus:n}=kW(),r=GL(),{registerHandler:i,unregisterHandler:a}=bl(),[o,s]=(0,F.useState)(null),c=(0,F.useRef)(e.id);c.current=e.id,(0,F.useEffect)(()=>{let n=`cost-alerts-${e.id}`;return i(n,e=>{let n=e;n.projectId!==void 0&&n.projectId!==``&&n.projectId!==c.current||(n.type===`cost_alert`?K.warning(t(`costAlerts.costAlertTitle`),{description:t(`costAlerts.costAlertDescription`,{cost:(n.cost??0).toFixed(4),threshold:(n.threshold??0).toFixed(2)})}):n.type===`daily_budget_exceeded`?(K.error(t(`costAlerts.dailyBudgetTitle`),{description:t(`costAlerts.dailyBudgetDescription`,{spent:(n.dailySpend??0).toFixed(2),budget:(n.budget??0).toFixed(2)}),duration:1/0}),s({dailySpend:n.dailySpend??0,budget:n.budget??0})):n.type===`desktop_daily_budget_exceeded`&&K.error(t(`costAlerts.desktopBudgetTitle`),{description:t(`costAlerts.desktopBudgetDescription`,{spent:(n.desktopDailySpend??0).toFixed(2),budget:(n.desktopBudget??0).toFixed(2)}),duration:1/0}))}),()=>a(n)},[e.id,i,a,t]);let l=gG(),u=_G(e.id),d=(0,F.useRef)(null),[f,p]=(0,F.useState)(typeof window<`u`?window.innerHeight:820);(0,F.useLayoutEffect)(()=>{if(!tB)return;let e=d.current;if(!e)return;let t=()=>p(e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,F.useEffect)(()=>{tB&&l.ensureProject(e.id)},[e.id,l]);let m=tB&&u.visibility===`hidden`?(0,q.jsx)(BG,{isOpen:!1,onClick:()=>l.setVisibility(e.id,`restored`)}):null;return(0,q.jsx)(kT,{delayDuration:400,children:(0,q.jsx)(UL.Provider,{value:r,children:(0,q.jsxs)(`div`,{ref:d,className:`flex flex-col h-full overflow-hidden`,children:[o&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-destructive/10 border-b border-destructive/20 text-xs`,children:[(0,q.jsx)(`span`,{className:`text-destructive font-medium`,children:t(`costAlerts.bannerMessage`,{spent:o.dailySpend.toFixed(2),budget:o.budget.toFixed(2)})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`text-muted-foreground hover:text-foreground ml-4 shrink-0`,children:t(`costAlerts.dismiss`)})]}),(0,q.jsxs)(`div`,{className:`flex flex-1 overflow-hidden min-h-0`,children:[(0,q.jsx)(`main`,{className:`flex-1 overflow-auto`,children:(0,q.jsx)(It,{})}),!1]}),tB&&(0,q.jsx)(oK,{projectId:e.id,provider:e.provider,providers:fd(e),state:u,viewportHeight:f,statusBarHeight:sK}),(0,q.jsx)(DW,{connectionStatus:n,rightSlot:m})]})})})}function lK({projectName:e,errorMessage:t,onRetry:n}){let{t:r}=G(`nav`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 p-8`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`errorBoundary.title`)}),e&&(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,q.jsx)(zi,{ns:`nav`,i18nKey:`errorBoundary.occurredIn`,values:{name:e},components:{strong:(0,q.jsx)(`span`,{className:`font-medium`})}})}),t&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/60 font-mono`,children:t})]}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,q.jsx)(pp,{className:`w-3.5 h-3.5`}),r(`common:actions.retry`)]})]})}var uK=class extends F.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ProjectErrorBoundary]`,e,t.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,q.jsx)(lK,{projectName:this.props.projectName,errorMessage:this.state.error?.message??null,onRetry:this.handleRetry}):this.props.children}};function dK({onAddProject:e}){let{t}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full min-h-[400px] gap-6 px-8 text-center`,children:[(0,q.jsx)(`div`,{className:`w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center`,children:(0,q.jsx)(Mp,{className:`w-7 h-7 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,q.jsx)(zi,{t,i18nKey:`welcome.title`,components:{spec:(0,q.jsx)(`span`,{className:`text-accent-primary`}),rails:(0,q.jsx)(`span`,{className:`text-accent-secondary`})}})}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:t(`welcome.description`)})]}),(0,q.jsxs)(Z,{onClick:e,size:`sm`,className:`gap-2`,children:[(0,q.jsx)(Of,{className:`w-3.5 h-3.5`}),t(`welcome.addFirstProject`)]})]})}var fK=[{id:`sr-architect`,name:`Architect`,description:`Architecture design, change specs, implementation planning`,category:`Architecture`},{id:`sr-developer`,name:`Developer`,description:`Full-stack implementation across all layers`,category:`Development`},{id:`sr-frontend-developer`,name:`Frontend Dev`,description:`Frontend implementation (React, Vue, Angular, etc.)`,category:`Development`},{id:`sr-backend-developer`,name:`Backend Dev`,description:`Backend specialization (APIs, databases, services)`,category:`Development`},{id:`sr-reviewer`,name:`Reviewer`,description:`General code review — the final quality gate`,category:`Review`},{id:`sr-frontend-reviewer`,name:`Frontend Reviewer`,description:`Frontend review (UI, accessibility, performance)`,category:`Review`},{id:`sr-backend-reviewer`,name:`Backend Reviewer`,description:`Backend review (APIs, security, scalability)`,category:`Review`},{id:`sr-security-reviewer`,name:`Security Reviewer`,description:`Security analysis — OWASP, vulnerabilities, hardening`,category:`Review`},{id:`sr-performance-reviewer`,name:`Perf Reviewer`,description:`Performance analysis — profiling, bottlenecks, optimization`,category:`Review`},{id:`sr-product-manager`,name:`Product Manager`,description:`Product discovery, VPC personas, backlog management`,category:`Product`},{id:`sr-product-analyst`,name:`Product Analyst`,description:`Backlog analysis, spec gap analysis, reporting`,category:`Product`},{id:`sr-test-writer`,name:`Test Writer`,description:`Comprehensive test generation (unit, integration, E2E)`,category:`Utilities`},{id:`sr-doc-sync`,name:`Doc Sync`,description:`Documentation sync — keeps docs aligned with code`,category:`Utilities`},{id:`sr-merge-resolver`,name:`Merge Resolver`,description:`Merge conflict resolution with context awareness`,category:`Utilities`}],pK=new Set([`sr-architect`,`sr-developer`,`sr-reviewer`]),mK=new Set([...pK]),hK=[`Architecture`,`Development`,`Review`,`Product`,`Utilities`],gK={Architecture:`text-accent-success`,Development:`text-accent-primary`,Review:`text-accent-info`,Product:`text-accent-secondary`,Utilities:`text-accent-warning`};function _K({selected:e,onChange:t}){let{t:n}=G(`agentstudio`),r=new Set(e);function i(e){if(pK.has(e))return;let n=new Set(r);n.has(e)?n.delete(e):n.add(e),t(Array.from(n))}function a(e){let n=fK.filter(t=>t.category===e).map(e=>e.id).filter(e=>!pK.has(e));if(n.length===0)return;let i=n.every(e=>r.has(e)),a=new Set(r);i?n.forEach(e=>a.delete(e)):n.forEach(e=>a.add(e)),t(Array.from(a))}function o(){t(fK.map(e=>e.id))}function s(){t([...pK])}return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`agentSelector.selectedCount`,{selected:e.length,total:fK.length})}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`button`,{onClick:o,className:`text-[10px] text-accent-primary hover:underline`,children:n(`agentSelector.selectAll`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`·`}),(0,q.jsx)(`button`,{onClick:s,className:`text-[10px] text-muted-foreground hover:underline`,children:n(`common:states.none`)})]})]}),(0,q.jsx)(`div`,{className:`space-y-4`,children:hK.map(e=>{let t=fK.filter(t=>t.category===e),o=t.every(e=>r.has(e.id)),s=t.some(e=>r.has(e.id));return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`button`,{onClick:()=>a(e),className:`flex items-center gap-2 mb-2 w-full text-left group`,children:[(0,q.jsx)(`div`,{className:X(`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors`,o?`bg-accent-primary border-accent-primary`:s?`bg-accent-primary/40 border-accent-primary/60`:`border-border/60 group-hover:border-accent-primary/40`),children:(o||s)&&(0,q.jsx)(Zd,{className:X(`w-2.5 h-2.5`,o?`text-background`:`text-accent-primary`)})}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-semibold uppercase tracking-wider`,gK[e]),children:n(`agentSelector.categories.${e.toLowerCase()}`)})]}),(0,q.jsx)(`div`,{className:`space-y-1 pl-1`,children:t.map(e=>{let t=pK.has(e.id),a=t||r.has(e.id);return(0,q.jsxs)(`button`,{onClick:()=>i(e.id),disabled:t,className:X(`flex items-start gap-2.5 w-full text-left rounded-md px-2 py-1.5 transition-colors`,t?`bg-accent-primary/10 cursor-default`:a?`bg-accent-primary/10 hover:bg-accent-primary/15`:`hover:bg-muted/30`),children:[(0,q.jsx)(`div`,{className:X(`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 mt-0.5 transition-colors`,a?`bg-accent-primary border-accent-primary`:`border-border/60 hover:border-accent-primary/40`),children:a&&(0,q.jsx)(Zd,{className:`w-2.5 h-2.5 text-background`})}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:X(`text-xs font-medium`,a?`text-foreground`:`text-foreground/80`),children:n(`agentSelector.agents.${e.id}.name`,{defaultValue:e.name})}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground/60 font-mono truncate`,children:e.id}),t&&(0,q.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-accent-warning/80`,children:[(0,q.jsx)(Wf,{className:`w-2.5 h-2.5`}),n(`agentSelector.coreBadge`)]})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-tight mt-0.5`,children:n(`agentSelector.agents.${e.id}.description`,{defaultValue:e.description})})]})]},e.id)})})]},e)})})]})}var vK=[{value:`sonnet`,label:`Claude Sonnet`},{value:`opus`,label:`Claude Opus`},{value:`haiku`,label:`Claude Haiku`}],yK=[{value:`gpt-5.5`,label:`GPT-5.5`},{value:`gpt-5.4`,label:`GPT-5.4`},{value:`gpt-5.4-mini`,label:`GPT-5.4 Mini`},{value:`gpt-5.3-codex`,label:`GPT-5.3 Codex`}],bK={balanced:{claude:`sonnet`,codex:`gpt-5.5`},budget:{claude:`haiku`,codex:`gpt-5.4-mini`},max:{claude:`sonnet`,codex:`gpt-5.5`}},xK={"sr-architect":{claude:`opus`,codex:`gpt-5.3-codex`},"sr-product-manager":{claude:`opus`,codex:`gpt-5.3-codex`}};function SK(e,t,n){return t===`max`&&xK[e]?xK[e][n]:bK[t][n]}function CK({agents:e,provider:t,preset:n,overrides:r,onPresetChange:i,onOverrideChange:a}){let{t:o}=G(`addspec`),s=t===`claude`?vK:yK;function c(e){return r[e]??SK(e,n,t)}function l(e){return e in r}function u(e){a(e,``)}return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-xs font-medium mb-2`,children:o(`modelSelector.presetHeading`)}),(0,q.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[`balanced`,`budget`,`max`].map(e=>(0,q.jsxs)(`button`,{onClick:()=>i(e),className:X(`flex flex-col items-center gap-1 rounded-md border px-3 py-2.5 text-left transition-colors`,`focus:outline-none focus-visible:ring-1 focus-visible:ring-ring`,n===e?`border-accent-primary bg-accent-primary/10`:`border-border/30 hover:border-border/60`),children:[(0,q.jsx)(`span`,{className:X(`text-xs font-semibold`,n===e?`text-accent-primary`:`text-foreground/80`),children:o(`modelSelector.preset.${e}.label`)}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground text-center leading-tight`,children:o(`modelSelector.preset.${e}.description`)})]},e))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:o(`modelSelector.overridesHeading`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:o(`modelSelector.overriddenCount`,{count:Object.keys(r).length})})]}),(0,q.jsx)(`div`,{className:`space-y-1.5 max-h-64 overflow-y-auto pr-1`,children:e.map(e=>{let t=c(e.id),n=l(e.id);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted/20`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`span`,{className:X(`text-xs`,n?`text-foreground`:`text-foreground/70`),children:e.name}),n&&(0,q.jsx)(`span`,{className:`ml-1 text-[9px] text-accent-warning`,children:o(`modelSelector.customBadge`)})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsxs)(Mw,{value:t,onValueChange:t=>a(e.id,t),children:[(0,q.jsx)(Pw,{className:`h-6 w-44 text-[10px] px-2`,children:(0,q.jsx)(Nw,{})}),(0,q.jsx)(Lw,{children:s.map(e=>(0,q.jsx)(zw,{value:e.value,children:e.label},e.value))})]}),n&&(0,q.jsx)(`button`,{onClick:()=>u(e.id),className:`text-[9px] text-muted-foreground hover:text-foreground transition-colors px-1`,title:o(`modelSelector.resetToDefault`),children:`↺`})]})]},e.id)})})]})]})}var wK=6e4,TK={data:null,fetchedAt:0,inFlight:null,error:null},EK=new Set;function DK(){EK.forEach(e=>{try{e()}catch{}})}function OK(){return TK.data!==null&&Date.now()-TK.fetchedAt<wK}async function kK(e){if(TK.inFlight)return TK.inFlight;let t=(async()=>{let t=await fetch(`${ol}/api/setup-prerequisites`,{signal:e});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(typeof n?.ok!=`boolean`||!Array.isArray(n?.prerequisites)||!Array.isArray(n?.missingRequired))throw Error(`Malformed prerequisites response`);return TK.data=n,TK.fetchedAt=Date.now(),TK.error=null,TK.inFlight=null,DK(),TK.data})().catch(t=>{throw TK.inFlight=null,e?.aborted?t:(TK.error=t instanceof Error?t:Error(String(t)),DK(),TK.error)});return TK.inFlight=t,t}var AK=!1;function jK(){AK||typeof window>`u`||(window.addEventListener(`focus`,()=>{TK.fetchedAt=0,TK.data=null,kK().catch(()=>{})}),AK=!0)}function MK(){let[,e]=(0,F.useState)(0),[t,n]=(0,F.useState)(()=>!OK()),[r,i]=(0,F.useState)(TK.error);(0,F.useEffect)(()=>{jK();let t=()=>{e(e=>e+1),i(TK.error),n(!1)};EK.add(t);let r=new AbortController;return!OK()&&!TK.inFlight?(n(!0),kK(r.signal).catch(e=>{r.signal.aborted||i(e instanceof Error?e:Error(String(e)))}).finally(()=>{r.signal.aborted||n(!1)})):TK.inFlight&&TK.inFlight.catch(()=>{}).finally(()=>{r.signal.aborted||n(!1)}),()=>{r.abort(),EK.delete(t)}},[]);let a=(0,F.useCallback)(async()=>{TK.fetchedAt=0,TK.data=null,TK.error=null,n(!0);try{await kK()}catch(e){i(e instanceof Error?e:Error(String(e)))}finally{n(!1)}},[]);return{status:TK.data,isLoading:t,error:r,recheck:a}}function NK(e,t){return e.error===`corrupted-bundle`?t(`setup:prerequisites.corruptedBundle`):e.installed?e.executable===!1?e.resolvedPath&&e.executionError?t(`setup:prerequisites.failedToExecuteAtWithError`,{path:e.resolvedPath,error:e.executionError}):e.resolvedPath?t(`setup:prerequisites.failedToExecuteAt`,{path:e.resolvedPath}):e.executionError?t(`setup:prerequisites.failedToExecuteWithError`,{error:e.executionError}):t(`setup:prerequisites.failedToExecute`):!e.meetsMinimum&&e.minVersion?t(`setup:prerequisites.needsMinimum`,{version:e.version??t(`setup:prerequisites.unknownVersion`),minVersion:e.minVersion}):e.version??t(`setup:prerequisites.installedLabel`):t(`setup:prerequisites.notInstalled`)}function PK({status:e,isLoading:t,error:n,onRefresh:r,onMoreInfo:i}){let{t:a}=G(`setup`);if(t&&!e)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`loading`,className:`rounded-lg border border-border/30 bg-background/30 px-3 py-2`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`w-4 h-4 rounded-full bg-muted-foreground/20 animate-pulse`}),(0,q.jsx)(`div`,{className:`h-3 w-32 rounded bg-muted-foreground/15 animate-pulse`})]})});if(n&&!e)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`error`,className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:a(`prerequisites.verifyError`)})});if(!e)return null;if(e.ok)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`ok`,className:`rounded-lg border border-accent-success/25 bg-accent-success/5 px-3 py-2`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(af,{className:`w-4 h-4 text-accent-success flex-shrink-0`}),(0,q.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:a(`prerequisites.allDetected`)})]}),r&&(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,disabled:t,className:`h-7 px-2 gap-1.5 text-[11px] flex-shrink-0`,children:[(0,q.jsx)(pp,{className:X(`w-3 h-3`,t&&`animate-spin`)}),a(`common:actions.refresh`)]})]})});let o=e.missingRequired?.length??0,s=o>0&&(e.missingRequired??[]).every(e=>e.error===`corrupted-bundle`),c=(e.missingRequired??[]).some(e=>e.error===`corrupted-bundle`);return(0,q.jsxs)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`missing`,className:X(`rounded-lg border px-3 py-2`,c?`border-destructive/40 bg-destructive/10`:`border-accent-primary/40 bg-accent-primary/10`),children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(Fp,{className:X(`w-4 h-4 flex-shrink-0`,c?`text-destructive`:`text-accent-primary`)}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:s?a(`prerequisites.bundleCorruptedTitle`):a(`prerequisites.toolsRequired`,{count:o})}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:a(s?`prerequisites.reinstallHint`:`prerequisites.installMissingHint`)})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[i&&!s&&(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,className:`h-7 px-2 gap-1.5 text-[11px]`,"data-testid":`prerequisites-more-info`,children:a(`prerequisites.moreInfo`)}),r&&(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,disabled:t,className:`h-7 px-2 gap-1.5 text-[11px]`,children:[(0,q.jsx)(pp,{className:X(`w-3 h-3`,t&&`animate-spin`)}),a(`common:actions.refresh`)]})]})]}),(0,q.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.prerequisites.map(e=>{let t=e.error===`corrupted-bundle`,n=e.bundled===!0&&e.executable===!0&&!t,r=!t&&e.installed&&e.meetsMinimum;return(0,q.jsxs)(`li`,{"data-testid":`prereq-row-${e.key}`,"data-ok":r?`true`:`false`,"data-bundled":e.bundled?`true`:void 0,"data-corrupted":t?`true`:void 0,className:X(`flex items-center gap-2 rounded-md border px-2 py-1.5 text-[11px]`,t?`border-destructive/40 bg-destructive/10 text-foreground`:r?`border-border/30 bg-background/30 text-muted-foreground`:`border-accent-primary/30 bg-background/50 text-foreground`),children:[t?(0,q.jsx)(of,{className:`w-3.5 h-3.5 text-destructive flex-shrink-0`}):n||r?(0,q.jsx)(af,{className:`w-3.5 h-3.5 text-accent-success flex-shrink-0`}):(0,q.jsx)(of,{className:`w-3.5 h-3.5 text-accent-primary flex-shrink-0`}),(0,q.jsx)(`span`,{className:`font-medium`,children:e.label}),n&&(0,q.jsxs)(`span`,{"data-testid":`prereq-bundled-badge-${e.key}`,className:`inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium bg-accent-secondary/20 text-accent-secondary border border-accent-secondary/30`,children:[(0,q.jsx)(Qf,{className:`w-2.5 h-2.5`}),a(`prerequisites.bundledBadge`)]}),(0,q.jsxs)(`span`,{className:X(`text-muted-foreground`,t&&`text-destructive/80`),children:[`— `,NK(e,a)]})]},e.key)})})]})}var FK={agents:0,specrailsCommands:0,opsxCommands:0,legacySrRemoved:0,tier:`quick`,provider:`claude`};function IK(e){return e.includes(`opus`)?`opus`:e.includes(`haiku`)?`haiku`:e.includes(`sonnet`)?`sonnet`:e}function LK(e){return{balanced:`sonnet`,budget:`haiku`,max:`sonnet`}[e]}function RK(){return{selectedAgents:[...mK],modelPreset:`balanced`,modelOverrides:{}}}var zK=()=>[{key:`base_install`,name:J.t(`setup:wizard.checkpoints.baseInstall`),status:`pending`},{key:`agent_selection`,name:J.t(`setup:wizard.checkpoints.agentSelection`),status:`pending`},{key:`agent_generation`,name:J.t(`setup:wizard.checkpoints.agentGeneration`),status:`pending`}],BK=new Map,VK=`prose prose-invert prose-xs max-w-none
121
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))})),jW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.FitAddon=r():n.FitAddon=r()})(self,(()=>(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,`__esModule`,{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue(`height`)),a=Math.max(0,parseInt(r.getPropertyValue(`width`))),o=window.getComputedStyle(this._terminal.element),s=i-(parseInt(o.getPropertyValue(`padding-top`))+parseInt(o.getPropertyValue(`padding-bottom`))),c=a-(parseInt(o.getPropertyValue(`padding-right`))+parseInt(o.getPropertyValue(`padding-left`)))-n;return{cols:Math.max(2,Math.floor(c/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()))})),MW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.WebLinksAddon=r():n.WebLinksAddon=r()})(self,(()=>(()=>{var e={6:(e,t)=>{function n(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,`__esModule`,{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=r.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map((e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e)))}};class r{static computeLink(e,t,i,a){let o=new RegExp(t.source,(t.flags||``)+`g`),[s,c]=r._getWindowedLineStrings(e-1,i),l=s.join(``),u,d=[];for(;u=o.exec(l);){let e=u[0];if(!n(e))continue;let[t,o]=r._mapStrIdx(i,c,0,u.index),[s,l]=r._mapStrIdx(i,t,o,e.length);if(t===-1||o===-1||s===-1||l===-1)continue;let f={start:{x:o+1,y:t+1},end:{x:l,y:s+1}};d.push({range:f,text:e,activate:a})}return d}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}}t.LinkComputer=r}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.WebLinksAddon=void 0;let t=n(6),i=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}e.WebLinksAddon=class{constructor(e=a,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let n=this._options,r=n.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,r,this._handler,n))}dispose(){this._linkProvider?.dispose()}}})(),r})()))})),NW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.SearchAddon=r():n.SearchAddon=r()})(self,(()=>(()=>{var e={345:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,`__esModule`,{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.SearchAddon=void 0;let t=n(345),i=n(859),a=` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`;class o extends i.Disposable{constructor(e){super(),this._highlightedLines=new Set,this._highlightDecorations=[],this._selectedDecoration=this.register(new i.MutableDisposable),this._linesCacheTimeoutId=0,this._linesCacheDisposables=new i.MutableDisposable,this._onDidChangeResults=this.register(new t.EventEmitter),this.onDidChangeResults=this._onDidChangeResults.event,this._highlightLimit=e?.highlightLimit??1e3}activate(e){this._terminal=e,this.register(this._terminal.onWriteParsed((()=>this._updateMatches()))),this.register(this._terminal.onResize((()=>this._updateMatches()))),this.register((0,i.toDisposable)((()=>this.clearDecorations())))}_updateMatches(){this._highlightTimeout&&window.clearTimeout(this._highlightTimeout),this._cachedSearchTerm&&this._lastSearchOptions?.decorations&&(this._highlightTimeout=setTimeout((()=>{let e=this._cachedSearchTerm;this._cachedSearchTerm=void 0,this.findPrevious(e,{...this._lastSearchOptions,incremental:!0,noScroll:!0})}),200))}clearDecorations(e){this._selectedDecoration.clear(),(0,i.disposeArray)(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear(),e||(this._cachedSearchTerm=void 0)}clearActiveDecoration(){this._selectedDecoration.clear()}findNext(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let n=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||n)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);if(!e||e.length===0)return void this.clearDecorations();t||={},this.clearDecorations(!0);let n=[],r,i=this._find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);for(let e of n){let n=this._createResultDecoration(e,t.decorations);n&&(this._highlightedLines.add(n.marker.line),this._highlightDecorations.push({decoration:n,match:e,dispose(){n.dispose()}}))}}_find(e,t,n,r){if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),void this.clearDecorations();if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);let i;this._initLinesCache();let a={startRow:t,startCol:n};if(i=this._findInLine(e,a,r),!i)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=n,a.startCol=0,i=this._findInLine(e,a,r),!i);n++);return i}_findNextAndSelect(e,t){if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,i=0;n&&(this._cachedSearchTerm===e?(r=n.end.x,i=n.end.y):(r=n.start.x,i=n.start.y)),this._initLinesCache();let a={startRow:i,startCol:r},o=this._findInLine(e,a,t);if(!o)for(let n=i+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=n,a.startCol=0,o=this._findInLine(e,a,t),!o);n++);if(!o&&i!==0)for(let n=0;n<i&&(a.startRow=n,a.startCol=0,o=this._findInLine(e,a,t),!o);n++);return!o&&n&&(a.startRow=n.start.y,a.startCol=0,o=this._findInLine(e,a,t)),this._selectResult(o,t?.decorations,t?.noScroll)}findPrevious(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let n=!this._lastSearchOptions||this._didOptionsChange(this._lastSearchOptions,t);this._lastSearchOptions=t,t?.decorations&&(this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||n)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t);return this._fireResults(t),this._cachedSearchTerm=e,r}_didOptionsChange(e,t){return!!t&&(e.caseSensitive!==t.caseSensitive||e.regex!==t.regex||e.wholeWord!==t.wholeWord)}_fireResults(e){if(e?.decorations){let e=-1;if(this._selectedDecoration.value){let t=this._selectedDecoration.value.match;for(let n=0;n<this._highlightDecorations.length;n++){let r=this._highlightDecorations[n].match;if(r.row===t.row&&r.col===t.col&&r.size===t.size){e=n;break}}}this._onDidChangeResults.fire({resultIndex:e,resultCount:this._highlightDecorations.length})}}_findPreviousAndSelect(e,t){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);if(!this._terminal||!e||e.length===0)return this._terminal?.clearSelection(),this.clearDecorations(),!1;let n=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,i=this._terminal.cols;this._initLinesCache();let a={startRow:r,startCol:i},o;if(n&&(a.startRow=r=n.start.y,a.startCol=i=n.start.x,this._cachedSearchTerm!==e&&(o=this._findInLine(e,a,t,!1),o||(a.startRow=r=n.end.y,a.startCol=i=n.end.x))),o||=this._findInLine(e,a,t,!0),!o){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let n=r-1;n>=0&&(a.startRow=n,o=this._findInLine(e,a,t,!0),!o);n--);}if(!o&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=r&&(a.startRow=n,o=this._findInLine(e,a,t,!0),!o);n--);return this._selectResult(o,t?.decorations,t?.noScroll)}_initLinesCache(){let e=this._terminal;this._linesCache||(this._linesCache=Array(e.buffer.active.length),this._linesCacheDisposables.value=(0,i.getDisposeArrayDisposable)([e.onLineFeed((()=>this._destroyLinesCache())),e.onCursorMove((()=>this._destroyLinesCache())),e.onResize((()=>this._destroyLinesCache()))])),window.clearTimeout(this._linesCacheTimeoutId),this._linesCacheTimeoutId=window.setTimeout((()=>this._destroyLinesCache()),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeoutId&&=(window.clearTimeout(this._linesCacheTimeoutId),0)}_isWholeWord(e,t,n){return(e===0||a.includes(t[e-1]))&&(e+n.length===t.length||a.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=this._terminal,a=t.startRow,o=t.startCol;if(i.buffer.active.getLine(a)?.isWrapped)return r?void(t.startCol+=i.cols):(t.startRow--,t.startCol+=i.cols,this._findInLine(e,t,n));let s=this._linesCache?.[a];s||(s=this._translateBufferLineToStringWithWrap(a,!0),this._linesCache&&(this._linesCache[a]=s));let[c,l]=s,u=this._bufferColsToStringOffset(a,o),d=n.caseSensitive?e:e.toLowerCase(),f=n.caseSensitive?c:c.toLowerCase(),p=-1;if(n.regex){let t=RegExp(d,`g`),n;if(r)for(;n=t.exec(f.slice(0,u));)p=t.lastIndex-n[0].length,e=n[0],t.lastIndex-=e.length-1;else n=t.exec(f.slice(u)),n&&n[0].length>0&&(p=u+(t.lastIndex-n[0].length),e=n[0])}else r?u-d.length>=0&&(p=f.lastIndexOf(d,u-d.length)):p=f.indexOf(d,u);if(p>=0){if(n.wholeWord&&!this._isWholeWord(p,f,e))return;let t=0;for(;t<l.length-1&&p>=l[t+1];)t++;let r=t;for(;r<l.length-1&&p+e.length>=l[r+1];)r++;let o=p-l[t],s=p+e.length-l[r],c=this._stringLengthToBufferSize(a+t,o);return{term:e,col:c,row:a+t,size:this._stringLengthToBufferSize(a+r,s)-c+i.cols*(r-t)}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=this._terminal,r=e,i=0,a=n.buffer.active.getLine(r);for(;t>0&&a;){for(let e=0;e<t&&e<n.cols;e++){let t=a.getCell(e);if(!t)break;t.getWidth()&&(i+=t.getCode()===0?1:t.getChars().length)}if(r++,a=n.buffer.active.getLine(r),a&&!a.isWrapped)break;t-=n.cols}return i}_translateBufferLineToStringWithWrap(e,t){let n=this._terminal,r=[],i=[0],a=n.buffer.active.getLine(e);for(;a;){let o=n.buffer.active.getLine(e+1),s=!!o&&o.isWrapped,c=a.translateToString(!s&&t);if(s&&o){let e=a.getCell(a.length-1);e&&e.getCode()===0&&e.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(c=c.slice(0,-1))}if(r.push(c),!s)break;i.push(i[i.length-1]+c.length),e++,a=o}return[r.join(``),i]}_selectResult(e,t,n){let r=this._terminal;if(this._selectedDecoration.clear(),!e)return r.clearSelection(),!1;if(r.select(e.col,e.row,e.size),t){let n=r.registerMarker(-r.buffer.active.baseY-r.buffer.active.cursorY+e.row);if(n){let a=r.registerDecoration({marker:n,x:e.col,width:e.size,backgroundColor:t.activeMatchBackground,layer:`top`,overviewRulerOptions:{color:t.activeMatchColorOverviewRuler}});if(a){let r=[];r.push(n),r.push(a.onRender((e=>this._applyStyles(e,t.activeMatchBorder,!0)))),r.push(a.onDispose((()=>(0,i.disposeArray)(r)))),this._selectedDecoration.value={decoration:a,match:e,dispose(){a.dispose()}}}}}if(!n&&(e.row>=r.buffer.active.viewportY+r.rows||e.row<r.buffer.active.viewportY)){let t=e.row-r.buffer.active.viewportY;t-=Math.floor(r.rows/2),r.scrollLines(t)}return!0}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecoration(e,t){let n=this._terminal,r=n.registerMarker(-n.buffer.active.baseY-n.buffer.active.cursorY+e.row);if(!r)return;let a=n.registerDecoration({marker:r,x:e.col,width:e.size,backgroundColor:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:t.matchOverviewRuler,position:`center`}});if(a){let e=[];e.push(r),e.push(a.onRender((e=>this._applyStyles(e,t.matchBorder,!1)))),e.push(a.onDispose((()=>(0,i.disposeArray)(e))))}return a}}e.SearchAddon=o})(),r})()))})),PW=n(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.Unicode11Addon=r():n.Unicode11Addon=r()})(e,(()=>(()=>{var e={433:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV11=void 0;let r=n(938),i=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],a=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],o=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],s=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],c;function l(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}t.UnicodeV11=class{constructor(){if(this.version=`11`,!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160);for(let e=0;e<i.length;++e)c.fill(0,i[e][0],i[e][1]+1);for(let e=0;e<o.length;++e)c.fill(2,o[e][0],o[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?c[e]:l(e,a)?0:l(e,s)?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},345:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},490:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let r=n(938),i=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],o;t.UnicodeV6=class{constructor(){if(this.version=`6`,!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;e<i.length;++e)o.fill(0,i[e][0],i[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?o[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,a)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let e=r.UnicodeService.extractWidth(t);e===0?i=!1:e>n&&(n=e)}return r.UnicodeService.createPropertyValue(0,n,i)}}},938:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(345),i=n(490);class a{static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(16777215&e)<<3|(3&t)<<1|!!n}constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,n=0,r=e.length;for(let i=0;i<r;++i){let o=e.charCodeAt(i);if(55296<=o&&o<=56319){if(++i>=r)return t+this.wcwidth(o);let n=e.charCodeAt(i);56320<=n&&n<=57343?o=1024*(o-55296)+n-56320+65536:t+=this.wcwidth(n)}let s=this.charProperties(o,n),c=a.extractWidth(s);a.extractShouldJoin(s)&&(c-=a.extractWidth(n)),t+=c,n=s}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=a}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Unicode11Addon=void 0;let t=n(433);e.Unicode11Addon=class{activate(e){e.unicode.register(new t.UnicodeV11)}dispose(){}}})(),r})()))})),FW=AW(),IW=jW(),LW=MW(),RW=NW(),zW=PW(),BW=new Map,VW=new Map;function HW(e){let t=BW.get(e);return t||(t={openPreExec:null,completed:[],cwd:null,promptRows:[]},BW.set(e,t)),t}function UW(e){let t=VW.get(e);if(!t)return;let n=HW(e);for(let e of t)try{e(n)}catch{}}function WW(e,t,n){let r=HW(e);switch(t.kind){case`prompt-start`:r.promptRows.push({ts:t.ts,row:n?.row??null,exitCode:null}),r.promptRows.length>1e3&&r.promptRows.shift();break;case`pre-exec`:r.openPreExec={startedAt:t.ts};break;case`post-exec`:{let e=t.payload?.exitCode??null,n=r.openPreExec?.startedAt??t.ts;r.completed.push({startedAt:n,finishedAt:t.ts,exitCode:e});let i=r.promptRows[r.promptRows.length-1];i&&(i.exitCode=e),r.openPreExec=null,r.completed.length>1e3&&r.completed.shift();break}case`cwd`:r.cwd=t.payload?.path??null;break}UW(e)}function GW(e,t){let n=VW.get(e);return n||(n=new Set,VW.set(e,n)),n.add(t),()=>{n.delete(t)}}function KW(e){return HW(e)}function qW(e){BW.delete(e),VW.delete(e)}function JW(){return typeof window<`u`&&window.__TAURI_INTERNALS__!==void 0}function YW(e){return Function(`s`,`return import(s)`)(e).catch(()=>null)}async function XW(e){if(JW()){try{let t=await YW(`@tauri-apps/plugin-opener`);if(t?.revealItemInDir){await t.revealItemInDir(e);return}}catch{}try{await(await YW(`@tauri-apps/api/shell`))?.open?.(e)}catch{}}}async function ZW(e){if(JW())try{let t=await r(()=>import(`./dist-js-XEilFTNz.js`),[]);if(typeof t.open==`function`){await t.open(e);return}}catch(e){console.warn(`[openExternalUrl] tauri shell open failed:`,e)}try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}var QW=new Map,$W=5e3;function eG(){return typeof document<`u`&&!document.hasFocus()}async function tG(e,t){let n=`${e}:${t.command??``}`,r=Date.now();if(r-(QW.get(n)??0)<$W)return;QW.set(n,r);let i=t.command?J.t(`terminal:notifications.commandFinishedNamed`,{command:nG(t.command,50)}):J.t(`terminal:notifications.commandFinished`),a=J.t(`terminal:notifications.finishedBody`,{code:t.exitCode??`?`,elapsed:rG(t.elapsedMs)});if(JW())try{let e=await YW(`@tauri-apps/plugin-notification`);if(e?.sendNotification){let t=await e.isPermissionGranted?.()??!0;if(t||=await e.requestPermission?.()===`granted`,t){await e.sendNotification({title:i,body:a});return}}}catch{}try{if(typeof Notification>`u`||Notification.permission===`default`&&await Notification.requestPermission().catch(()=>`denied`)!==`granted`||Notification.permission!==`granted`)return;new Notification(i,{body:a})}catch{}}function nG(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}function rG(e){if(e<6e4)return J.t(`terminal:duration.seconds`,{seconds:(e/1e3).toFixed(1)});let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return J.t(`terminal:duration.minutesSeconds`,{minutes:t,seconds:n})}async function iG(e,t){await $(`plugin:clipboard-manager|write_text`,{label:t?.label,text:e})}async function aG(){return await $(`plugin:clipboard-manager|read_text`)}async function oG(){if(JW())try{let e=await aG();return typeof e==`string`?e:null}catch{return null}try{if(typeof navigator<`u`&&navigator.clipboard?.readText)return await navigator.clipboard.readText()||null}catch{}return null}async function sG(e){if(JW())try{return await iG(e),!0}catch{return!1}try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return!1}var cG=(0,F.createContext)(null);function lG(e){return`specrails-desktop:terminal-panel:${e}`}function uG(e){try{let t=localStorage.getItem(lG(e));if(!t)return null;let n=JSON.parse(t);if(!n)return null;let r=n.visibility,i=n.userHeight;return r!==`hidden`&&r!==`restored`&&r!==`maximized`||typeof i!=`number`||!Number.isFinite(i)?null:{visibility:r,userHeight:i}}catch{return null}}function dG(e,t){try{localStorage.setItem(lG(e),JSON.stringify(t))}catch{}}function fG(e){return{visibility:e?.visibility??`hidden`,userHeight:e?.userHeight??320,sessions:[],activeId:null}}function pG(){let e=document.getElementById(`specrails-terminal-host`);return e||(e=document.createElement(`div`),e.id=`specrails-terminal-host`,e.style.position=`fixed`,e.style.left=`0`,e.style.top=`0`,e.style.width=`0`,e.style.height=`0`,e.style.overflow=`hidden`,e.style.visibility=`hidden`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),document.body.appendChild(e),e)}function mG({children:e,activeProjectId:t}){let[n,r]=(0,F.useState)({}),i=(0,F.useRef)(n);i.current=n;let a=(0,F.useRef)(new Map),o=(0,F.useRef)(new Map),s=(0,F.useRef)(null);(0,F.useEffect)(()=>(s.current=pG(),()=>{for(let e of a.current.values())TG(e);a.current.clear(),o.current.clear()}),[]);let c=uH()?.theme??null;(0,F.useEffect)(()=>{if(c)for(let e of a.current.values())try{e.term.options.theme=c.xterm}catch{}},[c]);let l=(0,F.useCallback)((e,t)=>{r(n=>{let r=n[e]??fG(uG(e)),i=t(r);return i===r?n:((i.visibility!==r.visibility||i.userHeight!==r.userHeight)&&dG(e,{visibility:i.visibility,userHeight:i.userHeight}),{...n,[e]:i})})},[]),u=(0,F.useCallback)(e=>{r(t=>t[e]?t:{...t,[e]:fG(uG(e))})},[]),d=(0,F.useCallback)(e=>i.current[e]??fG(uG(e)),[]),f=(0,F.useCallback)((e,t)=>{l(e,e=>e.visibility===t?e:{...e,visibility:t})},[l]),p=(0,F.useCallback)(e=>{l(e,e=>({...e,visibility:e.visibility===`hidden`?`restored`:`hidden`}))},[l]),m=(0,F.useCallback)((e,t)=>{l(e,e=>e.userHeight===t?e:{...e,userHeight:t})},[l]),h=(0,F.useCallback)((e,t)=>{l(e,e=>e.activeId===t?e:{...e,activeId:t})},[l]),g=(0,F.useRef)(t);g.current=t,(0,F.useEffect)(()=>{if(!t)return;u(t);let e=!1;return(async()=>{try{let n=await fetch(`${ol}/api/projects/${t}/terminals`);if(!n.ok)return;let r=await n.json();if(e)return;l(t,e=>{let t=new Set(r.sessions.map(e=>e.id));for(let n of e.sessions.map(e=>e.id))if(!t.has(n)){let e=a.current.get(n);e&&(TG(e),a.current.delete(n),o.current.delete(n),qW(n))}let n=r.sessions.map(t=>{let n=e.sessions.find(e=>e.id===t.id);return n?{...n,...t}:t}),i=n.find(t=>t.id===e.activeId)?.id??n[0]?.id??null;for(let e of n)a.current.has(e.id)||bG(e.projectId,e.id,e.cols,e.rows,a.current,o.current,s.current);return{...e,sessions:n,activeId:i}})}catch{}})(),()=>{e=!0}},[t,u,l]);let _=(0,F.useCallback)(async(e,t)=>{let n=t?.cols??80,r=t?.rows??24;try{let i=await fetch(`${ol}/api/projects/${e}/terminals`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:n,rows:r,name:t?.name})});if(!i.ok){let e=``;try{e=(await i.json())?.error??``}catch{}return K.error(e===`terminal_limit_exceeded`?J.t(`terminal:errors.limitReached`,{max:10}):e===`terminal_spawn_failed`?J.t(`terminal:errors.spawnFailed`):e===`terminal_name_invalid`?J.t(`terminal:errors.invalidName`):J.t(`terminal:errors.openFailed`)),null}let c=(await i.json()).session;return bG(e,c.id,c.cols,c.rows,a.current,o.current,s.current,MV,void 0,void 0,!0),l(e,e=>({...e,sessions:[...e.sessions,c],activeId:c.id})),c}catch{return K.error(J.t(`terminal:errors.serverUnreachable`)),null}},[l]),v=(0,F.useCallback)(async(e,t,n)=>{let r=await _(e,n);if(!r)return null;let i=a.current.get(r.id);if(!i)return r;let o=()=>{let e=i.ws;if(e)try{e.send(new TextEncoder().encode(t))}catch{}};return i.ws&&i.ws.readyState===WebSocket.OPEN?setTimeout(o,50):i.ws&&i.ws.addEventListener(`open`,()=>setTimeout(o,50),{once:!0}),r},[]),y=(0,F.useCallback)((e,t)=>{let n=a.current.get(e);if(!n?.ws||n.ws.readyState!==WebSocket.OPEN)return!1;try{n.ws.send(new TextEncoder().encode(t));try{n.term.focus()}catch{}return!0}catch{return!1}},[]),b=(0,F.useCallback)(async(e,t,n)=>{try{let r=await fetch(`${ol}/api/projects/${e}/terminals/${t}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n})});if(!r.ok)return!1;let i=await r.json();return l(e,e=>({...e,sessions:e.sessions.map(e=>e.id===t?{...e,name:i.session.name}:e)})),!0}catch{return!1}},[l]),x=(0,F.useCallback)(async(e,t)=>{let n=a.current.get(t);n&&(TG(n),a.current.delete(t),o.current.delete(t),qW(t)),l(e,e=>{let n=e.sessions.filter(e=>e.id!==t),r=e.activeId===t?n[0]?.id??null:e.activeId;return{...e,sessions:n,activeId:r}});try{await fetch(`${ol}/api/projects/${e}/terminals/${t}`,{method:`DELETE`})}catch{}},[l]),S=(0,F.useCallback)(e=>{let t=i.current[e];if(!t?.activeId)return;let n=a.current.get(t.activeId);if(n?.attached)try{n.term.focus()}catch{}},[]),C=(0,F.useCallback)(e=>{for(let[t,n]of o.current.entries()){if(n!==e)continue;let r=a.current.get(t);r&&(TG(r),a.current.delete(t)),o.current.delete(t)}r(t=>{if(!t[e])return t;let{[e]:n,...r}=t;return r});try{localStorage.removeItem(lG(e))}catch{}},[]),w=(0,F.useCallback)(e=>a.current.get(e)?.container??null,[]),T=(0,F.useCallback)(e=>{let t=a.current.get(e);if(!t)return;let n=!t.term.element||t.term.element.parentElement!==t.container;if(t.attached=!0,n){try{t.term.open(t.container)}catch{}let e=t.settings.renderMode;(e===`webgl`||e===`auto`&&wG())&&!t.webgl&&CG(t.term).then(e=>{e&&(t.webgl=e)})}try{t.fit.fit()}catch{}try{t.term.focus()}catch{}let r=t.term.cols,i=t.term.rows;if(t.ws&&t.ws.readyState===WebSocket.OPEN)try{t.ws.send(JSON.stringify({type:`resize`,cols:r,rows:i}))}catch{}},[]),E=(0,F.useCallback)(e=>{let t=a.current.get(e);if(!(!t||!t.attached)){try{t.fit.fit()}catch{}if(t.ws&&t.ws.readyState===WebSocket.OPEN)try{t.ws.send(JSON.stringify({type:`resize`,cols:t.term.cols,rows:t.term.rows}))}catch{}}},[]),D=(0,F.useCallback)((e,t)=>{let n=a.current.get(e);return n?(n.markListeners.add(t),()=>{n.markListeners.delete(t)}):()=>{}},[]),O=(0,F.useCallback)(e=>a.current.get(e)?.currentCwd??null,[]),k=(0,F.useCallback)(e=>a.current.get(e)?.search??null,[]),A=(0,F.useCallback)(e=>a.current.get(e)?.term??null,[]),j=(0,F.useCallback)((e,t)=>{let n=a.current.get(e);return n?(n.openSearchListeners.add(t),()=>{n.openSearchListeners.delete(t)}):()=>{}},[]),M=(0,F.useMemo)(()=>({states:n,getState:d,ensureProject:u,setVisibility:f,togglePanel:p,setUserHeight:m,setActive:h,create:_,createAndType:v,writeToSession:y,rename:b,kill:x,focusActive:S,disposeProject:C,getContainer:w,notifyAdopted:T,refitActive:E,subscribeMarks:D,getCwd:O,getSearchAddon:k,subscribeOpenSearch:j,getTerminalInstance:A}),[n,d,u,f,p,m,h,_,v,y,b,x,S,C,w,T,E,D,O,k,j,A]);return(0,q.jsx)(cG.Provider,{value:M,children:e})}var hG={states:{},getState:e=>fG(null),ensureProject:()=>{},setVisibility:()=>{},togglePanel:()=>{},setUserHeight:()=>{},setActive:()=>{},create:async()=>null,createAndType:async()=>null,writeToSession:()=>!1,rename:async()=>!1,kill:async()=>{},focusActive:()=>{},disposeProject:()=>{},getContainer:()=>null,notifyAdopted:()=>{},refitActive:()=>{},subscribeMarks:()=>()=>{},getCwd:()=>null,getSearchAddon:()=>null,subscribeOpenSearch:()=>()=>{},getTerminalInstance:()=>null};function gG(){return(0,F.useContext)(cG)??hG}function _G(e){let t=gG();return e?t.states[e]??fG(uG(e)):fG(null)}function vG(e,t,n,r,i){let a=e.get(t);if(!a)return;let o=a.term.options.fontSize??MV.fontSize,s;if(r===`reset`)s=a.settings.fontSize,i&&i(n,{fontSize:null});else{let e=o+r;if(e<8||e>32)return;s=NV(e),i&&i(n,{fontSize:s})}if(s!==o)try{a.term.options.fontSize=s,a.fit.fit()}catch{}}function yG(e,t,n){let r=e.get(t);if(!r)return;let{promptRows:i}=KW(t);if(i.length===0)return;let a=r.term.buffer.active.viewportY,o=null;if(n===`prev`)for(let e=i.length-1;e>=0;e--){let t=i[e].row;if(t!=null&&t<a){o=t;break}}else for(let e of i){let t=e.row;if(t!=null&&t>a){o=t;break}}if(o!=null)try{r.term.scrollToLine(o)}catch{}}function bG(e,t,n,r,i,a,o,s=MV,c,l,u=!1){let d=i.get(t);if(d)return d;let f=document.createElement(`div`);f.style.width=`100%`,f.style.height=`100%`,f.className=`specrails-xterm-container`;let p=new FW.Terminal({cols:n,rows:r,fontFamily:s.fontFamily,fontSize:s.fontSize,theme:nH().xterm,cursorBlink:!0,scrollback:1e4,allowProposedApi:!0}),m=new IW.FitAddon,h=new LW.WebLinksAddon,g=new RW.SearchAddon;p.loadAddon(m),p.loadAddon(h),p.loadAddon(g),p.attachCustomKeyEventHandler(n=>{if(n.type!==`keydown`||!(typeof navigator<`u`&&/Mac/i.test(navigator.platform||``)?n.metaKey:n.ctrlKey))return!0;let r=n.key;if(r===`c`||r===`C`){let e=p.getSelection();return e.length===0?!0:(sG(e),n.preventDefault(),!1)}if(r===`v`||r===`V`)return oG().then(e=>{if(e)try{p.paste(e)}catch{}}),n.preventDefault(),!1;if(r===`k`||r===`K`){try{p.clear()}catch{}return n.preventDefault(),!1}if(r===`f`||r===`F`){n.preventDefault();let e=i.get(t);if(e)for(let t of e.openSearchListeners)try{t()}catch{}return!1}return r===`=`||r===`+`?(n.preventDefault(),vG(i,t,e,1,l),!1):r===`-`||r===`_`?(n.preventDefault(),vG(i,t,e,-1,l),!1):r===`0`?(n.preventDefault(),vG(i,t,e,`reset`,l),!1):r===`ArrowUp`||r===`ArrowDown`?(n.preventDefault(),yG(i,t,r===`ArrowUp`?`prev`:`next`),!1):!0});try{let e=new zW.Unicode11Addon;p.loadAddon(e),p.unicode.activeVersion=`11`}catch{}s.imageRendering&&xG(p),SG(p),o&&o.appendChild(f);let _=`${aD||(typeof window<`u`?`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}`:`ws://localhost:4200`)}/ws/terminal/${t}?projectId=${encodeURIComponent(e)}`,v=pl(),y=v?new WebSocket(_,[`specrails-desktop`,v]):new WebSocket(_);y.binaryType=`arraybuffer`;let b=[];y.onmessage=e=>{if(typeof e.data==`string`){try{let n=JSON.parse(e.data);if(n?.type===`ready`)return;if(n?.type===`exit`){let e=i.get(t);e&&x(e,n.code??null,!!n.early);return}if(n?.type===`mark`&&typeof n.kind==`string`&&typeof n.ts==`number`){let e=i.get(t);if(e){n.kind===`cwd`&&n.payload?.path&&(e.currentCwd=n.payload.path);let r={type:`mark`,kind:n.kind,payload:n.payload,ts:n.ts,sessionId:t},i=e.term.buffer.active,a=n.kind===`prompt-start`?i.cursorY+i.viewportY:null,o=n.kind===`post-exec`?KW(t).openPreExec?.startedAt??null:null;if(WW(t,n,{row:a}),n.kind===`post-exec`&&o!=null&&eG()){let r=n.ts-o,i=e.settings.longCommandThresholdMs;e.settings.notifyOnCompletion&&r>=i&&tG(t,{command:null,exitCode:n.payload?.exitCode??null,elapsedMs:r})}for(let t of e.markListeners)try{t(r)}catch{}c&&c(r)}}}catch{}return}let n=i.get(t);n&&(n.gotData=!0);let r=new Uint8Array(e.data);try{p.write(r)}catch{}};let x=(e,t,n)=>{if(!e.exitShown){e.exitShown=!0;try{let n=t===null?J.t(`terminal:session.processExited`):J.t(`terminal:session.processExitedWithCode`,{code:t});e.term.write(`\r\n\x1b[2m${n}\x1b[0m\r\n`)}catch{}n&&!e.gotUserInput&&K.error(J.t(`terminal:errors.exitedImmediately`))}};y.onclose=e=>{let n=i.get(t);if(!n||n.disposing||n.exitShown)return;let r=(typeof e?.reason==`string`?e.reason:``)===`pty_exit_early`,a=n.openedAt>0&&Date.now()-n.openedAt<3e3&&!n.gotData&&!n.gotUserInput;x(n,null,r||a)};let S=p.onData(e=>{let n=i.get(t);if(n&&(n.gotUserInput=!0),y.readyState===WebSocket.OPEN)try{y.send(new TextEncoder().encode(e))}catch{}});b.push(()=>S.dispose());let C=null,w=()=>{if(f.isConnected){try{m.fit()}catch{return}if(y.readyState===WebSocket.OPEN)try{y.send(JSON.stringify({type:`resize`,cols:p.cols,rows:p.rows}))}catch{}}},T=()=>{C&&clearTimeout(C),C=setTimeout(()=>{C=null,w()},120)};y.onopen=()=>{let e=i.get(t);e&&(e.openedAt=Date.now()),w()};let E=new ResizeObserver(T);E.observe(f),b.push(()=>{C&&clearTimeout(C),E.disconnect()});let D={term:p,fit:m,webLinks:h,search:g,webgl:null,settings:s,container:f,ws:y,attached:!1,disposers:b,openedAt:0,gotData:!1,gotUserInput:!1,disposing:!1,exitShown:!1,currentCwd:null,markListeners:new Set,openSearchListeners:new Set};return i.set(t,D),a.set(t,e),D}async function xG(e){try{let n=(await r(()=>import(`./addon-image-3WCl5Vhd.js`).then(e=>t(e.default,1)),__vite__mapDeps([23,1]))).ImageAddon,i=new n({pixelLimit:8e6});e.loadAddon(i)}catch{}}async function SG(e){try{let n=(await r(()=>import(`./addon-ligatures-C5OdliKs.js`).then(e=>t(e.default,1)),__vite__mapDeps([24,1]))).LigaturesAddon;e.loadAddon(new n)}catch{}}async function CG(e){try{let n=(await r(()=>import(`./addon-webgl-BbX6pSjl.js`).then(e=>t(e.default,1)),__vite__mapDeps([25,1]))).WebglAddon,i=new n;return i.onContextLoss(()=>{try{i.dispose()}catch{}}),e.loadAddon(i),i}catch{return null}}function wG(){try{let e=document.createElement(`canvas`);return!!(e.getContext(`webgl2`)||e.getContext(`experimental-webgl2`))}catch{return!1}}function TG(e){e.disposing=!0;for(let t of e.disposers)try{t()}catch{}e.disposers=[],e.markListeners.clear(),e.openSearchListeners.clear();try{e.ws?.close(1e3,`client_dispose`)}catch{}e.ws=null;try{e.webgl?.dispose()}catch{}e.webgl=null;try{e.term.dispose()}catch{}try{e.container.remove()}catch{}}function EG(){return new kG(JU(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function DG(){return $(`plugin:webview|get_all_webviews`).then(e=>e.map(e=>new kG(new ZU(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}var OG=[`tauri://created`,`tauri://error`],kG=class{constructor(e,t,n){this.window=e,this.label=t,this.listeners=Object.create(null),n?.skip||$(`plugin:webview|create_webview`,{windowLabel:e.label,options:{...n,label:t}}).then(async()=>this.emit(`tauri://created`)).catch(async e=>this.emit(`tauri://error`,e))}static async getByLabel(e){return(await DG()).find(t=>t.label===e)??null}static getCurrent(){return EG()}static async getAll(){return DG()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:zU(e,t,{target:{kind:`Webview`,label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let n=this.listeners[e];n.splice(n.indexOf(t),1)}:BU(e,t,{target:{kind:`Webview`,label:this.label}})}async emit(e,t){if(OG.includes(e)){for(let n of this.listeners[e]||[])n({event:e,id:-1,payload:t});return}return VU(e,t)}async emitTo(e,t,n){if(OG.includes(t)){for(let e of this.listeners[t]||[])e({event:t,id:-1,payload:n});return}return HU(e,t,n)}_handleTauriEvent(e,t){return OG.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}async position(){return $(`plugin:webview|webview_position`,{label:this.label}).then(e=>new FU(e))}async size(){return $(`plugin:webview|webview_size`,{label:this.label}).then(e=>new MU(e))}async close(){return $(`plugin:webview|webview_close`,{label:this.label})}async setSize(e){return $(`plugin:webview|set_webview_size`,{label:this.label,value:e instanceof NU?e:new NU(e)})}async setPosition(e){return $(`plugin:webview|set_webview_position`,{label:this.label,value:e instanceof IU?e:new IU(e)})}async setFocus(){return $(`plugin:webview|set_webview_focus`,{label:this.label})}async setAutoResize(e){return $(`plugin:webview|set_webview_auto_resize`,{label:this.label,value:e})}async hide(){return $(`plugin:webview|webview_hide`,{label:this.label})}async show(){return $(`plugin:webview|webview_show`,{label:this.label})}async setZoom(e){return $(`plugin:webview|set_webview_zoom`,{label:this.label,value:e})}async reparent(e){return $(`plugin:webview|reparent`,{label:this.label,window:typeof e==`string`?e:e.label})}async clearAllBrowsingData(){return $(`plugin:webview|clear_all_browsing_data`)}async setBackgroundColor(e){return $(`plugin:webview|set_webview_background_color`,{color:e})}async onDragDropEvent(e){let t=await this.listen(LU.DRAG_ENTER,t=>{e({...t,payload:{type:`enter`,paths:t.payload.paths,position:new FU(t.payload.position)}})}),n=await this.listen(LU.DRAG_OVER,t=>{e({...t,payload:{type:`over`,position:new FU(t.payload.position)}})}),r=await this.listen(LU.DRAG_DROP,t=>{e({...t,payload:{type:`drop`,paths:t.payload.paths,position:new FU(t.payload.position)}})}),i=await this.listen(LU.DRAG_LEAVE,t=>{e({...t,payload:{type:`leave`}})});return()=>{t(),r(),n(),i()}}};function AG(e){return`'${e.replace(/'/g,`'\\''`)}'`}function jG(e){return`'${e.replace(/'/g,`''`)}'`}function MG(e,t){return t?jG(e):AG(e)}function NG(e,t){return e.map(e=>MG(e,t)).join(` `)}async function PG(e){if(!JW())return{dispose:()=>{}};try{let t=[],n=``,r=0,i=typeof navigator<`u`&&/Win/i.test(navigator.platform||``),a=t=>{let a=t.payload;if(!a||a.type!==`drop`)return;let o=a.paths;if(!o||o.length===0)return;let s=a.position;if(!s)return;let c=`${o.join(`\0`)}@${s.x},${s.y}`,l=Date.now();if(c===n&&l-r<250)return;n=c,r=l;let u=e();if(!u||!IG(s,u.viewportEl.getBoundingClientRect(),window.devicePixelRatio||1))return;let d=NG(o,i);try{u.writeText(d)}catch{}},o=FG((()=>{try{return EG()}catch{return null}})());o&&t.push(await o(a));let s=FG((()=>{try{return JU()}catch{return null}})());return s&&t.push(await s(a)),t.length===0?{dispose:()=>{}}:{dispose:()=>{for(let e of t)try{e()}catch{}}}}catch{return{dispose:()=>{}}}}function FG(e){let t=e?.onDragDropEvent;return typeof t==`function`?t.bind(e):null}function IG(e,t,n){if(LG(e.x,e.y,t))return!0;let r=Number.isFinite(n)&&n>0?n:1;return LG(e.x/r,e.y/r,t)}function LG(e,t,n){return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom}function RG({x:e,y:t,label:n,onSelect:r,onClose:i}){let a=(0,F.useRef)(null);return(0,F.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&i()},t=e=>{e.key===`Escape`&&i()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,q.jsx)(`div`,{ref:a,role:`menu`,"data-shortcut-context-menu":!0,style:{position:`fixed`,left:typeof window<`u`&&e+220>window.innerWidth?e-220:e,top:typeof window<`u`&&t+60>window.innerHeight?t-60:t,minWidth:200},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:(0,q.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(),i()},className:`w-full text-left px-3 py-1.5 text-[#f8f8f2] hover:bg-[#44475a]`,children:n})})}function zG({x:e,y:t,providers:n,onSelect:r,onClose:i}){let{t:a}=G(`terminal`),o=(0,F.useRef)(null);(0,F.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i()},t=e=>{e.key===`Escape`&&i()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=typeof window<`u`&&e+200>window.innerWidth?e-200:e,c=8+n.length*32;return(0,q.jsx)(`div`,{ref:o,role:`menu`,"data-cli-launch-menu":!0,style:{position:`fixed`,left:s,top:typeof window<`u`&&t+c>window.innerHeight?t-c:t,minWidth:180},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:n.map(e=>(0,q.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r(e),i()},className:`w-full text-left px-3 py-1.5 text-[#f8f8f2] hover:bg-[#44475a]`,children:a(`cliMenu.open`,{name:ME(e)})},e))})}var BG=(0,F.forwardRef)(function({isOpen:e,className:t,...n},r){let{t:i}=G(`terminal`);return(0,q.jsx)(`button`,{ref:r,type:`button`,"aria-label":i(e?`panelChevron.collapse`:`panelChevron.expand`),"aria-expanded":e,className:X(`panel-chevron`,`inline-flex items-center justify-center`,`h-5 w-6 mr-1.5`,`rounded text-muted-foreground`,`hover:bg-border/40 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-primary/60`,`transition-colors duration-120`,t),...n,children:(0,q.jsxs)(`svg`,{width:`14`,height:`10`,viewBox:`0 0 14 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,q.jsx)(`rect`,{x:`1`,y:`1`,width:`12`,height:`8`,rx:`1.5`}),e?(0,q.jsx)(`path`,{d:`M5 3.5 L7 5.5 L9 3.5`}):(0,q.jsx)(`path`,{d:`M5 6.5 L7 4.5 L9 6.5`})]})})});function VG({visibility:e,canCreate:t,hasActive:n,provider:r=`claude`,providers:i,onCreate:a,onOpenCli:o,onOpenBrowser:s,onPasteScript:c,pasteScriptDisabled:l,onConfigureBrowser:u,onConfigureScript:d,onKillActive:f,onToggleMaximize:p,onCollapse:m}){let{t:h}=G(`terminal`),g=!!i&&i.length>1,_=r===`codex`?`Codex`:`Claude`,v=h(`topBar.maxTerminals`,{max:10}),y=t?g?h(`topBar.openCliMulti`):h(`topBar.openCli`,{cli:_}):v;return(0,q.jsxs)(`div`,{className:X(`flex items-center justify-between h-7 px-2 shrink-0`,`bg-background/95 backdrop-blur-sm`,`border-b border-border/40`,`text-[10px] uppercase tracking-wide text-muted-foreground select-none`),children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 pl-1`,children:(0,q.jsx)(`span`,{className:`font-medium text-foreground`,children:h(`topBar.title`)})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,q.jsx)(HG,{label:y,disabled:!t,onClick:e=>o(e?{x:e.clientX,y:e.clientY}:void 0),children:(0,q.jsx)(Ep,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(`topBar.openInBrowser`),onClick:s,onContextMenu:e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY})},children:(0,q.jsx)(Mf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(l?`topBar.pasteScriptNoActive`:`topBar.pasteScript`),disabled:l,onClick:c,onContextMenu:e=>{e.preventDefault(),d({x:e.clientX,y:e.clientY})},children:(0,q.jsx)(uf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:t?h(`topBar.newTerminal`):v,disabled:!t,onClick:a,children:(0,q.jsx)(sp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(`topBar.killActive`),disabled:!n,onClick:f,children:(0,q.jsx)(Pp,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(HG,{label:h(e===`maximized`?`topBar.restorePanel`:`topBar.maximizePanel`),onClick:p,children:e===`maximized`?(0,q.jsx)(Jf,{className:`h-3.5 w-3.5`}):(0,q.jsx)(Gf,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(BG,{isOpen:!0,onClick:m})]})]})}function HG({label:e,disabled:t,onClick:n,onContextMenu:r,children:i}){return(0,q.jsx)(`button`,{type:`button`,onClick:e=>n(e),onContextMenu:r,disabled:t,title:e,"aria-label":e,className:X(`inline-flex items-center justify-center h-5 w-6 rounded`,`text-muted-foreground transition-colors duration-120`,t?`opacity-40 cursor-not-allowed`:`hover:bg-border/40 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent-primary/60`),children:i})}function UG({sessions:e,activeId:t,onActivate:n,onRename:r,onKill:i}){return(0,q.jsx)(`aside`,{className:X(`w-44 shrink-0 border-l border-border/40 bg-background/70`,`overflow-y-auto`),children:(0,q.jsx)(`ul`,{className:`py-1`,children:e.map(e=>(0,q.jsx)(WG,{session:e,active:e.id===t,onActivate:()=>n(e.id),onRename:t=>r(e.id,t),onKill:()=>i(e.id)},e.id))})})}function WG({session:e,active:t,onActivate:n,onRename:r,onKill:i}){let{t:a}=G(`terminal`),[o,s]=(0,F.useState)(!1),[c,l]=(0,F.useState)(e.name),u=(0,F.useRef)(null);(0,F.useEffect)(()=>{o&&(l(e.name),queueMicrotask(()=>{u.current?.focus(),u.current?.select()}))},[o,e.name]);function d(){let t=c.trim();t&&t!==e.name&&r(t),s(!1)}function f(){s(!0)}function p(){s(!1),l(e.name)}return(0,q.jsx)(`li`,{className:`relative group px-1`,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":t,onClick:()=>{o||n()},onKeyDown:e=>{o||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},onDoubleClick:f,className:X(`flex items-center gap-2 px-2 py-1.5 rounded-md text-xs cursor-pointer select-none`,`transition-colors duration-120`,t?`bg-border/40 text-foreground border-l-2 border-accent-primary/70 pl-[calc(0.5rem-2px)]`:`text-muted-foreground hover:bg-border/20 hover:text-foreground`),children:[(0,q.jsx)(Mp,{className:`h-3 w-3 shrink-0`}),o?(0,q.jsx)(`input`,{ref:u,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d()),e.key===`Escape`&&(e.preventDefault(),p())},onBlur:d,onClick:e=>e.stopPropagation(),maxLength:64,className:X(`flex-1 min-w-0 bg-background/60 border border-border/40 rounded px-1`,`text-xs text-foreground outline-none focus:ring-1 focus:ring-accent-primary/60`)}):(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),!o&&(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`sidebar.rename`,{name:e.name}),title:a(`sidebar.rename`,{name:e.name}),onClick:e=>{e.stopPropagation(),f()},className:X(`inline-flex items-center justify-center h-4 w-4 rounded`,`text-muted-foreground opacity-0 group-hover:opacity-100`,`hover:bg-border/40 hover:text-foreground`,`transition-opacity duration-120`,t&&`opacity-70`),children:(0,q.jsx)(rp,{className:`h-3 w-3`})}),(0,q.jsx)(`button`,{type:`button`,"aria-label":a(`sidebar.close`,{name:e.name}),title:a(`sidebar.close`,{name:e.name}),onClick:e=>{e.stopPropagation(),i()},className:X(`inline-flex items-center justify-center h-4 w-4 rounded`,`text-muted-foreground opacity-0 group-hover:opacity-100`,`hover:bg-destructive/20 hover:text-destructive`,`transition-opacity duration-120`,t&&`opacity-70`),children:(0,q.jsx)(Bp,{className:`h-3 w-3`})})]})})}function GG({search:e,onClose:t}){let{t:n}=G(`terminal`),r=(0,F.useRef)(null),[i,a]=(0,F.useState)(``),[o,s]=(0,F.useState)(!1),[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(null);(0,F.useEffect)(()=>(r.current?.focus(),()=>{try{e.clearDecorations()}catch{}}),[e]),(0,F.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);function m(){return{caseSensitive:o,regex:c,wholeWord:u,decorations:{matchBackground:`#bd93f9`,matchOverviewRuler:`#bd93f9`,activeMatchBackground:`#ff79c6`,activeMatchColorOverviewRuler:`#ff79c6`}}}function h(){if(i)try{e.findNext(i,m())}catch{}}function g(){if(i)try{e.findPrevious(i,m())}catch{}}return(0,F.useEffect)(()=>{let t=()=>{};try{let n=e.onDidChangeResults(e=>{if(!e){p(null);return}p({current:e.resultIndex+1,total:e.resultCount})});t=()=>{try{n.dispose()}catch{}}}catch{}return t},[e]),(0,q.jsxs)(`div`,{className:`absolute top-2 right-2 flex items-center gap-1 bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg px-2 py-1 z-30`,role:`search`,"data-terminal-search-overlay":!0,children:[(0,q.jsx)(`input`,{ref:r,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.shiftKey?g():h())},placeholder:n(`search.placeholder`),className:`bg-transparent text-sm outline-none text-[#f8f8f2] placeholder:text-[#6272a4] w-48`}),f&&(0,q.jsxs)(`span`,{className:`text-xs text-[#6272a4] tabular-nums`,children:[f.current,`/`,f.total]}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.previous`),onClick:g,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(tf,{size:14})}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.next`),onClick:h,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(Qd,{size:14})}),(0,q.jsx)(KG,{label:`Aa`,title:n(`search.matchCase`),active:o,onToggle:()=>s(e=>!e)}),(0,q.jsx)(KG,{label:`.*`,title:n(`search.regex`),active:c,onToggle:()=>l(e=>!e)}),(0,q.jsx)(KG,{label:`W`,title:n(`search.wholeWord`),active:u,onToggle:()=>d(e=>!e)}),(0,q.jsx)(`button`,{type:`button`,title:n(`search.close`),onClick:t,className:`text-[#f8f8f2] hover:text-white p-1`,children:(0,q.jsx)(Bp,{size:14})})]})}function KG({label:e,title:t,active:n,onToggle:r}){return(0,q.jsx)(`button`,{type:`button`,title:t,onClick:r,className:`text-xs px-1.5 py-0.5 rounded font-mono ${n?`bg-[#6272a4] text-white`:`text-[#f8f8f2] hover:bg-[#44475a]`}`,children:e})}function qG({x:e,y:t,term:n,cwd:r,hasReveal:i,onClose:a,onOpenSearch:o,onReveal:s,onSaveScrollback:c}){let{t:l}=G(`terminal`),u=(0,F.useRef)(null);(0,F.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&a()},t=e=>{e.key===`Escape`&&a()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[a]);let d=typeof window<`u`&&e+220>window.innerWidth?e-220:e,f=typeof window<`u`&&t+260>window.innerHeight?t-260:t,p=n.getSelection(),m=p.length>0;function h(){m&&(sG(p),a())}function g(){oG().then(e=>{if(e)try{n.paste(e)}catch{}}),a()}function _(){try{n.selectAll()}catch{}a()}function v(){try{n.clear()}catch{}a()}function y(){o(),a()}function b(){c(),a()}function x(){r&&s(r),a()}return(0,q.jsxs)(`div`,{ref:u,role:`menu`,"data-terminal-context-menu":!0,style:{position:`fixed`,left:d,top:f,minWidth:200},className:`bg-[#1f1f29] border border-[#44475a] rounded-md shadow-lg py-1 z-50 text-sm`,children:[(0,q.jsx)(JG,{onClick:h,disabled:!m,label:l(`common:actions.copy`),shortcut:`⌘C`}),(0,q.jsx)(JG,{onClick:g,label:l(`contextMenu.paste`),shortcut:`⌘V`}),(0,q.jsx)(JG,{onClick:_,label:l(`contextMenu.selectAll`),shortcut:`⌘A`}),(0,q.jsx)(YG,{}),(0,q.jsx)(JG,{onClick:v,label:l(`contextMenu.clear`),shortcut:`⌘K`}),(0,q.jsx)(JG,{onClick:y,label:l(`contextMenu.search`),shortcut:`⌘F`}),(0,q.jsx)(JG,{onClick:b,label:l(`contextMenu.saveScrollback`)}),r&&i&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(YG,{}),(0,q.jsx)(JG,{onClick:x,label:l(`contextMenu.openPath`,{path:XG(r,40)})})]})]})}function JG({onClick:e,label:t,shortcut:n,disabled:r}){return(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{r||e()},disabled:r,className:`w-full text-left px-3 py-1.5 flex justify-between items-center ${r?`text-[#6272a4] cursor-not-allowed`:`text-[#f8f8f2] hover:bg-[#44475a]`}`,children:[(0,q.jsx)(`span`,{children:t}),n&&(0,q.jsx)(`span`,{className:`text-xs text-[#6272a4] tabular-nums`,children:n})]})}function YG(){return(0,q.jsx)(`div`,{className:`my-1 border-t border-[#44475a]`})}function XG(e,t){return e.length<=t?e:`…`+e.slice(e.length-t+1)}async function ZG(e,t=`terminal-scrollback.txt`){let n=e.buffer.active,i=[];for(let e=0;e<n.length;e++){let t=n.getLine(e);t&&i.push(t.translateToString(!0))}let a=i.join(`
122
+ `);if(JW())try{let e=await(await r(()=>import(`./dist-js-BvQ52Q67.js`),[])).save({defaultPath:t});if(!e)return;try{let t=await YW(`@tauri-apps/plugin-fs`);if(t?.writeTextFile){await t.writeTextFile(e,a);return}}catch{}try{await(await YW(`@tauri-apps/api/fs`))?.writeTextFile?.({path:e,contents:a})}catch{}return}catch{}try{let e=new Blob([a],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch{}}function QG({sessionId:e}){let[t,n]=(0,F.useState)(()=>KW(e));return(0,F.useEffect)(()=>GW(e,n),[e]),t.promptRows.length===0?null:(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-prompt-gutter":!0,className:`absolute left-0 top-0 bottom-0 w-1 pointer-events-none z-10`,children:(0,q.jsx)(`div`,{className:`absolute top-0 left-0 bottom-0 w-full`,style:{backgroundImage:`linear-gradient(to bottom, rgba(189,147,249,0.2), rgba(189,147,249,0.05))`}})})}function $G({sessionId:e}){let{t}=G(`terminal`),[n,r]=(0,F.useState)(KW(e).openPreExec?.startedAt??null),[i,a]=(0,F.useState)(Date.now());if((0,F.useEffect)(()=>GW(e,e=>r(e.openPreExec?.startedAt??null)),[e]),(0,F.useEffect)(()=>{if(n==null)return;let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[n]),n==null)return null;let o=i-n;return o<500?null:(0,q.jsx)(`div`,{className:`absolute top-2 left-2 px-2 py-0.5 rounded text-xs font-mono bg-[#44475a] text-[#f8f8f2] z-10 pointer-events-none`,children:eK(o,t)})}function eK(e,t){return e<6e4?t(`terminal:duration.seconds`,{seconds:(e/1e3).toFixed(1)}):t(`terminal:duration.minutesSeconds`,{minutes:Math.floor(e/6e4),seconds:Math.floor(e%6e4/1e3)})}function tK({activeId:e}){let t=(0,F.useRef)(null),n=gG(),[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(null),s=JW();(0,F.useEffect)(()=>{if(e)return n.subscribeOpenSearch(e,()=>i(!0))},[e,n]),(0,F.useEffect)(()=>{i(!1),o(null)},[e]);let c=e?n.getSearchAddon(e):null,l=e?n.getTerminalInstance(e):null,u=e?n.getCwd(e):null,[d,f]=(0,F.useState)(!1),p=(0,F.useCallback)(t=>{if(!t)return!1;if(e&&n.writeToSession(e,t))return!0;if(!l)return!1;try{return l.paste(t),!0}catch{return!1}},[e,n,l]),m=(0,F.useCallback)(e=>{if(!l||!e||e.length===0)return!1;let t=Array.from(e).map(e=>nK(e)).filter(e=>!!e);return t.length===0?!1:p(NG(t,typeof navigator<`u`&&/Win/i.test(navigator.platform||``)))},[l,p]),h=(0,F.useCallback)(e=>{if(e.preventDefault(),!e.shiftKey&&l){let e=l.modes?.mouseTrackingMode;if(e&&e!==`none`)return}o({x:e.clientX,y:e.clientY})},[l]),g=(0,F.useCallback)(e=>{if(!l)return;if(e.clipboardData.files&&e.clipboardData.files.length>0){let t=Array.from(e.clipboardData.files).map(e=>nK(e)).filter(e=>!!e);if(t.length>0){e.preventDefault(),e.stopPropagation(),p(NG(t,typeof navigator<`u`&&/Win/i.test(navigator.platform||``)));return}}let t=e.clipboardData.getData(`text/plain`);t&&(e.preventDefault(),e.stopPropagation(),p(t))},[l,p]),_=(0,F.useCallback)(e=>{if(!l)return;let t=l.getSelection();t&&(e.clipboardData.setData(`text/plain`,t),e.preventDefault(),e.stopPropagation())},[l]),v=(0,F.useCallback)(e=>{if(l&&(typeof navigator<`u`&&/Mac/i.test(navigator.platform||``)?e.metaKey:e.ctrlKey)&&(e.key===`c`||e.key===`C`)){let t=l.getSelection();if(!t)return;e.preventDefault(),e.stopPropagation(),sG(t)}},[l]);return(0,F.useEffect)(()=>{let r=t.current;if(!r||!e)return;let i=n.getContainer(e);if(i)return r.appendChild(i),n.notifyAdopted(e),()=>{let e=document.getElementById(`specrails-terminal-host`);e&&i.parentElement===r&&e.appendChild(i)}},[e,n]),(0,F.useEffect)(()=>{let r=t.current;if(!r||!e)return;let i=[],a=r.parentElement;for(;a&&a!==document.body;)(a.tagName.toLowerCase()===`aside`||a.matches(`[data-sidebar]`))&&i.push(a),a=a.parentElement;if(i.length===0)return;let o=t=>{let r=t;r.propertyName!==`width`&&r.propertyName!==`height`||n.refitActive(e)};return i.forEach(e=>e.addEventListener(`transitionend`,o)),()=>{i.forEach(e=>e.removeEventListener(`transitionend`,o))}},[e,n]),(0,q.jsxs)(`div`,{ref:t,className:`flex-1 min-w-0 bg-background px-2 py-1 relative ${d?`outline outline-2 outline-accent-primary outline-offset-[-2px]`:``}`,role:`presentation`,"data-terminal-viewport":!0,onContextMenu:h,onPasteCapture:g,onCopyCapture:_,onKeyDownCapture:v,tabIndex:-1,onDragEnter:e=>{rK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),f(!0))},onDragOver:e=>{rK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),f(!0))},onDragLeave:()=>f(!1),onDrop:e=>{rK(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),m(e.dataTransfer.files)),f(!1)},children:[e&&(0,q.jsx)(QG,{sessionId:e}),e&&(0,q.jsx)($G,{sessionId:e}),r&&c&&(0,q.jsx)(GG,{search:c,onClose:()=>i(!1)}),a&&l&&(0,q.jsx)(qG,{x:a.x,y:a.y,term:l,cwd:u,hasReveal:s,onClose:()=>o(null),onOpenSearch:()=>i(!0),onReveal:e=>{XW(e)},onSaveScrollback:()=>{l&&ZG(l)}})]})}function nK(e){let t=e.path;return typeof t==`string`&&t.length>0?t:null}function rK(e){return e?Array.from(e.types).includes(`Files`):!1}function iK({height:e,maxHeight:t,onHeightCommit:n,onHeightPreview:r,minHeight:i=120}){let{t:a}=G(`terminal`),o=(0,F.useRef)(!1),s=(0,F.useRef)(0),c=(0,F.useRef)(e),l=(0,F.useRef)(!1),u=(0,F.useRef)(e),d=(0,F.useCallback)(e=>e<i?i:e>t?t:Math.round(e),[i,t]);(0,F.useEffect)(()=>{function e(e){if(!o.current)return;let t=s.current-e.clientY;u.current=d(c.current+t),l.current||(l.current=!0,requestAnimationFrame(()=>{l.current=!1,r?.(u.current)}))}function t(){o.current&&(o.current=!1,document.body.style.userSelect=``,document.body.style.cursor=``,n(u.current))}return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[d,n,r]);function f(t){o.current=!0,s.current=t.clientY,c.current=e,u.current=e,document.body.style.userSelect=`none`,document.body.style.cursor=`row-resize`;let n=t.target;if(typeof n.setPointerCapture==`function`)try{n.setPointerCapture(t.pointerId)}catch{}}return(0,q.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`dragHandle.resize`),onPointerDown:f,className:X(`absolute top-0 left-0 right-0 h-1`,`cursor-row-resize`,`bg-transparent hover:bg-accent-primary/40`,`transition-colors duration-120`,`z-10`)})}function aK({onCreate:e}){let{t}=G(`terminal`);return(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-center px-6 bg-background-deep`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,q.jsx)(Mp,{className:`h-8 w-8 opacity-50`}),(0,q.jsx)(`p`,{className:`text-xs`,children:t(`emptyState.noTerminals`)}),(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs bg-border/30 hover:bg-border/50 hover:text-foreground transition-colors`,children:[(0,q.jsx)(sp,{className:`h-3 w-3`}),` `,t(`emptyState.newTerminal`)]})]})})}function oK({projectId:e,provider:t=`claude`,providers:n,state:r,viewportHeight:i,statusBarHeight:a}){let o=gG(),{t:s}=G(`terminal`),c=st(),l=(0,F.useRef)(null),[u,d]=(0,F.useState)(null),[f,p]=(0,F.useState)(MV),[m,h]=(0,F.useState)(null),[g,_]=(0,F.useState)(null),v=n&&n.length>0?n:[t],y=v.length>1,b=(0,F.useCallback)(async(t=()=>!1)=>{try{let n=await fetch(`/api/projects/${e}/terminal-settings`);if(!n.ok)return;let r=await n.json();!t()&&r?.resolved&&p(r.resolved)}catch{}},[e]);(0,F.useEffect)(()=>{let e=!1;return b(()=>e),()=>{e=!0}},[b]),(0,F.useEffect)(()=>{let t=t=>{let n=t.detail;n?.mode===`project`&&n.projectId!==e||b()};return window.addEventListener(PV,t),()=>window.removeEventListener(PV,t)},[b,e]);let x=Math.max(120,i-a-40),S=Math.min(Math.max(r.userHeight||320,120),x),C=r.visibility===`maximized`?Math.max(120,i-a):u??S,w=r.sessions.length<10,T=r.activeId!==null;(0,F.useEffect)(()=>{let e=!1,t=null;return PG(()=>{let e=l.current,t=r.activeId;return!e||!t||r.visibility===`hidden`?null:{viewportEl:e,writeText:e=>{if(o.writeToSession(t,e))return!0;let n=o.getTerminalInstance(t);try{return n?.paste(e),!!n}catch{return!1}}}}).then(n=>{e?n.dispose():t=n}),()=>{e=!0,t?.dispose()}},[r.activeId,r.visibility,o]);let E=(0,F.useCallback)(()=>{w&&o.create(e)},[w,e,o]),D=(0,F.useCallback)(t=>{if(!w)return;let n=t===`codex`?`codex`:`claude`,i=RegExp(`^${n} \\(\\d+\\)$`),a=r.sessions.filter(e=>e.name===n||i.test(e.name)),s=a.length===0?n:`${n} (${a.length+1})`;o.createAndType(e,`${n}\n`,{name:s})},[w,e,r.sessions,o]),O=(0,F.useCallback)(e=>{if(w){if(y&&e){_(e);return}D(t===`codex`?`codex`:`claude`)}},[w,y,t,D]),k=(0,F.useCallback)(()=>{ZW(f.browserShortcutUrl)},[f.browserShortcutUrl]),A=(0,F.useCallback)(()=>{r.activeId&&f.quickScript&&o.writeToSession(r.activeId,f.quickScript)},[f.quickScript,r.activeId,o]),j=(0,F.useCallback)(e=>{h({...e,kind:`browser`})},[]),M=(0,F.useCallback)(e=>{h({...e,kind:`script`})},[]),N=(0,F.useCallback)(e=>{c(`/settings${e===`browser`?`#terminal-browser-shortcut-url`:`#terminal-quick-script`}`)},[c]),P=(0,F.useCallback)(()=>{r.activeId&&o.kill(e,r.activeId)},[e,r.activeId,o]),I=(0,F.useCallback)(()=>{o.setVisibility(e,r.visibility===`maximized`?`restored`:`maximized`)},[e,r.visibility,o]),L=(0,F.useCallback)(()=>{o.setVisibility(e,`hidden`)},[e,o]);return(0,F.useEffect)(()=>{d(null)},[r.visibility]),r.visibility===`hidden`?null:(0,q.jsxs)(`div`,{ref:l,className:X(`relative flex flex-col shrink-0 bg-background/95`,`border-t border-border/40`),style:{height:C},"data-testid":`terminal-bottom-panel`,children:[(0,q.jsx)(iK,{height:S,maxHeight:x,onHeightPreview:e=>d(e),onHeightCommit:t=>{d(null),o.setUserHeight(e,t),r.visibility===`maximized`&&o.setVisibility(e,`restored`)}}),(0,q.jsx)(VG,{visibility:r.visibility,canCreate:w,hasActive:T,provider:t,providers:v,onCreate:E,onOpenCli:O,onOpenBrowser:k,onPasteScript:A,pasteScriptDisabled:!T||!f.quickScript,onConfigureBrowser:j,onConfigureScript:M,onKillActive:P,onToggleMaximize:I,onCollapse:L}),m&&(0,q.jsx)(RG,{x:m.x,y:m.y,label:m.kind===`browser`?s(`shortcutMenu.configureBrowserUrl`):s(`shortcutMenu.editQuickScript`),onSelect:()=>N(m.kind),onClose:()=>h(null)}),g&&(0,q.jsx)(zG,{x:g.x,y:g.y,providers:v,onSelect:e=>D(e),onClose:()=>_(null)}),(0,q.jsx)(`div`,{className:`flex-1 flex min-h-0`,children:r.sessions.length===0?(0,q.jsx)(aK,{onCreate:E}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(tK,{activeId:r.activeId}),(0,q.jsx)(UG,{sessions:r.sessions,activeId:r.activeId,onActivate:t=>o.setActive(e,t),onRename:(t,n)=>void o.rename(e,t,n),onKill:t=>void o.kill(e,t)})]})})]})}var sK=28;function cK({project:e}){let{t}=G(`nav`),{connectionStatus:n}=kW(),r=GL(),{registerHandler:i,unregisterHandler:a}=bl(),[o,s]=(0,F.useState)(null),c=(0,F.useRef)(e.id);c.current=e.id,(0,F.useEffect)(()=>{let n=`cost-alerts-${e.id}`;return i(n,e=>{let n=e;n.projectId!==void 0&&n.projectId!==``&&n.projectId!==c.current||(n.type===`cost_alert`?K.warning(t(`costAlerts.costAlertTitle`),{description:t(`costAlerts.costAlertDescription`,{cost:(n.cost??0).toFixed(4),threshold:(n.threshold??0).toFixed(2)})}):n.type===`daily_budget_exceeded`?(K.error(t(`costAlerts.dailyBudgetTitle`),{description:t(`costAlerts.dailyBudgetDescription`,{spent:(n.dailySpend??0).toFixed(2),budget:(n.budget??0).toFixed(2)}),duration:1/0}),s({dailySpend:n.dailySpend??0,budget:n.budget??0})):n.type===`desktop_daily_budget_exceeded`&&K.error(t(`costAlerts.desktopBudgetTitle`),{description:t(`costAlerts.desktopBudgetDescription`,{spent:(n.desktopDailySpend??0).toFixed(2),budget:(n.desktopBudget??0).toFixed(2)}),duration:1/0}))}),()=>a(n)},[e.id,i,a,t]);let l=gG(),u=_G(e.id),d=(0,F.useRef)(null),[f,p]=(0,F.useState)(typeof window<`u`?window.innerHeight:820);(0,F.useLayoutEffect)(()=>{if(!tB)return;let e=d.current;if(!e)return;let t=()=>p(e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,F.useEffect)(()=>{tB&&l.ensureProject(e.id)},[e.id,l]);let m=tB&&u.visibility===`hidden`?(0,q.jsx)(BG,{isOpen:!1,onClick:()=>l.setVisibility(e.id,`restored`)}):null;return(0,q.jsx)(kT,{delayDuration:400,children:(0,q.jsx)(UL.Provider,{value:r,children:(0,q.jsxs)(`div`,{ref:d,className:`flex flex-col h-full overflow-hidden`,children:[o&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-destructive/10 border-b border-destructive/20 text-xs`,children:[(0,q.jsx)(`span`,{className:`text-destructive font-medium`,children:t(`costAlerts.bannerMessage`,{spent:o.dailySpend.toFixed(2),budget:o.budget.toFixed(2)})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`text-muted-foreground hover:text-foreground ml-4 shrink-0`,children:t(`costAlerts.dismiss`)})]}),(0,q.jsxs)(`div`,{className:`flex flex-1 overflow-hidden min-h-0`,children:[(0,q.jsx)(`main`,{className:`flex-1 overflow-auto`,children:(0,q.jsx)(It,{})}),!1]}),tB&&(0,q.jsx)(oK,{projectId:e.id,provider:e.provider,providers:fd(e),state:u,viewportHeight:f,statusBarHeight:sK}),(0,q.jsx)(DW,{connectionStatus:n,rightSlot:m})]})})})}function lK({projectName:e,errorMessage:t,onRetry:n}){let{t:r}=G(`nav`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-4 p-8`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`errorBoundary.title`)}),e&&(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,q.jsx)(zi,{ns:`nav`,i18nKey:`errorBoundary.occurredIn`,values:{name:e},components:{strong:(0,q.jsx)(`span`,{className:`font-medium`})}})}),t&&(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground/60 font-mono`,children:t})]}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,q.jsx)(pp,{className:`w-3.5 h-3.5`}),r(`common:actions.retry`)]})]})}var uK=class extends F.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`[ProjectErrorBoundary]`,e,t.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?(0,q.jsx)(lK,{projectName:this.props.projectName,errorMessage:this.state.error?.message??null,onRetry:this.handleRetry}):this.props.children}};function dK({onAddProject:e}){let{t}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full min-h-[400px] gap-6 px-8 text-center`,children:[(0,q.jsx)(`div`,{className:`w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center`,children:(0,q.jsx)(Mp,{className:`w-7 h-7 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,q.jsx)(zi,{t,i18nKey:`welcome.title`,components:{spec:(0,q.jsx)(`span`,{className:`text-accent-primary`}),rails:(0,q.jsx)(`span`,{className:`text-accent-secondary`})}})}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:t(`welcome.description`)})]}),(0,q.jsxs)(Z,{onClick:e,size:`sm`,className:`gap-2`,children:[(0,q.jsx)(Of,{className:`w-3.5 h-3.5`}),t(`welcome.addFirstProject`)]})]})}var fK=[{id:`sr-architect`,name:`Architect`,description:`Architecture design, change specs, implementation planning`,category:`Architecture`},{id:`sr-developer`,name:`Developer`,description:`Full-stack implementation across all layers`,category:`Development`},{id:`sr-frontend-developer`,name:`Frontend Dev`,description:`Frontend implementation (React, Vue, Angular, etc.)`,category:`Development`},{id:`sr-backend-developer`,name:`Backend Dev`,description:`Backend specialization (APIs, databases, services)`,category:`Development`},{id:`sr-reviewer`,name:`Reviewer`,description:`General code review — the final quality gate`,category:`Review`},{id:`sr-frontend-reviewer`,name:`Frontend Reviewer`,description:`Frontend review (UI, accessibility, performance)`,category:`Review`},{id:`sr-backend-reviewer`,name:`Backend Reviewer`,description:`Backend review (APIs, security, scalability)`,category:`Review`},{id:`sr-security-reviewer`,name:`Security Reviewer`,description:`Security analysis — OWASP, vulnerabilities, hardening`,category:`Review`},{id:`sr-performance-reviewer`,name:`Perf Reviewer`,description:`Performance analysis — profiling, bottlenecks, optimization`,category:`Review`},{id:`sr-product-manager`,name:`Product Manager`,description:`Product discovery, VPC personas, backlog management`,category:`Product`},{id:`sr-product-analyst`,name:`Product Analyst`,description:`Backlog analysis, spec gap analysis, reporting`,category:`Product`},{id:`sr-test-writer`,name:`Test Writer`,description:`Comprehensive test generation (unit, integration, E2E)`,category:`Utilities`},{id:`sr-doc-sync`,name:`Doc Sync`,description:`Documentation sync — keeps docs aligned with code`,category:`Utilities`},{id:`sr-merge-resolver`,name:`Merge Resolver`,description:`Merge conflict resolution with context awareness`,category:`Utilities`}],pK=new Set([`sr-architect`,`sr-developer`,`sr-reviewer`]),mK=new Set([...pK]),hK=[`Architecture`,`Development`,`Review`,`Product`,`Utilities`],gK={Architecture:`text-accent-success`,Development:`text-accent-primary`,Review:`text-accent-info`,Product:`text-accent-secondary`,Utilities:`text-accent-warning`};function _K({selected:e,onChange:t}){let{t:n}=G(`agentstudio`),r=new Set(e);function i(e){if(pK.has(e))return;let n=new Set(r);n.has(e)?n.delete(e):n.add(e),t(Array.from(n))}function a(e){let n=fK.filter(t=>t.category===e).map(e=>e.id).filter(e=>!pK.has(e));if(n.length===0)return;let i=n.every(e=>r.has(e)),a=new Set(r);i?n.forEach(e=>a.delete(e)):n.forEach(e=>a.add(e)),t(Array.from(a))}function o(){t(fK.map(e=>e.id))}function s(){t([...pK])}return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`agentSelector.selectedCount`,{selected:e.length,total:fK.length})}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(`button`,{onClick:o,className:`text-[10px] text-accent-primary hover:underline`,children:n(`agentSelector.selectAll`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`·`}),(0,q.jsx)(`button`,{onClick:s,className:`text-[10px] text-muted-foreground hover:underline`,children:n(`common:states.none`)})]})]}),(0,q.jsx)(`div`,{className:`space-y-4`,children:hK.map(e=>{let t=fK.filter(t=>t.category===e),o=t.every(e=>r.has(e.id)),s=t.some(e=>r.has(e.id));return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`button`,{onClick:()=>a(e),className:`flex items-center gap-2 mb-2 w-full text-left group`,children:[(0,q.jsx)(`div`,{className:X(`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors`,o?`bg-accent-primary border-accent-primary`:s?`bg-accent-primary/40 border-accent-primary/60`:`border-border/60 group-hover:border-accent-primary/40`),children:(o||s)&&(0,q.jsx)(Zd,{className:X(`w-2.5 h-2.5`,o?`text-background`:`text-accent-primary`)})}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-semibold uppercase tracking-wider`,gK[e]),children:n(`agentSelector.categories.${e.toLowerCase()}`)})]}),(0,q.jsx)(`div`,{className:`space-y-1 pl-1`,children:t.map(e=>{let t=pK.has(e.id),a=t||r.has(e.id);return(0,q.jsxs)(`button`,{onClick:()=>i(e.id),disabled:t,className:X(`flex items-start gap-2.5 w-full text-left rounded-md px-2 py-1.5 transition-colors`,t?`bg-accent-primary/10 cursor-default`:a?`bg-accent-primary/10 hover:bg-accent-primary/15`:`hover:bg-muted/30`),children:[(0,q.jsx)(`div`,{className:X(`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 mt-0.5 transition-colors`,a?`bg-accent-primary border-accent-primary`:`border-border/60 hover:border-accent-primary/40`),children:a&&(0,q.jsx)(Zd,{className:`w-2.5 h-2.5 text-background`})}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:X(`text-xs font-medium`,a?`text-foreground`:`text-foreground/80`),children:n(`agentSelector.agents.${e.id}.name`,{defaultValue:e.name})}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground/60 font-mono truncate`,children:e.id}),t&&(0,q.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-accent-warning/80`,children:[(0,q.jsx)(Wf,{className:`w-2.5 h-2.5`}),n(`agentSelector.coreBadge`)]})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-tight mt-0.5`,children:n(`agentSelector.agents.${e.id}.description`,{defaultValue:e.description})})]})]},e.id)})})]},e)})})]})}var vK=[{value:`sonnet`,label:`Claude Sonnet`},{value:`opus`,label:`Claude Opus`},{value:`haiku`,label:`Claude Haiku`}],yK=[{value:`gpt-5.5`,label:`GPT-5.5`},{value:`gpt-5.4`,label:`GPT-5.4`},{value:`gpt-5.4-mini`,label:`GPT-5.4 Mini`},{value:`gpt-5.3-codex`,label:`GPT-5.3 Codex`}],bK={balanced:{claude:`sonnet`,codex:`gpt-5.5`},budget:{claude:`haiku`,codex:`gpt-5.4-mini`},max:{claude:`sonnet`,codex:`gpt-5.5`}},xK={"sr-architect":{claude:`opus`,codex:`gpt-5.3-codex`},"sr-product-manager":{claude:`opus`,codex:`gpt-5.3-codex`}};function SK(e,t,n){return t===`max`&&xK[e]?xK[e][n]:bK[t][n]}function CK({agents:e,provider:t,preset:n,overrides:r,onPresetChange:i,onOverrideChange:a}){let{t:o}=G(`addspec`),s=t===`claude`?vK:yK;function c(e){return r[e]??SK(e,n,t)}function l(e){return e in r}function u(e){a(e,``)}return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-xs font-medium mb-2`,children:o(`modelSelector.presetHeading`)}),(0,q.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[`balanced`,`budget`,`max`].map(e=>(0,q.jsxs)(`button`,{onClick:()=>i(e),className:X(`flex flex-col items-center gap-1 rounded-md border px-3 py-2.5 text-left transition-colors`,`focus:outline-none focus-visible:ring-1 focus-visible:ring-ring`,n===e?`border-accent-primary bg-accent-primary/10`:`border-border/30 hover:border-border/60`),children:[(0,q.jsx)(`span`,{className:X(`text-xs font-semibold`,n===e?`text-accent-primary`:`text-foreground/80`),children:o(`modelSelector.preset.${e}.label`)}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground text-center leading-tight`,children:o(`modelSelector.preset.${e}.description`)})]},e))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium`,children:o(`modelSelector.overridesHeading`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:o(`modelSelector.overriddenCount`,{count:Object.keys(r).length})})]}),(0,q.jsx)(`div`,{className:`space-y-1.5 max-h-64 overflow-y-auto pr-1`,children:e.map(e=>{let t=c(e.id),n=l(e.id);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted/20`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`span`,{className:X(`text-xs`,n?`text-foreground`:`text-foreground/70`),children:e.name}),n&&(0,q.jsx)(`span`,{className:`ml-1 text-[9px] text-accent-warning`,children:o(`modelSelector.customBadge`)})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsxs)(Mw,{value:t,onValueChange:t=>a(e.id,t),children:[(0,q.jsx)(Pw,{className:`h-6 w-44 text-[10px] px-2`,children:(0,q.jsx)(Nw,{})}),(0,q.jsx)(Lw,{children:s.map(e=>(0,q.jsx)(zw,{value:e.value,children:e.label},e.value))})]}),n&&(0,q.jsx)(`button`,{onClick:()=>u(e.id),className:`text-[9px] text-muted-foreground hover:text-foreground transition-colors px-1`,title:o(`modelSelector.resetToDefault`),children:`↺`})]})]},e.id)})})]})]})}var wK=6e4,TK={data:null,fetchedAt:0,inFlight:null,error:null},EK=new Set;function DK(){EK.forEach(e=>{try{e()}catch{}})}function OK(){return TK.data!==null&&Date.now()-TK.fetchedAt<wK}async function kK(e){if(TK.inFlight)return TK.inFlight;let t=(async()=>{let t=await fetch(`${ol}/api/setup-prerequisites`,{signal:e});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(typeof n?.ok!=`boolean`||!Array.isArray(n?.prerequisites)||!Array.isArray(n?.missingRequired))throw Error(`Malformed prerequisites response`);return TK.data=n,TK.fetchedAt=Date.now(),TK.error=null,TK.inFlight=null,DK(),TK.data})().catch(t=>{throw TK.inFlight=null,e?.aborted?t:(TK.error=t instanceof Error?t:Error(String(t)),DK(),TK.error)});return TK.inFlight=t,t}var AK=!1;function jK(){AK||typeof window>`u`||(window.addEventListener(`focus`,()=>{TK.fetchedAt=0,TK.data=null,kK().catch(()=>{})}),AK=!0)}function MK(){let[,e]=(0,F.useState)(0),[t,n]=(0,F.useState)(()=>!OK()),[r,i]=(0,F.useState)(TK.error);(0,F.useEffect)(()=>{jK();let t=()=>{e(e=>e+1),i(TK.error),n(!1)};EK.add(t);let r=new AbortController;return!OK()&&!TK.inFlight?(n(!0),kK(r.signal).catch(e=>{r.signal.aborted||i(e instanceof Error?e:Error(String(e)))}).finally(()=>{r.signal.aborted||n(!1)})):TK.inFlight&&TK.inFlight.catch(()=>{}).finally(()=>{r.signal.aborted||n(!1)}),()=>{r.abort(),EK.delete(t)}},[]);let a=(0,F.useCallback)(async()=>{TK.fetchedAt=0,TK.data=null,TK.error=null,n(!0);try{await kK()}catch(e){i(e instanceof Error?e:Error(String(e)))}finally{n(!1)}},[]);return{status:TK.data,isLoading:t,error:r,recheck:a}}function NK(e,t){return e.error===`corrupted-bundle`?t(`setup:prerequisites.corruptedBundle`):e.installed?e.executable===!1?e.resolvedPath&&e.executionError?t(`setup:prerequisites.failedToExecuteAtWithError`,{path:e.resolvedPath,error:e.executionError}):e.resolvedPath?t(`setup:prerequisites.failedToExecuteAt`,{path:e.resolvedPath}):e.executionError?t(`setup:prerequisites.failedToExecuteWithError`,{error:e.executionError}):t(`setup:prerequisites.failedToExecute`):!e.meetsMinimum&&e.minVersion?t(`setup:prerequisites.needsMinimum`,{version:e.version??t(`setup:prerequisites.unknownVersion`),minVersion:e.minVersion}):e.version??t(`setup:prerequisites.installedLabel`):t(`setup:prerequisites.notInstalled`)}function PK({status:e,isLoading:t,error:n,onRefresh:r,onMoreInfo:i}){let{t:a}=G(`setup`);if(t&&!e)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`loading`,className:`rounded-lg border border-border/30 bg-background/30 px-3 py-2`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`w-4 h-4 rounded-full bg-muted-foreground/20 animate-pulse`}),(0,q.jsx)(`div`,{className:`h-3 w-32 rounded bg-muted-foreground/15 animate-pulse`})]})});if(n&&!e)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`error`,className:`rounded-lg border border-border/40 bg-background/40 px-3 py-2`,children:(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:a(`prerequisites.verifyError`)})});if(!e)return null;if(e.ok)return(0,q.jsx)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`ok`,className:`rounded-lg border border-accent-success/25 bg-accent-success/5 px-3 py-2`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(af,{className:`w-4 h-4 text-accent-success flex-shrink-0`}),(0,q.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:a(`prerequisites.allDetected`)})]}),r&&(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,disabled:t,className:`h-7 px-2 gap-1.5 text-[11px] flex-shrink-0`,children:[(0,q.jsx)(pp,{className:X(`w-3 h-3`,t&&`animate-spin`)}),a(`common:actions.refresh`)]})]})});let o=e.missingRequired?.length??0,s=o>0&&(e.missingRequired??[]).every(e=>e.error===`corrupted-bundle`),c=(e.missingRequired??[]).some(e=>e.error===`corrupted-bundle`);return(0,q.jsxs)(`div`,{"data-testid":`prerequisites-panel`,"data-state":`missing`,className:X(`rounded-lg border px-3 py-2`,c?`border-destructive/40 bg-destructive/10`:`border-accent-primary/40 bg-accent-primary/10`),children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,q.jsx)(Fp,{className:X(`w-4 h-4 flex-shrink-0`,c?`text-destructive`:`text-accent-primary`)}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:s?a(`prerequisites.bundleCorruptedTitle`):a(`prerequisites.toolsRequired`,{count:o})}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:a(s?`prerequisites.reinstallHint`:`prerequisites.installMissingHint`)})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[i&&!s&&(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,className:`h-7 px-2 gap-1.5 text-[11px]`,"data-testid":`prerequisites-more-info`,children:a(`prerequisites.moreInfo`)}),r&&(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,disabled:t,className:`h-7 px-2 gap-1.5 text-[11px]`,children:[(0,q.jsx)(pp,{className:X(`w-3 h-3`,t&&`animate-spin`)}),a(`common:actions.refresh`)]})]})]}),(0,q.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.prerequisites.map(e=>{let t=e.error===`corrupted-bundle`,n=e.bundled===!0&&e.executable===!0&&!t,r=!t&&e.installed&&e.meetsMinimum;return(0,q.jsxs)(`li`,{"data-testid":`prereq-row-${e.key}`,"data-ok":r?`true`:`false`,"data-bundled":e.bundled?`true`:void 0,"data-corrupted":t?`true`:void 0,className:X(`flex items-center gap-2 rounded-md border px-2 py-1.5 text-[11px]`,t?`border-destructive/40 bg-destructive/10 text-foreground`:r?`border-border/30 bg-background/30 text-muted-foreground`:`border-accent-primary/30 bg-background/50 text-foreground`),children:[t?(0,q.jsx)(of,{className:`w-3.5 h-3.5 text-destructive flex-shrink-0`}):n||r?(0,q.jsx)(af,{className:`w-3.5 h-3.5 text-accent-success flex-shrink-0`}):(0,q.jsx)(of,{className:`w-3.5 h-3.5 text-accent-primary flex-shrink-0`}),(0,q.jsx)(`span`,{className:`font-medium`,children:e.label}),n&&(0,q.jsxs)(`span`,{"data-testid":`prereq-bundled-badge-${e.key}`,className:`inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium bg-accent-secondary/20 text-accent-secondary border border-accent-secondary/30`,children:[(0,q.jsx)(Qf,{className:`w-2.5 h-2.5`}),a(`prerequisites.bundledBadge`)]}),(0,q.jsxs)(`span`,{className:X(`text-muted-foreground`,t&&`text-destructive/80`),children:[`— `,NK(e,a)]})]},e.key)})})]})}var FK={agents:0,specrailsCommands:0,opsxCommands:0,legacySrRemoved:0,tier:`quick`,provider:`claude`};function IK(e){return e.includes(`opus`)?`opus`:e.includes(`haiku`)?`haiku`:e.includes(`sonnet`)?`sonnet`:e}function LK(e){return{balanced:`sonnet`,budget:`haiku`,max:`sonnet`}[e]}function RK(){return{selectedAgents:[...mK],modelPreset:`balanced`,modelOverrides:{}}}var zK=()=>[{key:`base_install`,name:J.t(`setup:wizard.checkpoints.baseInstall`),status:`pending`},{key:`agent_selection`,name:J.t(`setup:wizard.checkpoints.agentSelection`),status:`pending`},{key:`agent_generation`,name:J.t(`setup:wizard.checkpoints.agentGeneration`),status:`pending`}],BK=new Map,VK=`prose prose-invert prose-xs max-w-none
123
123
  prose-p:my-1 prose-p:leading-relaxed
124
124
  prose-headings:mt-3 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
125
125
  prose-ul:my-1 prose-ol:my-1 prose-li:my-0
@@ -133,10 +133,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
133
133
  text-foreground/80`,HK=(0,F.memo)(function({lines:e}){let t=e.join(`
134
134
  `);return(0,q.jsx)(`div`,{className:VK,children:(0,q.jsx)(LP,{remarkPlugins:[VL],children:t})})});function UK({config:e,onChange:t,onInstall:n,onSkip:r,provider:i,ctaLabel:a,lastStep:o=!0,prerequisites:s,prerequisitesLoading:c,prerequisitesError:l,onRefreshPrerequisites:u}){let{t:d}=G(`setup`),[f,p]=(0,F.useState)(`agents`),m=fK.filter(t=>e.selectedAgents.includes(t.id)),h=s!==null&&!s.ok&&!l,g=e.selectedAgents.length===0||h;return(0,q.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`flex-shrink-0 px-6 pt-6 pb-4 space-y-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-accent-primary/20 flex items-center justify-center flex-shrink-0`,children:(0,q.jsx)(Gd,{className:`w-5 h-5 text-accent-primary`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:d(`wizard.configureAgents`,{provider:ME(i)})}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:d(`wizard.configureSubtitle`)})]})]}),(0,q.jsx)(PK,{status:s,isLoading:c,error:l,onRefresh:u}),(0,q.jsx)(`div`,{className:`flex border-b border-border/30`,children:[`agents`,`models`].map(e=>(0,q.jsx)(`button`,{onClick:()=>p(e),className:X(`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium border-b-2 -mb-px transition-colors`,f===e?`border-accent-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e===`agents`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Gd,{className:`w-3 h-3`}),d(`wizard.tabs.agents`)]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Sp,{className:`w-3 h-3`}),d(`wizard.tabs.models`)]})},e))})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto px-6 pb-4`,children:f===`agents`?(0,q.jsx)(_K,{selected:e.selectedAgents,onChange:n=>t({...e,selectedAgents:n})}):(0,q.jsx)(CK,{agents:m,provider:i,preset:e.modelPreset,overrides:e.modelOverrides,onPresetChange:n=>t({...e,modelPreset:n}),onOverrideChange:(n,r)=>{let i={...e.modelOverrides};r?i[n]=r:delete i[n],t({...e,modelOverrides:i})}})}),(0,q.jsxs)(`div`,{className:`flex-shrink-0 border-t border-border/30 px-6 py-4 relative flex items-center`,children:[(0,q.jsx)(`button`,{onClick:r,className:`absolute left-6 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:d(`wizard.skipForNow`)}),(0,q.jsx)(`div`,{"data-testid":`install-cta-wrapper`,className:`mx-auto`,children:(0,q.jsxs)(Z,{size:`sm`,className:`gap-2`,onClick:n,disabled:g,children:[o?(0,q.jsx)(Qf,{className:`w-3.5 h-3.5`}):(0,q.jsx)(Bd,{className:`w-3.5 h-3.5`}),a??d(`wizard.install`)]})})]})]})}function WK({logLines:e,onBack:t,providerLabelText:n}){let{t:r}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col h-full max-w-lg mx-auto px-6 py-8 gap-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`w-8 h-8 rounded-full bg-accent-primary/20 flex items-center justify-center flex-shrink-0`,children:(0,q.jsx)(Qf,{className:`w-4 h-4 text-accent-primary animate-pulse`})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:n?r(`wizard.installingProvider`,{provider:n}):r(`wizard.installingSpecrails`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.installingFromTemplates`)})]})]}),(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 gap-1.5 text-xs`,children:[(0,q.jsx)($d,{className:`w-3.5 h-3.5`}),r(`common:actions.back`)]})]}),(0,q.jsx)(`div`,{className:`flex-1 rounded-lg border border-border/30 bg-muted/10 overflow-auto p-3 text-[11px] text-muted-foreground space-y-0.5`,children:e.length===0?(0,q.jsx)(`p`,{className:`text-center text-muted-foreground mt-4`,children:r(`wizard.waitingForOutput`)}):(0,q.jsx)(HK,{lines:e.slice(-300)})})]})}function GK({summary:e}){let{t}=G(`setup`),n=e.provider===`codex`;return(0,q.jsxs)(`div`,{className:`w-full rounded-lg border border-border/50 bg-muted/20 p-4`,children:[(0,q.jsx)(`div`,{className:`text-[11px] font-semibold text-foreground mb-2`,children:ME(e.provider)}),(0,q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-center`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-2xl font-bold text-accent-primary`,children:e.agents}),(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:t(n?`wizard.summary.agentSkills`:`wizard.summary.agents`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-2xl font-bold text-accent-success`,children:e.specrailsCommands}),(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:n?t(`wizard.summary.skills`):`/specrails:*`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-2xl font-bold text-accent-info`,children:e.opsxCommands}),(0,q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:n?t(`wizard.summary.openspecSkills`):`/opsx:*`})]})]}),e.legacySrRemoved>0&&(0,q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground text-center`,children:(0,q.jsx)(zi,{t,i18nKey:`wizard.summary.legacyRemoved`,count:e.legacySrRemoved,components:{code:(0,q.jsx)(`code`,{className:`text-xs`})}})})]})}function KK({projectName:e,summaries:t,onGoToProject:n}){let{t:r}=G(`setup`),i=t.length>0?t:[{...FK}];return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full max-w-lg mx-auto px-6 gap-6 overflow-auto py-8`,children:[(0,q.jsx)(`div`,{className:`w-16 h-16 rounded-2xl bg-accent-success/20 flex items-center justify-center`,children:(0,q.jsx)(Zd,{className:`w-8 h-8 text-accent-success`})}),(0,q.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,q.jsx)(`h2`,{className:`text-lg font-semibold`,children:(0,q.jsx)(zi,{t:r,i18nKey:`wizard.complete.welcome`,components:{spec:(0,q.jsx)(`span`,{className:`text-accent-primary`}),rails:(0,q.jsx)(`span`,{className:`text-accent-secondary`})}})}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:(0,q.jsx)(zi,{t:r,i18nKey:`wizard.complete.configured`,values:{projectName:e},components:{strong:(0,q.jsx)(`strong`,{className:`text-foreground`})}})})]}),i.length>1&&(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:r(`wizard.complete.installedForEngines`,{count:i.length})}),i.map((e,t)=>(0,q.jsx)(GK,{summary:e},e.provider??t)),(0,q.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.complete.learnMore`)}),(0,q.jsx)(`a`,{href:`https://specrails.dev/docs`,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:`specrails.dev/docs`})]}),(0,q.jsxs)(Z,{size:`sm`,className:`gap-2`,onClick:n,children:[r(`wizard.complete.continueToProject`),(0,q.jsx)(Bd,{className:`w-3.5 h-3.5`})]})]})}function qK({message:e,onRetry:t,onSkip:n}){let{t:r}=G(`setup`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full max-w-lg mx-auto px-6 gap-6`,children:[(0,q.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,q.jsx)(`h2`,{className:`text-base font-semibold text-destructive`,children:r(`wizard.error.title`)}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e})]}),(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:n,children:r(`wizard.error.skipSetup`)}),(0,q.jsxs)(Z,{size:`sm`,className:`gap-2`,onClick:t,children:[(0,q.jsx)(hp,{className:`w-3.5 h-3.5`}),r(`common:actions.retry`)]})]})]})}function JK({wizardStep:e,providers:t}){let{t:n}=G(`setup`),r=t.length>1?t.map(e=>({label:ME(e)})):[{label:n(`wizard.steps.configure`)}],i=[...r,{label:n(`wizard.install`)},{label:n(`common:actions.done`)}],a=r.length,o=a+1,s=e.step===`agent-selection`?Math.min(e.providerIndex,r.length-1):e.step===`installing`||e.step===`error`?a:o;return(0,q.jsx)(`div`,{className:`flex items-center gap-2`,children:i.map((e,t)=>{let n=t<s,r=t===s;return(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`div`,{className:X(`w-4 h-4 rounded-full flex items-center justify-center text-[9px] font-bold`,n&&`bg-accent-success text-background`,r&&`bg-accent-primary text-background`,!n&&!r&&`bg-muted/50 text-muted-foreground`),children:n?(0,q.jsx)(Zd,{className:`w-2.5 h-2.5`}):t+1}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-medium`,r&&`text-foreground`,!r&&`text-muted-foreground`),children:e.label})]}),t<i.length-1&&(0,q.jsx)(`div`,{className:X(`w-6 h-px`,n?`bg-accent-success/50`:`bg-border/50`)})]},`${e.label}-${t}`)})})}function YK({project:e,onComplete:t,onSkip:n}){let{t:r}=G(`setup`),i=(0,F.useCallback)(()=>{BK.delete(e.id),t()},[e.id,t]),a=(0,F.useCallback)(()=>{BK.delete(e.id),n()},[e.id,n]),o=fd(e),s=BK.get(e.id),[c,l]=(0,F.useState)(s?.wizardStep??{step:`agent-selection`,providerIndex:0}),[u,d]=(0,F.useState)(()=>{if(s?.configs)return s.configs;let e={};for(let t of o)e[t]=RK();return e}),[f,p]=(0,F.useState)(s?.checkpoints??zK()),[m,h]=(0,F.useState)(s?.logLines??[]),{status:g,isLoading:_,error:v,recheck:y}=MK(),b=c.step===`agent-selection`?c.providerIndex:0,x=o[Math.min(b,o.length-1)]??`claude`,S=u[x]??RK(),C=(0,F.useCallback)(e=>{d(t=>({...t,[x]:e}))},[x]),w=(0,F.useRef)([]),T=(0,F.useRef)(0),E=(0,F.useRef)(()=>{}),D=(0,F.useRef)(c),O=(0,F.useRef)(f),k=(0,F.useRef)(m),A=(0,F.useRef)(u);D.current=c,O.current=f,k.current=m,A.current=u,(0,F.useEffect)(()=>()=>{BK.set(e.id,{wizardStep:D.current,checkpoints:O.current,logLines:k.current,configs:A.current})},[e.id]),(0,F.useEffect)(()=>{if(c.step!==`installing`)return;async function t(){try{let t=await fetch(`/api/projects/${e.id}/setup/checkpoints`);if(!t.ok)return;let n=await t.json();n.checkpoints&&p(e=>e.map(e=>{let t=n.checkpoints.find(t=>t.key===e.key);return!t||e.status===`done`&&t.status!==`done`?e:{...e,...t}})),n.logLines&&n.logLines.length>0&&h(e=>n.logLines.length>e.length?n.logLines:e),c.step===`installing`&&!n.isInstalling&&n.checkpoints?.some(e=>e.key===`base_install`&&e.status===`done`)&&l({step:`complete`,summaries:w.current.length>0?w.current:[n.summary??{...FK}]})}catch{}}t()},[]);let{registerHandler:j,unregisterHandler:M}=bl(),N=(0,F.useCallback)(t=>{let n=t;if(typeof n.type==`string`&&n.projectId===e.id)switch(n.type){case`setup_log`:h(e=>[...e,n.line]);break;case`setup_install_done`:{let e=n.summary??{...FK};w.current=[...w.current,e];let t=T.current+1;t<o.length?(T.current=t,E.current(t)):l({step:`complete`,summaries:[...w.current]});break}case`setup_checkpoint`:{let e=n.checkpoint,t=n.status,r=n.detail,i=n.duration_ms;p(n=>n.map(n=>n.key===e?{...n,status:t,detail:r??n.detail,duration_ms:i??n.duration_ms}:n));break}case`setup_error`:{let e=n.error;l({step:`error`,message:e,retryStep:`installing`,providerIndex:T.current});break}}},[e.id,o.length]);(0,F.useLayoutEffect)(()=>(j(`setup-${e.id}`,N),()=>M(`setup-${e.id}`)),[N,j,M,e.id]);let P=(0,F.useCallback)(t=>{let n=o[t]??`claude`,r=A.current[n]??RK(),i=[...new Set([...pK,...r.selectedAgents])],a=fK.map(e=>e.id).filter(e=>!i.includes(e)),s={};for(let[e,t]of Object.entries(r.modelOverrides))t&&(s[e]=IK(t));p(zK()),h([]),l({step:`installing`,providerIndex:t}),(async()=>{try{await fetch(`/api/projects/${e.id}/setup/install-config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({version:1,provider:n,tier:`quick`,agents:{selected:i,excluded:a},models:{preset:r.modelPreset,defaults:{model:LK(r.modelPreset)},overrides:s},agent_teams:!1})})}catch(e){console.error(`[SetupWizard] install-config write error:`,e)}fetch(`/api/projects/${e.id}/setup/install`,{method:`POST`}).catch(e=>{console.error(`[SetupWizard] install start error:`,e)})})()},[e.id,o]);E.current=P;let I=(0,F.useCallback)(()=>{if(g!==null&&!g.ok){l({step:`error`,retryStep:`installing`,providerIndex:0,message:[r(`wizard.error.prereqMissing`),r(`wizard.error.prereqRetryHint`)].join(`
135
135
 
136
- `)});return}w.current=[],T.current=0,P(0)},[g,P,r]),L=(0,F.useCallback)(()=>{if(c.step!==`agent-selection`)return;let e=c.providerIndex;e<o.length-1?l({step:`agent-selection`,providerIndex:e+1}):I()},[c,o.length,I]);function ee(){c.step===`error`&&I()}let R=c.step===`agent-selection`?c.providerIndex:0,te=R>=o.length-1,z=te?r(`wizard.install`):r(`wizard.nextProvider`,{provider:ME(o[R+1])});return(0,q.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,q.jsx)(`div`,{className:`flex-shrink-0 border-b border-border/30 px-4 py-2`,children:(0,q.jsx)(JK,{wizardStep:c,providers:o})}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[c.step===`agent-selection`&&(0,q.jsx)(UK,{config:S,onChange:C,onInstall:L,onSkip:a,provider:x,ctaLabel:z,lastStep:te,prerequisites:g,prerequisitesLoading:_,prerequisitesError:v,onRefreshPrerequisites:y},x),c.step===`installing`&&(0,q.jsx)(WK,{logLines:m,providerLabelText:o.length>1?ME(o[c.providerIndex]):void 0,onBack:()=>l({step:`agent-selection`,providerIndex:o.length-1})}),c.step===`complete`&&(0,q.jsx)(KK,{projectName:e.name,summaries:c.summaries,onGoToProject:i}),c.step===`error`&&(0,q.jsx)(qK,{message:c.message,onRetry:ee,onSkip:a})]})]})}var XK=`https://specrails.dev/companion/ios`,ZK=`https://specrails.dev/companion/android`,QK=`specrails-desktop:onboarding-dismissed`;function $K(){try{return localStorage.getItem(QK)===`true`}catch{return!1}}function eq(){try{localStorage.setItem(QK,`true`)}catch{}}var tq=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||``),nq=tq?`⌘`:`Ctrl`,rq=tq?`⌥`:`Alt`,iq={primary:{text:`text-accent-primary`,bar:`bg-accent-primary`,glow:`glow-primary`,btn:`bg-accent-primary hover:bg-accent-primary/90 text-primary-foreground`,softBorder:`border-accent-primary/30`,softBg:`bg-accent-primary/5`,chipBg:`bg-accent-primary/10 text-accent-primary`},info:{text:`text-accent-info`,bar:`bg-accent-info`,glow:`glow-info`,btn:`bg-accent-info hover:bg-accent-info/90 text-primary-foreground`,softBorder:`border-accent-info/30`,softBg:`bg-accent-info/5`,chipBg:`bg-accent-info/10 text-accent-info`},success:{text:`text-accent-success`,bar:`bg-accent-success`,glow:`glow-success`,btn:`bg-accent-success hover:bg-accent-success/90 text-primary-foreground`,softBorder:`border-accent-success/30`,softBg:`bg-accent-success/5`,chipBg:`bg-accent-success/10 text-accent-success`},secondary:{text:`text-accent-secondary`,bar:`bg-accent-secondary`,glow:`glow-secondary`,btn:`bg-accent-secondary hover:bg-accent-secondary/90 text-primary-foreground`,softBorder:`border-accent-secondary/30`,softBg:`bg-accent-secondary/5`,chipBg:`bg-accent-secondary/10 text-accent-secondary`},warning:{text:`text-accent-warning`,bar:`bg-accent-warning`,glow:`glow-warning`,btn:`bg-accent-warning hover:bg-accent-warning/90 text-primary-foreground`,softBorder:`border-accent-warning/30`,softBg:`bg-accent-warning/5`,chipBg:`bg-accent-warning/10 text-accent-warning`},highlight:{text:`text-accent-highlight`,bar:`bg-accent-highlight`,glow:`glow-highlight`,btn:`bg-accent-highlight hover:bg-accent-highlight/90 text-primary-foreground`,softBorder:`border-accent-highlight/30`,softBg:`bg-accent-highlight/5`,chipBg:`bg-accent-highlight/10 text-accent-highlight`}};function aq({children:e}){return(0,q.jsx)(`kbd`,{className:`inline-flex items-center justify-center min-w-[1.5rem] h-5 px-1.5 rounded border border-border/60 bg-card/80 font-mono text-[11px] text-foreground shadow-sm`,children:e})}function oq({icon:e,label:t,children:n,accent:r}){return(0,q.jsxs)(`div`,{className:`flex gap-3 items-start`,children:[(0,q.jsx)(`div`,{className:X(`mt-0.5 shrink-0 grid place-items-center w-7 h-7 rounded-md border border-border/40`,r.softBg,r.text),children:e}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground leading-tight`,children:t}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground leading-relaxed`,children:n})]})]})}function sq({accent:e,label:t,children:n}){return(0,q.jsxs)(`div`,{className:X(`rounded-lg border p-3`,e.softBorder,e.softBg),children:[t&&(0,q.jsx)(`p`,{className:X(`text-[10px] font-semibold uppercase tracking-wider mb-1.5`,e.text),children:t}),(0,q.jsx)(`div`,{className:`text-xs text-foreground/90 leading-relaxed`,children:n})]})}function cq({steps:e}){return(0,q.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap text-[13px] font-medium`,children:e.map((t,n)=>(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:t.cls,children:t.label}),n<e.length-1&&(0,q.jsx)(Bd,{className:`w-3.5 h-3.5 text-muted-foreground`})]},t.label))})}function lq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:e(`onboarding.language.intro`)}),(0,q.jsx)(bH,{}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.language.note`)})]})}function uq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:e(`onboarding.theme.intro`)}),(0,q.jsx)(fH,{}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.theme.note`)})]})}function dq({icon:e,url:t,label:n,testId:r}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border/40 bg-card/40 p-3`,children:[(0,q.jsx)(`div`,{className:`shrink-0 rounded-md bg-white p-1.5`,"aria-hidden":`true`,children:(0,q.jsx)(YH,{value:t,size:72})}),(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[13px] font-semibold text-foreground leading-tight`,children:[e,n]}),(0,q.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":r,"aria-label":n,className:`inline-flex items-center gap-1 text-xs text-accent-info hover:underline break-all`,children:[t.replace(`https://`,``),(0,q.jsx)(Sf,{className:`w-3 h-3 shrink-0`,"aria-hidden":`true`})]})]})]})}function fq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.companion.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsx)(sq,{accent:iq.success,label:e(`onboarding.companion.localLabel`),children:e(`onboarding.companion.localBody`)}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:e(`onboarding.companion.downloadLabel`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`onboarding.companion.downloadHint`)}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-3`,children:[(0,q.jsx)(dq,{icon:(0,q.jsx)(Id,{className:`w-4 h-4 shrink-0`,"aria-hidden":`true`}),url:XK,label:e(`onboarding.companion.ios`),testId:`companion-ios-link`}),(0,q.jsx)(dq,{icon:(0,q.jsx)(Tp,{className:`w-4 h-4 shrink-0`,"aria-hidden":`true`}),url:ZK,label:e(`onboarding.companion.android`),testId:`companion-android-link`})]})]}),(0,q.jsx)(oq,{icon:(0,q.jsx)(lp,{className:`w-4 h-4`}),label:e(`onboarding.companion.pairLabel`),accent:iq.success,children:e(`onboarding.companion.pairBody`)})]})}function pq(e){return[{navLabel:e(`onboarding.language.nav`),icon:(0,q.jsx)(Rf,{className:`w-6 h-6`}),accent:iq.info,title:e(`onboarding.language.title`),subtitle:e(`onboarding.language.subtitle`),content:(0,q.jsx)(lq,{})},{navLabel:e(`onboarding.theme.nav`),icon:(0,q.jsx)($f,{className:`w-6 h-6`}),accent:iq.highlight,title:e(`onboarding.theme.title`),subtitle:e(`onboarding.theme.subtitle`),content:(0,q.jsx)(uq,{})},{navLabel:e(`onboarding.welcome.nav`),icon:(0,q.jsx)(Ep,{className:`w-6 h-6`}),accent:iq.primary,title:e(`onboarding.welcome.title`),subtitle:e(`onboarding.welcome.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.welcome.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(sq,{accent:iq.primary,label:e(`onboarding.welcome.coreLoopLabel`),children:[(0,q.jsx)(cq,{steps:[{label:e(`onboarding.flow.addSpec`),cls:`text-accent-info`},{label:e(`onboarding.flow.dropInRail`),cls:`text-accent-success`},{label:e(`onboarding.flow.hitPlay`),cls:`text-accent-warning`},{label:e(`onboarding.flow.ship`),cls:`text-accent-secondary`}]}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.welcome.flowCaption`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`})}})})]}),(0,q.jsxs)(`div`,{className:`flex gap-3 items-start`,children:[(0,q.jsx)(wp,{className:`w-4 h-4 mt-0.5 shrink-0 text-accent-success`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.welcome.localNote`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`}),i:(0,q.jsx)(`span`,{className:`italic`})}})})]}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.welcome.tourNote`)})]})},{navLabel:e(`onboarding.authorSpecs.nav`),icon:(0,q.jsx)(Kf,{className:`w-6 h-6`}),accent:iq.info,title:e(`onboarding.authorSpecs.title`),subtitle:e(`onboarding.authorSpecs.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.authorSpecs.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Kf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.exploreLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.exploreBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Vp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.quickLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.quickBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Mf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.websiteLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.websiteBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(vp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.smashLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.smashBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(_p,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.draftsLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.draftsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(pf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.compareLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.compareBody`)})]})]})},{navLabel:e(`onboarding.rails.nav`),icon:(0,q.jsx)(zp,{className:`w-6 h-6`}),accent:iq.success,title:e(`onboarding.rails.title`),subtitle:e(`onboarding.rails.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.rails.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`}),play:(0,q.jsx)(`span`,{className:`text-accent-warning font-medium`})}})}),(0,q.jsxs)(sq,{accent:iq.success,label:e(`onboarding.rails.jobLabel`),children:[(0,q.jsx)(cq,{steps:[{label:e(`onboarding.flow.architect`),cls:`text-accent-info`},{label:e(`onboarding.flow.developer`),cls:`text-accent-success`},{label:e(`onboarding.flow.reviewer`),cls:`text-accent-warning`},{label:e(`onboarding.flow.ship`),cls:`text-accent-secondary`}]}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e(`onboarding.rails.flowCaption`)})]}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Af,{className:`w-4 h-4`}),label:e(`onboarding.rails.modeLabel`),accent:iq.success,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.rails.modeBody`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Gd,{className:`w-4 h-4`}),label:e(`onboarding.rails.profilesLabel`),accent:iq.success,children:e(`onboarding.rails.profilesBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(kf,{className:`w-4 h-4`}),label:e(`onboarding.rails.jobDetailLabel`),accent:iq.success,children:e(`onboarding.rails.jobDetailBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Of,{className:`w-4 h-4`}),label:e(`onboarding.rails.isolationLabel`),accent:iq.success,children:e(`onboarding.rails.isolationBody`)})]})]})},{navLabel:e(`onboarding.providers.nav`),icon:(0,q.jsx)(Gd,{className:`w-6 h-6`}),accent:iq.secondary,title:e(`onboarding.providers.title`),subtitle:e(`onboarding.providers.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.providers.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`rounded-lg border border-border/40 overflow-hidden text-xs`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_1fr_1fr] bg-card/40`,children:[(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-muted-foreground`,children:e(`onboarding.providers.table.capability`)}),(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-accent-secondary text-center`,children:`Claude Code`}),(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-accent-success text-center`,children:`Codex CLI`})]}),[[e(`onboarding.providers.table.streamingResume`),e(`onboarding.providers.table.native`),e(`onboarding.providers.table.native`)],[e(`onboarding.providers.table.costReporting`),e(`onboarding.providers.table.providerBilled`),e(`onboarding.providers.table.estimated`)],[e(`onboarding.providers.table.telemetry`),e(`onboarding.providers.table.native`),e(`onboarding.providers.table.synthesized`)],[e(`onboarding.providers.table.agentProfiles`),e(`common:states.yes`),`—`]].map(e=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_1fr_1fr] border-t border-border/30`,children:[(0,q.jsx)(`div`,{className:`px-3 py-2 text-foreground/90`,children:e[0]}),(0,q.jsx)(`div`,{className:`px-3 py-2 text-center text-muted-foreground`,children:e[1]}),(0,q.jsx)(`div`,{className:`px-3 py-2 text-center text-muted-foreground`,children:e[2]})]},e[0]))]}),(0,q.jsx)(sq,{accent:iq.secondary,label:e(`onboarding.providers.calloutLabel`),children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.providers.calloutBody`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`}),mono:(0,q.jsx)(`span`,{className:`font-mono`})}})})]})},{navLabel:e(`onboarding.cost.nav`),icon:(0,q.jsx)(ff,{className:`w-6 h-6`}),accent:iq.warning,title:e(`onboarding.cost.title`),subtitle:e(`onboarding.cost.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.cost.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(kf,{className:`w-4 h-4`}),label:e(`onboarding.cost.analyticsLabel`),accent:iq.warning,children:e(`onboarding.cost.analyticsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(dp,{className:`w-4 h-4`}),label:e(`onboarding.cost.perTicketLabel`),accent:iq.warning,children:e(`onboarding.cost.perTicketBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(yf,{className:`w-4 h-4`}),label:e(`onboarding.cost.honestLabel`),accent:iq.warning,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.cost.honestBody`,components:{mono:(0,q.jsx)(`span`,{className:`font-mono`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Rp,{className:`w-4 h-4`}),label:e(`onboarding.cost.budgetsLabel`),accent:iq.warning,children:e(`onboarding.cost.budgetsBody`)})]})]})},{navLabel:e(`onboarding.workspace.nav`),icon:(0,q.jsx)(Kd,{className:`w-6 h-6`}),accent:iq.highlight,title:e(`onboarding.workspace.title`),subtitle:e(`onboarding.workspace.subtitle`),content:(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Mp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.terminalLabel`),accent:iq.highlight,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.workspace.terminalBody`,values:{mod:nq},components:{mod:(0,q.jsx)(aq,{children:nq}),j:(0,q.jsx)(aq,{children:`J`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Cf,{className:`w-4 h-4`}),label:e(`onboarding.workspace.codeLabel`),accent:iq.highlight,children:e(`onboarding.workspace.codeBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(op,{className:`w-4 h-4`}),label:e(`onboarding.workspace.integrationsLabel`),accent:iq.highlight,children:e(`onboarding.workspace.integrationsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)($f,{className:`w-4 h-4`}),label:e(`onboarding.workspace.themesLabel`),accent:iq.highlight,children:e(`onboarding.workspace.themesBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(zf,{className:`w-4 h-4`}),label:e(`onboarding.workspace.chatsLabel`),accent:iq.highlight,children:e(`onboarding.workspace.chatsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(mp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.desktopLabel`),accent:iq.highlight,children:e(`onboarding.workspace.desktopBody`)})]})})},{navLabel:e(`onboarding.companion.nav`),icon:(0,q.jsx)(Tp,{className:`w-6 h-6`}),accent:iq.success,title:e(`onboarding.companion.title`),subtitle:e(`onboarding.companion.subtitle`),content:(0,q.jsx)(fq,{})},{navLabel:e(`onboarding.moveFast.nav`),icon:(0,q.jsx)(mf,{className:`w-6 h-6`}),accent:iq.primary,title:e(`onboarding.moveFast.title`),subtitle:e(`onboarding.moveFast.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(sq,{accent:iq.primary,label:e(`onboarding.moveFast.paletteLabel`),children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.paletteShortcut`,values:{mod:nq},components:{f:(0,q.jsx)(`span`,{className:`text-foreground`}),m:(0,q.jsx)(`span`,{className:`text-muted-foreground`}),mod:(0,q.jsx)(aq,{children:nq}),k:(0,q.jsx)(aq,{children:`K`})}})}),e(`onboarding.moveFast.paletteBody`)]}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-3`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Mp,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.terminalLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.terminalBody`,values:{mod:nq},components:{mod:(0,q.jsx)(aq,{children:nq}),j:(0,q.jsx)(aq,{children:`J`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Lf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.shortcutsLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.shortcutsBody`,components:{q:(0,q.jsx)(aq,{children:`?`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Kf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.chatLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.chatBody`,values:{mod:nq},components:{mod:(0,q.jsx)(aq,{children:nq}),bkey:(0,q.jsx)(aq,{children:`B`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Of,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.projectsLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.projectsBody`,values:{alt:rq,mod:nq},components:{alt:(0,q.jsx)(aq,{children:rq}),mod:(0,q.jsx)(aq,{children:nq}),bkey:(0,q.jsx)(aq,{children:`B`})}})})]}),(0,q.jsx)(sq,{accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.outro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})})]})}]}function mq({open:e,onClose:t}){let{t:n}=G(`setup`),[r,i]=(0,F.useState)(0),[a,o]=(0,F.useState)(!1),s=(0,F.useMemo)(()=>pq(n),[n]),c=s[r],l=r===0,u=r===s.length-1,d=(0,F.useCallback)(()=>{a&&eq(),i(0),t()},[a,t]),f=(0,F.useCallback)(()=>{eq(),i(0),t()},[t]),p=(0,F.useCallback)(()=>{u?f():i(e=>e+1)},[u,f]),m=(0,F.useCallback)(()=>i(e=>Math.max(0,e-1)),[]);return(0,q.jsx)(jy,{open:e,onOpenChange:e=>{e||d()},children:(0,q.jsxs)(My,{children:[(0,q.jsx)(Ny,{className:`fixed inset-0 z-50 bg-black/70 backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,q.jsxs)(Py,{className:`fixed left-[50%] top-[50%] z-50 flex flex-col w-[calc(100vw-2rem)] max-w-4xl max-h-[88vh] translate-x-[-50%] translate-y-[-50%] overflow-hidden border border-border/30 bg-popover shadow-2xl backdrop-blur-xl sm:rounded-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,"data-testid":`onboarding-wizard`,"aria-describedby":`onboarding-description`,children:[(0,q.jsx)(`div`,{className:X(`h-1 w-full shrink-0 transition-all duration-500`,c.accent.bar)}),(0,q.jsxs)(`div`,{className:`flex min-h-0`,children:[(0,q.jsxs)(`nav`,{className:`hidden md:flex w-60 shrink-0 flex-col border-r border-border/30 bg-card/20 p-4`,children:[(0,q.jsxs)(`div`,{className:`px-2 mb-5`,children:[(0,q.jsxs)(`p`,{className:`text-sm font-bold tracking-tight`,children:[(0,q.jsx)(`span`,{className:`text-accent-primary`,children:`spec`}),(0,q.jsx)(`span`,{className:`text-accent-secondary`,children:`rails`})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:n(`onboarding.productTour`)})]}),(0,q.jsx)(`ol`,{className:`space-y-0.5 min-h-0 overflow-y-auto`,children:s.map((e,t)=>{let a=t===r,o=t<r;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":n(`onboarding.goToStep`,{step:t+1,label:e.navLabel}),"aria-current":a?`step`:void 0,className:X(`w-full flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors`,a?X(`bg-card/70`,e.accent.text):`text-muted-foreground hover:bg-card/40 hover:text-foreground`),children:[(0,q.jsx)(`span`,{className:X(`grid place-items-center w-5 h-5 shrink-0 rounded-full text-[10px] font-bold border`,a?X(e.accent.bar,`text-primary-foreground border-transparent`):o?`bg-accent-success/15 text-accent-success border-accent-success/30`:`border-border/50 text-muted-foreground`),children:o?(0,q.jsx)(Zd,{className:`w-3 h-3`}):t+1}),(0,q.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.navLabel})]})},e.navLabel)})}),(0,q.jsx)(`div`,{className:`mt-auto px-2.5 pt-4 text-[10px] text-muted-foreground`,children:n(`onboarding.stepCount`,{current:r+1,total:s.length})})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 sm:p-7`,children:[(0,q.jsxs)(`div`,{className:X(`flex items-center gap-3.5 mb-5`,c.accent.text),children:[(0,q.jsx)(`div`,{className:X(`grid place-items-center w-12 h-12 shrink-0 rounded-xl border border-border/30 bg-card/40`,c.accent.glow),children:c.icon}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(Fy,{className:`text-lg font-bold leading-tight text-foreground`,children:c.title}),(0,q.jsx)(`p`,{id:`onboarding-description`,className:`text-xs text-muted-foreground mt-0.5`,children:c.subtitle})]})]}),(0,q.jsx)(`div`,{className:`md:hidden flex items-center gap-1.5 mb-5`,children:s.map((e,t)=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":n(`onboarding.stepLabel`,{step:t+1}),"aria-current":t===r?`step`:void 0,className:X(`h-1.5 rounded-full transition-all`,t===r?X(`w-6`,e.accent.bar):`w-1.5 bg-muted-foreground/30`)},e.navLabel))}),(0,q.jsx)(`div`,{className:`min-h-[300px]`,children:c.content})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border/30 px-6 sm:px-7 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex-1 min-w-0`,children:l&&(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-2 cursor-pointer group`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),className:`w-3.5 h-3.5 rounded`,"data-testid":`onboarding-dismiss-checkbox`}),(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground group-hover:text-foreground transition-colors`,children:n(`onboarding.dontShowAgain`)})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:d,className:`text-xs text-muted-foreground`,"data-testid":`onboarding-skip`,children:n(`onboarding.skipTour`)}):(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:m,className:`text-xs`,"data-testid":`onboarding-back`,children:[(0,q.jsx)(zd,{className:`w-3.5 h-3.5 mr-1`}),n(`common:actions.back`)]}),(0,q.jsxs)(Z,{size:`sm`,onClick:p,className:X(`text-xs`,c.accent.btn),"data-testid":`onboarding-next`,children:[n(u?`onboarding.getStarted`:`common:actions.next`),!u&&(0,q.jsx)(Bd,{className:`w-3.5 h-3.5 ml-1`})]})]})]})]})]})]})]})})}var hq=[`pinned-open`,`pinned-collapsed`,`unpinned`],gq=`specrails-desktop:sidebar-mode:left`,_q=`specrails-desktop:sidebar-mode:right`;function vq(e){return typeof e==`string`&&hq.includes(e)}function yq(e){try{let t=window.localStorage.getItem(e);if(vq(t))return t}catch{}return`unpinned`}function bq(e,t){try{window.localStorage.setItem(e,t)}catch{}}function xq(e){switch(e){case`pinned-open`:return`pinned-collapsed`;case`pinned-collapsed`:return`unpinned`;case`unpinned`:return`pinned-open`}}var Sq=(0,F.createContext)({leftMode:`unpinned`,rightMode:`unpinned`,setLeftMode:()=>{},setRightMode:()=>{},cycleLeftMode:()=>{},cycleRightMode:()=>{}});function Cq({children:e}){let[t,n]=(0,F.useState)(()=>yq(gq)),[r,i]=(0,F.useState)(()=>yq(_q));(0,F.useEffect)(()=>{bq(gq,t)},[t]),(0,F.useEffect)(()=>{bq(_q,r)},[r]);let a=(0,F.useCallback)(e=>n(e),[]),o=(0,F.useCallback)(e=>i(e),[]),s=(0,F.useCallback)(()=>n(e=>xq(e)),[]),c=(0,F.useCallback)(()=>i(e=>xq(e)),[]),l=(0,F.useMemo)(()=>({leftMode:t,rightMode:r,setLeftMode:a,setRightMode:o,cycleLeftMode:s,cycleRightMode:c}),[t,r,a,o,s,c]);return(0,q.jsx)(Sq.Provider,{value:l,children:e})}function wq(){return(0,F.useContext)(Sq)}function Tq({project:e,isActive:t,expanded:n,onSelect:r,onRemove:i}){let{t:a}=G(`nav`),[o,s]=(0,F.useState)(!1),c=(0,F.useRef)(null);(0,F.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);function l(e){e.stopPropagation(),o?(c.current&&clearTimeout(c.current),s(!1),i()):(s(!0),c.current=setTimeout(()=>{s(!1),c.current=null},3e3))}function u(e){e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),r())}return(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:r,onKeyDown:u,className:X(`group relative flex items-center gap-2 w-full h-8 rounded-md transition-colors`,n?`px-2`:`px-0 justify-center`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),title:n?void 0:e.name,"aria-current":t?`page`:void 0,children:[(0,q.jsx)(Of,{className:X(`flex-shrink-0 w-4 h-4`,t&&`text-accent-primary`)}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-xs truncate flex-1 text-left`,children:e.name}),(0,q.jsx)(`button`,{type:`button`,onClick:l,className:X(`flex-shrink-0 flex items-center justify-center rounded-sm transition-all`,`opacity-0 group-hover:opacity-50 hover:!opacity-100 hover:bg-muted`,o?`opacity-100 px-1 h-4 text-[10px] text-destructive bg-destructive/10 hover:bg-destructive/20`:`w-3.5 h-3.5`),"aria-label":a(o?`projects.confirmRemove`:`projects.remove`,{name:e.name}),children:o?a(`projects.confirmShort`):(0,q.jsx)(Bp,{className:`w-2.5 h-2.5`})})]})]})}var Eq={"pinned-open":`sidebarPin.left.pinnedOpen`,"pinned-collapsed":`sidebarPin.left.pinnedCollapsed`,unpinned:`sidebarPin.left.unpinned`};function Dq({onAddProject:e,onOpenAnalytics:t,onOpenDocs:n,onOpenSettings:r}){let{t:i}=G(`nav`),{projects:a,activeProjectId:o,setActiveProjectId:s,removeProject:c}=yd(),{leftMode:l,cycleLeftMode:u}=wq(),[d,f]=(0,F.useState)(!1),p=l===`pinned-open`||l===`unpinned`&&d,m=l!==`unpinned`,h=i(Eq[l]),g=[{label:i(`arcSidebar.docs`),icon:Wd,action:n},{label:i(`arcSidebar.analytics`),icon:Yd,action:t},{label:i(`arcSidebar.settings`),icon:Cp,action:r}];async function _(e){try{await c(e.id)}catch{}}return(0,q.jsxs)(`div`,{className:X(`relative flex flex-col h-full border-r border-border bg-background flex-shrink-0`,`transition-all duration-200 ease-in-out overflow-hidden`,p?`w-52`:`w-11`),onMouseEnter:()=>{l===`unpinned`&&f(!0)},onMouseLeave:()=>{l===`unpinned`&&f(!1)},children:[(0,q.jsxs)(`div`,{className:X(`flex items-center h-12 border-b border-border flex-shrink-0`,p?`px-3 justify-between`:`justify-center`),children:[p&&(0,q.jsx)(`span`,{className:`font-mono text-sm font-bold whitespace-nowrap overflow-hidden text-accent-primary`,children:i(`arcSidebar.desktopTitle`)}),(0,q.jsx)(`button`,{type:`button`,onClick:u,className:X(`flex items-center justify-center w-7 h-7 rounded-md transition-colors flex-shrink-0`,m?`text-foreground bg-muted`:`text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/50`),"aria-label":h,title:i(`sidebarPin.withShortcut`,{label:h,shortcut:`⌥⌘B`}),children:(0,q.jsx)(ep,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1.5 space-y-0.5`,children:[a.map(e=>(0,q.jsx)(Tq,{project:e,isActive:e.id===o,expanded:p,onSelect:()=>s(e.id),onRemove:()=>_(e)},e.id)),(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted/50`,p?`px-2`:`px-0 justify-center`),"aria-label":i(`projects.addProject`),title:p?void 0:i(`projects.addProject`),children:[(0,q.jsx)(sp,{className:`w-4 h-4 flex-shrink-0`}),p&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap`,children:i(`projects.addProject`)})]})]}),(0,q.jsx)(`div`,{className:`border-t border-border py-2 px-1.5 space-y-0.5`,children:g.map(({label:e,icon:t,action:n})=>(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted/50`,p?`px-2`:`px-0 justify-center`),"aria-label":e,title:p?void 0:e,children:[(0,q.jsx)(t,{className:`w-4 h-4 flex-shrink-0`}),p&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap`,children:e})]},e))})]})}var Oq={"pinned-open":`sidebarPin.right.pinnedOpen`,"pinned-collapsed":`sidebarPin.right.pinnedCollapsed`,unpinned:`sidebarPin.right.unpinned`};function kq(){let{t:e}=G(`nav`),{rightMode:t,cycleRightMode:n}=wq(),{projects:r,activeProjectId:i}=yd(),[a,o]=(0,F.useState)(!1),s=t===`pinned-open`||t===`unpinned`&&a,c=t!==`unpinned`,l=e(Oq[t]),u=r.find(e=>e.id===i),d=u?fd(u):[`claude`],f=nB&&jE(`agents`,d),p=jE(`integrations`,d),m=[{to:`/`,end:!0,icon:Bf,label:e(`rightSidebar.dashboard`)},{to:`/jobs`,end:!1,icon:qd,label:e(`rightSidebar.jobs`)},{to:`/analytics`,end:!1,icon:Jd,label:e(`rightSidebar.analytics`)},...f?[{to:`/agents`,end:!1,icon:Gd,label:e(`rightSidebar.agents`)}]:[],...rB?[{to:`/code`,end:!1,icon:uf,label:e(`rightSidebar.code`)}]:[],...p?[{to:`/integrations`,end:!1,icon:cp,label:e(`rightSidebar.integrations`)}]:[],{to:`/settings`,end:!1,icon:Cp,label:e(`rightSidebar.settings`)}];return(0,q.jsxs)(`div`,{className:X(`relative flex flex-col h-full border-l border-border bg-background flex-shrink-0`,`transition-all duration-200 ease-in-out overflow-hidden`,s?`w-44`:`w-11`),onMouseEnter:()=>{t===`unpinned`&&o(!0)},onMouseLeave:()=>{t===`unpinned`&&o(!1)},children:[(0,q.jsxs)(`div`,{className:X(`flex items-center h-12 border-b border-border flex-shrink-0`,s?`px-3 justify-between`:`justify-center`),children:[s&&(0,q.jsx)(`span`,{className:`font-mono text-sm font-bold whitespace-nowrap overflow-hidden text-accent-secondary`,children:e(`rightSidebar.projectTitle`)}),(0,q.jsx)(`button`,{type:`button`,onClick:n,className:X(`flex items-center justify-center w-7 h-7 rounded-md transition-colors`,c?`text-foreground bg-muted`:`text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/50`),"aria-label":l,title:e(`sidebarPin.withShortcut`,{label:l,shortcut:`⌘B`}),children:(0,q.jsx)(tp,{className:`w-4 h-4`})})]}),(0,q.jsx)(`nav`,{className:`flex-1 py-2 px-1.5 space-y-0.5`,children:m.map(({to:e,end:t,icon:n,label:r})=>(0,q.jsxs)(Mn,{to:e,end:t,className:({isActive:e})=>X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,s?`px-2`:`px-0 justify-center`,e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),title:s?void 0:r,children:[(0,q.jsx)(n,{className:`w-4 h-4 flex-shrink-0`}),s&&(0,q.jsx)(`span`,{className:`text-xs truncate`,children:r})]},e))})]})}function Aq(e){return{darwin:{title:`macOS`,intro:e(`setup:instructions.darwin.intro`),commands:[{label:e(`setup:instructions.darwin.installNodeGit`),command:`brew install node git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitOfficial`),url:`https://git-scm.com/downloads`},{label:`Homebrew`,url:`https://brew.sh`}]},win32:{title:`Windows`,intro:e(`setup:instructions.win32.intro`),commands:[{label:e(`setup:instructions.win32.installNode`),command:`winget install OpenJS.NodeJS.LTS`},{label:e(`setup:instructions.win32.installGit`),command:`winget install Git.Git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitWindows`),url:`https://git-scm.com/download/win`}],note:e(`setup:instructions.win32.note`)},linux:{title:`Linux`,intro:e(`setup:instructions.linux.intro`),commands:[{label:e(`setup:instructions.linux.debian`),command:`sudo apt install -y nodejs npm git`},{label:e(`setup:instructions.linux.fedora`),command:`sudo dnf install -y nodejs npm git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitOfficial`),url:`https://git-scm.com/downloads`}]}}}var jq=[`darwin`,`win32`,`linux`];async function Mq(e){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Nq({command:e}){let{t}=G(`setup`),[n,r]=(0,F.useState)(!1);return(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:async()=>{await Mq(e)&&(r(!0),window.setTimeout(()=>r(!1),1500))},className:`h-7 px-2 gap-1.5 text-[11px]`,"data-testid":`install-copy-button`,children:n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Zd,{className:`w-3 h-3`}),t(`common:actions.copied`)]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(hf,{className:`w-3 h-3`}),t(`common:actions.copy`)]})})}function Pq({platform:e,primary:t}){let{t:n}=G(`setup`),r=Aq(n)[e];return(0,q.jsxs)(`section`,{"data-testid":`install-section-${e}`,className:X(`rounded-lg border px-3 py-3`,t?`border-border/40 bg-background/40`:`border-border/20 bg-background/20`),children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:r.title}),r.intro&&(0,q.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:r.intro}),(0,q.jsx)(`div`,{className:`mt-2 space-y-2`,children:r.commands.map(e=>(0,q.jsxs)(`div`,{className:`rounded-md border border-border/30 bg-background/60 px-2 py-2`,children:[(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground mb-1`,children:e.label}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`code`,{className:`text-xs text-foreground font-mono break-all`,children:e.command}),(0,q.jsx)(Nq,{command:e.command})]})]},e.command))}),r.links.length>0&&(0,q.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1`,children:r.links.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-accent-info hover:underline`,children:[e.label,(0,q.jsx)(Sf,{className:`w-3 h-3`})]})},e.url))}),r.note&&(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-accent-highlight`,children:r.note})]})}function Fq(){let{t:e}=G(`setup`),[t,n]=(0,F.useState)(`idle`);return(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:async()=>{n(`copying`);try{let e=await fetch(`${ol}/api/setup-prerequisites?diagnostic=1`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();await navigator.clipboard.writeText(JSON.stringify(t,null,2)),n(`copied`),setTimeout(()=>n(`idle`),1800)}catch{n(`error`),setTimeout(()=>n(`idle`),2400)}},disabled:t===`copying`,className:`gap-1.5 text-[11px]`,"data-testid":`copy-diagnostics-button`,children:[t===`copied`?(0,q.jsx)(Zd,{className:`w-3 h-3 text-accent-success`}):(0,q.jsx)(cf,{className:`w-3 h-3`}),e(t===`copied`?`instructions.diagnostics.copied`:t===`error`?`instructions.diagnostics.failed`:`instructions.diagnostics.copy`)]})}function Iq({open:e,onClose:t,status:n,onRecheck:r,isRechecking:i}){let{t:a}=G(`setup`),[o,s]=(0,F.useState)(!1),c=n?.platform??`darwin`,l=jq.filter(e=>e!==c);return n?.missingRequired?.some(e=>e.error===`corrupted-bundle`)??!1?(0,q.jsx)(Ry,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Vy,{className:`max-w-xl`,"data-testid":`install-modal-corrupted-bundle`,children:[(0,q.jsxs)(Hy,{children:[(0,q.jsx)(Wy,{children:a(`instructions.corrupted.title`)}),(0,q.jsx)(Gy,{children:a(`instructions.corrupted.description`)})]}),(0,q.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`instructions.corrupted.body`)}),(0,q.jsx)(`div`,{className:`flex justify-end mt-2`,children:(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,"data-testid":`install-corrupted-close-button`,children:a(`common:actions.close`)})})]})}):(0,q.jsx)(Ry,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Vy,{className:`max-w-xl`,children:[(0,q.jsxs)(Hy,{children:[(0,q.jsx)(Wy,{children:a(`instructions.title`)}),(0,q.jsx)(Gy,{children:a(`instructions.description`)})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(Pq,{platform:c,primary:!0}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-[11px] text-muted-foreground hover:text-foreground underline-offset-2 hover:underline`,"data-testid":`install-toggle-others`,children:a(o?`instructions.hideOtherPlatforms`:`instructions.showOtherPlatforms`)}),o&&(0,q.jsx)(`div`,{className:`space-y-3`,children:l.map(e=>(0,q.jsx)(Pq,{platform:e,primary:!1},e))})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mt-2`,children:[(0,q.jsx)(Fq,{}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:a(`common:actions.close`)}),(0,q.jsxs)(Z,{type:`button`,variant:`default`,size:`sm`,onClick:r,disabled:i,className:`gap-1.5`,"data-testid":`install-recheck-button`,children:[(0,q.jsx)(pp,{className:X(`w-3 h-3`,i&&`animate-spin`)}),a(`instructions.recheck`)]})]})]})]})})}var Lq=typeof window<`u`&&`__TAURI_INTERNALS__`in window,Rq=[`claude`,`codex`];function zq({open:e,onClose:t}){let[n,i]=(0,F.useState)(new Set([`claude`])),[a,o]=(0,F.useState)(``),[s,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)({claude:!0,codex:!1}),[p,m]=(0,F.useState)(!1),{t:h}=G(`setup`),{addProject:g,startSetupWizard:_,setActiveProjectId:v}=yd(),{status:y,isLoading:b,error:x,recheck:S}=MK(),C=(0,F.useMemo)(()=>{if(!y||y.ok)return null;let e=y.missingRequired.map(e=>e.label);return e.length===0?null:h(`addProject.toolsRequired`,{tools:e.join(`, `),count:e.length})},[y,h]),w=y!==null&&!y.ok&&!x;(0,F.useEffect)(()=>{e&&fetch(`/api/available-providers`).then(e=>e.json()).then(e=>{let t=!!e.claude,n=!!e.codex;f({claude:t,codex:n});let r=new Set;t&&r.add(`claude`),n&&r.add(`codex`),r.size===0&&r.add(`claude`),i(r)}).catch(()=>{})},[e]);function T(e){i(t=>{let n=new Set(t);if(n.has(e)){if(n.size===1)return t;n.delete(e)}else n.add(e);return n})}let E=Rq.filter(e=>n.has(e)&&d[e]);async function D(){let e=a.trim();if(!e){K.error(h(`addProject.errors.pathRequired`));return}if(E.length===0){K.error(h(`addProject.errors.selectProvider`));return}u(!0);try{let t=await g(e,s.trim()||void 0,E);if(!t)return;let{project:n}=t;t.has_specrails===!1?(O(),v(n.id),_(n.id)):(K.success(h(`addProject.toasts.registered`,{name:n.name})),O())}catch(e){K.error(h(`addProject.errors.addFailed`),{description:e.message})}finally{u(!1)}}function O(){o(``),c(``),t()}function k(e){e||O()}let A=!d.claude&&!d.codex;return(0,q.jsx)(Ry,{open:e,onOpenChange:k,children:(0,q.jsxs)(Vy,{className:`max-w-md`,children:[(0,q.jsxs)(Hy,{children:[(0,q.jsxs)(Wy,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Of,{className:`w-4 h-4`}),h(`addProject.title`)]}),(0,q.jsx)(Gy,{children:h(`addProject.description`)})]}),A&&(0,q.jsx)(`p`,{className:`text-xs text-destructive bg-destructive/10 rounded-md p-2`,children:h(`addProject.noProviderDetected`)}),(0,q.jsx)(PK,{status:y,isLoading:b,error:x,onMoreInfo:()=>m(!0),onRefresh:S}),(0,q.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{className:`text-xs font-medium`,children:[h(`addProject.pathLabel`),` `,(0,q.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(jV,{placeholder:h(`addProject.pathPlaceholder`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&D()},autoFocus:!0,className:`flex-1`}),Lq&&(0,q.jsx)(Z,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,title:h(`addProject.browseForFolder`),onClick:async()=>{try{let{open:e}=await r(async()=>{let{open:e}=await import(`./dist-js-DAazzqbg.js`);return{open:e}},[]),t=await e({directory:!0,multiple:!1,title:h(`addProject.selectProjectFolder`)});typeof t==`string`&&t&&(o(t),s||c(t.split(`/`).filter(Boolean).pop()??``))}catch{}},children:(0,q.jsx)(Of,{className:`w-4 h-4`})})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:h(`addProject.pathHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{className:`text-xs font-medium`,children:[h(`addProject.nameLabel`),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:h(`addProject.optional`)})]}),(0,q.jsx)(jV,{placeholder:h(`addProject.namePlaceholder`),value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&D()}}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:h(`addProject.nameHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:h(`addProject.providersLabel`)}),(0,q.jsx)(`div`,{className:`flex gap-2`,children:[{id:`claude`,icon:`🤖`,label:`Claude`},{id:`codex`,icon:`⚡`,label:`Codex`}].map(({id:e,icon:t,label:r})=>{let i=d[e],a=n.has(e)&&i;return(0,q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":a,disabled:!i,onClick:()=>T(e),"data-testid":`provider-toggle-${e}`,className:X(`flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-left transition-colors text-xs`,`focus:outline-none focus-visible:ring-1 focus-visible:ring-ring`,a?`border-accent-primary/60 bg-accent-primary/10 text-foreground`:`border-border/30 text-muted-foreground hover:border-border/60`,!i&&`opacity-40 cursor-not-allowed`),children:[(0,q.jsx)(`span`,{className:X(`inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm border text-[9px] leading-none`,a?`border-accent-primary bg-accent-primary text-background`:`border-border/50`),"aria-hidden":!0,children:a?`✓`:``}),(0,q.jsx)(`span`,{children:t}),(0,q.jsx)(`span`,{className:`font-medium`,children:r}),!i&&(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground/60`,children:h(`addProject.notFound`)})]},e)})}),(0,q.jsx)(`p`,{className:`text-[9px] text-muted-foreground/70`,children:E.length>1?h(`addProject.multiProviderHint`):h(`addProject.singleProviderHint`)})]})]}),(0,q.jsxs)(Uy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:t,disabled:l,children:h(`common:actions.cancel`)}),(0,q.jsx)(Z,{size:`sm`,onClick:D,disabled:l||!a.trim()||A||E.length===0||w||b,title:w?C??void 0:void 0,"data-testid":`add-project-submit`,children:h(l?`addProject.adding`:`addProject.submit`)})]}),(0,q.jsx)(Iq,{open:p,onClose:()=>m(!1),status:y,onRecheck:S,isRechecking:b})]})})}var Bq=1,Vq=.9,Hq=.8,Uq=.17,Wq=.1,Gq=.999,Kq=.9999,qq=.99,Jq=/[\\\/_+.#"@\[\(\{&]/,Yq=/[\\\/_+.#"@\[\(\{&]/g,Xq=/[\s-]/,Zq=/[\s-]/g;function Qq(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Bq:qq;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Qq(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Bq:Jq.test(e.charAt(l-1))?(d*=Hq,p=e.slice(i,l-1).match(Yq),p&&i>0&&(d*=Gq**+p.length)):Xq.test(e.charAt(l-1))?(d*=Vq,m=e.slice(i,l-1).match(Zq),m&&i>0&&(d*=Gq**+m.length)):(d*=Uq,i>0&&(d*=Gq**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Kq)),(d<Wq&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Qq(e,t,n,r,l+1,a+2,o),f*Wq>d&&(d=f*Wq)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function $q(e){return e.toLowerCase().replace(Zq,` `)}function eJ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Qq(e,t,$q(e),$q(t),0,0,{})}var tJ=`[cmdk-group=""]`,nJ=`[cmdk-group-items=""]`,rJ=`[cmdk-group-heading=""]`,iJ=`[cmdk-item=""]`,aJ=`${iJ}:not([aria-disabled="true"])`,oJ=`cmdk-item-select`,sJ=`data-value`,cJ=(e,t,n)=>eJ(e,t,n),lJ=F.createContext(void 0),uJ=()=>F.useContext(lJ),dJ=F.createContext(void 0),fJ=()=>F.useContext(dJ),pJ=F.createContext(void 0),mJ=F.forwardRef((e,t)=>{let n=OJ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=OJ(()=>new Set),i=OJ(()=>new Map),a=OJ(()=>new Map),o=OJ(()=>new Set),s=EJ(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Dg(),y=Dg(),b=Dg(),x=F.useRef(null),S=jJ();DJ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),DJ(()=>{S(6,k)},[]);let C=F.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=F.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??cJ;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(nJ);t?t.appendChild(e.parentElement===t?e:e.closest(`${nJ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${nJ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${tJ}[${sJ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(sJ);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(tJ)?.querySelector(rJ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${iJ}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(aJ)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(sJ))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(sJ))}function P(e){let t=A()?.closest(tJ),n;for(;t&&!n;)t=e>0?wJ(t,tJ):TJ(t,tJ),n=t?.querySelector(aJ);n?C.setState(`value`,n.getAttribute(sJ)):N(e)}let I=()=>M(j().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?P(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return F.createElement(Rg.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(oJ);t.dispatchEvent(e)}}}}},F.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:PJ},c),NJ(e,e=>F.createElement(dJ.Provider,{value:C},F.createElement(lJ.Provider,{value:w},e))))}),hJ=F.forwardRef((e,t)=>{let n=Dg(),r=F.useRef(null),i=F.useContext(pJ),a=uJ(),o=EJ(e),s=o.current?.forceMount??i?.forceMount;DJ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=AJ(n,r,[e.value,e.children,r],e.keywords),l=fJ(),u=kJ(e=>e.value&&e.value===c.current),d=kJ(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);F.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(oJ,f),()=>t.removeEventListener(oJ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return F.createElement(Rg.div,{ref:Up(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),gJ=F.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Dg(),s=F.useRef(null),c=F.useRef(null),l=Dg(),u=uJ(),d=kJ(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);DJ(()=>u.group(o),[]),AJ(o,s,[e.value,e.heading,c]);let f=F.useMemo(()=>({id:o,forceMount:i}),[i]);return F.createElement(Rg.div,{ref:Up(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&F.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),NJ(e,e=>F.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},F.createElement(pJ.Provider,{value:f},e))))}),_J=F.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=F.useRef(null),a=kJ(e=>!e.search);return!n&&!a?null:F.createElement(Rg.div,{ref:Up(i,t),...r,"cmdk-separator":``,role:`separator`})}),vJ=F.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=fJ(),o=kJ(e=>e.search),s=kJ(e=>e.selectedItemId),c=uJ();return F.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),F.createElement(Rg.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),yJ=F.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=F.useRef(null),o=F.useRef(null),s=kJ(e=>e.selectedItemId),c=uJ();return F.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),F.createElement(Rg.div,{ref:Up(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},NJ(e,e=>F.createElement(`div`,{ref:Up(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),bJ=F.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return F.createElement(jy,{open:n,onOpenChange:r},F.createElement(My,{container:o},F.createElement(Ny,{"cmdk-overlay":``,className:i}),F.createElement(Py,{"aria-label":e.label,"cmdk-dialog":``,className:a},F.createElement(mJ,{ref:t,...s}))))}),xJ=F.forwardRef((e,t)=>kJ(e=>e.filtered.count===0)?F.createElement(Rg.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),SJ=F.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return F.createElement(Rg.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},NJ(e,e=>F.createElement(`div`,{"aria-hidden":!0},e)))}),CJ=Object.assign(mJ,{List:yJ,Item:hJ,Input:vJ,Group:gJ,Separator:_J,Dialog:bJ,Empty:xJ,Loading:SJ});function wJ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function TJ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function EJ(e){let t=F.useRef(e);return DJ(()=>{t.current=e}),t}var DJ=typeof window>`u`?F.useEffect:F.useLayoutEffect;function OJ(e){let t=F.useRef();return t.current===void 0&&(t.current=e()),t}function kJ(e){let t=fJ(),n=()=>e(t.snapshot());return F.useSyncExternalStore(t.subscribe,n,n)}function AJ(e,t,n,r=[]){let i=F.useRef(),a=uJ();return DJ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(sJ,s),i.current=s}),i}var jJ=()=>{let[e,t]=F.useState(),n=OJ(()=>new Map);return DJ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function MJ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function NJ({asChild:e,children:t},n){return e&&F.isValidElement(t)?F.cloneElement(MJ(t),{ref:t.ref},n(t.props.children)):n(t)}var PJ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function FJ({onOpenSettings:e,onOpenAnalytics:t,onOpenDocs:n}){let{t:r}=G(`commands`),[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)([]),[c,l]=(0,F.useState)([]),{projects:u,activeProjectId:d,setActiveProjectId:f}=yd(),{leftMode:p,rightMode:m,cycleLeftMode:h,cycleRightMode:g}=wq(),_=r(p===`pinned-open`?`palette.sidebar.collapseLeftKeepPinned`:p===`pinned-collapsed`?`palette.sidebar.unpinLeft`:`palette.sidebar.pinLeftOpen`),v=r(m===`pinned-open`?`palette.sidebar.collapseRightKeepPinned`:m===`pinned-collapsed`?`palette.sidebar.unpinRight`:`palette.sidebar.pinRightOpen`),y=st(),b=(0,F.useRef)(!1);(0,F.useEffect)(()=>{function e(e){e.key===`k`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),a(e=>!e))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,F.useEffect)(()=>{if(!i){b.current=!1;return}if(b.current)return;b.current=!0;async function e(){try{let[e,t]=await Promise.all([fetch(`${ll()}/config`),fetch(`${ll()}/jobs?limit=10`)]);e.ok&&s((await e.json()).commands),t.ok&&l((await t.json()).jobs)}catch{}}e()},[i]);let x=(0,F.useCallback)(e=>{f(e),a(!1)},[f]),S=(0,F.useCallback)(async e=>{a(!1);try{let t=await fetch(`${ll()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:`/specrails:${e}`})}),n=await t.json();if(!t.ok)throw Error(n.error??r(`errors.spawnFailed`));K.success(r(`toasts.queued`,{name:e})),y(`/jobs/${n.jobId}`)}catch(e){K.error(e instanceof Error?e.message:r(`errors.spawnFailed`))}},[y,r]),C=(0,F.useCallback)(e=>{a(!1),y(`/jobs/${e}`)},[y]),w=(0,F.useCallback)(e=>{a(!1),y(e)},[y]),T=(0,F.useCallback)(e=>{e&&(a(!1),e())},[]),E=`flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer text-sm data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground`;return(0,q.jsxs)(CJ.Dialog,{open:i,onOpenChange:a,label:r(`palette.label`),className:X(`fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%]`,`border border-border/30 bg-popover shadow-2xl backdrop-blur-md rounded-xl overflow-hidden`),children:[(0,q.jsx)(`span`,{className:`sr-only`,children:r(`palette.label`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 border-b border-border/30`,children:[(0,q.jsx)(bp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(CJ.Input,{placeholder:r(`palette.searchPlaceholder`),className:`flex-1 h-11 bg-transparent text-sm outline-none placeholder:text-muted-foreground/50`}),(0,q.jsx)(`kbd`,{className:`hidden sm:inline-flex items-center gap-0.5 rounded border border-border/50 bg-muted/30 px-1.5 py-0.5 text-[10px] text-muted-foreground font-mono`,children:`esc`})]}),(0,q.jsxs)(CJ.List,{className:`max-h-80 overflow-y-auto p-2`,children:[(0,q.jsx)(CJ.Empty,{className:`py-8 text-center text-sm text-muted-foreground`,children:r(`palette.noResults`)}),u.length>0&&(0,q.jsx)(CJ.Group,{heading:r(`palette.groups.projects`),children:u.map(e=>(0,q.jsxs)(CJ.Item,{value:e.name,keywords:[e.slug],onSelect:()=>x(e.id),className:X(E,e.id===d&&`text-accent-primary`),children:[(0,q.jsx)(Of,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.id===d&&(0,q.jsx)(`span`,{className:`text-[10px] text-accent-primary font-medium`,children:r(`palette.activeBadge`)})]},e.id))}),o.length>0&&(0,q.jsx)(CJ.Group,{heading:r(`palette.groups.spec`),children:o.map(e=>(0,q.jsxs)(CJ.Item,{value:e.name,keywords:[e.slug,e.description??``],onSelect:()=>S(e.slug),className:E,children:[(0,q.jsx)(Vp,{className:`w-4 h-4 text-accent-info shrink-0`}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.name}),e.description&&(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60 ml-2 truncate`,children:e.description})]})]},e.id))}),c.length>0&&(0,q.jsx)(CJ.Group,{heading:r(`palette.groups.jobs`),children:c.map(e=>(0,q.jsxs)(CJ.Item,{value:`${e.command} ${e.id}`,keywords:[e.status],onSelect:()=>C(e.id),className:E,children:[(0,q.jsx)(qd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.command}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-medium`,e.status===`completed`&&`text-accent-success`,e.status===`failed`&&`text-destructive`,e.status===`running`&&`text-accent-info`,e.status===`queued`&&`text-muted-foreground`),children:r(`common:status.${e.status}`,{defaultValue:e.status})})]},e.id))}),(0,q.jsxs)(CJ.Group,{heading:r(`palette.groups.navigation`),children:[(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.dashboard`),keywords:[`home`],onSelect:()=>w(`/`),className:E,children:[(0,q.jsx)(Bf,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.dashboard`)})]}),t&&(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.desktopAnalytics`),keywords:[`cross-project`,`desktop`],onSelect:()=>T(t),className:E,children:[(0,q.jsx)(Xd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.desktopAnalytics`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.projectAnalytics`),keywords:[`metrics`],onSelect:()=>w(`/analytics`),className:E,children:[(0,q.jsx)(Jd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.projectAnalytics`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.activityFeed`),keywords:[`log`],onSelect:()=>w(`/activity`),className:E,children:[(0,q.jsx)(Fd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.activityFeed`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.desktopSettings`),keywords:[`configuration`],onSelect:()=>e?T(e):w(`/settings`),className:E,children:[(0,q.jsx)(Cp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.desktopSettings`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.docs`),keywords:[`documentation`],onSelect:()=>n?T(n):w(`/docs`),className:E,children:[(0,q.jsx)(Ef,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.docs`)})]}),(0,q.jsxs)(CJ.Item,{value:_,keywords:[`sidebar`,`panel`,`left`,`pin`,`collapse`,`unpin`,`cycle`],onSelect:()=>{h(),a(!1)},className:E,children:[(0,q.jsx)(ep,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:_})]}),(0,q.jsxs)(CJ.Item,{value:v,keywords:[`sidebar`,`panel`,`right`,`nav`,`pin`,`collapse`,`unpin`,`cycle`],onSelect:()=>{g(),a(!1)},className:E,children:[(0,q.jsx)(tp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:v})]})]})]}),(0,q.jsx)(`div`,{className:`flex items-center justify-between px-3 py-2 border-t border-border/30 text-[10px] text-muted-foreground/50`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`↑↓`}),` `,r(`palette.footer.navigate`)]}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`↵`}),` `,r(`palette.footer.select`)]}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`esc`}),` `,r(`palette.footer.close`)]})]})})]})}var IJ=`
136
+ `)});return}w.current=[],T.current=0,P(0)},[g,P,r]),L=(0,F.useCallback)(()=>{if(c.step!==`agent-selection`)return;let e=c.providerIndex;e<o.length-1?l({step:`agent-selection`,providerIndex:e+1}):I()},[c,o.length,I]);function ee(){c.step===`error`&&I()}let R=c.step===`agent-selection`?c.providerIndex:0,te=R>=o.length-1,z=te?r(`wizard.install`):r(`wizard.nextProvider`,{provider:ME(o[R+1])});return(0,q.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,q.jsx)(`div`,{className:`flex-shrink-0 border-b border-border/30 px-4 py-2`,children:(0,q.jsx)(JK,{wizardStep:c,providers:o})}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[c.step===`agent-selection`&&(0,q.jsx)(UK,{config:S,onChange:C,onInstall:L,onSkip:a,provider:x,ctaLabel:z,lastStep:te,prerequisites:g,prerequisitesLoading:_,prerequisitesError:v,onRefreshPrerequisites:y},x),c.step===`installing`&&(0,q.jsx)(WK,{logLines:m,providerLabelText:o.length>1?ME(o[c.providerIndex]):void 0,onBack:()=>l({step:`agent-selection`,providerIndex:o.length-1})}),c.step===`complete`&&(0,q.jsx)(KK,{projectName:e.name,summaries:c.summaries,onGoToProject:i}),c.step===`error`&&(0,q.jsx)(qK,{message:c.message,onRetry:ee,onSkip:a})]})]})}var XK=`https://specrails.dev/companion/ios`,ZK=`https://specrails.dev/companion/android`,QK=`specrails-desktop:onboarding-dismissed`;function $K(){try{return localStorage.getItem(QK)===`true`}catch{return!1}}function eq(){try{localStorage.setItem(QK,`true`)}catch{}}var tq=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||``),nq=tq?`⌘`:`Ctrl`,rq=tq?`⌥`:`Alt`,iq={primary:{text:`text-accent-primary`,bar:`bg-accent-primary`,glow:`glow-primary`,btn:`bg-accent-primary hover:bg-accent-primary/90 text-primary-foreground`,softBorder:`border-accent-primary/30`,softBg:`bg-accent-primary/5`,chipBg:`bg-accent-primary/10 text-accent-primary`},info:{text:`text-accent-info`,bar:`bg-accent-info`,glow:`glow-info`,btn:`bg-accent-info hover:bg-accent-info/90 text-primary-foreground`,softBorder:`border-accent-info/30`,softBg:`bg-accent-info/5`,chipBg:`bg-accent-info/10 text-accent-info`},success:{text:`text-accent-success`,bar:`bg-accent-success`,glow:`glow-success`,btn:`bg-accent-success hover:bg-accent-success/90 text-primary-foreground`,softBorder:`border-accent-success/30`,softBg:`bg-accent-success/5`,chipBg:`bg-accent-success/10 text-accent-success`},secondary:{text:`text-accent-secondary`,bar:`bg-accent-secondary`,glow:`glow-secondary`,btn:`bg-accent-secondary hover:bg-accent-secondary/90 text-primary-foreground`,softBorder:`border-accent-secondary/30`,softBg:`bg-accent-secondary/5`,chipBg:`bg-accent-secondary/10 text-accent-secondary`},warning:{text:`text-accent-warning`,bar:`bg-accent-warning`,glow:`glow-warning`,btn:`bg-accent-warning hover:bg-accent-warning/90 text-primary-foreground`,softBorder:`border-accent-warning/30`,softBg:`bg-accent-warning/5`,chipBg:`bg-accent-warning/10 text-accent-warning`},highlight:{text:`text-accent-highlight`,bar:`bg-accent-highlight`,glow:`glow-highlight`,btn:`bg-accent-highlight hover:bg-accent-highlight/90 text-primary-foreground`,softBorder:`border-accent-highlight/30`,softBg:`bg-accent-highlight/5`,chipBg:`bg-accent-highlight/10 text-accent-highlight`}};function aq({children:e}){return(0,q.jsx)(`kbd`,{className:`inline-flex items-center justify-center min-w-[1.5rem] h-5 px-1.5 rounded border border-border/60 bg-card/80 font-mono text-[11px] text-foreground shadow-sm`,children:e})}function oq({icon:e,label:t,children:n,accent:r}){return(0,q.jsxs)(`div`,{className:`flex gap-3 items-start`,children:[(0,q.jsx)(`div`,{className:X(`mt-0.5 shrink-0 grid place-items-center w-7 h-7 rounded-md border border-border/40`,r.softBg,r.text),children:e}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground leading-tight`,children:t}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground leading-relaxed`,children:n})]})]})}function sq({accent:e,label:t,children:n}){return(0,q.jsxs)(`div`,{className:X(`rounded-lg border p-3`,e.softBorder,e.softBg),children:[t&&(0,q.jsx)(`p`,{className:X(`text-[10px] font-semibold uppercase tracking-wider mb-1.5`,e.text),children:t}),(0,q.jsx)(`div`,{className:`text-xs text-foreground/90 leading-relaxed`,children:n})]})}function cq({steps:e}){return(0,q.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap text-[13px] font-medium`,children:e.map((t,n)=>(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:t.cls,children:t.label}),n<e.length-1&&(0,q.jsx)(Bd,{className:`w-3.5 h-3.5 text-muted-foreground`})]},t.label))})}function lq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:e(`onboarding.language.intro`)}),(0,q.jsx)(bH,{}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.language.note`)})]})}function uq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:e(`onboarding.theme.intro`)}),(0,q.jsx)(fH,{}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.theme.note`)})]})}function dq({icon:e,url:t,label:n,testId:r}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border/40 bg-card/40 p-3`,children:[(0,q.jsx)(`div`,{className:`shrink-0 rounded-md bg-white p-1.5`,"aria-hidden":`true`,children:(0,q.jsx)(YH,{value:t,size:72})}),(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[13px] font-semibold text-foreground leading-tight`,children:[e,n]}),(0,q.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":r,"aria-label":n,className:`inline-flex items-center gap-1 text-xs text-accent-info hover:underline break-all`,children:[t.replace(`https://`,``),(0,q.jsx)(Sf,{className:`w-3 h-3 shrink-0`,"aria-hidden":`true`})]})]})]})}function fq(){let{t:e}=G(`setup`);return(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.companion.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsx)(sq,{accent:iq.success,label:e(`onboarding.companion.localLabel`),children:e(`onboarding.companion.localBody`)}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:e(`onboarding.companion.downloadLabel`)}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`onboarding.companion.downloadHint`)}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-3`,children:[(0,q.jsx)(dq,{icon:(0,q.jsx)(Id,{className:`w-4 h-4 shrink-0`,"aria-hidden":`true`}),url:XK,label:e(`onboarding.companion.ios`),testId:`companion-ios-link`}),(0,q.jsx)(dq,{icon:(0,q.jsx)(Tp,{className:`w-4 h-4 shrink-0`,"aria-hidden":`true`}),url:ZK,label:e(`onboarding.companion.android`),testId:`companion-android-link`})]})]}),(0,q.jsx)(oq,{icon:(0,q.jsx)(lp,{className:`w-4 h-4`}),label:e(`onboarding.companion.pairLabel`),accent:iq.success,children:e(`onboarding.companion.pairBody`)})]})}function pq(e){return[{navLabel:e(`onboarding.language.nav`),icon:(0,q.jsx)(Rf,{className:`w-6 h-6`}),accent:iq.info,title:e(`onboarding.language.title`),subtitle:e(`onboarding.language.subtitle`),content:(0,q.jsx)(lq,{})},{navLabel:e(`onboarding.theme.nav`),icon:(0,q.jsx)($f,{className:`w-6 h-6`}),accent:iq.highlight,title:e(`onboarding.theme.title`),subtitle:e(`onboarding.theme.subtitle`),content:(0,q.jsx)(uq,{})},{navLabel:e(`onboarding.welcome.nav`),icon:(0,q.jsx)(Ep,{className:`w-6 h-6`}),accent:iq.primary,title:e(`onboarding.welcome.title`),subtitle:e(`onboarding.welcome.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.welcome.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(sq,{accent:iq.primary,label:e(`onboarding.welcome.coreLoopLabel`),children:[(0,q.jsx)(cq,{steps:[{label:e(`onboarding.flow.addSpec`),cls:`text-accent-info`},{label:e(`onboarding.flow.dropInRail`),cls:`text-accent-success`},{label:e(`onboarding.flow.hitPlay`),cls:`text-accent-warning`},{label:e(`onboarding.flow.ship`),cls:`text-accent-secondary`}]}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.welcome.flowCaption`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`})}})})]}),(0,q.jsxs)(`div`,{className:`flex gap-3 items-start`,children:[(0,q.jsx)(wp,{className:`w-4 h-4 mt-0.5 shrink-0 text-accent-success`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.welcome.localNote`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`}),i:(0,q.jsx)(`span`,{className:`italic`})}})})]}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:e(`onboarding.welcome.tourNote`)})]})},{navLabel:e(`onboarding.authorSpecs.nav`),icon:(0,q.jsx)(Kf,{className:`w-6 h-6`}),accent:iq.info,title:e(`onboarding.authorSpecs.title`),subtitle:e(`onboarding.authorSpecs.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.authorSpecs.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Kf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.exploreLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.exploreBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Vp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.quickLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.quickBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Mf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.websiteLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.websiteBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(vp,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.smashLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.smashBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(_p,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.draftsLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.draftsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(pf,{className:`w-4 h-4`}),label:e(`onboarding.authorSpecs.compareLabel`),accent:iq.info,children:e(`onboarding.authorSpecs.compareBody`)})]})]})},{navLabel:e(`onboarding.rails.nav`),icon:(0,q.jsx)(zp,{className:`w-6 h-6`}),accent:iq.success,title:e(`onboarding.rails.title`),subtitle:e(`onboarding.rails.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.rails.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`}),play:(0,q.jsx)(`span`,{className:`text-accent-warning font-medium`})}})}),(0,q.jsxs)(sq,{accent:iq.success,label:e(`onboarding.rails.jobLabel`),children:[(0,q.jsx)(cq,{steps:[{label:e(`onboarding.flow.architect`),cls:`text-accent-info`},{label:e(`onboarding.flow.developer`),cls:`text-accent-success`},{label:e(`onboarding.flow.reviewer`),cls:`text-accent-warning`},{label:e(`onboarding.flow.ship`),cls:`text-accent-secondary`}]}),(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e(`onboarding.rails.flowCaption`)})]}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Af,{className:`w-4 h-4`}),label:e(`onboarding.rails.modeLabel`),accent:iq.success,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.rails.modeBody`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Gd,{className:`w-4 h-4`}),label:e(`onboarding.rails.profilesLabel`),accent:iq.success,children:e(`onboarding.rails.profilesBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(kf,{className:`w-4 h-4`}),label:e(`onboarding.rails.jobDetailLabel`),accent:iq.success,children:e(`onboarding.rails.jobDetailBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Of,{className:`w-4 h-4`}),label:e(`onboarding.rails.isolationLabel`),accent:iq.success,children:e(`onboarding.rails.isolationBody`)})]})]})},{navLabel:e(`onboarding.providers.nav`),icon:(0,q.jsx)(Gd,{className:`w-6 h-6`}),accent:iq.secondary,title:e(`onboarding.providers.title`),subtitle:e(`onboarding.providers.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.providers.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`rounded-lg border border-border/40 overflow-hidden text-xs`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_1fr_1fr] bg-card/40`,children:[(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-muted-foreground`,children:e(`onboarding.providers.table.capability`)}),(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-accent-secondary text-center`,children:`Claude Code`}),(0,q.jsx)(`div`,{className:`px-3 py-2 font-semibold text-accent-success text-center`,children:`Codex CLI`})]}),[[e(`onboarding.providers.table.streamingResume`),e(`onboarding.providers.table.native`),e(`onboarding.providers.table.native`)],[e(`onboarding.providers.table.costReporting`),e(`onboarding.providers.table.providerBilled`),e(`onboarding.providers.table.estimated`)],[e(`onboarding.providers.table.telemetry`),e(`onboarding.providers.table.native`),e(`onboarding.providers.table.synthesized`)],[e(`onboarding.providers.table.agentProfiles`),e(`common:states.yes`),`—`]].map(e=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[1.4fr_1fr_1fr] border-t border-border/30`,children:[(0,q.jsx)(`div`,{className:`px-3 py-2 text-foreground/90`,children:e[0]}),(0,q.jsx)(`div`,{className:`px-3 py-2 text-center text-muted-foreground`,children:e[1]}),(0,q.jsx)(`div`,{className:`px-3 py-2 text-center text-muted-foreground`,children:e[2]})]},e[0]))]}),(0,q.jsx)(sq,{accent:iq.secondary,label:e(`onboarding.providers.calloutLabel`),children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.providers.calloutBody`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground`}),mono:(0,q.jsx)(`span`,{className:`font-mono`})}})})]})},{navLabel:e(`onboarding.cost.nav`),icon:(0,q.jsx)(ff,{className:`w-6 h-6`}),accent:iq.warning,title:e(`onboarding.cost.title`),subtitle:e(`onboarding.cost.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.cost.intro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(kf,{className:`w-4 h-4`}),label:e(`onboarding.cost.analyticsLabel`),accent:iq.warning,children:e(`onboarding.cost.analyticsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(dp,{className:`w-4 h-4`}),label:e(`onboarding.cost.perTicketLabel`),accent:iq.warning,children:e(`onboarding.cost.perTicketBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(yf,{className:`w-4 h-4`}),label:e(`onboarding.cost.honestLabel`),accent:iq.warning,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.cost.honestBody`,components:{mono:(0,q.jsx)(`span`,{className:`font-mono`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Rp,{className:`w-4 h-4`}),label:e(`onboarding.cost.budgetsLabel`),accent:iq.warning,children:e(`onboarding.cost.budgetsBody`)})]})]})},{navLabel:e(`onboarding.workspace.nav`),icon:(0,q.jsx)(Kd,{className:`w-6 h-6`}),accent:iq.highlight,title:e(`onboarding.workspace.title`),subtitle:e(`onboarding.workspace.subtitle`),content:(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-4`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Mp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.terminalLabel`),accent:iq.highlight,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.workspace.terminalBody`,values:{mod:nq},components:{mod:(0,q.jsx)(aq,{children:nq}),j:(0,q.jsx)(aq,{children:`J`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Cf,{className:`w-4 h-4`}),label:e(`onboarding.workspace.codeLabel`),accent:iq.highlight,children:e(`onboarding.workspace.codeBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(op,{className:`w-4 h-4`}),label:e(`onboarding.workspace.integrationsLabel`),accent:iq.highlight,children:e(`onboarding.workspace.integrationsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)($f,{className:`w-4 h-4`}),label:e(`onboarding.workspace.themesLabel`),accent:iq.highlight,children:e(`onboarding.workspace.themesBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(zf,{className:`w-4 h-4`}),label:e(`onboarding.workspace.chatsLabel`),accent:iq.highlight,children:e(`onboarding.workspace.chatsBody`)}),(0,q.jsx)(oq,{icon:(0,q.jsx)(mp,{className:`w-4 h-4`}),label:e(`onboarding.workspace.desktopLabel`),accent:iq.highlight,children:e(`onboarding.workspace.desktopBody`)})]})})},{navLabel:e(`onboarding.companion.nav`),icon:(0,q.jsx)(Tp,{className:`w-6 h-6`}),accent:iq.success,title:e(`onboarding.companion.title`),subtitle:e(`onboarding.companion.subtitle`),content:(0,q.jsx)(fq,{})},{navLabel:e(`onboarding.moveFast.nav`),icon:(0,q.jsx)(mf,{className:`w-6 h-6`}),accent:iq.primary,title:e(`onboarding.moveFast.title`),subtitle:e(`onboarding.moveFast.subtitle`),content:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(sq,{accent:iq.primary,label:e(`onboarding.moveFast.paletteLabel`),children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.paletteShortcut`,values:{mod:nq},components:{f:(0,q.jsx)(`span`,{className:`text-foreground`}),m:(0,q.jsx)(`span`,{className:`text-muted-foreground`}),mod:(0,q.jsx)(aq,{children:nq}),k:(0,q.jsx)(aq,{children:`K`})}})}),e(`onboarding.moveFast.paletteBody`)]}),(0,q.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-x-5 gap-y-3`,children:[(0,q.jsx)(oq,{icon:(0,q.jsx)(Mp,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.terminalLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.terminalBody`,values:{mod:nq},components:{mod:(0,q.jsx)(aq,{children:nq}),j:(0,q.jsx)(aq,{children:`J`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Lf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.shortcutsLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.shortcutsBody`,components:{q:(0,q.jsx)(aq,{children:`?`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Kf,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.chatLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.chatBody`,values:{mod:nq},components:{mod:(0,q.jsx)(aq,{children:nq}),bkey:(0,q.jsx)(aq,{children:`B`})}})}),(0,q.jsx)(oq,{icon:(0,q.jsx)(Of,{className:`w-4 h-4`}),label:e(`onboarding.moveFast.projectsLabel`),accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.projectsBody`,values:{alt:rq,mod:nq},components:{alt:(0,q.jsx)(aq,{children:rq}),mod:(0,q.jsx)(aq,{children:nq}),bkey:(0,q.jsx)(aq,{children:`B`})}})})]}),(0,q.jsx)(sq,{accent:iq.primary,children:(0,q.jsx)(zi,{t:e,i18nKey:`onboarding.moveFast.outro`,components:{b:(0,q.jsx)(`span`,{className:`text-foreground font-medium`})}})})]})}]}function mq({open:e,onClose:t}){let{t:n}=G(`setup`),[r,i]=(0,F.useState)(0),[a,o]=(0,F.useState)(!1),s=(0,F.useMemo)(()=>pq(n),[n]),c=s[r],l=r===0,u=r===s.length-1,d=(0,F.useCallback)(()=>{a&&eq(),i(0),t()},[a,t]),f=(0,F.useCallback)(()=>{eq(),i(0),t()},[t]),p=(0,F.useCallback)(()=>{u?f():i(e=>e+1)},[u,f]),m=(0,F.useCallback)(()=>i(e=>Math.max(0,e-1)),[]);return(0,q.jsx)(jy,{open:e,onOpenChange:e=>{e||d()},children:(0,q.jsxs)(My,{children:[(0,q.jsx)(Ny,{className:`fixed inset-0 z-50 bg-black/70 backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,q.jsxs)(Py,{className:`fixed left-[50%] top-[50%] z-50 flex flex-col w-[calc(100vw-2rem)] max-w-4xl max-h-[88vh] translate-x-[-50%] translate-y-[-50%] overflow-hidden border border-border/30 bg-popover shadow-2xl backdrop-blur-xl sm:rounded-2xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,"data-testid":`onboarding-wizard`,"aria-describedby":`onboarding-description`,children:[(0,q.jsx)(`div`,{className:X(`h-1 w-full shrink-0 transition-all duration-500`,c.accent.bar)}),(0,q.jsxs)(`div`,{className:`flex min-h-0`,children:[(0,q.jsxs)(`nav`,{className:`hidden md:flex w-60 shrink-0 flex-col border-r border-border/30 bg-card/20 p-4`,children:[(0,q.jsxs)(`div`,{className:`px-2 mb-5`,children:[(0,q.jsxs)(`p`,{className:`text-sm font-bold tracking-tight`,children:[(0,q.jsx)(`span`,{className:`text-accent-primary`,children:`spec`}),(0,q.jsx)(`span`,{className:`text-accent-secondary`,children:`rails`})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:n(`onboarding.productTour`)})]}),(0,q.jsx)(`ol`,{className:`space-y-0.5 min-h-0 overflow-y-auto`,children:s.map((e,t)=>{let a=t===r,o=t<r;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":n(`onboarding.goToStep`,{step:t+1,label:e.navLabel}),"aria-current":a?`step`:void 0,className:X(`w-full flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors`,a?X(`bg-card/70`,e.accent.text):`text-muted-foreground hover:bg-card/40 hover:text-foreground`),children:[(0,q.jsx)(`span`,{className:X(`grid place-items-center w-5 h-5 shrink-0 rounded-full text-[10px] font-bold border`,a?X(e.accent.bar,`text-primary-foreground border-transparent`):o?`bg-accent-success/15 text-accent-success border-accent-success/30`:`border-border/50 text-muted-foreground`),children:o?(0,q.jsx)(Zd,{className:`w-3 h-3`}):t+1}),(0,q.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.navLabel})]})},e.navLabel)})}),(0,q.jsx)(`div`,{className:`mt-auto px-2.5 pt-4 text-[10px] text-muted-foreground`,children:n(`onboarding.stepCount`,{current:r+1,total:s.length})})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 sm:p-7`,children:[(0,q.jsxs)(`div`,{className:X(`flex items-center gap-3.5 mb-5`,c.accent.text),children:[(0,q.jsx)(`div`,{className:X(`grid place-items-center w-12 h-12 shrink-0 rounded-xl border border-border/30 bg-card/40`,c.accent.glow),children:c.icon}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(Fy,{className:`text-lg font-bold leading-tight text-foreground`,children:c.title}),(0,q.jsx)(`p`,{id:`onboarding-description`,className:`text-xs text-muted-foreground mt-0.5`,children:c.subtitle})]})]}),(0,q.jsx)(`div`,{className:`md:hidden flex items-center gap-1.5 mb-5`,children:s.map((e,t)=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":n(`onboarding.stepLabel`,{step:t+1}),"aria-current":t===r?`step`:void 0,className:X(`h-1.5 rounded-full transition-all`,t===r?X(`w-6`,e.accent.bar):`w-1.5 bg-muted-foreground/30`)},e.navLabel))}),(0,q.jsx)(`div`,{className:`min-h-[300px]`,children:c.content})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border/30 px-6 sm:px-7 py-3.5`,children:[(0,q.jsx)(`div`,{className:`flex-1 min-w-0`,children:l&&(0,q.jsxs)(`label`,{className:`inline-flex items-center gap-2 cursor-pointer group`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),className:`w-3.5 h-3.5 rounded`,"data-testid":`onboarding-dismiss-checkbox`}),(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground group-hover:text-foreground transition-colors`,children:n(`onboarding.dontShowAgain`)})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l?(0,q.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:d,className:`text-xs text-muted-foreground`,"data-testid":`onboarding-skip`,children:n(`onboarding.skipTour`)}):(0,q.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:m,className:`text-xs`,"data-testid":`onboarding-back`,children:[(0,q.jsx)(zd,{className:`w-3.5 h-3.5 mr-1`}),n(`common:actions.back`)]}),(0,q.jsxs)(Z,{size:`sm`,onClick:p,className:X(`text-xs`,c.accent.btn),"data-testid":`onboarding-next`,children:[n(u?`onboarding.getStarted`:`common:actions.next`),!u&&(0,q.jsx)(Bd,{className:`w-3.5 h-3.5 ml-1`})]})]})]})]})]})]})]})})}var hq=[`pinned-open`,`pinned-collapsed`,`unpinned`],gq=`specrails-desktop:sidebar-mode:left`,_q=`specrails-desktop:sidebar-mode:right`;function vq(e){return typeof e==`string`&&hq.includes(e)}function yq(e){try{let t=window.localStorage.getItem(e);if(vq(t))return t}catch{}return`unpinned`}function bq(e,t){try{window.localStorage.setItem(e,t)}catch{}}function xq(e){switch(e){case`pinned-open`:return`pinned-collapsed`;case`pinned-collapsed`:return`unpinned`;case`unpinned`:return`pinned-open`}}var Sq=(0,F.createContext)({leftMode:`unpinned`,rightMode:`unpinned`,setLeftMode:()=>{},setRightMode:()=>{},cycleLeftMode:()=>{},cycleRightMode:()=>{}});function Cq({children:e}){let[t,n]=(0,F.useState)(()=>yq(gq)),[r,i]=(0,F.useState)(()=>yq(_q));(0,F.useEffect)(()=>{bq(gq,t)},[t]),(0,F.useEffect)(()=>{bq(_q,r)},[r]);let a=(0,F.useCallback)(e=>n(e),[]),o=(0,F.useCallback)(e=>i(e),[]),s=(0,F.useCallback)(()=>n(e=>xq(e)),[]),c=(0,F.useCallback)(()=>i(e=>xq(e)),[]),l=(0,F.useMemo)(()=>({leftMode:t,rightMode:r,setLeftMode:a,setRightMode:o,cycleLeftMode:s,cycleRightMode:c}),[t,r,a,o,s,c]);return(0,q.jsx)(Sq.Provider,{value:l,children:e})}function wq(){return(0,F.useContext)(Sq)}function Tq({project:e,isActive:t,expanded:n,onSelect:r,onRemove:i}){let{t:a}=G(`nav`),[o,s]=(0,F.useState)(!1),c=(0,F.useRef)(null);(0,F.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);function l(e){e.stopPropagation(),o?(c.current&&clearTimeout(c.current),s(!1),i()):(s(!0),c.current=setTimeout(()=>{s(!1),c.current=null},3e3))}function u(e){e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),r())}return(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:r,onKeyDown:u,className:X(`group relative flex items-center gap-2 w-full h-8 rounded-md transition-colors`,n?`px-2`:`px-0 justify-center`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),title:n?void 0:e.name,"aria-current":t?`page`:void 0,children:[(0,q.jsx)(Of,{className:X(`flex-shrink-0 w-4 h-4`,t&&`text-accent-primary`)}),n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-xs truncate flex-1 text-left`,children:e.name}),(0,q.jsx)(`button`,{type:`button`,onClick:l,className:X(`flex-shrink-0 flex items-center justify-center rounded-sm transition-all`,`opacity-0 group-hover:opacity-50 hover:!opacity-100 hover:bg-muted`,o?`opacity-100 px-1 h-4 text-[10px] text-destructive bg-destructive/10 hover:bg-destructive/20`:`w-3.5 h-3.5`),"aria-label":a(o?`projects.confirmRemove`:`projects.remove`,{name:e.name}),children:o?a(`projects.confirmShort`):(0,q.jsx)(Bp,{className:`w-2.5 h-2.5`})})]})]})}var Eq={"pinned-open":`sidebarPin.left.pinnedOpen`,"pinned-collapsed":`sidebarPin.left.pinnedCollapsed`,unpinned:`sidebarPin.left.unpinned`};function Dq({onAddProject:e,onOpenAnalytics:t,onOpenDocs:n,onOpenSettings:r}){let{t:i}=G(`nav`),{projects:a,activeProjectId:o,setActiveProjectId:s,removeProject:c}=yd(),{leftMode:l,cycleLeftMode:u}=wq(),[d,f]=(0,F.useState)(!1),p=l===`pinned-open`||l===`unpinned`&&d,m=l!==`unpinned`,h=i(Eq[l]),g=[{label:i(`arcSidebar.docs`),icon:Wd,action:n},{label:i(`arcSidebar.analytics`),icon:Yd,action:t},{label:i(`arcSidebar.settings`),icon:Cp,action:r}];async function _(e){try{await c(e.id)}catch{}}return(0,q.jsxs)(`div`,{className:X(`relative flex flex-col h-full border-r border-border bg-background flex-shrink-0`,`transition-all duration-200 ease-in-out overflow-hidden`,p?`w-52`:`w-11`),onMouseEnter:()=>{l===`unpinned`&&f(!0)},onMouseLeave:()=>{l===`unpinned`&&f(!1)},children:[(0,q.jsxs)(`div`,{className:X(`flex items-center h-12 border-b border-border flex-shrink-0`,p?`px-3 justify-between`:`justify-center`),children:[p&&(0,q.jsx)(`span`,{className:`font-mono text-sm font-bold whitespace-nowrap overflow-hidden text-accent-primary`,children:i(`arcSidebar.desktopTitle`)}),(0,q.jsx)(`button`,{type:`button`,onClick:u,className:X(`flex items-center justify-center w-7 h-7 rounded-md transition-colors flex-shrink-0`,m?`text-foreground bg-muted`:`text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/50`),"aria-label":h,title:i(`sidebarPin.withShortcut`,{label:h,shortcut:`⌥⌘B`}),children:(0,q.jsx)(ep,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1.5 space-y-0.5`,children:[a.map(e=>(0,q.jsx)(Tq,{project:e,isActive:e.id===o,expanded:p,onSelect:()=>s(e.id),onRemove:()=>_(e)},e.id)),(0,q.jsxs)(`button`,{type:`button`,onClick:e,className:X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted/50`,p?`px-2`:`px-0 justify-center`),"aria-label":i(`projects.addProject`),title:p?void 0:i(`projects.addProject`),children:[(0,q.jsx)(sp,{className:`w-4 h-4 flex-shrink-0`}),p&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap`,children:i(`projects.addProject`)})]})]}),(0,q.jsx)(`div`,{className:`border-t border-border py-2 px-1.5 space-y-0.5`,children:g.map(({label:e,icon:t,action:n})=>(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted/50`,p?`px-2`:`px-0 justify-center`),"aria-label":e,title:p?void 0:e,children:[(0,q.jsx)(t,{className:`w-4 h-4 flex-shrink-0`}),p&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap`,children:e})]},e))})]})}var Oq={"pinned-open":`sidebarPin.right.pinnedOpen`,"pinned-collapsed":`sidebarPin.right.pinnedCollapsed`,unpinned:`sidebarPin.right.unpinned`};function kq(){let{t:e}=G(`nav`),{rightMode:t,cycleRightMode:n}=wq(),{projects:r,activeProjectId:i}=yd(),[a,o]=(0,F.useState)(!1),s=t===`pinned-open`||t===`unpinned`&&a,c=t!==`unpinned`,l=e(Oq[t]),u=r.find(e=>e.id===i),d=u?fd(u):[`claude`],f=nB&&jE(`agents`,d),p=jE(`integrations`,d),m=[{to:`/`,end:!0,icon:Bf,label:e(`rightSidebar.dashboard`)},{to:`/jobs`,end:!1,icon:qd,label:e(`rightSidebar.jobs`)},{to:`/analytics`,end:!1,icon:Jd,label:e(`rightSidebar.analytics`)},...f?[{to:`/agents`,end:!1,icon:Gd,label:e(`rightSidebar.agents`)}]:[],...rB?[{to:`/code`,end:!1,icon:uf,label:e(`rightSidebar.code`)}]:[],...p?[{to:`/integrations`,end:!1,icon:cp,label:e(`rightSidebar.integrations`)}]:[],{to:`/settings`,end:!1,icon:Cp,label:e(`rightSidebar.settings`)}];return(0,q.jsxs)(`div`,{className:X(`relative flex flex-col h-full border-l border-border bg-background flex-shrink-0`,`transition-all duration-200 ease-in-out overflow-hidden`,s?`w-44`:`w-11`),onMouseEnter:()=>{t===`unpinned`&&o(!0)},onMouseLeave:()=>{t===`unpinned`&&o(!1)},children:[(0,q.jsxs)(`div`,{className:X(`flex items-center h-12 border-b border-border flex-shrink-0`,s?`px-3 justify-between`:`justify-center`),children:[s&&(0,q.jsx)(`span`,{className:`font-mono text-sm font-bold whitespace-nowrap overflow-hidden text-accent-secondary`,children:e(`rightSidebar.projectTitle`)}),(0,q.jsx)(`button`,{type:`button`,onClick:n,className:X(`flex items-center justify-center w-7 h-7 rounded-md transition-colors`,c?`text-foreground bg-muted`:`text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/50`),"aria-label":l,title:e(`sidebarPin.withShortcut`,{label:l,shortcut:`⌘B`}),children:(0,q.jsx)(tp,{className:`w-4 h-4`})})]}),(0,q.jsx)(`nav`,{className:`flex-1 py-2 px-1.5 space-y-0.5`,children:m.map(({to:e,end:t,icon:n,label:r})=>(0,q.jsxs)(Mn,{to:e,end:t,className:({isActive:e})=>X(`flex items-center gap-2 w-full h-8 rounded-md transition-colors`,s?`px-2`:`px-0 justify-center`,e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),title:s?void 0:r,children:[(0,q.jsx)(n,{className:`w-4 h-4 flex-shrink-0`}),s&&(0,q.jsx)(`span`,{className:`text-xs truncate`,children:r})]},e))})]})}function Aq(e){return{darwin:{title:`macOS`,intro:e(`setup:instructions.darwin.intro`),commands:[{label:e(`setup:instructions.darwin.installNodeGit`),command:`brew install node git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitOfficial`),url:`https://git-scm.com/downloads`},{label:`Homebrew`,url:`https://brew.sh`}]},win32:{title:`Windows`,intro:e(`setup:instructions.win32.intro`),commands:[{label:e(`setup:instructions.win32.installNode`),command:`winget install OpenJS.NodeJS.LTS`},{label:e(`setup:instructions.win32.installGit`),command:`winget install Git.Git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitWindows`),url:`https://git-scm.com/download/win`}],note:e(`setup:instructions.win32.note`)},linux:{title:`Linux`,intro:e(`setup:instructions.linux.intro`),commands:[{label:e(`setup:instructions.linux.debian`),command:`sudo apt install -y nodejs npm git`},{label:e(`setup:instructions.linux.fedora`),command:`sudo dnf install -y nodejs npm git`}],links:[{label:e(`setup:instructions.links.nodeOfficial`),url:`https://nodejs.org/en/download`},{label:e(`setup:instructions.links.gitOfficial`),url:`https://git-scm.com/downloads`}]}}}var jq=[`darwin`,`win32`,`linux`];async function Mq(e){try{if(navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function Nq({command:e}){let{t}=G(`setup`),[n,r]=(0,F.useState)(!1);return(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:async()=>{await Mq(e)&&(r(!0),window.setTimeout(()=>r(!1),1500))},className:`h-7 px-2 gap-1.5 text-[11px]`,"data-testid":`install-copy-button`,children:n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Zd,{className:`w-3 h-3`}),t(`common:actions.copied`)]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(hf,{className:`w-3 h-3`}),t(`common:actions.copy`)]})})}function Pq({platform:e,primary:t}){let{t:n}=G(`setup`),r=Aq(n)[e];return(0,q.jsxs)(`section`,{"data-testid":`install-section-${e}`,className:X(`rounded-lg border px-3 py-3`,t?`border-border/40 bg-background/40`:`border-border/20 bg-background/20`),children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:r.title}),r.intro&&(0,q.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:r.intro}),(0,q.jsx)(`div`,{className:`mt-2 space-y-2`,children:r.commands.map(e=>(0,q.jsxs)(`div`,{className:`rounded-md border border-border/30 bg-background/60 px-2 py-2`,children:[(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground mb-1`,children:e.label}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`code`,{className:`text-xs text-foreground font-mono break-all`,children:e.command}),(0,q.jsx)(Nq,{command:e.command})]})]},e.command))}),r.links.length>0&&(0,q.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1`,children:r.links.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-accent-info hover:underline`,children:[e.label,(0,q.jsx)(Sf,{className:`w-3 h-3`})]})},e.url))}),r.note&&(0,q.jsx)(`p`,{className:`mt-2 text-[11px] text-accent-highlight`,children:r.note})]})}function Fq(){let{t:e}=G(`setup`),[t,n]=(0,F.useState)(`idle`);return(0,q.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:async()=>{n(`copying`);try{let e=await fetch(`${ol}/api/setup-prerequisites?diagnostic=1`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();await navigator.clipboard.writeText(JSON.stringify(t,null,2)),n(`copied`),setTimeout(()=>n(`idle`),1800)}catch{n(`error`),setTimeout(()=>n(`idle`),2400)}},disabled:t===`copying`,className:`gap-1.5 text-[11px]`,"data-testid":`copy-diagnostics-button`,children:[t===`copied`?(0,q.jsx)(Zd,{className:`w-3 h-3 text-accent-success`}):(0,q.jsx)(cf,{className:`w-3 h-3`}),e(t===`copied`?`instructions.diagnostics.copied`:t===`error`?`instructions.diagnostics.failed`:`instructions.diagnostics.copy`)]})}function Iq({open:e,onClose:t,status:n,onRecheck:r,isRechecking:i}){let{t:a}=G(`setup`),[o,s]=(0,F.useState)(!1),c=n?.platform??`darwin`,l=jq.filter(e=>e!==c);return n?.missingRequired?.some(e=>e.error===`corrupted-bundle`)??!1?(0,q.jsx)(Ry,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Vy,{className:`max-w-xl`,"data-testid":`install-modal-corrupted-bundle`,children:[(0,q.jsxs)(Hy,{children:[(0,q.jsx)(Wy,{children:a(`instructions.corrupted.title`)}),(0,q.jsx)(Gy,{children:a(`instructions.corrupted.description`)})]}),(0,q.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`instructions.corrupted.body`)}),(0,q.jsx)(`div`,{className:`flex justify-end mt-2`,children:(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,"data-testid":`install-corrupted-close-button`,children:a(`common:actions.close`)})})]})}):(0,q.jsx)(Ry,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(Vy,{className:`max-w-xl`,children:[(0,q.jsxs)(Hy,{children:[(0,q.jsx)(Wy,{children:a(`instructions.title`)}),(0,q.jsx)(Gy,{children:a(`instructions.description`)})]}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsx)(Pq,{platform:c,primary:!0}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-[11px] text-muted-foreground hover:text-foreground underline-offset-2 hover:underline`,"data-testid":`install-toggle-others`,children:a(o?`instructions.hideOtherPlatforms`:`instructions.showOtherPlatforms`)}),o&&(0,q.jsx)(`div`,{className:`space-y-3`,children:l.map(e=>(0,q.jsx)(Pq,{platform:e,primary:!1},e))})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mt-2`,children:[(0,q.jsx)(Fq,{}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:a(`common:actions.close`)}),(0,q.jsxs)(Z,{type:`button`,variant:`default`,size:`sm`,onClick:r,disabled:i,className:`gap-1.5`,"data-testid":`install-recheck-button`,children:[(0,q.jsx)(pp,{className:X(`w-3 h-3`,i&&`animate-spin`)}),a(`instructions.recheck`)]})]})]})]})})}var Lq=typeof window<`u`&&`__TAURI_INTERNALS__`in window,Rq=[`claude`,`codex`];function zq({open:e,onClose:t}){let[n,i]=(0,F.useState)(new Set([`claude`])),[a,o]=(0,F.useState)(``),[s,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)({claude:!0,codex:!1}),[p,m]=(0,F.useState)(!1),{t:h}=G(`setup`),{addProject:g,startSetupWizard:_,setActiveProjectId:v}=yd(),{status:y,isLoading:b,error:x,recheck:S}=MK(),C=(0,F.useMemo)(()=>{if(!y||y.ok)return null;let e=y.missingRequired.map(e=>e.label);return e.length===0?null:h(`addProject.toolsRequired`,{tools:e.join(`, `),count:e.length})},[y,h]),w=y!==null&&!y.ok&&!x;(0,F.useEffect)(()=>{e&&fetch(`/api/available-providers`).then(e=>e.json()).then(e=>{let t=!!e.claude,n=!!e.codex;f({claude:t,codex:n});let r=new Set;t&&r.add(`claude`),n&&r.add(`codex`),r.size===0&&r.add(`claude`),i(r)}).catch(()=>{})},[e]);function T(e){i(t=>{let n=new Set(t);if(n.has(e)){if(n.size===1)return t;n.delete(e)}else n.add(e);return n})}let E=Rq.filter(e=>n.has(e)&&d[e]);async function D(){let e=a.trim();if(!e){K.error(h(`addProject.errors.pathRequired`));return}if(E.length===0){K.error(h(`addProject.errors.selectProvider`));return}u(!0);try{let t=await g(e,s.trim()||void 0,E);if(!t)return;let{project:n}=t;t.has_specrails===!1?(O(),v(n.id),_(n.id)):(K.success(h(`addProject.toasts.registered`,{name:n.name})),O())}catch(e){K.error(h(`addProject.errors.addFailed`),{description:e.message})}finally{u(!1)}}function O(){o(``),c(``),t()}function k(e){e||O()}let A=!d.claude&&!d.codex;return(0,q.jsx)(Ry,{open:e,onOpenChange:k,children:(0,q.jsxs)(Vy,{className:`max-w-md`,children:[(0,q.jsxs)(Hy,{children:[(0,q.jsxs)(Wy,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Of,{className:`w-4 h-4`}),h(`addProject.title`)]}),(0,q.jsx)(Gy,{children:h(`addProject.description`)})]}),A&&(0,q.jsx)(`p`,{className:`text-xs text-destructive bg-destructive/10 rounded-md p-2`,children:h(`addProject.noProviderDetected`)}),(0,q.jsx)(PK,{status:y,isLoading:b,error:x,onMoreInfo:()=>m(!0),onRefresh:S}),(0,q.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{className:`text-xs font-medium`,children:[h(`addProject.pathLabel`),` `,(0,q.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(jV,{placeholder:h(`addProject.pathPlaceholder`),value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&D()},autoFocus:!0,className:`flex-1`}),Lq&&(0,q.jsx)(Z,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,title:h(`addProject.browseForFolder`),onClick:async()=>{try{let{open:e}=await r(async()=>{let{open:e}=await import(`./dist-js-BvQ52Q67.js`);return{open:e}},[]),t=await e({directory:!0,multiple:!1,title:h(`addProject.selectProjectFolder`)});typeof t==`string`&&t&&(o(t),s||c(t.split(`/`).filter(Boolean).pop()??``))}catch{}},children:(0,q.jsx)(Of,{className:`w-4 h-4`})})]}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:h(`addProject.pathHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`label`,{className:`text-xs font-medium`,children:[h(`addProject.nameLabel`),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:h(`addProject.optional`)})]}),(0,q.jsx)(jV,{placeholder:h(`addProject.namePlaceholder`),value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&D()}}),(0,q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:h(`addProject.nameHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:h(`addProject.providersLabel`)}),(0,q.jsx)(`div`,{className:`flex gap-2`,children:[{id:`claude`,icon:`🤖`,label:`Claude`},{id:`codex`,icon:`⚡`,label:`Codex`}].map(({id:e,icon:t,label:r})=>{let i=d[e],a=n.has(e)&&i;return(0,q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":a,disabled:!i,onClick:()=>T(e),"data-testid":`provider-toggle-${e}`,className:X(`flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-left transition-colors text-xs`,`focus:outline-none focus-visible:ring-1 focus-visible:ring-ring`,a?`border-accent-primary/60 bg-accent-primary/10 text-foreground`:`border-border/30 text-muted-foreground hover:border-border/60`,!i&&`opacity-40 cursor-not-allowed`),children:[(0,q.jsx)(`span`,{className:X(`inline-flex h-3.5 w-3.5 items-center justify-center rounded-sm border text-[9px] leading-none`,a?`border-accent-primary bg-accent-primary text-background`:`border-border/50`),"aria-hidden":!0,children:a?`✓`:``}),(0,q.jsx)(`span`,{children:t}),(0,q.jsx)(`span`,{className:`font-medium`,children:r}),!i&&(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground/60`,children:h(`addProject.notFound`)})]},e)})}),(0,q.jsx)(`p`,{className:`text-[9px] text-muted-foreground/70`,children:E.length>1?h(`addProject.multiProviderHint`):h(`addProject.singleProviderHint`)})]})]}),(0,q.jsxs)(Uy,{children:[(0,q.jsx)(Z,{variant:`outline`,size:`sm`,onClick:t,disabled:l,children:h(`common:actions.cancel`)}),(0,q.jsx)(Z,{size:`sm`,onClick:D,disabled:l||!a.trim()||A||E.length===0||w||b,title:w?C??void 0:void 0,"data-testid":`add-project-submit`,children:h(l?`addProject.adding`:`addProject.submit`)})]}),(0,q.jsx)(Iq,{open:p,onClose:()=>m(!1),status:y,onRecheck:S,isRechecking:b})]})})}var Bq=1,Vq=.9,Hq=.8,Uq=.17,Wq=.1,Gq=.999,Kq=.9999,qq=.99,Jq=/[\\\/_+.#"@\[\(\{&]/,Yq=/[\\\/_+.#"@\[\(\{&]/g,Xq=/[\s-]/,Zq=/[\s-]/g;function Qq(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Bq:qq;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Qq(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Bq:Jq.test(e.charAt(l-1))?(d*=Hq,p=e.slice(i,l-1).match(Yq),p&&i>0&&(d*=Gq**+p.length)):Xq.test(e.charAt(l-1))?(d*=Vq,m=e.slice(i,l-1).match(Zq),m&&i>0&&(d*=Gq**+m.length)):(d*=Uq,i>0&&(d*=Gq**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Kq)),(d<Wq&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Qq(e,t,n,r,l+1,a+2,o),f*Wq>d&&(d=f*Wq)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function $q(e){return e.toLowerCase().replace(Zq,` `)}function eJ(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Qq(e,t,$q(e),$q(t),0,0,{})}var tJ=`[cmdk-group=""]`,nJ=`[cmdk-group-items=""]`,rJ=`[cmdk-group-heading=""]`,iJ=`[cmdk-item=""]`,aJ=`${iJ}:not([aria-disabled="true"])`,oJ=`cmdk-item-select`,sJ=`data-value`,cJ=(e,t,n)=>eJ(e,t,n),lJ=F.createContext(void 0),uJ=()=>F.useContext(lJ),dJ=F.createContext(void 0),fJ=()=>F.useContext(dJ),pJ=F.createContext(void 0),mJ=F.forwardRef((e,t)=>{let n=OJ(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=OJ(()=>new Set),i=OJ(()=>new Map),a=OJ(()=>new Map),o=OJ(()=>new Set),s=EJ(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Dg(),y=Dg(),b=Dg(),x=F.useRef(null),S=jJ();DJ(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),DJ(()=>{S(6,k)},[]);let C=F.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=F.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??cJ;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(nJ);t?t.appendChild(e.parentElement===t?e:e.closest(`${nJ} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${nJ} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${tJ}[${sJ}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(sJ);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(tJ)?.querySelector(rJ))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${iJ}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(aJ)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(sJ))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(sJ))}function P(e){let t=A()?.closest(tJ),n;for(;t&&!n;)t=e>0?wJ(t,tJ):TJ(t,tJ),n=t?.querySelector(aJ);n?C.setState(`value`,n.getAttribute(sJ)):N(e)}let I=()=>M(j().length-1),L=e=>{e.preventDefault(),e.metaKey?I():e.altKey?P(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return F.createElement(Rg.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(oJ);t.dispatchEvent(e)}}}}},F.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:PJ},c),NJ(e,e=>F.createElement(dJ.Provider,{value:C},F.createElement(lJ.Provider,{value:w},e))))}),hJ=F.forwardRef((e,t)=>{let n=Dg(),r=F.useRef(null),i=F.useContext(pJ),a=uJ(),o=EJ(e),s=o.current?.forceMount??i?.forceMount;DJ(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=AJ(n,r,[e.value,e.children,r],e.keywords),l=fJ(),u=kJ(e=>e.value&&e.value===c.current),d=kJ(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);F.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(oJ,f),()=>t.removeEventListener(oJ,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return F.createElement(Rg.div,{ref:Up(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),gJ=F.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Dg(),s=F.useRef(null),c=F.useRef(null),l=Dg(),u=uJ(),d=kJ(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);DJ(()=>u.group(o),[]),AJ(o,s,[e.value,e.heading,c]);let f=F.useMemo(()=>({id:o,forceMount:i}),[i]);return F.createElement(Rg.div,{ref:Up(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&F.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),NJ(e,e=>F.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},F.createElement(pJ.Provider,{value:f},e))))}),_J=F.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=F.useRef(null),a=kJ(e=>!e.search);return!n&&!a?null:F.createElement(Rg.div,{ref:Up(i,t),...r,"cmdk-separator":``,role:`separator`})}),vJ=F.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=fJ(),o=kJ(e=>e.search),s=kJ(e=>e.selectedItemId),c=uJ();return F.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),F.createElement(Rg.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),yJ=F.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=F.useRef(null),o=F.useRef(null),s=kJ(e=>e.selectedItemId),c=uJ();return F.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),F.createElement(Rg.div,{ref:Up(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},NJ(e,e=>F.createElement(`div`,{ref:Up(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),bJ=F.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return F.createElement(jy,{open:n,onOpenChange:r},F.createElement(My,{container:o},F.createElement(Ny,{"cmdk-overlay":``,className:i}),F.createElement(Py,{"aria-label":e.label,"cmdk-dialog":``,className:a},F.createElement(mJ,{ref:t,...s}))))}),xJ=F.forwardRef((e,t)=>kJ(e=>e.filtered.count===0)?F.createElement(Rg.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),SJ=F.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return F.createElement(Rg.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},NJ(e,e=>F.createElement(`div`,{"aria-hidden":!0},e)))}),CJ=Object.assign(mJ,{List:yJ,Item:hJ,Input:vJ,Group:gJ,Separator:_J,Dialog:bJ,Empty:xJ,Loading:SJ});function wJ(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function TJ(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function EJ(e){let t=F.useRef(e);return DJ(()=>{t.current=e}),t}var DJ=typeof window>`u`?F.useEffect:F.useLayoutEffect;function OJ(e){let t=F.useRef();return t.current===void 0&&(t.current=e()),t}function kJ(e){let t=fJ(),n=()=>e(t.snapshot());return F.useSyncExternalStore(t.subscribe,n,n)}function AJ(e,t,n,r=[]){let i=F.useRef(),a=uJ();return DJ(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(sJ,s),i.current=s}),i}var jJ=()=>{let[e,t]=F.useState(),n=OJ(()=>new Map);return DJ(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function MJ(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function NJ({asChild:e,children:t},n){return e&&F.isValidElement(t)?F.cloneElement(MJ(t),{ref:t.ref},n(t.props.children)):n(t)}var PJ={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function FJ({onOpenSettings:e,onOpenAnalytics:t,onOpenDocs:n}){let{t:r}=G(`commands`),[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)([]),[c,l]=(0,F.useState)([]),{projects:u,activeProjectId:d,setActiveProjectId:f}=yd(),{leftMode:p,rightMode:m,cycleLeftMode:h,cycleRightMode:g}=wq(),_=r(p===`pinned-open`?`palette.sidebar.collapseLeftKeepPinned`:p===`pinned-collapsed`?`palette.sidebar.unpinLeft`:`palette.sidebar.pinLeftOpen`),v=r(m===`pinned-open`?`palette.sidebar.collapseRightKeepPinned`:m===`pinned-collapsed`?`palette.sidebar.unpinRight`:`palette.sidebar.pinRightOpen`),y=st(),b=(0,F.useRef)(!1);(0,F.useEffect)(()=>{function e(e){e.key===`k`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),a(e=>!e))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,F.useEffect)(()=>{if(!i){b.current=!1;return}if(b.current)return;b.current=!0;async function e(){try{let[e,t]=await Promise.all([fetch(`${ll()}/config`),fetch(`${ll()}/jobs?limit=10`)]);e.ok&&s((await e.json()).commands),t.ok&&l((await t.json()).jobs)}catch{}}e()},[i]);let x=(0,F.useCallback)(e=>{f(e),a(!1)},[f]),S=(0,F.useCallback)(async e=>{a(!1);try{let t=await fetch(`${ll()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:`/specrails:${e}`})}),n=await t.json();if(!t.ok)throw Error(n.error??r(`errors.spawnFailed`));K.success(r(`toasts.queued`,{name:e})),y(`/jobs/${n.jobId}`)}catch(e){K.error(e instanceof Error?e.message:r(`errors.spawnFailed`))}},[y,r]),C=(0,F.useCallback)(e=>{a(!1),y(`/jobs/${e}`)},[y]),w=(0,F.useCallback)(e=>{a(!1),y(e)},[y]),T=(0,F.useCallback)(e=>{e&&(a(!1),e())},[]),E=`flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer text-sm data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground`;return(0,q.jsxs)(CJ.Dialog,{open:i,onOpenChange:a,label:r(`palette.label`),className:X(`fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%]`,`border border-border/30 bg-popover shadow-2xl backdrop-blur-md rounded-xl overflow-hidden`),children:[(0,q.jsx)(`span`,{className:`sr-only`,children:r(`palette.label`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 border-b border-border/30`,children:[(0,q.jsx)(bp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(CJ.Input,{placeholder:r(`palette.searchPlaceholder`),className:`flex-1 h-11 bg-transparent text-sm outline-none placeholder:text-muted-foreground/50`}),(0,q.jsx)(`kbd`,{className:`hidden sm:inline-flex items-center gap-0.5 rounded border border-border/50 bg-muted/30 px-1.5 py-0.5 text-[10px] text-muted-foreground font-mono`,children:`esc`})]}),(0,q.jsxs)(CJ.List,{className:`max-h-80 overflow-y-auto p-2`,children:[(0,q.jsx)(CJ.Empty,{className:`py-8 text-center text-sm text-muted-foreground`,children:r(`palette.noResults`)}),u.length>0&&(0,q.jsx)(CJ.Group,{heading:r(`palette.groups.projects`),children:u.map(e=>(0,q.jsxs)(CJ.Item,{value:e.name,keywords:[e.slug],onSelect:()=>x(e.id),className:X(E,e.id===d&&`text-accent-primary`),children:[(0,q.jsx)(Of,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.id===d&&(0,q.jsx)(`span`,{className:`text-[10px] text-accent-primary font-medium`,children:r(`palette.activeBadge`)})]},e.id))}),o.length>0&&(0,q.jsx)(CJ.Group,{heading:r(`palette.groups.spec`),children:o.map(e=>(0,q.jsxs)(CJ.Item,{value:e.name,keywords:[e.slug,e.description??``],onSelect:()=>S(e.slug),className:E,children:[(0,q.jsx)(Vp,{className:`w-4 h-4 text-accent-info shrink-0`}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.name}),e.description&&(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60 ml-2 truncate`,children:e.description})]})]},e.id))}),c.length>0&&(0,q.jsx)(CJ.Group,{heading:r(`palette.groups.jobs`),children:c.map(e=>(0,q.jsxs)(CJ.Item,{value:`${e.command} ${e.id}`,keywords:[e.status],onSelect:()=>C(e.id),className:E,children:[(0,q.jsx)(qd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.command}),(0,q.jsx)(`span`,{className:X(`text-[10px] font-medium`,e.status===`completed`&&`text-accent-success`,e.status===`failed`&&`text-destructive`,e.status===`running`&&`text-accent-info`,e.status===`queued`&&`text-muted-foreground`),children:r(`common:status.${e.status}`,{defaultValue:e.status})})]},e.id))}),(0,q.jsxs)(CJ.Group,{heading:r(`palette.groups.navigation`),children:[(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.dashboard`),keywords:[`home`],onSelect:()=>w(`/`),className:E,children:[(0,q.jsx)(Bf,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.dashboard`)})]}),t&&(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.desktopAnalytics`),keywords:[`cross-project`,`desktop`],onSelect:()=>T(t),className:E,children:[(0,q.jsx)(Xd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.desktopAnalytics`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.projectAnalytics`),keywords:[`metrics`],onSelect:()=>w(`/analytics`),className:E,children:[(0,q.jsx)(Jd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.projectAnalytics`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.activityFeed`),keywords:[`log`],onSelect:()=>w(`/activity`),className:E,children:[(0,q.jsx)(Fd,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.activityFeed`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.desktopSettings`),keywords:[`configuration`],onSelect:()=>e?T(e):w(`/settings`),className:E,children:[(0,q.jsx)(Cp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.desktopSettings`)})]}),(0,q.jsxs)(CJ.Item,{value:r(`palette.nav.docs`),keywords:[`documentation`],onSelect:()=>n?T(n):w(`/docs`),className:E,children:[(0,q.jsx)(Ef,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:r(`palette.nav.docs`)})]}),(0,q.jsxs)(CJ.Item,{value:_,keywords:[`sidebar`,`panel`,`left`,`pin`,`collapse`,`unpin`,`cycle`],onSelect:()=>{h(),a(!1)},className:E,children:[(0,q.jsx)(ep,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:_})]}),(0,q.jsxs)(CJ.Item,{value:v,keywords:[`sidebar`,`panel`,`right`,`nav`,`pin`,`collapse`,`unpin`,`cycle`],onSelect:()=>{g(),a(!1)},className:E,children:[(0,q.jsx)(tp,{className:`w-4 h-4 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{children:v})]})]})]}),(0,q.jsx)(`div`,{className:`flex items-center justify-between px-3 py-2 border-t border-border/30 text-[10px] text-muted-foreground/50`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`↑↓`}),` `,r(`palette.footer.navigate`)]}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`↵`}),` `,r(`palette.footer.select`)]}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`font-mono`,children:`esc`}),` `,r(`palette.footer.close`)]})]})})]})}var IJ=`
137
137
 
138
138
  ---
139
139
 
140
140
  ## Contract Layer
141
141
 
142
- `;function LJ(e){return`contract-refine:${e}`}async function RJ(e,t){try{let n=await fetch(`${ol}/api/projects/${e}/tickets/${t}/contract-refine`,{method:`POST`});if(n.ok)K.loading(J.t(`activity:contractRefine.refining`),{id:LJ(t)});else{let e=await n.json().catch(()=>({}));K.error(e.error?J.t(`activity:contractRefine.retryRejectedWithError`,{error:e.error}):J.t(`activity:contractRefine.retryRejected`),{id:LJ(t)})}}catch(e){K.error(J.t(`activity:contractRefine.retryFailed`,{message:e.message}),{id:LJ(t)})}}function zJ({children:e}){let{registerHandler:t,unregisterHandler:n}=bl(),r=(0,F.useRef)(new Map),i=(0,F.useCallback)(e=>{let t=e;if(!t||t.type!==`explore.contract_refine_failed`)return;let n=t.ticketId,i=t.projectId,a=t.reason??`unknown`;typeof n!=`number`||!i||(r.current.set(n,i),K.error(J.t(`activity:contractRefine.skipped`),{id:LJ(n),description:J.t(`activity:contractRefine.reason`,{reason:a}),action:{label:J.t(`common:actions.retry`),onClick:()=>void RJ(i,n)},duration:15e3}))},[]),a=(0,F.useCallback)(e=>{let t=e;if(!t||t.type!==`ticket_updated`)return;let n=t.ticket;n&&typeof n.description==`string`&&n.description.includes(IJ)&&K.success(J.t(`activity:contractRefine.added`,{title:n.title||`#${n.id}`}),{id:LJ(n.id),duration:3500})},[]);return(0,F.useLayoutEffect)(()=>(t(`_contract_refine_failed`,i),t(`_contract_refine_ticket_updated`,a),()=>{n(`_contract_refine_failed`),n(`_contract_refine_ticket_updated`)}),[t,n,i,a]),(0,F.useEffect)(()=>()=>r.current.clear(),[]),(0,q.jsx)(q.Fragment,{children:e})}var BJ=class extends AU{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,t){HJ(t);let n=new kU;e&&(n.onmessage=e);let r=await $(`plugin:updater|download`,{onEvent:n,rid:this.rid,...t});this.downloadedBytes=new AU(r)}async install(){if(!this.downloadedBytes)throw Error(`Update.install called before Update.download`);await $(`plugin:updater|install`,{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(e,t){HJ(t);let n=new kU;e&&(n.onmessage=e),await $(`plugin:updater|download_and_install`,{onEvent:n,rid:this.rid,...t})}async close(){await this.downloadedBytes?.close(),await super.close()}};async function VJ(e){HJ(e);let t=await $(`plugin:updater|check`,{...e});return t?new BJ(t):null}function HJ(e){e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries()))}async function UJ(){await $(`plugin:process|restart`)}var WJ=`specrails-desktop:dismissedDesktopUpdateVersion`,GJ=`specrails-desktop-desktop-update`,KJ=360*60*1e3;function qJ(){return typeof window<`u`&&`__TAURI_INTERNALS__`in window}function JJ(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_MOCK_DESKTOP_UPDATE===`true`}function YJ(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_MOCK_DESKTOP_UPDATE_VERSION||`99.0.0-test`}function XJ(e){return new Promise(t=>setTimeout(t,e))}function ZJ(){return{currentVersion:`1.40.1`,version:YJ(),isMock:!0,async downloadAndInstall(e){let t=18*1024*1024;e({event:`Started`,data:{contentLength:t}});for(let n=0;n<12;n+=1)await XJ(180),e({event:`Progress`,data:{chunkLength:Math.round(t/12)}});e({event:`Finished`})}}}function QJ(e){return e<1024*1024?J.t(`commands:update.units.kb`,{value:Math.max(1,Math.round(e/1024))}):J.t(`commands:update.units.mb`,{value:(e/(1024*1024)).toFixed(1)})}function $J(){try{return localStorage.getItem(WJ)}catch{return null}}function eY(e){try{localStorage.setItem(WJ,e)}catch{}K.dismiss(GJ)}function tY(e){switch(e){case`downloading`:return`var(--color-accent-info)`;case`ready`:return`var(--color-accent-success)`;default:return`var(--color-accent-primary)`}}function nY({state:e}){let t=`h-[15px] w-[15px]`;return e===`installing`?(0,q.jsx)(df,{className:`${t} u-spin`,"aria-hidden":!0}):e===`ready`?(0,q.jsx)(Zd,{className:`${t} u-check`,"aria-hidden":!0}):e===`error`?(0,q.jsx)(Fp,{className:t,"aria-hidden":!0}):(0,q.jsx)(lf,{className:t,"aria-hidden":!0})}function rY({state:e,progress:t}){let n=e===`downloading`&&t!=null,r=e===`installing`||e===`downloading`&&t==null,i=e===`ready`;return(0,q.jsxs)(`div`,{className:`relative h-1.5 w-full overflow-hidden rounded-full border border-border/30 bg-background/70`,children:[n&&(0,q.jsx)(`div`,{className:`relative h-full overflow-hidden rounded-full bg-[color:var(--u-accent)] transition-[width] duration-300 ease-out`,style:{width:`${t}%`},role:`progressbar`,"aria-valuenow":t??0,"aria-valuemin":0,"aria-valuemax":100,children:(0,q.jsx)(`span`,{className:`u-shimmer`,"aria-hidden":!0})}),r&&(0,q.jsx)(`span`,{className:`u-indeterminate`,"aria-hidden":!0}),i&&(0,q.jsx)(`div`,{className:`h-full w-full rounded-full bg-[color:var(--u-accent)]/80`,"aria-hidden":!0})]})}function iY({update:e,onClose:t}){let{t:n}=G(`commands`),[r,i]=(0,F.useState)(`available`),[a,o]=(0,F.useState)(0),[s,c]=(0,F.useState)(null),[l,u]=(0,F.useState)(null);async function d(){try{i(`downloading`),o(0),c(null),u(null),await e.downloadAndInstall(e=>{if(e.event===`Started`){c(e.data.contentLength??null),o(0);return}if(e.event===`Progress`){o(t=>t+e.data.chunkLength);return}i(`installing`)}),i(`ready`)}catch(e){u(e.message||n(`update.errors.installFailed`)),i(`error`)}}function f(){if(e.isMock){K.success(n(`update.mockReady`),{duration:2500}),K.dismiss(GJ),t?.();return}$(`restart_app`).catch(()=>{UJ()})}let p=s&&s>0?Math.min(100,Math.round(a/s*100)):null,m=tY(r),h=r===`downloading`||r===`installing`,g=n(r===`downloading`?`update.title.downloading`:r===`installing`?`update.title.installing`:r===`ready`?`update.title.ready`:r===`error`?`update.title.error`:`update.title.available`),_=r===`available`?n(`update.desc.available`):r===`downloading`?p==null?n(`update.desc.fetching`,{size:QJ(a)}):n(`update.desc.progress`,{percent:p,downloaded:QJ(a),total:QJ(s??0)}):r===`installing`?n(`update.desc.installing`):r===`ready`?n(`update.desc.ready`,{version:e.version}):l&&l.length<=80?l:n(`update.desc.errorFallback`),v=r===`available`?`${e.currentVersion} → ${e.version}`:r===`downloading`?n(`update.pill.downloading`):r===`installing`?n(`update.pill.installing`):r===`ready`?n(`update.pill.ready`):null;return(0,q.jsxs)(`div`,{className:`u-update-card relative flex w-full flex-col gap-2 overflow-hidden`,style:{"--u-accent":m},role:r===`error`?`alert`:`status`,"aria-live":r===`error`?`assertive`:`polite`,"data-state":r,children:[(0,q.jsx)(`span`,{className:`u-glow`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,q.jsx)(`span`,{className:`u-badge grid h-7 w-7 shrink-0 place-items-center rounded-lg border border-border/50 bg-background/60 text-[color:var(--u-accent)]`,"aria-hidden":!0,children:(0,q.jsx)(nY,{state:r})}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold leading-tight text-foreground`,children:g}),v!=null&&(0,q.jsx)(`span`,{className:`shrink-0 whitespace-nowrap rounded-md border border-border/40 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,style:r===`available`?void 0:{color:`var(--u-accent)`},children:v})]}),(0,q.jsx)(`p`,{className:`h-4 truncate text-[11px] leading-4 text-muted-foreground`,"data-testid":`update-description`,children:_}),(0,q.jsx)(rY,{state:r,progress:p}),(0,q.jsx)(`div`,{className:`flex items-center justify-end gap-1.5`,children:r===`ready`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-grid h-7 min-w-[64px] place-items-center rounded-lg border border-[color:var(--u-accent)]/45 bg-[color:var(--u-accent)]/15 px-3 text-[11px] font-semibold leading-none text-foreground transition-colors hover:bg-[color:var(--u-accent)]/25`,onClick:f,children:n(`update.actions.restart`)}),(0,q.jsx)(`button`,{type:`button`,className:`h-7 rounded-lg px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground`,onClick:()=>{K.dismiss(GJ),t?.()},children:n(`update.actions.later`)})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-grid h-7 min-w-[64px] place-items-center rounded-lg border border-[color:var(--u-accent)]/45 bg-[color:var(--u-accent)]/15 px-3 text-[11px] font-semibold leading-none text-foreground transition-colors hover:bg-[color:var(--u-accent)]/25 disabled:cursor-not-allowed disabled:opacity-50`,disabled:h,onClick:()=>void d(),children:n(r===`installing`?`update.actions.installing`:r===`error`?`update.actions.tryAgain`:`update.actions.update`)}),(0,q.jsx)(`button`,{type:`button`,className:`h-7 rounded-lg px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,disabled:h,onClick:()=>{eY(e.version),t?.()},children:n(`update.actions.dismiss`)})]})})]})}function aY(){(0,F.useEffect)(()=>{let e=JJ();if(!e&&!qJ())return;let t=!1,n={current:!1};async function r(){if(!(t||n.current))try{let r=e?ZJ():await VJ();if(t||!r||$J()===r.version)return;n.current=!0,K.custom(()=>(0,q.jsx)(iY,{update:r,onClose:()=>{n.current=!1}}),{id:GJ,duration:1/0,dismissible:!1,unstyled:!0,closeButton:!1,onDismiss:()=>{n.current=!1},onAutoClose:()=>{n.current=!1}})}catch(e){console.warn(`[desktop-update] update check failed:`,e)}}r();let i=setInterval(()=>void r(),KJ);return()=>{t=!0,clearInterval(i)}},[])}function oY(){let{state:e,openTicketDetail:t,enterSplit:n,setComparedTicket:r}=SB(),{tickets:i}=Dd(),a=it(),o=st(),s=(0,F.useRef)(!1);(0,F.useEffect)(()=>{if(s.current||i.length===0)return;s.current=!0;let e=new URLSearchParams(a.search),c=e.get(`compare`),l=e.get(`compareSide`);if(!c)return;let u=Number.parseInt(c,10),d=l===`right`?`right`:`left`;if(typeof window<`u`&&window.innerWidth<900)return;if(!i.some(e=>e.id===u)){let e=new URLSearchParams(a.search);e.delete(`compare`),e.delete(`compareSide`);let t=e.toString();o({pathname:a.pathname,search:t?`?${t}`:``},{replace:!0});return}let f=e.get(`compareOrigin`);if(f){let e=Number.parseInt(f,10);if(i.some(t=>t.id===e)){t(e),n(d),r(u,d===`left`?`right`:`left`);return}}t(u)},[i,a.search,a.pathname,o,t,n,r]),(0,F.useEffect)(()=>{if(!s.current)return;let t=new URLSearchParams(a.search),n=t.has(`compare`);if(e.originSide===null){if(n){t.delete(`compare`),t.delete(`compareSide`),t.delete(`compareOrigin`);let e=t.toString();o({pathname:a.pathname,search:e?`?${e}`:``},{replace:!0})}return}let r=e.originSide===`left`?e.leftId:e.rightId,i=e.originSide===`left`?e.rightId:e.leftId;if(r==null||e.originSide==null)return;let c=new URLSearchParams(a.search);c.set(`compareSide`,e.originSide),c.set(`compareOrigin`,String(r)),i==null?c.delete(`compare`):c.set(`compare`,String(i));let l=c.toString();l!==(a.search.startsWith(`?`)?a.search.slice(1):a.search)&&o({pathname:a.pathname,search:l?`?${l}`:``},{replace:!0})},[e,a.search,a.pathname,o])}var sY=(0,F.lazy)(()=>r(()=>import(`./JobDetailPage-D59Uhx1u.js`),__vite__mapDeps([26,1,27,28]))),cY=(0,F.lazy)(()=>r(()=>import(`./JobsPage-CF03VyL2.js`),__vite__mapDeps([29,1,30,31,28]))),lY=(0,F.lazy)(()=>r(()=>import(`./AnalyticsPage-1oKv_dqQ.js`),__vite__mapDeps([32,1,33,34,30]))),uY=(0,F.lazy)(()=>r(()=>import(`./ActivityFeedPage-CzMoyXH1.js`),__vite__mapDeps([35,1]))),dY=(0,F.lazy)(()=>r(()=>import(`./AgentsPage-ClIs2Gio.js`),__vite__mapDeps([36,1]))),fY=(0,F.lazy)(()=>r(()=>import(`./CodePage-sMBftx0a.js`),__vite__mapDeps([37,1,38,31]))),pY=(0,F.lazy)(()=>r(()=>import(`./IntegrationsPage-WQ2Tzm5R.js`),__vite__mapDeps([39,1,31]))),mY=(0,F.lazy)(()=>r(()=>import(`./DesktopAnalyticsPage-zeI2hEc4.js`),__vite__mapDeps([40,1,33,34]))),hY=(0,F.lazy)(()=>r(()=>import(`./DocsPage-Bv5oHAxO.js`),__vite__mapDeps([41,1,27,42]))),gY=(0,F.lazy)(()=>r(()=>import(`./DocsDialog-DZAg7yxC.js`),__vite__mapDeps([43,1,27,42]))),_Y=new Set([`/settings`]),vY=`specrails-desktop:routeMemory`;try{localStorage.removeItem(vY)}catch{}function yY(e){let t=it(),n=st(),r=(0,F.useRef)(new Map),i=(0,F.useRef)(null),a=(0,F.useRef)(!1);(0,F.useEffect)(()=>{xa((e,t)=>{r.current.set(e,t)})},[]),(0,F.useEffect)(()=>{a.current||(a.current=!0,t.pathname!==`/`&&n(`/`,{replace:!0}))},[]),(0,F.useEffect)(()=>{if(i.current&&i.current!==e&&r.current.set(i.current,t.pathname),e&&e!==i.current){let i=r.current.get(e)??`/`;t.pathname!==i&&n(i,{replace:!0})}i.current=e},[e,t.pathname,n]),(0,F.useEffect)(()=>{e&&t.pathname!==`/`&&!_Y.has(t.pathname)&&r.current.set(e,t.pathname)},[e,t.pathname])}function bY(){let{t:e}=G(`common`),{projects:t,activeProjectId:n,isLoading:r,isSwitchingProject:i,setupProjectIds:a,completeSetupWizard:o,setActiveProjectId:s}=yd(),{cycleLeftMode:c,cycleRightMode:l}=wq(),u=st(),d=gG();oY();let[f,p]=(0,F.useState)(!1),[m,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),[v,y]=(0,F.useState)(!1),b=(0,F.useCallback)(()=>y(!1),[]),[x,S]=(0,F.useState)(()=>!$K());yY(n);let{cheatsheetOpen:C,setCheatsheetOpen:w,openCheatsheet:T}=mU(),E=[`/`,`/jobs`,`/analytics`,...nB?[`/agents`]:[],...rB?[`/code`]:[],`/integrations`,`/settings`];pU({onOpenCheatsheet:T,onToggleLeftSidebar:c,onToggleRightSidebar:l,onSwitchProject:e=>{let n=t[e-1];n&&s(n.id)},onSwitchProjectPage:e=>{let t=E[e-1];t&&u(t)},onToggleTerminalPanel:tB?()=>{n&&(d.togglePanel(n),d.getState(n).visibility===`hidden`?queueMicrotask(()=>d.focusActive(n)):d.focusActive(n))}:void 0}),aU({setActiveProjectId:s,projectsById:(0,F.useMemo)(()=>new Map(t.map(e=>[e.id,e.name])),[t])});let D=t.find(e=>e.id===n),O=n!==null&&a.has(n);return r?(0,q.jsxs)(`div`,{className:`flex h-full`,children:[(0,q.jsx)(`div`,{className:`w-11 border-r border-border bg-card/50 animate-pulse flex-shrink-0`}),(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})})]}):(0,q.jsxs)(`div`,{className:`flex h-full overflow-hidden font-sans`,children:[(0,q.jsx)(Dq,{onAddProject:()=>p(!0),onOpenAnalytics:()=>_(!0),onOpenDocs:()=>y(!0),onOpenSettings:()=>h(!0)}),(0,q.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[i&&(0,q.jsx)(`div`,{className:`h-0.5 w-full bg-accent-primary/70 animate-pulse shrink-0`,"data-testid":`project-switching-bar`}),(0,q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:O&&D?(0,q.jsx)(YK,{project:D,onComplete:()=>o(D.id),onSkip:()=>o(D.id)},D.id):(0,q.jsx)(F.Suspense,{fallback:(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})}),children:(0,q.jsxs)(zt,{children:[(0,q.jsx)(Lt,{path:`/docs`,element:(0,q.jsx)(hY,{})}),(0,q.jsx)(Lt,{path:`/docs/:category/:slug`,element:(0,q.jsx)(hY,{})}),t.length===0?(0,q.jsx)(Lt,{path:`*`,element:(0,q.jsx)(dK,{onAddProject:()=>p(!0)})}):D?(0,q.jsxs)(Lt,{element:(0,q.jsx)(uK,{projectName:D.name,children:(0,q.jsx)(cK,{project:D})},D.id),children:[(0,q.jsx)(Lt,{path:`/`,element:(0,q.jsx)(wV,{})}),(0,q.jsx)(Lt,{path:`/jobs`,element:(0,q.jsx)(cY,{})}),(0,q.jsx)(Lt,{path:`/jobs/:id`,element:(0,q.jsx)(sY,{})}),(0,q.jsx)(Lt,{path:`/analytics`,element:(0,q.jsx)(lY,{})}),(0,q.jsx)(Lt,{path:`/activity`,element:(0,q.jsx)(uY,{})}),(0,q.jsx)(Lt,{path:`/agents`,element:(0,q.jsx)(dY,{})}),(0,q.jsx)(Lt,{path:`/code`,element:rB?(0,q.jsx)(fY,{}):(0,q.jsx)(Ft,{to:`/`,replace:!0})}),(0,q.jsx)(Lt,{path:`/integrations`,element:(0,q.jsx)(pY,{})}),(0,q.jsx)(Lt,{path:`/settings`,element:(0,q.jsx)(BV,{})}),(0,q.jsx)(Lt,{path:`*`,element:(0,q.jsx)(Ft,{to:`/`,replace:!0})})]}):(0,q.jsx)(Lt,{path:`*`,element:(0,q.jsx)(dK,{onAddProject:()=>p(!0)})})]})})})]}),D&&!O&&(0,q.jsx)(kq,{}),(0,q.jsx)(zq,{open:f,onClose:()=>p(!1)}),(0,q.jsx)(cU,{open:m,onClose:()=>h(!1),onOpenOnboarding:()=>{h(!1),S(!0)}}),(0,q.jsx)(Ry,{open:g,onOpenChange:_,children:(0,q.jsx)(Vy,{className:`max-w-5xl max-h-[90vh] overflow-hidden p-0 flex flex-col`,children:(0,q.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,q.jsx)(F.Suspense,{fallback:(0,q.jsx)(`div`,{className:`flex items-center justify-center h-40`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})}),children:(0,q.jsx)(mY,{})})})})}),(0,q.jsx)(F.Suspense,{fallback:null,children:(0,q.jsx)(gY,{open:v,onClose:b})}),(0,q.jsx)(FJ,{onOpenSettings:()=>h(!0),onOpenAnalytics:()=>_(!0),onOpenDocs:()=>y(!0)}),(0,q.jsx)(yU,{open:C,onOpenChange:w}),(0,q.jsx)(mq,{open:x,onClose:()=>S(!1)})]})}function xY({children:e}){let{activeProjectId:t}=yd();return(0,q.jsx)(mG,{activeProjectId:t,children:e})}function SY(){return(0,q.jsx)(`span`,{"aria-hidden":!0,style:{display:`none`}})}function CY(){let{theme:e}=lH(),t=e.previewSwatches.accents[0],n=e.status.completed,r=e.status.failed,i=e.status.canceled,a=e.status.running;return(0,q.jsx)(ya,{position:`bottom-right`,theme:e.scheme,gap:8,closeButton:!0,visibleToasts:6,icons:{loading:(0,q.jsx)(SY,{})},style:{"--accent":t,"--toast-success-border":`color-mix(in srgb, ${n} 38%, transparent)`,"--toast-error-border":`color-mix(in srgb, ${r} 38%, transparent)`,"--toast-warning-border":`color-mix(in srgb, ${i} 38%, transparent)`,"--toast-info-border":`color-mix(in srgb, ${a} 38%, transparent)`},toastOptions:{unstyled:!0,classNames:{toast:`glass-card border border-border/30 text-foreground text-xs p-3 rounded-lg flex items-start gap-2 w-[356px] max-w-[356px] overflow-hidden shadow-lg`,content:`flex-1 min-w-0 flex flex-col gap-0.5`,icon:`shrink-0 mt-[2px] flex items-center justify-center`,title:`font-medium text-sm`,description:`text-muted-foreground mt-0.5`,actionButton:`text-[11px] px-2.5 py-1 rounded-md bg-accent-primary text-white hover:bg-accent-primary/90 whitespace-nowrap shrink-0 self-start`,cancelButton:`text-[11px] px-2.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50 whitespace-nowrap shrink-0 self-start`,closeButton:`text-muted-foreground hover:text-foreground rounded-md p-0.5`,success:`border-l-4 border-l-[var(--toast-success-border)]`,error:`border-l-4 border-l-[var(--toast-error-border)]`,warning:`border-l-4 border-l-[var(--toast-warning-border)]`,info:`border-l-4 border-l-[var(--toast-info-border)]`,loading:``}}})}function wY(){return aY(),(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100vh`,overflow:`hidden`},children:(0,q.jsx)(`div`,{style:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:(0,q.jsx)(yl,{url:aD,children:(0,q.jsx)(cH,{children:(0,q.jsxs)(vH,{children:[(0,q.jsx)(EW,{}),(0,q.jsxs)(_d,{children:[(0,q.jsx)(oW,{}),(0,q.jsx)(iE,{children:(0,q.jsx)(zJ,{children:(0,q.jsx)(PB,{children:(0,q.jsx)(Cq,{children:(0,q.jsx)(xY,{children:(0,q.jsx)(dg,{children:(0,q.jsxs)(xB,{children:[(0,q.jsx)(bY,{}),(0,q.jsx)(CY,{})]})})})})})})})]})]})})})})})}async function TY(){await dl(),ml(),await cd(),(0,Xn.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(F.StrictMode,{children:(0,q.jsx)(On,{children:(0,q.jsx)(wY,{})})}));let e=document.getElementById(`specrails-splash`);e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.classList.add(`is-hidden`),setTimeout(()=>e.remove(),300)})})}TY();export{wf as $,zn as $t,X as A,Ol as At,hp as B,ds as Bt,Uy as C,ru as Ct,pg as D,Fl as Dt,fg as E,Ll as Et,jp as F,Pc as Ft,Yf as G,Ja as Gt,cp as H,bo as Ht,Ep as I,rl as It,Pf as J,Vi as Jt,Uf as K,K as Kt,bp as L,$c as Lt,Bp as M,gl as Mt,Fp as N,ll as Nt,Nh as O,Pl as Ot,Pp as P,Gc as Pt,Tf as Q,dt as Qt,_p as R,Vc as Rt,Gy as S,J as St,Wy as T,Rl as Tt,sp as U,lo as Ut,pp as V,gs as Vt,rp as W,uo as Wt,Of as X,jn as Xt,jf as Y,zi as Yt,Ef as Z,st as Zt,AT as _,Fd as _t,jV as a,of as at,Ry as b,yd as bt,SB as c,tf as ct,VL as d,Zd as dt,M as en,Sf as et,LP as f,Wd as ft,ME as g,Rd as gt,tO as h,zd as ht,dH as i,sf as it,Vp as j,bl as jt,Z as k,kl as kt,Jz as l,ef as lt,ON as m,Vd as mt,kU as n,hf as nt,TB as o,af as ot,zN as p,Hd as pt,Vf as q,G as qt,$ as r,cf as rt,wB as s,nf as st,kW as t,O as tn,bf as tt,Iz as u,Qd as ut,MT as v,Y as vt,Hy as w,zl as wt,Vy as x,dd as xt,jT as y,fd as yt,gp as z,pc as zt};
142
+ `;function LJ(e){return`contract-refine:${e}`}async function RJ(e,t){try{let n=await fetch(`${ol}/api/projects/${e}/tickets/${t}/contract-refine`,{method:`POST`});if(n.ok)K.loading(J.t(`activity:contractRefine.refining`),{id:LJ(t)});else{let e=await n.json().catch(()=>({}));K.error(e.error?J.t(`activity:contractRefine.retryRejectedWithError`,{error:e.error}):J.t(`activity:contractRefine.retryRejected`),{id:LJ(t)})}}catch(e){K.error(J.t(`activity:contractRefine.retryFailed`,{message:e.message}),{id:LJ(t)})}}function zJ({children:e}){let{registerHandler:t,unregisterHandler:n}=bl(),r=(0,F.useRef)(new Map),i=(0,F.useCallback)(e=>{let t=e;if(!t||t.type!==`explore.contract_refine_failed`)return;let n=t.ticketId,i=t.projectId,a=t.reason??`unknown`;typeof n!=`number`||!i||(r.current.set(n,i),K.error(J.t(`activity:contractRefine.skipped`),{id:LJ(n),description:J.t(`activity:contractRefine.reason`,{reason:a}),action:{label:J.t(`common:actions.retry`),onClick:()=>void RJ(i,n)},duration:15e3}))},[]),a=(0,F.useCallback)(e=>{let t=e;if(!t||t.type!==`ticket_updated`)return;let n=t.ticket;n&&typeof n.description==`string`&&n.description.includes(IJ)&&K.success(J.t(`activity:contractRefine.added`,{title:n.title||`#${n.id}`}),{id:LJ(n.id),duration:3500})},[]);return(0,F.useLayoutEffect)(()=>(t(`_contract_refine_failed`,i),t(`_contract_refine_ticket_updated`,a),()=>{n(`_contract_refine_failed`),n(`_contract_refine_ticket_updated`)}),[t,n,i,a]),(0,F.useEffect)(()=>()=>r.current.clear(),[]),(0,q.jsx)(q.Fragment,{children:e})}var BJ=class extends AU{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,t){HJ(t);let n=new kU;e&&(n.onmessage=e);let r=await $(`plugin:updater|download`,{onEvent:n,rid:this.rid,...t});this.downloadedBytes=new AU(r)}async install(){if(!this.downloadedBytes)throw Error(`Update.install called before Update.download`);await $(`plugin:updater|install`,{updateRid:this.rid,bytesRid:this.downloadedBytes.rid}),this.downloadedBytes=void 0}async downloadAndInstall(e,t){HJ(t);let n=new kU;e&&(n.onmessage=e),await $(`plugin:updater|download_and_install`,{onEvent:n,rid:this.rid,...t})}async close(){await this.downloadedBytes?.close(),await super.close()}};async function VJ(e){HJ(e);let t=await $(`plugin:updater|check`,{...e});return t?new BJ(t):null}function HJ(e){e?.headers&&(e.headers=Array.from(new Headers(e.headers).entries()))}async function UJ(){await $(`plugin:process|restart`)}var WJ=`specrails-desktop:dismissedDesktopUpdateVersion`,GJ=`specrails-desktop-desktop-update`,KJ=360*60*1e3;function qJ(){return typeof window<`u`&&`__TAURI_INTERNALS__`in window}function JJ(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_MOCK_DESKTOP_UPDATE===`true`}function YJ(){return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}?.VITE_MOCK_DESKTOP_UPDATE_VERSION||`99.0.0-test`}function XJ(e){return new Promise(t=>setTimeout(t,e))}function ZJ(){return{currentVersion:`1.40.1`,version:YJ(),isMock:!0,async downloadAndInstall(e){let t=18*1024*1024;e({event:`Started`,data:{contentLength:t}});for(let n=0;n<12;n+=1)await XJ(180),e({event:`Progress`,data:{chunkLength:Math.round(t/12)}});e({event:`Finished`})}}}function QJ(e){return e<1024*1024?J.t(`commands:update.units.kb`,{value:Math.max(1,Math.round(e/1024))}):J.t(`commands:update.units.mb`,{value:(e/(1024*1024)).toFixed(1)})}function $J(){try{return localStorage.getItem(WJ)}catch{return null}}function eY(e){try{localStorage.setItem(WJ,e)}catch{}K.dismiss(GJ)}function tY(e){switch(e){case`downloading`:return`var(--color-accent-info)`;case`ready`:return`var(--color-accent-success)`;default:return`var(--color-accent-primary)`}}function nY({state:e}){let t=`h-[15px] w-[15px]`;return e===`installing`?(0,q.jsx)(df,{className:`${t} u-spin`,"aria-hidden":!0}):e===`ready`?(0,q.jsx)(Zd,{className:`${t} u-check`,"aria-hidden":!0}):e===`error`?(0,q.jsx)(Fp,{className:t,"aria-hidden":!0}):(0,q.jsx)(lf,{className:t,"aria-hidden":!0})}function rY({state:e,progress:t}){let n=e===`downloading`&&t!=null,r=e===`installing`||e===`downloading`&&t==null,i=e===`ready`;return(0,q.jsxs)(`div`,{className:`relative h-1.5 w-full overflow-hidden rounded-full border border-border/30 bg-background/70`,children:[n&&(0,q.jsx)(`div`,{className:`relative h-full overflow-hidden rounded-full bg-[color:var(--u-accent)] transition-[width] duration-300 ease-out`,style:{width:`${t}%`},role:`progressbar`,"aria-valuenow":t??0,"aria-valuemin":0,"aria-valuemax":100,children:(0,q.jsx)(`span`,{className:`u-shimmer`,"aria-hidden":!0})}),r&&(0,q.jsx)(`span`,{className:`u-indeterminate`,"aria-hidden":!0}),i&&(0,q.jsx)(`div`,{className:`h-full w-full rounded-full bg-[color:var(--u-accent)]/80`,"aria-hidden":!0})]})}function iY({update:e,onClose:t}){let{t:n}=G(`commands`),[r,i]=(0,F.useState)(`available`),[a,o]=(0,F.useState)(0),[s,c]=(0,F.useState)(null),[l,u]=(0,F.useState)(null);async function d(){try{i(`downloading`),o(0),c(null),u(null),await e.downloadAndInstall(e=>{if(e.event===`Started`){c(e.data.contentLength??null),o(0);return}if(e.event===`Progress`){o(t=>t+e.data.chunkLength);return}i(`installing`)}),i(`ready`)}catch(e){u(e.message||n(`update.errors.installFailed`)),i(`error`)}}function f(){if(e.isMock){K.success(n(`update.mockReady`),{duration:2500}),K.dismiss(GJ),t?.();return}$(`restart_app`).catch(()=>{UJ()})}let p=s&&s>0?Math.min(100,Math.round(a/s*100)):null,m=tY(r),h=r===`downloading`||r===`installing`,g=n(r===`downloading`?`update.title.downloading`:r===`installing`?`update.title.installing`:r===`ready`?`update.title.ready`:r===`error`?`update.title.error`:`update.title.available`),_=r===`available`?n(`update.desc.available`):r===`downloading`?p==null?n(`update.desc.fetching`,{size:QJ(a)}):n(`update.desc.progress`,{percent:p,downloaded:QJ(a),total:QJ(s??0)}):r===`installing`?n(`update.desc.installing`):r===`ready`?n(`update.desc.ready`,{version:e.version}):l&&l.length<=80?l:n(`update.desc.errorFallback`),v=r===`available`?`${e.currentVersion} → ${e.version}`:r===`downloading`?n(`update.pill.downloading`):r===`installing`?n(`update.pill.installing`):r===`ready`?n(`update.pill.ready`):null;return(0,q.jsxs)(`div`,{className:`u-update-card relative flex w-full flex-col gap-2 overflow-hidden`,style:{"--u-accent":m},role:r===`error`?`alert`:`status`,"aria-live":r===`error`?`assertive`:`polite`,"data-state":r,children:[(0,q.jsx)(`span`,{className:`u-glow`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,q.jsx)(`span`,{className:`u-badge grid h-7 w-7 shrink-0 place-items-center rounded-lg border border-border/50 bg-background/60 text-[color:var(--u-accent)]`,"aria-hidden":!0,children:(0,q.jsx)(nY,{state:r})}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold leading-tight text-foreground`,children:g}),v!=null&&(0,q.jsx)(`span`,{className:`shrink-0 whitespace-nowrap rounded-md border border-border/40 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground`,style:r===`available`?void 0:{color:`var(--u-accent)`},children:v})]}),(0,q.jsx)(`p`,{className:`h-4 truncate text-[11px] leading-4 text-muted-foreground`,"data-testid":`update-description`,children:_}),(0,q.jsx)(rY,{state:r,progress:p}),(0,q.jsx)(`div`,{className:`flex items-center justify-end gap-1.5`,children:r===`ready`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-grid h-7 min-w-[64px] place-items-center rounded-lg border border-[color:var(--u-accent)]/45 bg-[color:var(--u-accent)]/15 px-3 text-[11px] font-semibold leading-none text-foreground transition-colors hover:bg-[color:var(--u-accent)]/25`,onClick:f,children:n(`update.actions.restart`)}),(0,q.jsx)(`button`,{type:`button`,className:`h-7 rounded-lg px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground`,onClick:()=>{K.dismiss(GJ),t?.()},children:n(`update.actions.later`)})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-grid h-7 min-w-[64px] place-items-center rounded-lg border border-[color:var(--u-accent)]/45 bg-[color:var(--u-accent)]/15 px-3 text-[11px] font-semibold leading-none text-foreground transition-colors hover:bg-[color:var(--u-accent)]/25 disabled:cursor-not-allowed disabled:opacity-50`,disabled:h,onClick:()=>void d(),children:n(r===`installing`?`update.actions.installing`:r===`error`?`update.actions.tryAgain`:`update.actions.update`)}),(0,q.jsx)(`button`,{type:`button`,className:`h-7 rounded-lg px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-background/70 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,disabled:h,onClick:()=>{eY(e.version),t?.()},children:n(`update.actions.dismiss`)})]})})]})}function aY(){(0,F.useEffect)(()=>{let e=JJ();if(!e&&!qJ())return;let t=!1,n={current:!1};async function r(){if(!(t||n.current))try{let r=e?ZJ():await VJ();if(t||!r||$J()===r.version)return;n.current=!0,K.custom(()=>(0,q.jsx)(iY,{update:r,onClose:()=>{n.current=!1}}),{id:GJ,duration:1/0,dismissible:!1,unstyled:!0,closeButton:!1,onDismiss:()=>{n.current=!1},onAutoClose:()=>{n.current=!1}})}catch(e){console.warn(`[desktop-update] update check failed:`,e)}}r();let i=setInterval(()=>void r(),KJ);return()=>{t=!0,clearInterval(i)}},[])}function oY(){let{state:e,openTicketDetail:t,enterSplit:n,setComparedTicket:r}=SB(),{tickets:i}=Dd(),a=it(),o=st(),s=(0,F.useRef)(!1);(0,F.useEffect)(()=>{if(s.current||i.length===0)return;s.current=!0;let e=new URLSearchParams(a.search),c=e.get(`compare`),l=e.get(`compareSide`);if(!c)return;let u=Number.parseInt(c,10),d=l===`right`?`right`:`left`;if(typeof window<`u`&&window.innerWidth<900)return;if(!i.some(e=>e.id===u)){let e=new URLSearchParams(a.search);e.delete(`compare`),e.delete(`compareSide`);let t=e.toString();o({pathname:a.pathname,search:t?`?${t}`:``},{replace:!0});return}let f=e.get(`compareOrigin`);if(f){let e=Number.parseInt(f,10);if(i.some(t=>t.id===e)){t(e),n(d),r(u,d===`left`?`right`:`left`);return}}t(u)},[i,a.search,a.pathname,o,t,n,r]),(0,F.useEffect)(()=>{if(!s.current)return;let t=new URLSearchParams(a.search),n=t.has(`compare`);if(e.originSide===null){if(n){t.delete(`compare`),t.delete(`compareSide`),t.delete(`compareOrigin`);let e=t.toString();o({pathname:a.pathname,search:e?`?${e}`:``},{replace:!0})}return}let r=e.originSide===`left`?e.leftId:e.rightId,i=e.originSide===`left`?e.rightId:e.leftId;if(r==null||e.originSide==null)return;let c=new URLSearchParams(a.search);c.set(`compareSide`,e.originSide),c.set(`compareOrigin`,String(r)),i==null?c.delete(`compare`):c.set(`compare`,String(i));let l=c.toString();l!==(a.search.startsWith(`?`)?a.search.slice(1):a.search)&&o({pathname:a.pathname,search:l?`?${l}`:``},{replace:!0})},[e,a.search,a.pathname,o])}var sY=(0,F.lazy)(()=>r(()=>import(`./JobDetailPage-1RtejIOB.js`),__vite__mapDeps([26,1,27,28]))),cY=(0,F.lazy)(()=>r(()=>import(`./JobsPage-NuDf5Zbx.js`),__vite__mapDeps([29,1,30,31,28]))),lY=(0,F.lazy)(()=>r(()=>import(`./AnalyticsPage-D6LE6wG2.js`),__vite__mapDeps([32,1,33,34,30]))),uY=(0,F.lazy)(()=>r(()=>import(`./ActivityFeedPage-BupGdGjj.js`),__vite__mapDeps([35,1]))),dY=(0,F.lazy)(()=>r(()=>import(`./AgentsPage-F3xksiLd.js`),__vite__mapDeps([36,1]))),fY=(0,F.lazy)(()=>r(()=>import(`./CodePage-DLwCJgQ0.js`),__vite__mapDeps([37,1,38,31]))),pY=(0,F.lazy)(()=>r(()=>import(`./IntegrationsPage-DANIzihd.js`),__vite__mapDeps([39,1,31]))),mY=(0,F.lazy)(()=>r(()=>import(`./DesktopAnalyticsPage-DG5LA_WO.js`),__vite__mapDeps([40,1,33,34]))),hY=(0,F.lazy)(()=>r(()=>import(`./DocsPage-BfGH8NUf.js`),__vite__mapDeps([41,1,27,42]))),gY=(0,F.lazy)(()=>r(()=>import(`./DocsDialog-ChQ1oXLC.js`),__vite__mapDeps([43,1,27,42]))),_Y=new Set([`/settings`]),vY=`specrails-desktop:routeMemory`;try{localStorage.removeItem(vY)}catch{}function yY(e){let t=it(),n=st(),r=(0,F.useRef)(new Map),i=(0,F.useRef)(null),a=(0,F.useRef)(!1);(0,F.useEffect)(()=>{xa((e,t)=>{r.current.set(e,t)})},[]),(0,F.useEffect)(()=>{a.current||(a.current=!0,t.pathname!==`/`&&n(`/`,{replace:!0}))},[]),(0,F.useEffect)(()=>{if(i.current&&i.current!==e&&r.current.set(i.current,t.pathname),e&&e!==i.current){let i=r.current.get(e)??`/`;t.pathname!==i&&n(i,{replace:!0})}i.current=e},[e,t.pathname,n]),(0,F.useEffect)(()=>{e&&t.pathname!==`/`&&!_Y.has(t.pathname)&&r.current.set(e,t.pathname)},[e,t.pathname])}function bY(){let{t:e}=G(`common`),{projects:t,activeProjectId:n,isLoading:r,isSwitchingProject:i,setupProjectIds:a,completeSetupWizard:o,setActiveProjectId:s}=yd(),{cycleLeftMode:c,cycleRightMode:l}=wq(),u=st(),d=gG();oY();let[f,p]=(0,F.useState)(!1),[m,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),[v,y]=(0,F.useState)(!1),b=(0,F.useCallback)(()=>y(!1),[]),[x,S]=(0,F.useState)(()=>!$K());yY(n);let{cheatsheetOpen:C,setCheatsheetOpen:w,openCheatsheet:T}=mU(),E=[`/`,`/jobs`,`/analytics`,...nB?[`/agents`]:[],...rB?[`/code`]:[],`/integrations`,`/settings`];pU({onOpenCheatsheet:T,onToggleLeftSidebar:c,onToggleRightSidebar:l,onSwitchProject:e=>{let n=t[e-1];n&&s(n.id)},onSwitchProjectPage:e=>{let t=E[e-1];t&&u(t)},onToggleTerminalPanel:tB?()=>{n&&(d.togglePanel(n),d.getState(n).visibility===`hidden`?queueMicrotask(()=>d.focusActive(n)):d.focusActive(n))}:void 0}),aU({setActiveProjectId:s,projectsById:(0,F.useMemo)(()=>new Map(t.map(e=>[e.id,e.name])),[t])});let D=t.find(e=>e.id===n),O=n!==null&&a.has(n);return r?(0,q.jsxs)(`div`,{className:`flex h-full`,children:[(0,q.jsx)(`div`,{className:`w-11 border-r border-border bg-card/50 animate-pulse flex-shrink-0`}),(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})})]}):(0,q.jsxs)(`div`,{className:`flex h-full overflow-hidden font-sans`,children:[(0,q.jsx)(Dq,{onAddProject:()=>p(!0),onOpenAnalytics:()=>_(!0),onOpenDocs:()=>y(!0),onOpenSettings:()=>h(!0)}),(0,q.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[i&&(0,q.jsx)(`div`,{className:`h-0.5 w-full bg-accent-primary/70 animate-pulse shrink-0`,"data-testid":`project-switching-bar`}),(0,q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:O&&D?(0,q.jsx)(YK,{project:D,onComplete:()=>o(D.id),onSkip:()=>o(D.id)},D.id):(0,q.jsx)(F.Suspense,{fallback:(0,q.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})}),children:(0,q.jsxs)(zt,{children:[(0,q.jsx)(Lt,{path:`/docs`,element:(0,q.jsx)(hY,{})}),(0,q.jsx)(Lt,{path:`/docs/:category/:slug`,element:(0,q.jsx)(hY,{})}),t.length===0?(0,q.jsx)(Lt,{path:`*`,element:(0,q.jsx)(dK,{onAddProject:()=>p(!0)})}):D?(0,q.jsxs)(Lt,{element:(0,q.jsx)(uK,{projectName:D.name,children:(0,q.jsx)(cK,{project:D})},D.id),children:[(0,q.jsx)(Lt,{path:`/`,element:(0,q.jsx)(wV,{})}),(0,q.jsx)(Lt,{path:`/jobs`,element:(0,q.jsx)(cY,{})}),(0,q.jsx)(Lt,{path:`/jobs/:id`,element:(0,q.jsx)(sY,{})}),(0,q.jsx)(Lt,{path:`/analytics`,element:(0,q.jsx)(lY,{})}),(0,q.jsx)(Lt,{path:`/activity`,element:(0,q.jsx)(uY,{})}),(0,q.jsx)(Lt,{path:`/agents`,element:(0,q.jsx)(dY,{})}),(0,q.jsx)(Lt,{path:`/code`,element:rB?(0,q.jsx)(fY,{}):(0,q.jsx)(Ft,{to:`/`,replace:!0})}),(0,q.jsx)(Lt,{path:`/integrations`,element:(0,q.jsx)(pY,{})}),(0,q.jsx)(Lt,{path:`/settings`,element:(0,q.jsx)(BV,{})}),(0,q.jsx)(Lt,{path:`*`,element:(0,q.jsx)(Ft,{to:`/`,replace:!0})})]}):(0,q.jsx)(Lt,{path:`*`,element:(0,q.jsx)(dK,{onAddProject:()=>p(!0)})})]})})})]}),D&&!O&&(0,q.jsx)(kq,{}),(0,q.jsx)(zq,{open:f,onClose:()=>p(!1)}),(0,q.jsx)(cU,{open:m,onClose:()=>h(!1),onOpenOnboarding:()=>{h(!1),S(!0)}}),(0,q.jsx)(Ry,{open:g,onOpenChange:_,children:(0,q.jsx)(Vy,{className:`max-w-5xl max-h-[90vh] overflow-hidden p-0 flex flex-col`,children:(0,q.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,q.jsx)(F.Suspense,{fallback:(0,q.jsx)(`div`,{className:`flex items-center justify-center h-40`,children:(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`states.loading`)})}),children:(0,q.jsx)(mY,{})})})})}),(0,q.jsx)(F.Suspense,{fallback:null,children:(0,q.jsx)(gY,{open:v,onClose:b})}),(0,q.jsx)(FJ,{onOpenSettings:()=>h(!0),onOpenAnalytics:()=>_(!0),onOpenDocs:()=>y(!0)}),(0,q.jsx)(yU,{open:C,onOpenChange:w}),(0,q.jsx)(mq,{open:x,onClose:()=>S(!1)})]})}function xY({children:e}){let{activeProjectId:t}=yd();return(0,q.jsx)(mG,{activeProjectId:t,children:e})}function SY(){return(0,q.jsx)(`span`,{"aria-hidden":!0,style:{display:`none`}})}function CY(){let{theme:e}=lH(),t=e.previewSwatches.accents[0],n=e.status.completed,r=e.status.failed,i=e.status.canceled,a=e.status.running;return(0,q.jsx)(ya,{position:`bottom-right`,theme:e.scheme,gap:8,closeButton:!0,visibleToasts:6,icons:{loading:(0,q.jsx)(SY,{})},style:{"--accent":t,"--toast-success-border":`color-mix(in srgb, ${n} 38%, transparent)`,"--toast-error-border":`color-mix(in srgb, ${r} 38%, transparent)`,"--toast-warning-border":`color-mix(in srgb, ${i} 38%, transparent)`,"--toast-info-border":`color-mix(in srgb, ${a} 38%, transparent)`},toastOptions:{unstyled:!0,classNames:{toast:`glass-card border border-border/30 text-foreground text-xs p-3 rounded-lg flex items-start gap-2 w-[356px] max-w-[356px] overflow-hidden shadow-lg`,content:`flex-1 min-w-0 flex flex-col gap-0.5`,icon:`shrink-0 mt-[2px] flex items-center justify-center`,title:`font-medium text-sm`,description:`text-muted-foreground mt-0.5`,actionButton:`text-[11px] px-2.5 py-1 rounded-md bg-accent-primary text-white hover:bg-accent-primary/90 whitespace-nowrap shrink-0 self-start`,cancelButton:`text-[11px] px-2.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50 whitespace-nowrap shrink-0 self-start`,closeButton:`text-muted-foreground hover:text-foreground rounded-md p-0.5`,success:`border-l-4 border-l-[var(--toast-success-border)]`,error:`border-l-4 border-l-[var(--toast-error-border)]`,warning:`border-l-4 border-l-[var(--toast-warning-border)]`,info:`border-l-4 border-l-[var(--toast-info-border)]`,loading:``}}})}function wY(){return aY(),(0,q.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100vh`,overflow:`hidden`},children:(0,q.jsx)(`div`,{style:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:(0,q.jsx)(yl,{url:aD,children:(0,q.jsx)(cH,{children:(0,q.jsxs)(vH,{children:[(0,q.jsx)(EW,{}),(0,q.jsxs)(_d,{children:[(0,q.jsx)(oW,{}),(0,q.jsx)(iE,{children:(0,q.jsx)(zJ,{children:(0,q.jsx)(PB,{children:(0,q.jsx)(Cq,{children:(0,q.jsx)(xY,{children:(0,q.jsx)(dg,{children:(0,q.jsxs)(xB,{children:[(0,q.jsx)(bY,{}),(0,q.jsx)(CY,{})]})})})})})})})]})]})})})})})}async function TY(){await dl(),ml(),await cd(),(0,Xn.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(F.StrictMode,{children:(0,q.jsx)(On,{children:(0,q.jsx)(wY,{})})}));let e=document.getElementById(`specrails-splash`);e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.classList.add(`is-hidden`),setTimeout(()=>e.remove(),300)})})}TY();export{wf as $,zn as $t,X as A,Ol as At,hp as B,ds as Bt,Uy as C,ru as Ct,pg as D,Fl as Dt,fg as E,Ll as Et,jp as F,Pc as Ft,Yf as G,Ja as Gt,cp as H,bo as Ht,Ep as I,rl as It,Pf as J,Vi as Jt,Uf as K,K as Kt,bp as L,$c as Lt,Bp as M,gl as Mt,Fp as N,ll as Nt,Nh as O,Pl as Ot,Pp as P,Gc as Pt,Tf as Q,dt as Qt,_p as R,Vc as Rt,Gy as S,J as St,Wy as T,Rl as Tt,sp as U,lo as Ut,pp as V,gs as Vt,rp as W,uo as Wt,Of as X,jn as Xt,jf as Y,zi as Yt,Ef as Z,st as Zt,AT as _,Fd as _t,jV as a,of as at,Ry as b,yd as bt,SB as c,tf as ct,VL as d,Zd as dt,M as en,Sf as et,LP as f,Wd as ft,ME as g,Rd as gt,tO as h,zd as ht,dH as i,sf as it,Vp as j,bl as jt,Z as k,kl as kt,Jz as l,ef as lt,ON as m,Vd as mt,kU as n,hf as nt,TB as o,af as ot,zN as p,Hd as pt,Vf as q,G as qt,$ as r,cf as rt,wB as s,nf as st,kW as t,O as tn,bf as tt,Iz as u,Qd as ut,MT as v,Y as vt,Hy as w,zl as wt,Vy as x,dd as xt,jT as y,fd as yt,gp as z,pc as zt};