@venturewild/workspace 0.6.22 → 0.6.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/bin/wild-workspace.mjs +31 -7
- package/server/src/agent.mjs +19 -0
- package/server/src/auto-update.mjs +13 -3
- package/server/src/index.mjs +15 -1
- package/server/src/service.mjs +70 -0
- package/web/dist/assets/index-CUcUGKJC.css +32 -0
- package/web/dist/assets/index-Ccr8fqed.js +131 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-ABxdF5Rs.css +0 -32
- package/web/dist/assets/index-CPnHHTR6.js +0 -131
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var oc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function za(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fk(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var eb={exports:{}},Gc={},tb={exports:{}},Ue={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ba=Symbol.for("react.element"),pk=Symbol.for("react.portal"),mk=Symbol.for("react.fragment"),gk=Symbol.for("react.strict_mode"),yk=Symbol.for("react.profiler"),vk=Symbol.for("react.provider"),_k=Symbol.for("react.context"),bk=Symbol.for("react.forward_ref"),wk=Symbol.for("react.suspense"),xk=Symbol.for("react.memo"),Sk=Symbol.for("react.lazy"),Zm=Symbol.iterator;function kk(e){return e===null||typeof e!="object"?null:(e=Zm&&e[Zm]||e["@@iterator"],typeof e=="function"?e:null)}var nb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rb=Object.assign,ib={};function po(e,t,n){this.props=e,this.context=t,this.refs=ib,this.updater=n||nb}po.prototype.isReactComponent={};po.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};po.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function sb(){}sb.prototype=po.prototype;function Xf(e,t,n){this.props=e,this.context=t,this.refs=ib,this.updater=n||nb}var Jf=Xf.prototype=new sb;Jf.constructor=Xf;rb(Jf,po.prototype);Jf.isPureReactComponent=!0;var Qm=Array.isArray,ob=Object.prototype.hasOwnProperty,Zf={current:null},ab={key:!0,ref:!0,__self:!0,__source:!0};function lb(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)ob.call(t,r)&&!ab.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:Ba,type:e,key:s,ref:o,props:i,_owner:Zf.current}}function Ck(e,t){return{$$typeof:Ba,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Qf(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ba}function Ek(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var eg=/\/+/g;function Iu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ek(""+e.key):t.toString(36)}function Il(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ba:case pk:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Iu(o,0):r,Qm(i)?(n="",e!=null&&(n=e.replace(eg,"$&/")+"/"),Il(i,t,n,"",function(u){return u})):i!=null&&(Qf(i)&&(i=Ck(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(eg,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",Qm(e))for(var a=0;a<e.length;a++){s=e[a];var c=r+Iu(s,a);o+=Il(s,t,n,c,i)}else if(c=kk(e),typeof c=="function")for(e=c.call(e),a=0;!(s=e.next()).done;)s=s.value,c=r+Iu(s,a++),o+=Il(s,t,n,c,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Qa(e,t,n){if(e==null)return e;var r=[],i=0;return Il(e,r,"","",function(s){return t.call(n,s,i++)}),r}function Nk(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Sn={current:null},Ml={transition:null},jk={ReactCurrentDispatcher:Sn,ReactCurrentBatchConfig:Ml,ReactCurrentOwner:Zf};function cb(){throw Error("act(...) is not supported in production builds of React.")}Ue.Children={map:Qa,forEach:function(e,t,n){Qa(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Qa(e,function(){t++}),t},toArray:function(e){return Qa(e,function(t){return t})||[]},only:function(e){if(!Qf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ue.Component=po;Ue.Fragment=mk;Ue.Profiler=yk;Ue.PureComponent=Xf;Ue.StrictMode=gk;Ue.Suspense=wk;Ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jk;Ue.act=cb;Ue.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=rb({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Zf.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)ob.call(t,c)&&!ab.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Ba,type:e.type,key:i,ref:s,props:r,_owner:o}};Ue.createContext=function(e){return e={$$typeof:_k,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:vk,_context:e},e.Consumer=e};Ue.createElement=lb;Ue.createFactory=function(e){var t=lb.bind(null,e);return t.type=e,t};Ue.createRef=function(){return{current:null}};Ue.forwardRef=function(e){return{$$typeof:bk,render:e}};Ue.isValidElement=Qf;Ue.lazy=function(e){return{$$typeof:Sk,_payload:{_status:-1,_result:e},_init:Nk}};Ue.memo=function(e,t){return{$$typeof:xk,type:e,compare:t===void 0?null:t}};Ue.startTransition=function(e){var t=Ml.transition;Ml.transition={};try{e()}finally{Ml.transition=t}};Ue.unstable_act=cb;Ue.useCallback=function(e,t){return Sn.current.useCallback(e,t)};Ue.useContext=function(e){return Sn.current.useContext(e)};Ue.useDebugValue=function(){};Ue.useDeferredValue=function(e){return Sn.current.useDeferredValue(e)};Ue.useEffect=function(e,t){return Sn.current.useEffect(e,t)};Ue.useId=function(){return Sn.current.useId()};Ue.useImperativeHandle=function(e,t,n){return Sn.current.useImperativeHandle(e,t,n)};Ue.useInsertionEffect=function(e,t){return Sn.current.useInsertionEffect(e,t)};Ue.useLayoutEffect=function(e,t){return Sn.current.useLayoutEffect(e,t)};Ue.useMemo=function(e,t){return Sn.current.useMemo(e,t)};Ue.useReducer=function(e,t,n){return Sn.current.useReducer(e,t,n)};Ue.useRef=function(e){return Sn.current.useRef(e)};Ue.useState=function(e){return Sn.current.useState(e)};Ue.useSyncExternalStore=function(e,t,n){return Sn.current.useSyncExternalStore(e,t,n)};Ue.useTransition=function(){return Sn.current.useTransition()};Ue.version="18.3.1";tb.exports=Ue;var b=tb.exports;const yr=za(b);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Rk=b,Tk=Symbol.for("react.element"),Pk=Symbol.for("react.fragment"),Dk=Object.prototype.hasOwnProperty,Lk=Rk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ak={key:!0,ref:!0,__self:!0,__source:!0};function ub(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Dk.call(t,r)&&!Ak.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Tk,type:e,key:s,ref:o,props:i,_owner:Lk.current}}Gc.Fragment=Pk;Gc.jsx=ub;Gc.jsxs=ub;eb.exports=Gc;var l=eb.exports,ed={},hb={exports:{}},Kn={},db={exports:{}},fb={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(N,H){var C=N.length;N.push(H);e:for(;0<C;){var re=C-1>>>1,Q=N[re];if(0<i(Q,H))N[re]=H,N[C]=Q,C=re;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var H=N[0],C=N.pop();if(C!==H){N[0]=C;e:for(var re=0,Q=N.length,x=Q>>>1;re<x;){var Y=2*(re+1)-1,Z=N[Y],oe=Y+1,me=N[oe];if(0>i(Z,C))oe<Q&&0>i(me,Z)?(N[re]=me,N[oe]=C,re=oe):(N[re]=Z,N[Y]=C,re=Y);else if(oe<Q&&0>i(me,C))N[re]=me,N[oe]=C,re=oe;else break e}}return H}function i(N,H){var C=N.sortIndex-H.sortIndex;return C!==0?C:N.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var c=[],u=[],d=1,h=null,f=3,p=!1,m=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(N){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=N)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function S(N){if(g=!1,y(N),!m)if(n(c)!==null)m=!0,M(E);else{var H=n(u);H!==null&&W(S,H.startTime-N)}}function E(N,H){m=!1,g&&(g=!1,v(R),R=-1),p=!0;var C=f;try{for(y(H),h=n(c);h!==null&&(!(h.expirationTime>H)||N&&!$());){var re=h.callback;if(typeof re=="function"){h.callback=null,f=h.priorityLevel;var Q=re(h.expirationTime<=H);H=e.unstable_now(),typeof Q=="function"?h.callback=Q:h===n(c)&&r(c),y(H)}else r(c);h=n(c)}if(h!==null)var x=!0;else{var Y=n(u);Y!==null&&W(S,Y.startTime-H),x=!1}return x}finally{h=null,f=C,p=!1}}var k=!1,T=null,R=-1,O=5,j=-1;function $(){return!(e.unstable_now()-j<O)}function L(){if(T!==null){var N=e.unstable_now();j=N;var H=!0;try{H=T(!0,N)}finally{H?P():(k=!1,T=null)}}else k=!1}var P;if(typeof _=="function")P=function(){_(L)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,D=A.port2;A.port1.onmessage=L,P=function(){D.postMessage(null)}}else P=function(){w(L,0)};function M(N){T=N,k||(k=!0,P())}function W(N,H){R=w(function(){N(e.unstable_now())},H)}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(N){N.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(E))},e.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<N?Math.floor(1e3/N):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(N){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var C=f;f=H;try{return N()}finally{f=C}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(N,H){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var C=f;f=N;try{return H()}finally{f=C}},e.unstable_scheduleCallback=function(N,H,C){var re=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?re+C:re):C=re,N){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=C+Q,N={id:d++,callback:H,priorityLevel:N,startTime:C,expirationTime:Q,sortIndex:-1},C>re?(N.sortIndex=C,t(u,N),n(c)===null&&N===n(u)&&(g?(v(R),R=-1):g=!0,W(S,C-re))):(N.sortIndex=Q,t(c,N),m||p||(m=!0,M(E))),N},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(N){var H=f;return function(){var C=f;f=H;try{return N.apply(this,arguments)}finally{f=C}}}})(fb);db.exports=fb;var Ik=db.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var Mk=b,qn=Ik;function ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var pb=new Set,ga={};function ys(e,t){io(e,t),io(e+"Capture",t)}function io(e,t){for(ga[e]=t,e=0;e<t.length;e++)pb.add(t[e])}var Yr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),td=Object.prototype.hasOwnProperty,Ok=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,tg={},ng={};function zk(e){return td.call(ng,e)?!0:td.call(tg,e)?!1:Ok.test(e)?ng[e]=!0:(tg[e]=!0,!1)}function Bk(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function $k(e,t,n,r){if(t===null||typeof t>"u"||Bk(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function kn(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var ln={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ln[e]=new kn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ln[t]=new kn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ln[e]=new kn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ln[e]=new kn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ln[e]=new kn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ln[e]=new kn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ln[e]=new kn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ln[e]=new kn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ln[e]=new kn(e,5,!1,e.toLowerCase(),null,!1,!1)});var ep=/[\-:]([a-z])/g;function tp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ep,tp);ln[t]=new kn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ep,tp);ln[t]=new kn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ep,tp);ln[t]=new kn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ln[e]=new kn(e,1,!1,e.toLowerCase(),null,!1,!1)});ln.xlinkHref=new kn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ln[e]=new kn(e,1,!1,e.toLowerCase(),null,!0,!0)});function np(e,t,n,r){var i=ln.hasOwnProperty(t)?ln[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&($k(t,n,i,r)&&(n=null),r||i===null?zk(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Zr=Mk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,el=Symbol.for("react.element"),Is=Symbol.for("react.portal"),Ms=Symbol.for("react.fragment"),rp=Symbol.for("react.strict_mode"),nd=Symbol.for("react.profiler"),mb=Symbol.for("react.provider"),gb=Symbol.for("react.context"),ip=Symbol.for("react.forward_ref"),rd=Symbol.for("react.suspense"),id=Symbol.for("react.suspense_list"),sp=Symbol.for("react.memo"),pi=Symbol.for("react.lazy"),yb=Symbol.for("react.offscreen"),rg=Symbol.iterator;function ko(e){return e===null||typeof e!="object"?null:(e=rg&&e[rg]||e["@@iterator"],typeof e=="function"?e:null)}var Dt=Object.assign,Mu;function Ho(e){if(Mu===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Mu=t&&t[1]||""}return`
|
|
34
|
+
`+Mu+e}var Ou=!1;function zu(e,t){if(!e||Ou)return"";Ou=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var i=u.stack.split(`
|
|
35
|
+
`),s=r.stack.split(`
|
|
36
|
+
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var c=`
|
|
37
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=a);break}}}finally{Ou=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ho(e):""}function Fk(e){switch(e.tag){case 5:return Ho(e.type);case 16:return Ho("Lazy");case 13:return Ho("Suspense");case 19:return Ho("SuspenseList");case 0:case 2:case 15:return e=zu(e.type,!1),e;case 11:return e=zu(e.type.render,!1),e;case 1:return e=zu(e.type,!0),e;default:return""}}function sd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ms:return"Fragment";case Is:return"Portal";case nd:return"Profiler";case rp:return"StrictMode";case rd:return"Suspense";case id:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gb:return(e.displayName||"Context")+".Consumer";case mb:return(e._context.displayName||"Context")+".Provider";case ip:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case sp:return t=e.displayName||null,t!==null?t:sd(e.type)||"Memo";case pi:t=e._payload,e=e._init;try{return sd(e(t))}catch{}}return null}function Hk(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return sd(t);case 8:return t===rp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Pi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vb(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Wk(e){var t=vb(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function tl(e){e._valueTracker||(e._valueTracker=Wk(e))}function _b(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=vb(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ac(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function od(e,t){var n=t.checked;return Dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ig(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Pi(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function bb(e,t){t=t.checked,t!=null&&np(e,"checked",t,!1)}function ad(e,t){bb(e,t);var n=Pi(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ld(e,t.type,n):t.hasOwnProperty("defaultValue")&&ld(e,t.type,Pi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function sg(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ld(e,t,n){(t!=="number"||ac(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Wo=Array.isArray;function Gs(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Pi(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function cd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return Dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function og(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ee(92));if(Wo(n)){if(1<n.length)throw Error(ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Pi(n)}}function wb(e,t){var n=Pi(t.value),r=Pi(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function ag(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function xb(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ud(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?xb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var nl,Sb=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(nl=nl||document.createElement("div"),nl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=nl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ya(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ea={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Uk=["Webkit","ms","Moz","O"];Object.keys(ea).forEach(function(e){Uk.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ea[t]=ea[e]})});function kb(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ea.hasOwnProperty(e)&&ea[e]?(""+t).trim():t+"px"}function Cb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=kb(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Vk=Dt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function hd(e,t){if(t){if(Vk[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function dd(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var fd=null;function op(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pd=null,Xs=null,Js=null;function lg(e){if(e=Ha(e)){if(typeof pd!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=eu(t),pd(e.stateNode,e.type,t))}}function Eb(e){Xs?Js?Js.push(e):Js=[e]:Xs=e}function Nb(){if(Xs){var e=Xs,t=Js;if(Js=Xs=null,lg(e),t)for(e=0;e<t.length;e++)lg(t[e])}}function jb(e,t){return e(t)}function Rb(){}var Bu=!1;function Tb(e,t,n){if(Bu)return e(t,n);Bu=!0;try{return jb(e,t,n)}finally{Bu=!1,(Xs!==null||Js!==null)&&(Rb(),Nb())}}function va(e,t){var n=e.stateNode;if(n===null)return null;var r=eu(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ee(231,t,typeof n));return n}var md=!1;if(Yr)try{var Co={};Object.defineProperty(Co,"passive",{get:function(){md=!0}}),window.addEventListener("test",Co,Co),window.removeEventListener("test",Co,Co)}catch{md=!1}function qk(e,t,n,r,i,s,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var ta=!1,lc=null,cc=!1,gd=null,Kk={onError:function(e){ta=!0,lc=e}};function Yk(e,t,n,r,i,s,o,a,c){ta=!1,lc=null,qk.apply(Kk,arguments)}function Gk(e,t,n,r,i,s,o,a,c){if(Yk.apply(this,arguments),ta){if(ta){var u=lc;ta=!1,lc=null}else throw Error(ee(198));cc||(cc=!0,gd=u)}}function vs(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 Pb(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 cg(e){if(vs(e)!==e)throw Error(ee(188))}function Xk(e){var t=e.alternate;if(!t){if(t=vs(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return cg(i),e;if(s===r)return cg(i),t;s=s.sibling}throw Error(ee(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(ee(189))}}if(n.alternate!==r)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?e:t}function Db(e){return e=Xk(e),e!==null?Lb(e):null}function Lb(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Lb(e);if(t!==null)return t;e=e.sibling}return null}var Ab=qn.unstable_scheduleCallback,ug=qn.unstable_cancelCallback,Jk=qn.unstable_shouldYield,Zk=qn.unstable_requestPaint,Ot=qn.unstable_now,Qk=qn.unstable_getCurrentPriorityLevel,ap=qn.unstable_ImmediatePriority,Ib=qn.unstable_UserBlockingPriority,uc=qn.unstable_NormalPriority,e1=qn.unstable_LowPriority,Mb=qn.unstable_IdlePriority,Xc=null,Pr=null;function t1(e){if(Pr&&typeof Pr.onCommitFiberRoot=="function")try{Pr.onCommitFiberRoot(Xc,e,void 0,(e.current.flags&128)===128)}catch{}}var pr=Math.clz32?Math.clz32:i1,n1=Math.log,r1=Math.LN2;function i1(e){return e>>>=0,e===0?32:31-(n1(e)/r1|0)|0}var rl=64,il=4194304;function Uo(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function hc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Uo(a):(s&=o,s!==0&&(r=Uo(s)))}else o=n&~i,o!==0?r=Uo(o):s!==0&&(r=Uo(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-pr(t),i=1<<n,r|=e[n],t&=~i;return r}function s1(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function o1(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-pr(s),a=1<<o,c=i[o];c===-1?(!(a&n)||a&r)&&(i[o]=s1(a,t)):c<=t&&(e.expiredLanes|=a),s&=~a}}function yd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ob(){var e=rl;return rl<<=1,!(rl&4194240)&&(rl=64),e}function $u(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $a(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-pr(t),e[t]=n}function a1(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-pr(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function lp(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-pr(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var at=0;function zb(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bb,cp,$b,Fb,Hb,vd=!1,sl=[],xi=null,Si=null,ki=null,_a=new Map,ba=new Map,yi=[],l1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function hg(e,t){switch(e){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":Si=null;break;case"mouseover":case"mouseout":ki=null;break;case"pointerover":case"pointerout":_a.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ba.delete(t.pointerId)}}function Eo(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=Ha(t),t!==null&&cp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function c1(e,t,n,r,i){switch(t){case"focusin":return xi=Eo(xi,e,t,n,r,i),!0;case"dragenter":return Si=Eo(Si,e,t,n,r,i),!0;case"mouseover":return ki=Eo(ki,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return _a.set(s,Eo(_a.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,ba.set(s,Eo(ba.get(s)||null,e,t,n,r,i)),!0}return!1}function Wb(e){var t=Zi(e.target);if(t!==null){var n=vs(t);if(n!==null){if(t=n.tag,t===13){if(t=Pb(n),t!==null){e.blockedOn=t,Hb(e.priority,function(){$b(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ol(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_d(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);fd=r,n.target.dispatchEvent(r),fd=null}else return t=Ha(n),t!==null&&cp(t),e.blockedOn=n,!1;t.shift()}return!0}function dg(e,t,n){Ol(e)&&n.delete(t)}function u1(){vd=!1,xi!==null&&Ol(xi)&&(xi=null),Si!==null&&Ol(Si)&&(Si=null),ki!==null&&Ol(ki)&&(ki=null),_a.forEach(dg),ba.forEach(dg)}function No(e,t){e.blockedOn===t&&(e.blockedOn=null,vd||(vd=!0,qn.unstable_scheduleCallback(qn.unstable_NormalPriority,u1)))}function wa(e){function t(i){return No(i,e)}if(0<sl.length){No(sl[0],e);for(var n=1;n<sl.length;n++){var r=sl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(xi!==null&&No(xi,e),Si!==null&&No(Si,e),ki!==null&&No(ki,e),_a.forEach(t),ba.forEach(t),n=0;n<yi.length;n++)r=yi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<yi.length&&(n=yi[0],n.blockedOn===null);)Wb(n),n.blockedOn===null&&yi.shift()}var Zs=Zr.ReactCurrentBatchConfig,dc=!0;function h1(e,t,n,r){var i=at,s=Zs.transition;Zs.transition=null;try{at=1,up(e,t,n,r)}finally{at=i,Zs.transition=s}}function d1(e,t,n,r){var i=at,s=Zs.transition;Zs.transition=null;try{at=4,up(e,t,n,r)}finally{at=i,Zs.transition=s}}function up(e,t,n,r){if(dc){var i=_d(e,t,n,r);if(i===null)Xu(e,t,r,fc,n),hg(e,r);else if(c1(i,e,t,n,r))r.stopPropagation();else if(hg(e,r),t&4&&-1<l1.indexOf(e)){for(;i!==null;){var s=Ha(i);if(s!==null&&Bb(s),s=_d(e,t,n,r),s===null&&Xu(e,t,r,fc,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Xu(e,t,r,null,n)}}var fc=null;function _d(e,t,n,r){if(fc=null,e=op(r),e=Zi(e),e!==null)if(t=vs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Pb(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return fc=e,null}function Ub(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Qk()){case ap:return 1;case Ib:return 4;case uc:case e1:return 16;case Mb:return 536870912;default:return 16}default:return 16}}var _i=null,hp=null,zl=null;function Vb(){if(zl)return zl;var e,t=hp,n=t.length,r,i="value"in _i?_i.value:_i.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return zl=i.slice(e,1<r?1-r:void 0)}function Bl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ol(){return!0}function fg(){return!1}function Yn(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?ol:fg,this.isPropagationStopped=fg,this}return Dt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ol)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ol)},persist:function(){},isPersistent:ol}),t}var mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dp=Yn(mo),Fa=Dt({},mo,{view:0,detail:0}),f1=Yn(Fa),Fu,Hu,jo,Jc=Dt({},Fa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fp,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==jo&&(jo&&e.type==="mousemove"?(Fu=e.screenX-jo.screenX,Hu=e.screenY-jo.screenY):Hu=Fu=0,jo=e),Fu)},movementY:function(e){return"movementY"in e?e.movementY:Hu}}),pg=Yn(Jc),p1=Dt({},Jc,{dataTransfer:0}),m1=Yn(p1),g1=Dt({},Fa,{relatedTarget:0}),Wu=Yn(g1),y1=Dt({},mo,{animationName:0,elapsedTime:0,pseudoElement:0}),v1=Yn(y1),_1=Dt({},mo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),b1=Yn(_1),w1=Dt({},mo,{data:0}),mg=Yn(w1),x1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},S1={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},k1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function C1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=k1[e])?!!t[e]:!1}function fp(){return C1}var E1=Dt({},Fa,{key:function(e){if(e.key){var t=x1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?S1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fp,charCode:function(e){return e.type==="keypress"?Bl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),N1=Yn(E1),j1=Dt({},Jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gg=Yn(j1),R1=Dt({},Fa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fp}),T1=Yn(R1),P1=Dt({},mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),D1=Yn(P1),L1=Dt({},Jc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),A1=Yn(L1),I1=[9,13,27,32],pp=Yr&&"CompositionEvent"in window,na=null;Yr&&"documentMode"in document&&(na=document.documentMode);var M1=Yr&&"TextEvent"in window&&!na,qb=Yr&&(!pp||na&&8<na&&11>=na),yg=" ",vg=!1;function Kb(e,t){switch(e){case"keyup":return I1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Os=!1;function O1(e,t){switch(e){case"compositionend":return Yb(t);case"keypress":return t.which!==32?null:(vg=!0,yg);case"textInput":return e=t.data,e===yg&&vg?null:e;default:return null}}function z1(e,t){if(Os)return e==="compositionend"||!pp&&Kb(e,t)?(e=Vb(),zl=hp=_i=null,Os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return qb&&t.locale!=="ko"?null:t.data;default:return null}}var B1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function _g(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!B1[e.type]:t==="textarea"}function Gb(e,t,n,r){Eb(r),t=pc(t,"onChange"),0<t.length&&(n=new dp("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ra=null,xa=null;function $1(e){ow(e,0)}function Zc(e){var t=$s(e);if(_b(t))return e}function F1(e,t){if(e==="change")return t}var Xb=!1;if(Yr){var Uu;if(Yr){var Vu="oninput"in document;if(!Vu){var bg=document.createElement("div");bg.setAttribute("oninput","return;"),Vu=typeof bg.oninput=="function"}Uu=Vu}else Uu=!1;Xb=Uu&&(!document.documentMode||9<document.documentMode)}function wg(){ra&&(ra.detachEvent("onpropertychange",Jb),xa=ra=null)}function Jb(e){if(e.propertyName==="value"&&Zc(xa)){var t=[];Gb(t,xa,e,op(e)),Tb($1,t)}}function H1(e,t,n){e==="focusin"?(wg(),ra=t,xa=n,ra.attachEvent("onpropertychange",Jb)):e==="focusout"&&wg()}function W1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zc(xa)}function U1(e,t){if(e==="click")return Zc(t)}function V1(e,t){if(e==="input"||e==="change")return Zc(t)}function q1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var vr=typeof Object.is=="function"?Object.is:q1;function Sa(e,t){if(vr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!td.call(t,i)||!vr(e[i],t[i]))return!1}return!0}function xg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sg(e,t){var n=xg(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=xg(n)}}function Zb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qb(){for(var e=window,t=ac();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ac(e.document)}return t}function mp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function K1(e){var t=Qb(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Zb(n.ownerDocument.documentElement,n)){if(r!==null&&mp(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Sg(n,s);var o=Sg(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Y1=Yr&&"documentMode"in document&&11>=document.documentMode,zs=null,bd=null,ia=null,wd=!1;function kg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wd||zs==null||zs!==ac(r)||(r=zs,"selectionStart"in r&&mp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ia&&Sa(ia,r)||(ia=r,r=pc(bd,"onSelect"),0<r.length&&(t=new dp("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=zs)))}function al(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Bs={animationend:al("Animation","AnimationEnd"),animationiteration:al("Animation","AnimationIteration"),animationstart:al("Animation","AnimationStart"),transitionend:al("Transition","TransitionEnd")},qu={},ew={};Yr&&(ew=document.createElement("div").style,"AnimationEvent"in window||(delete Bs.animationend.animation,delete Bs.animationiteration.animation,delete Bs.animationstart.animation),"TransitionEvent"in window||delete Bs.transitionend.transition);function Qc(e){if(qu[e])return qu[e];if(!Bs[e])return e;var t=Bs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ew)return qu[e]=t[n];return e}var tw=Qc("animationend"),nw=Qc("animationiteration"),rw=Qc("animationstart"),iw=Qc("transitionend"),sw=new Map,Cg="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ai(e,t){sw.set(e,t),ys(t,[e])}for(var Ku=0;Ku<Cg.length;Ku++){var Yu=Cg[Ku],G1=Yu.toLowerCase(),X1=Yu[0].toUpperCase()+Yu.slice(1);Ai(G1,"on"+X1)}Ai(tw,"onAnimationEnd");Ai(nw,"onAnimationIteration");Ai(rw,"onAnimationStart");Ai("dblclick","onDoubleClick");Ai("focusin","onFocus");Ai("focusout","onBlur");Ai(iw,"onTransitionEnd");io("onMouseEnter",["mouseout","mouseover"]);io("onMouseLeave",["mouseout","mouseover"]);io("onPointerEnter",["pointerout","pointerover"]);io("onPointerLeave",["pointerout","pointerover"]);ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ys("onBeforeInput",["compositionend","keypress","textInput","paste"]);ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),J1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Vo));function Eg(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Gk(r,t,void 0,e),e.currentTarget=null}function ow(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==s&&i.isPropagationStopped())break e;Eg(i,a,u),s=c}else for(o=0;o<r.length;o++){if(a=r[o],c=a.instance,u=a.currentTarget,a=a.listener,c!==s&&i.isPropagationStopped())break e;Eg(i,a,u),s=c}}}if(cc)throw e=gd,cc=!1,gd=null,e}function wt(e,t){var n=t[Ed];n===void 0&&(n=t[Ed]=new Set);var r=e+"__bubble";n.has(r)||(aw(t,e,2,!1),n.add(r))}function Gu(e,t,n){var r=0;t&&(r|=4),aw(n,e,r,t)}var ll="_reactListening"+Math.random().toString(36).slice(2);function ka(e){if(!e[ll]){e[ll]=!0,pb.forEach(function(n){n!=="selectionchange"&&(J1.has(n)||Gu(n,!1,e),Gu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ll]||(t[ll]=!0,Gu("selectionchange",!1,t))}}function aw(e,t,n,r){switch(Ub(t)){case 1:var i=h1;break;case 4:i=d1;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!md||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Xu(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;a!==null;){if(o=Zi(a),o===null)return;if(c=o.tag,c===5||c===6){r=s=o;continue e}a=a.parentNode}}r=r.return}Tb(function(){var u=s,d=op(n),h=[];e:{var f=sw.get(e);if(f!==void 0){var p=dp,m=e;switch(e){case"keypress":if(Bl(n)===0)break e;case"keydown":case"keyup":p=N1;break;case"focusin":m="focus",p=Wu;break;case"focusout":m="blur",p=Wu;break;case"beforeblur":case"afterblur":p=Wu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=pg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=m1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=T1;break;case tw:case nw:case rw:p=v1;break;case iw:p=D1;break;case"scroll":p=f1;break;case"wheel":p=A1;break;case"copy":case"cut":case"paste":p=b1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=gg}var g=(t&4)!==0,w=!g&&e==="scroll",v=g?f!==null?f+"Capture":null:f;g=[];for(var _=u,y;_!==null;){y=_;var S=y.stateNode;if(y.tag===5&&S!==null&&(y=S,v!==null&&(S=va(_,v),S!=null&&g.push(Ca(_,S,y)))),w)break;_=_.return}0<g.length&&(f=new p(f,m,null,n,d),h.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&n!==fd&&(m=n.relatedTarget||n.fromElement)&&(Zi(m)||m[Gr]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?Zi(m):null,m!==null&&(w=vs(m),m!==w||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(g=pg,S="onMouseLeave",v="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(g=gg,S="onPointerLeave",v="onPointerEnter",_="pointer"),w=p==null?f:$s(p),y=m==null?f:$s(m),f=new g(S,_+"leave",p,n,d),f.target=w,f.relatedTarget=y,S=null,Zi(d)===u&&(g=new g(v,_+"enter",m,n,d),g.target=y,g.relatedTarget=w,S=g),w=S,p&&m)t:{for(g=p,v=m,_=0,y=g;y;y=Es(y))_++;for(y=0,S=v;S;S=Es(S))y++;for(;0<_-y;)g=Es(g),_--;for(;0<y-_;)v=Es(v),y--;for(;_--;){if(g===v||v!==null&&g===v.alternate)break t;g=Es(g),v=Es(v)}g=null}else g=null;p!==null&&Ng(h,f,p,g,!1),m!==null&&w!==null&&Ng(h,w,m,g,!0)}}e:{if(f=u?$s(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var E=F1;else if(_g(f))if(Xb)E=V1;else{E=W1;var k=H1}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=U1);if(E&&(E=E(e,u))){Gb(h,E,n,d);break e}k&&k(e,f,u),e==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&ld(f,"number",f.value)}switch(k=u?$s(u):window,e){case"focusin":(_g(k)||k.contentEditable==="true")&&(zs=k,bd=u,ia=null);break;case"focusout":ia=bd=zs=null;break;case"mousedown":wd=!0;break;case"contextmenu":case"mouseup":case"dragend":wd=!1,kg(h,n,d);break;case"selectionchange":if(Y1)break;case"keydown":case"keyup":kg(h,n,d)}var T;if(pp)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Os?Kb(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(qb&&n.locale!=="ko"&&(Os||R!=="onCompositionStart"?R==="onCompositionEnd"&&Os&&(T=Vb()):(_i=d,hp="value"in _i?_i.value:_i.textContent,Os=!0)),k=pc(u,R),0<k.length&&(R=new mg(R,e,null,n,d),h.push({event:R,listeners:k}),T?R.data=T:(T=Yb(n),T!==null&&(R.data=T)))),(T=M1?O1(e,n):z1(e,n))&&(u=pc(u,"onBeforeInput"),0<u.length&&(d=new mg("onBeforeInput","beforeinput",null,n,d),h.push({event:d,listeners:u}),d.data=T))}ow(h,t)})}function Ca(e,t,n){return{instance:e,listener:t,currentTarget:n}}function pc(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=va(e,n),s!=null&&r.unshift(Ca(e,s,i)),s=va(e,t),s!=null&&r.push(Ca(e,s,i))),e=e.return}return r}function Es(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Ng(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var a=n,c=a.alternate,u=a.stateNode;if(c!==null&&c===r)break;a.tag===5&&u!==null&&(a=u,i?(c=va(n,s),c!=null&&o.unshift(Ca(n,c,a))):i||(c=va(n,s),c!=null&&o.push(Ca(n,c,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Z1=/\r\n?/g,Q1=/\u0000|\uFFFD/g;function jg(e){return(typeof e=="string"?e:""+e).replace(Z1,`
|
|
38
|
+
`).replace(Q1,"")}function cl(e,t,n){if(t=jg(t),jg(e)!==t&&n)throw Error(ee(425))}function mc(){}var xd=null,Sd=null;function kd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Cd=typeof setTimeout=="function"?setTimeout:void 0,eC=typeof clearTimeout=="function"?clearTimeout:void 0,Rg=typeof Promise=="function"?Promise:void 0,tC=typeof queueMicrotask=="function"?queueMicrotask:typeof Rg<"u"?function(e){return Rg.resolve(null).then(e).catch(nC)}:Cd;function nC(e){setTimeout(function(){throw e})}function Ju(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),wa(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);wa(t)}function Ci(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Tg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var go=Math.random().toString(36).slice(2),jr="__reactFiber$"+go,Ea="__reactProps$"+go,Gr="__reactContainer$"+go,Ed="__reactEvents$"+go,rC="__reactListeners$"+go,iC="__reactHandles$"+go;function Zi(e){var t=e[jr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gr]||n[jr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Tg(e);e!==null;){if(n=e[jr])return n;e=Tg(e)}return t}e=n,n=e.parentNode}return null}function Ha(e){return e=e[jr]||e[Gr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function $s(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function eu(e){return e[Ea]||null}var Nd=[],Fs=-1;function Ii(e){return{current:e}}function St(e){0>Fs||(e.current=Nd[Fs],Nd[Fs]=null,Fs--)}function yt(e,t){Fs++,Nd[Fs]=e.current,e.current=t}var Di={},gn=Ii(Di),Dn=Ii(!1),as=Di;function so(e,t){var n=e.type.contextTypes;if(!n)return Di;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ln(e){return e=e.childContextTypes,e!=null}function gc(){St(Dn),St(gn)}function Pg(e,t,n){if(gn.current!==Di)throw Error(ee(168));yt(gn,t),yt(Dn,n)}function lw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(ee(108,Hk(e)||"Unknown",i));return Dt({},n,r)}function yc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Di,as=gn.current,yt(gn,e),yt(Dn,Dn.current),!0}function Dg(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=lw(e,t,as),r.__reactInternalMemoizedMergedChildContext=e,St(Dn),St(gn),yt(gn,e)):St(Dn),yt(Dn,n)}var Fr=null,tu=!1,Zu=!1;function cw(e){Fr===null?Fr=[e]:Fr.push(e)}function sC(e){tu=!0,cw(e)}function Mi(){if(!Zu&&Fr!==null){Zu=!0;var e=0,t=at;try{var n=Fr;for(at=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Fr=null,tu=!1}catch(i){throw Fr!==null&&(Fr=Fr.slice(e+1)),Ab(ap,Mi),i}finally{at=t,Zu=!1}}return null}var Hs=[],Ws=0,vc=null,_c=0,er=[],tr=0,ls=null,Wr=1,Ur="";function qi(e,t){Hs[Ws++]=_c,Hs[Ws++]=vc,vc=e,_c=t}function uw(e,t,n){er[tr++]=Wr,er[tr++]=Ur,er[tr++]=ls,ls=e;var r=Wr;e=Ur;var i=32-pr(r)-1;r&=~(1<<i),n+=1;var s=32-pr(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Wr=1<<32-pr(t)+i|n<<i|r,Ur=s+e}else Wr=1<<s|n<<i|r,Ur=e}function gp(e){e.return!==null&&(qi(e,1),uw(e,1,0))}function yp(e){for(;e===vc;)vc=Hs[--Ws],Hs[Ws]=null,_c=Hs[--Ws],Hs[Ws]=null;for(;e===ls;)ls=er[--tr],er[tr]=null,Ur=er[--tr],er[tr]=null,Wr=er[--tr],er[tr]=null}var Un=null,Wn=null,Ct=!1,fr=null;function hw(e,t){var n=rr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Lg(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Un=e,Wn=Ci(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Un=e,Wn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ls!==null?{id:Wr,overflow:Ur}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Un=e,Wn=null,!0):!1;default:return!1}}function jd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Rd(e){if(Ct){var t=Wn;if(t){var n=t;if(!Lg(e,t)){if(jd(e))throw Error(ee(418));t=Ci(n.nextSibling);var r=Un;t&&Lg(e,t)?hw(r,n):(e.flags=e.flags&-4097|2,Ct=!1,Un=e)}}else{if(jd(e))throw Error(ee(418));e.flags=e.flags&-4097|2,Ct=!1,Un=e}}}function Ag(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Un=e}function ul(e){if(e!==Un)return!1;if(!Ct)return Ag(e),Ct=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!kd(e.type,e.memoizedProps)),t&&(t=Wn)){if(jd(e))throw dw(),Error(ee(418));for(;t;)hw(e,t),t=Ci(t.nextSibling)}if(Ag(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Wn=Ci(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Wn=null}}else Wn=Un?Ci(e.stateNode.nextSibling):null;return!0}function dw(){for(var e=Wn;e;)e=Ci(e.nextSibling)}function oo(){Wn=Un=null,Ct=!1}function vp(e){fr===null?fr=[e]:fr.push(e)}var oC=Zr.ReactCurrentBatchConfig;function Ro(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ee(309));var r=n.stateNode}if(!r)throw Error(ee(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(ee(284));if(!n._owner)throw Error(ee(290,e))}return e}function hl(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ig(e){var t=e._init;return t(e._payload)}function fw(e){function t(v,_){if(e){var y=v.deletions;y===null?(v.deletions=[_],v.flags|=16):y.push(_)}}function n(v,_){if(!e)return null;for(;_!==null;)t(v,_),_=_.sibling;return null}function r(v,_){for(v=new Map;_!==null;)_.key!==null?v.set(_.key,_):v.set(_.index,_),_=_.sibling;return v}function i(v,_){return v=Ri(v,_),v.index=0,v.sibling=null,v}function s(v,_,y){return v.index=y,e?(y=v.alternate,y!==null?(y=y.index,y<_?(v.flags|=2,_):y):(v.flags|=2,_)):(v.flags|=1048576,_)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function a(v,_,y,S){return _===null||_.tag!==6?(_=sh(y,v.mode,S),_.return=v,_):(_=i(_,y),_.return=v,_)}function c(v,_,y,S){var E=y.type;return E===Ms?d(v,_,y.props.children,S,y.key):_!==null&&(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===pi&&Ig(E)===_.type)?(S=i(_,y.props),S.ref=Ro(v,_,y),S.return=v,S):(S=ql(y.type,y.key,y.props,null,v.mode,S),S.ref=Ro(v,_,y),S.return=v,S)}function u(v,_,y,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==y.containerInfo||_.stateNode.implementation!==y.implementation?(_=oh(y,v.mode,S),_.return=v,_):(_=i(_,y.children||[]),_.return=v,_)}function d(v,_,y,S,E){return _===null||_.tag!==7?(_=is(y,v.mode,S,E),_.return=v,_):(_=i(_,y),_.return=v,_)}function h(v,_,y){if(typeof _=="string"&&_!==""||typeof _=="number")return _=sh(""+_,v.mode,y),_.return=v,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case el:return y=ql(_.type,_.key,_.props,null,v.mode,y),y.ref=Ro(v,null,_),y.return=v,y;case Is:return _=oh(_,v.mode,y),_.return=v,_;case pi:var S=_._init;return h(v,S(_._payload),y)}if(Wo(_)||ko(_))return _=is(_,v.mode,y,null),_.return=v,_;hl(v,_)}return null}function f(v,_,y,S){var E=_!==null?_.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return E!==null?null:a(v,_,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case el:return y.key===E?c(v,_,y,S):null;case Is:return y.key===E?u(v,_,y,S):null;case pi:return E=y._init,f(v,_,E(y._payload),S)}if(Wo(y)||ko(y))return E!==null?null:d(v,_,y,S,null);hl(v,y)}return null}function p(v,_,y,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return v=v.get(y)||null,a(_,v,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case el:return v=v.get(S.key===null?y:S.key)||null,c(_,v,S,E);case Is:return v=v.get(S.key===null?y:S.key)||null,u(_,v,S,E);case pi:var k=S._init;return p(v,_,y,k(S._payload),E)}if(Wo(S)||ko(S))return v=v.get(y)||null,d(_,v,S,E,null);hl(_,S)}return null}function m(v,_,y,S){for(var E=null,k=null,T=_,R=_=0,O=null;T!==null&&R<y.length;R++){T.index>R?(O=T,T=null):O=T.sibling;var j=f(v,T,y[R],S);if(j===null){T===null&&(T=O);break}e&&T&&j.alternate===null&&t(v,T),_=s(j,_,R),k===null?E=j:k.sibling=j,k=j,T=O}if(R===y.length)return n(v,T),Ct&&qi(v,R),E;if(T===null){for(;R<y.length;R++)T=h(v,y[R],S),T!==null&&(_=s(T,_,R),k===null?E=T:k.sibling=T,k=T);return Ct&&qi(v,R),E}for(T=r(v,T);R<y.length;R++)O=p(T,v,R,y[R],S),O!==null&&(e&&O.alternate!==null&&T.delete(O.key===null?R:O.key),_=s(O,_,R),k===null?E=O:k.sibling=O,k=O);return e&&T.forEach(function($){return t(v,$)}),Ct&&qi(v,R),E}function g(v,_,y,S){var E=ko(y);if(typeof E!="function")throw Error(ee(150));if(y=E.call(y),y==null)throw Error(ee(151));for(var k=E=null,T=_,R=_=0,O=null,j=y.next();T!==null&&!j.done;R++,j=y.next()){T.index>R?(O=T,T=null):O=T.sibling;var $=f(v,T,j.value,S);if($===null){T===null&&(T=O);break}e&&T&&$.alternate===null&&t(v,T),_=s($,_,R),k===null?E=$:k.sibling=$,k=$,T=O}if(j.done)return n(v,T),Ct&&qi(v,R),E;if(T===null){for(;!j.done;R++,j=y.next())j=h(v,j.value,S),j!==null&&(_=s(j,_,R),k===null?E=j:k.sibling=j,k=j);return Ct&&qi(v,R),E}for(T=r(v,T);!j.done;R++,j=y.next())j=p(T,v,R,j.value,S),j!==null&&(e&&j.alternate!==null&&T.delete(j.key===null?R:j.key),_=s(j,_,R),k===null?E=j:k.sibling=j,k=j);return e&&T.forEach(function(L){return t(v,L)}),Ct&&qi(v,R),E}function w(v,_,y,S){if(typeof y=="object"&&y!==null&&y.type===Ms&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case el:e:{for(var E=y.key,k=_;k!==null;){if(k.key===E){if(E=y.type,E===Ms){if(k.tag===7){n(v,k.sibling),_=i(k,y.props.children),_.return=v,v=_;break e}}else if(k.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===pi&&Ig(E)===k.type){n(v,k.sibling),_=i(k,y.props),_.ref=Ro(v,k,y),_.return=v,v=_;break e}n(v,k);break}else t(v,k);k=k.sibling}y.type===Ms?(_=is(y.props.children,v.mode,S,y.key),_.return=v,v=_):(S=ql(y.type,y.key,y.props,null,v.mode,S),S.ref=Ro(v,_,y),S.return=v,v=S)}return o(v);case Is:e:{for(k=y.key;_!==null;){if(_.key===k)if(_.tag===4&&_.stateNode.containerInfo===y.containerInfo&&_.stateNode.implementation===y.implementation){n(v,_.sibling),_=i(_,y.children||[]),_.return=v,v=_;break e}else{n(v,_);break}else t(v,_);_=_.sibling}_=oh(y,v.mode,S),_.return=v,v=_}return o(v);case pi:return k=y._init,w(v,_,k(y._payload),S)}if(Wo(y))return m(v,_,y,S);if(ko(y))return g(v,_,y,S);hl(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,_!==null&&_.tag===6?(n(v,_.sibling),_=i(_,y),_.return=v,v=_):(n(v,_),_=sh(y,v.mode,S),_.return=v,v=_),o(v)):n(v,_)}return w}var ao=fw(!0),pw=fw(!1),bc=Ii(null),wc=null,Us=null,_p=null;function bp(){_p=Us=wc=null}function wp(e){var t=bc.current;St(bc),e._currentValue=t}function Td(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Qs(e,t){wc=e,_p=Us=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Pn=!0),e.firstContext=null)}function or(e){var t=e._currentValue;if(_p!==e)if(e={context:e,memoizedValue:t,next:null},Us===null){if(wc===null)throw Error(ee(308));Us=e,wc.dependencies={lanes:0,firstContext:e}}else Us=Us.next=e;return t}var Qi=null;function xp(e){Qi===null?Qi=[e]:Qi.push(e)}function mw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,xp(t)):(n.next=i.next,i.next=n),t.interleaved=n,Xr(e,r)}function Xr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var mi=!1;function Sp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function qr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ei(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Je&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Xr(e,n)}return i=r.interleaved,i===null?(t.next=t,xp(r)):(t.next=i.next,i.next=t),r.interleaved=t,Xr(e,n)}function $l(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lp(e,n)}}function Mg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function xc(e,t,n,r){var i=e.updateQueue;mi=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var c=a,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(s!==null){var h=i.baseState;o=0,d=u=c=null,a=s;do{var f=a.lane,p=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,g=a;switch(f=t,p=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){h=m.call(p,h,f);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m=="function"?m.call(p,h,f):m,f==null)break e;h=Dt({},h,f);break e;case 2:mi=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(d===null&&(c=h),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);us|=o,e.lanes=o,e.memoizedState=h}}function Og(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(ee(191,i));i.call(r)}}}var Wa={},Dr=Ii(Wa),Na=Ii(Wa),ja=Ii(Wa);function es(e){if(e===Wa)throw Error(ee(174));return e}function kp(e,t){switch(yt(ja,t),yt(Na,e),yt(Dr,Wa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ud(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ud(t,e)}St(Dr),yt(Dr,t)}function lo(){St(Dr),St(Na),St(ja)}function yw(e){es(ja.current);var t=es(Dr.current),n=ud(t,e.type);t!==n&&(yt(Na,e),yt(Dr,n))}function Cp(e){Na.current===e&&(St(Dr),St(Na))}var Tt=Ii(0);function Sc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Qu=[];function Ep(){for(var e=0;e<Qu.length;e++)Qu[e]._workInProgressVersionPrimary=null;Qu.length=0}var Fl=Zr.ReactCurrentDispatcher,eh=Zr.ReactCurrentBatchConfig,cs=0,Pt=null,qt=null,Xt=null,kc=!1,sa=!1,Ra=0,aC=0;function un(){throw Error(ee(321))}function Np(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!vr(e[n],t[n]))return!1;return!0}function jp(e,t,n,r,i,s){if(cs=s,Pt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Fl.current=e===null||e.memoizedState===null?hC:dC,e=n(r,i),sa){s=0;do{if(sa=!1,Ra=0,25<=s)throw Error(ee(301));s+=1,Xt=qt=null,t.updateQueue=null,Fl.current=fC,e=n(r,i)}while(sa)}if(Fl.current=Cc,t=qt!==null&&qt.next!==null,cs=0,Xt=qt=Pt=null,kc=!1,t)throw Error(ee(300));return e}function Rp(){var e=Ra!==0;return Ra=0,e}function kr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Pt.memoizedState=Xt=e:Xt=Xt.next=e,Xt}function ar(){if(qt===null){var e=Pt.alternate;e=e!==null?e.memoizedState:null}else e=qt.next;var t=Xt===null?Pt.memoizedState:Xt.next;if(t!==null)Xt=t,qt=e;else{if(e===null)throw Error(ee(310));qt=e,e={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},Xt===null?Pt.memoizedState=Xt=e:Xt=Xt.next=e}return Xt}function Ta(e,t){return typeof t=="function"?t(e):t}function th(e){var t=ar(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=qt,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,c=null,u=s;do{var d=u.lane;if((cs&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=h,o=r):c=c.next=h,Pt.lanes|=d,us|=d}u=u.next}while(u!==null&&u!==s);c===null?o=r:c.next=a,vr(r,t.memoizedState)||(Pn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,Pt.lanes|=s,us|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function nh(e){var t=ar(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);vr(s,t.memoizedState)||(Pn=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function vw(){}function _w(e,t){var n=Pt,r=ar(),i=t(),s=!vr(r.memoizedState,i);if(s&&(r.memoizedState=i,Pn=!0),r=r.queue,Tp(xw.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Xt!==null&&Xt.memoizedState.tag&1){if(n.flags|=2048,Pa(9,ww.bind(null,n,r,i,t),void 0,null),en===null)throw Error(ee(349));cs&30||bw(n,t,i)}return i}function bw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Pt.updateQueue,t===null?(t={lastEffect:null,stores:null},Pt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ww(e,t,n,r){t.value=n,t.getSnapshot=r,Sw(t)&&kw(e)}function xw(e,t,n){return n(function(){Sw(t)&&kw(e)})}function Sw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!vr(e,n)}catch{return!0}}function kw(e){var t=Xr(e,1);t!==null&&mr(t,e,1,-1)}function zg(e){var t=kr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ta,lastRenderedState:e},t.queue=e,e=e.dispatch=uC.bind(null,Pt,e),[t.memoizedState,e]}function Pa(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Pt.updateQueue,t===null?(t={lastEffect:null,stores:null},Pt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Cw(){return ar().memoizedState}function Hl(e,t,n,r){var i=kr();Pt.flags|=e,i.memoizedState=Pa(1|t,n,void 0,r===void 0?null:r)}function nu(e,t,n,r){var i=ar();r=r===void 0?null:r;var s=void 0;if(qt!==null){var o=qt.memoizedState;if(s=o.destroy,r!==null&&Np(r,o.deps)){i.memoizedState=Pa(t,n,s,r);return}}Pt.flags|=e,i.memoizedState=Pa(1|t,n,s,r)}function Bg(e,t){return Hl(8390656,8,e,t)}function Tp(e,t){return nu(2048,8,e,t)}function Ew(e,t){return nu(4,2,e,t)}function Nw(e,t){return nu(4,4,e,t)}function jw(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rw(e,t,n){return n=n!=null?n.concat([e]):null,nu(4,4,jw.bind(null,t,e),n)}function Pp(){}function Tw(e,t){var n=ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Np(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Pw(e,t){var n=ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Np(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Dw(e,t,n){return cs&21?(vr(n,t)||(n=Ob(),Pt.lanes|=n,us|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Pn=!0),e.memoizedState=n)}function lC(e,t){var n=at;at=n!==0&&4>n?n:4,e(!0);var r=eh.transition;eh.transition={};try{e(!1),t()}finally{at=n,eh.transition=r}}function Lw(){return ar().memoizedState}function cC(e,t,n){var r=ji(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Aw(e))Iw(t,n);else if(n=mw(e,t,n,r),n!==null){var i=xn();mr(n,e,r,i),Mw(n,t,r)}}function uC(e,t,n){var r=ji(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Aw(e))Iw(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,vr(a,o)){var c=t.interleaved;c===null?(i.next=i,xp(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=mw(e,t,i,r),n!==null&&(i=xn(),mr(n,e,r,i),Mw(n,t,r))}}function Aw(e){var t=e.alternate;return e===Pt||t!==null&&t===Pt}function Iw(e,t){sa=kc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Mw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lp(e,n)}}var Cc={readContext:or,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},hC={readContext:or,useCallback:function(e,t){return kr().memoizedState=[e,t===void 0?null:t],e},useContext:or,useEffect:Bg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hl(4194308,4,jw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hl(4,2,e,t)},useMemo:function(e,t){var n=kr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=cC.bind(null,Pt,e),[r.memoizedState,e]},useRef:function(e){var t=kr();return e={current:e},t.memoizedState=e},useState:zg,useDebugValue:Pp,useDeferredValue:function(e){return kr().memoizedState=e},useTransition:function(){var e=zg(!1),t=e[0];return e=lC.bind(null,e[1]),kr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Pt,i=kr();if(Ct){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),en===null)throw Error(ee(349));cs&30||bw(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Bg(xw.bind(null,r,s,e),[e]),r.flags|=2048,Pa(9,ww.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=kr(),t=en.identifierPrefix;if(Ct){var n=Ur,r=Wr;n=(r&~(1<<32-pr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ra++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=aC++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},dC={readContext:or,useCallback:Tw,useContext:or,useEffect:Tp,useImperativeHandle:Rw,useInsertionEffect:Ew,useLayoutEffect:Nw,useMemo:Pw,useReducer:th,useRef:Cw,useState:function(){return th(Ta)},useDebugValue:Pp,useDeferredValue:function(e){var t=ar();return Dw(t,qt.memoizedState,e)},useTransition:function(){var e=th(Ta)[0],t=ar().memoizedState;return[e,t]},useMutableSource:vw,useSyncExternalStore:_w,useId:Lw,unstable_isNewReconciler:!1},fC={readContext:or,useCallback:Tw,useContext:or,useEffect:Tp,useImperativeHandle:Rw,useInsertionEffect:Ew,useLayoutEffect:Nw,useMemo:Pw,useReducer:nh,useRef:Cw,useState:function(){return nh(Ta)},useDebugValue:Pp,useDeferredValue:function(e){var t=ar();return qt===null?t.memoizedState=e:Dw(t,qt.memoizedState,e)},useTransition:function(){var e=nh(Ta)[0],t=ar().memoizedState;return[e,t]},useMutableSource:vw,useSyncExternalStore:_w,useId:Lw,unstable_isNewReconciler:!1};function hr(e,t){if(e&&e.defaultProps){t=Dt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Pd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Dt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ru={isMounted:function(e){return(e=e._reactInternals)?vs(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=xn(),i=ji(e),s=qr(r,i);s.payload=t,n!=null&&(s.callback=n),t=Ei(e,s,i),t!==null&&(mr(t,e,i,r),$l(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=xn(),i=ji(e),s=qr(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Ei(e,s,i),t!==null&&(mr(t,e,i,r),$l(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=xn(),r=ji(e),i=qr(n,r);i.tag=2,t!=null&&(i.callback=t),t=Ei(e,i,r),t!==null&&(mr(t,e,r,n),$l(t,e,r))}};function $g(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!Sa(n,r)||!Sa(i,s):!0}function Ow(e,t,n){var r=!1,i=Di,s=t.contextType;return typeof s=="object"&&s!==null?s=or(s):(i=Ln(t)?as:gn.current,r=t.contextTypes,s=(r=r!=null)?so(e,i):Di),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ru,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Fg(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ru.enqueueReplaceState(t,t.state,null)}function Dd(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Sp(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=or(s):(s=Ln(t)?as:gn.current,i.context=so(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Pd(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&ru.enqueueReplaceState(i,i.state,null),xc(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function co(e,t){try{var n="",r=t;do n+=Fk(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
39
|
+
Error generating stack: `+s.message+`
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function rh(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ld(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var pC=typeof WeakMap=="function"?WeakMap:Map;function zw(e,t,n){n=qr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Nc||(Nc=!0,Wd=r),Ld(e,t)},n}function Bw(e,t,n){n=qr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ld(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Ld(e,t),typeof r!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Hg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new pC;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=jC.bind(null,e,t,n),t.then(e,e))}function Wg(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ug(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=qr(-1,1),t.tag=2,Ei(n,t,1))),n.lanes|=1),e)}var mC=Zr.ReactCurrentOwner,Pn=!1;function bn(e,t,n,r){t.child=e===null?pw(t,null,n,r):ao(t,e.child,n,r)}function Vg(e,t,n,r,i){n=n.render;var s=t.ref;return Qs(t,i),r=jp(e,t,n,r,s,i),n=Rp(),e!==null&&!Pn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Jr(e,t,i)):(Ct&&n&&gp(t),t.flags|=1,bn(e,t,r,i),t.child)}function qg(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Bp(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,$w(e,t,s,r,i)):(e=ql(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Sa,n(o,r)&&e.ref===t.ref)return Jr(e,t,i)}return t.flags|=1,e=Ri(s,r),e.ref=t.ref,e.return=t,t.child=e}function $w(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Sa(s,r)&&e.ref===t.ref)if(Pn=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(Pn=!0);else return t.lanes=e.lanes,Jr(e,t,i)}return Ad(e,t,n,r,i)}function Fw(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},yt(qs,Hn),Hn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,yt(qs,Hn),Hn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,yt(qs,Hn),Hn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,yt(qs,Hn),Hn|=r;return bn(e,t,i,n),t.child}function Hw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ad(e,t,n,r,i){var s=Ln(n)?as:gn.current;return s=so(t,s),Qs(t,i),n=jp(e,t,n,r,s,i),r=Rp(),e!==null&&!Pn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Jr(e,t,i)):(Ct&&r&&gp(t),t.flags|=1,bn(e,t,n,i),t.child)}function Kg(e,t,n,r,i){if(Ln(n)){var s=!0;yc(t)}else s=!1;if(Qs(t,i),t.stateNode===null)Wl(e,t),Ow(t,n,r),Dd(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=or(u):(u=Ln(n)?as:gn.current,u=so(t,u));var d=n.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||c!==u)&&Fg(t,o,r,u),mi=!1;var f=t.memoizedState;o.state=f,xc(t,r,o,i),c=t.memoizedState,a!==r||f!==c||Dn.current||mi?(typeof d=="function"&&(Pd(t,n,d,r),c=t.memoizedState),(a=mi||$g(t,n,a,r,f,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,gw(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:hr(t.type,a),o.props=u,h=t.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=or(c):(c=Ln(n)?as:gn.current,c=so(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==c)&&Fg(t,o,r,c),mi=!1,f=t.memoizedState,o.state=f,xc(t,r,o,i);var m=t.memoizedState;a!==h||f!==m||Dn.current||mi?(typeof p=="function"&&(Pd(t,n,p,r),m=t.memoizedState),(u=mi||$g(t,n,u,r,f,m,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Id(e,t,n,r,s,i)}function Id(e,t,n,r,i,s){Hw(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&Dg(t,n,!1),Jr(e,t,s);r=t.stateNode,mC.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=ao(t,e.child,null,s),t.child=ao(t,null,a,s)):bn(e,t,a,s),t.memoizedState=r.state,i&&Dg(t,n,!0),t.child}function Ww(e){var t=e.stateNode;t.pendingContext?Pg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Pg(e,t.context,!1),kp(e,t.containerInfo)}function Yg(e,t,n,r,i){return oo(),vp(i),t.flags|=256,bn(e,t,n,r),t.child}var Md={dehydrated:null,treeContext:null,retryLane:0};function Od(e){return{baseLanes:e,cachePool:null,transitions:null}}function Uw(e,t,n){var r=t.pendingProps,i=Tt.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),yt(Tt,i&1),e===null)return Rd(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=ou(o,r,0,null),e=is(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Od(n),t.memoizedState=Md,e):Dp(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return gC(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ri(i,c),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Ri(a,s):(s=is(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Od(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Md,r}return s=e.child,e=s.sibling,r=Ri(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Dp(e,t){return t=ou({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function dl(e,t,n,r){return r!==null&&vp(r),ao(t,e.child,null,n),e=Dp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gC(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=rh(Error(ee(422))),dl(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=ou({mode:"visible",children:r.children},i,0,null),s=is(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&ao(t,e.child,null,o),t.child.memoizedState=Od(o),t.memoizedState=Md,s);if(!(t.mode&1))return dl(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(ee(419)),r=rh(s,r,void 0),dl(e,t,o,r)}if(a=(o&e.childLanes)!==0,Pn||a){if(r=en,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Xr(e,i),mr(r,e,i,-1))}return zp(),r=rh(Error(ee(421))),dl(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=RC.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Wn=Ci(i.nextSibling),Un=t,Ct=!0,fr=null,e!==null&&(er[tr++]=Wr,er[tr++]=Ur,er[tr++]=ls,Wr=e.id,Ur=e.overflow,ls=t),t=Dp(t,r.children),t.flags|=4096,t)}function Gg(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Td(e.return,t,n)}function ih(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Vw(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(bn(e,t,r.children,n),r=Tt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gg(e,n,t);else if(e.tag===19)Gg(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(yt(Tt,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Sc(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ih(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Sc(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ih(t,!0,n,null,s);break;case"together":ih(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Wl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Jr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),us|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,n=Ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function yC(e,t,n){switch(t.tag){case 3:Ww(t),oo();break;case 5:yw(t);break;case 1:Ln(t.type)&&yc(t);break;case 4:kp(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;yt(bc,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(yt(Tt,Tt.current&1),t.flags|=128,null):n&t.child.childLanes?Uw(e,t,n):(yt(Tt,Tt.current&1),e=Jr(e,t,n),e!==null?e.sibling:null);yt(Tt,Tt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Vw(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),yt(Tt,Tt.current),r)break;return null;case 22:case 23:return t.lanes=0,Fw(e,t,n)}return Jr(e,t,n)}var qw,zd,Kw,Yw;qw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};zd=function(){};Kw=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,es(Dr.current);var s=null;switch(n){case"input":i=od(e,i),r=od(e,r),s=[];break;case"select":i=Dt({},i,{value:void 0}),r=Dt({},r,{value:void 0}),s=[];break;case"textarea":i=cd(e,i),r=cd(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=mc)}hd(n,r);var o;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ga.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(a=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(s=s||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ga.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&wt("scroll",e),s||a===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};Yw=function(e,t,n,r){n!==r&&(t.flags|=4)};function To(e,t){if(!Ct)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function hn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function vC(e,t,n){var r=t.pendingProps;switch(yp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hn(t),null;case 1:return Ln(t.type)&&gc(),hn(t),null;case 3:return r=t.stateNode,lo(),St(Dn),St(gn),Ep(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ul(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,fr!==null&&(qd(fr),fr=null))),zd(e,t),hn(t),null;case 5:Cp(t);var i=es(ja.current);if(n=t.type,e!==null&&t.stateNode!=null)Kw(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ee(166));return hn(t),null}if(e=es(Dr.current),ul(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[jr]=t,r[Ea]=s,e=(t.mode&1)!==0,n){case"dialog":wt("cancel",r),wt("close",r);break;case"iframe":case"object":case"embed":wt("load",r);break;case"video":case"audio":for(i=0;i<Vo.length;i++)wt(Vo[i],r);break;case"source":wt("error",r);break;case"img":case"image":case"link":wt("error",r),wt("load",r);break;case"details":wt("toggle",r);break;case"input":ig(r,s),wt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},wt("invalid",r);break;case"textarea":og(r,s),wt("invalid",r)}hd(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&cl(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&cl(r.textContent,a,e),i=["children",""+a]):ga.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&wt("scroll",r)}switch(n){case"input":tl(r),sg(r,s,!0);break;case"textarea":tl(r),ag(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=mc)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=xb(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[jr]=t,e[Ea]=r,qw(e,t,!1,!1),t.stateNode=e;e:{switch(o=dd(n,r),n){case"dialog":wt("cancel",e),wt("close",e),i=r;break;case"iframe":case"object":case"embed":wt("load",e),i=r;break;case"video":case"audio":for(i=0;i<Vo.length;i++)wt(Vo[i],e);i=r;break;case"source":wt("error",e),i=r;break;case"img":case"image":case"link":wt("error",e),wt("load",e),i=r;break;case"details":wt("toggle",e),i=r;break;case"input":ig(e,r),i=od(e,r),wt("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Dt({},r,{value:void 0}),wt("invalid",e);break;case"textarea":og(e,r),i=cd(e,r),wt("invalid",e);break;default:i=r}hd(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var c=a[s];s==="style"?Cb(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Sb(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&ya(e,c):typeof c=="number"&&ya(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(ga.hasOwnProperty(s)?c!=null&&s==="onScroll"&&wt("scroll",e):c!=null&&np(e,s,c,o))}switch(n){case"input":tl(e),sg(e,r,!1);break;case"textarea":tl(e),ag(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Pi(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Gs(e,!!r.multiple,s,!1):r.defaultValue!=null&&Gs(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=mc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return hn(t),null;case 6:if(e&&t.stateNode!=null)Yw(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ee(166));if(n=es(ja.current),es(Dr.current),ul(t)){if(r=t.stateNode,n=t.memoizedProps,r[jr]=t,(s=r.nodeValue!==n)&&(e=Un,e!==null))switch(e.tag){case 3:cl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&cl(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[jr]=t,t.stateNode=r}return hn(t),null;case 13:if(St(Tt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ct&&Wn!==null&&t.mode&1&&!(t.flags&128))dw(),oo(),t.flags|=98560,s=!1;else if(s=ul(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(ee(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ee(317));s[jr]=t}else oo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hn(t),s=!1}else fr!==null&&(qd(fr),fr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Tt.current&1?Kt===0&&(Kt=3):zp())),t.updateQueue!==null&&(t.flags|=4),hn(t),null);case 4:return lo(),zd(e,t),e===null&&ka(t.stateNode.containerInfo),hn(t),null;case 10:return wp(t.type._context),hn(t),null;case 17:return Ln(t.type)&&gc(),hn(t),null;case 19:if(St(Tt),s=t.memoizedState,s===null)return hn(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)To(s,!1);else{if(Kt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Sc(e),o!==null){for(t.flags|=128,To(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return yt(Tt,Tt.current&1|2),t.child}e=e.sibling}s.tail!==null&&Ot()>uo&&(t.flags|=128,r=!0,To(s,!1),t.lanes=4194304)}else{if(!r)if(e=Sc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),To(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ct)return hn(t),null}else 2*Ot()-s.renderingStartTime>uo&&n!==1073741824&&(t.flags|=128,r=!0,To(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ot(),t.sibling=null,n=Tt.current,yt(Tt,r?n&1|2:n&1),t):(hn(t),null);case 22:case 23:return Op(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Hn&1073741824&&(hn(t),t.subtreeFlags&6&&(t.flags|=8192)):hn(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function _C(e,t){switch(yp(t),t.tag){case 1:return Ln(t.type)&&gc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lo(),St(Dn),St(gn),Ep(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cp(t),null;case 13:if(St(Tt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));oo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return St(Tt),null;case 4:return lo(),null;case 10:return wp(t.type._context),null;case 22:case 23:return Op(),null;case 24:return null;default:return null}}var fl=!1,pn=!1,bC=typeof WeakSet=="function"?WeakSet:Set,ve=null;function Vs(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){At(e,t,r)}else n.current=null}function Bd(e,t,n){try{n()}catch(r){At(e,t,r)}}var Xg=!1;function wC(e,t){if(xd=dc,e=Qb(),mp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,c=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(c=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===n&&++u===i&&(a=o),f===s&&++d===r&&(c=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}n=a===-1||c===-1?null:{start:a,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Sd={focusedElem:e,selectionRange:n},dc=!1,ve=t;ve!==null;)if(t=ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ve=e;else for(;ve!==null;){t=ve;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,w=m.memoizedState,v=t.stateNode,_=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:hr(t.type,g),w);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(S){At(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,ve=e;break}ve=t.return}return m=Xg,Xg=!1,m}function oa(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Bd(t,n,s)}i=i.next}while(i!==r)}}function iu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $d(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Gw(e){var t=e.alternate;t!==null&&(e.alternate=null,Gw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[jr],delete t[Ea],delete t[Ed],delete t[rC],delete t[iC])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Xw(e){return e.tag===5||e.tag===3||e.tag===4}function Jg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=mc));else if(r!==4&&(e=e.child,e!==null))for(Fd(e,t,n),e=e.sibling;e!==null;)Fd(e,t,n),e=e.sibling}function Hd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Hd(e,t,n),e=e.sibling;e!==null;)Hd(e,t,n),e=e.sibling}var rn=null,dr=!1;function ai(e,t,n){for(n=n.child;n!==null;)Jw(e,t,n),n=n.sibling}function Jw(e,t,n){if(Pr&&typeof Pr.onCommitFiberUnmount=="function")try{Pr.onCommitFiberUnmount(Xc,n)}catch{}switch(n.tag){case 5:pn||Vs(n,t);case 6:var r=rn,i=dr;rn=null,ai(e,t,n),rn=r,dr=i,rn!==null&&(dr?(e=rn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):rn.removeChild(n.stateNode));break;case 18:rn!==null&&(dr?(e=rn,n=n.stateNode,e.nodeType===8?Ju(e.parentNode,n):e.nodeType===1&&Ju(e,n),wa(e)):Ju(rn,n.stateNode));break;case 4:r=rn,i=dr,rn=n.stateNode.containerInfo,dr=!0,ai(e,t,n),rn=r,dr=i;break;case 0:case 11:case 14:case 15:if(!pn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Bd(n,t,o),i=i.next}while(i!==r)}ai(e,t,n);break;case 1:if(!pn&&(Vs(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){At(n,t,a)}ai(e,t,n);break;case 21:ai(e,t,n);break;case 22:n.mode&1?(pn=(r=pn)||n.memoizedState!==null,ai(e,t,n),pn=r):ai(e,t,n);break;default:ai(e,t,n)}}function Zg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bC),t.forEach(function(r){var i=TC.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function lr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:rn=a.stateNode,dr=!1;break e;case 3:rn=a.stateNode.containerInfo,dr=!0;break e;case 4:rn=a.stateNode.containerInfo,dr=!0;break e}a=a.return}if(rn===null)throw Error(ee(160));Jw(s,o,i),rn=null,dr=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(u){At(i,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Zw(t,e),t=t.sibling}function Zw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(lr(t,e),br(e),r&4){try{oa(3,e,e.return),iu(3,e)}catch(g){At(e,e.return,g)}try{oa(5,e,e.return)}catch(g){At(e,e.return,g)}}break;case 1:lr(t,e),br(e),r&512&&n!==null&&Vs(n,n.return);break;case 5:if(lr(t,e),br(e),r&512&&n!==null&&Vs(n,n.return),e.flags&32){var i=e.stateNode;try{ya(i,"")}catch(g){At(e,e.return,g)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&bb(i,s),dd(a,o);var u=dd(a,s);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?Cb(i,h):d==="dangerouslySetInnerHTML"?Sb(i,h):d==="children"?ya(i,h):np(i,d,h,u)}switch(a){case"input":ad(i,s);break;case"textarea":wb(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Gs(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Gs(i,!!s.multiple,s.defaultValue,!0):Gs(i,!!s.multiple,s.multiple?[]:"",!1))}i[Ea]=s}catch(g){At(e,e.return,g)}}break;case 6:if(lr(t,e),br(e),r&4){if(e.stateNode===null)throw Error(ee(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(g){At(e,e.return,g)}}break;case 3:if(lr(t,e),br(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{wa(t.containerInfo)}catch(g){At(e,e.return,g)}break;case 4:lr(t,e),br(e);break;case 13:lr(t,e),br(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Ip=Ot())),r&4&&Zg(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(pn=(u=pn)||d,lr(t,e),pn=u):lr(t,e),br(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ve=e,d=e.child;d!==null;){for(h=ve=d;ve!==null;){switch(f=ve,p=f.child,f.tag){case 0:case 11:case 14:case 15:oa(4,f,f.return);break;case 1:Vs(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(g){At(r,n,g)}}break;case 5:Vs(f,f.return);break;case 22:if(f.memoizedState!==null){ey(h);continue}}p!==null?(p.return=f,ve=p):ey(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{i=h.stateNode,u?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=kb("display",o))}catch(g){At(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){At(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:lr(t,e),br(e),r&4&&Zg(e);break;case 21:break;default:lr(t,e),br(e)}}function br(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Xw(n)){var r=n;break e}n=n.return}throw Error(ee(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(ya(i,""),r.flags&=-33);var s=Jg(e);Hd(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Jg(e);Fd(e,a,o);break;default:throw Error(ee(161))}}catch(c){At(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function xC(e,t,n){ve=e,Qw(e)}function Qw(e,t,n){for(var r=(e.mode&1)!==0;ve!==null;){var i=ve,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||fl;if(!o){var a=i.alternate,c=a!==null&&a.memoizedState!==null||pn;a=fl;var u=pn;if(fl=o,(pn=c)&&!u)for(ve=i;ve!==null;)o=ve,c=o.child,o.tag===22&&o.memoizedState!==null?ty(i):c!==null?(c.return=o,ve=c):ty(i);for(;s!==null;)ve=s,Qw(s),s=s.sibling;ve=i,fl=a,pn=u}Qg(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,ve=s):Qg(e)}}function Qg(e){for(;ve!==null;){var t=ve;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:pn||iu(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!pn)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:hr(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Og(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Og(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&wa(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}pn||t.flags&512&&$d(t)}catch(f){At(t,t.return,f)}}if(t===e){ve=null;break}if(n=t.sibling,n!==null){n.return=t.return,ve=n;break}ve=t.return}}function ey(e){for(;ve!==null;){var t=ve;if(t===e){ve=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ve=n;break}ve=t.return}}function ty(e){for(;ve!==null;){var t=ve;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{iu(4,t)}catch(c){At(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){At(t,i,c)}}var s=t.return;try{$d(t)}catch(c){At(t,s,c)}break;case 5:var o=t.return;try{$d(t)}catch(c){At(t,o,c)}}}catch(c){At(t,t.return,c)}if(t===e){ve=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ve=a;break}ve=t.return}}var SC=Math.ceil,Ec=Zr.ReactCurrentDispatcher,Lp=Zr.ReactCurrentOwner,ir=Zr.ReactCurrentBatchConfig,Je=0,en=null,Ft=null,an=0,Hn=0,qs=Ii(0),Kt=0,Da=null,us=0,su=0,Ap=0,aa=null,Tn=null,Ip=0,uo=1/0,$r=null,Nc=!1,Wd=null,Ni=null,pl=!1,bi=null,jc=0,la=0,Ud=null,Ul=-1,Vl=0;function xn(){return Je&6?Ot():Ul!==-1?Ul:Ul=Ot()}function ji(e){return e.mode&1?Je&2&&an!==0?an&-an:oC.transition!==null?(Vl===0&&(Vl=Ob()),Vl):(e=at,e!==0||(e=window.event,e=e===void 0?16:Ub(e.type)),e):1}function mr(e,t,n,r){if(50<la)throw la=0,Ud=null,Error(ee(185));$a(e,n,r),(!(Je&2)||e!==en)&&(e===en&&(!(Je&2)&&(su|=n),Kt===4&&vi(e,an)),An(e,r),n===1&&Je===0&&!(t.mode&1)&&(uo=Ot()+500,tu&&Mi()))}function An(e,t){var n=e.callbackNode;o1(e,t);var r=hc(e,e===en?an:0);if(r===0)n!==null&&ug(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ug(n),t===1)e.tag===0?sC(ny.bind(null,e)):cw(ny.bind(null,e)),tC(function(){!(Je&6)&&Mi()}),n=null;else{switch(zb(r)){case 1:n=ap;break;case 4:n=Ib;break;case 16:n=uc;break;case 536870912:n=Mb;break;default:n=uc}n=ax(n,ex.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ex(e,t){if(Ul=-1,Vl=0,Je&6)throw Error(ee(327));var n=e.callbackNode;if(eo()&&e.callbackNode!==n)return null;var r=hc(e,e===en?an:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Rc(e,r);else{t=r;var i=Je;Je|=2;var s=nx();(en!==e||an!==t)&&($r=null,uo=Ot()+500,rs(e,t));do try{EC();break}catch(a){tx(e,a)}while(!0);bp(),Ec.current=s,Je=i,Ft!==null?t=0:(en=null,an=0,t=Kt)}if(t!==0){if(t===2&&(i=yd(e),i!==0&&(r=i,t=Vd(e,i))),t===1)throw n=Da,rs(e,0),vi(e,r),An(e,Ot()),n;if(t===6)vi(e,r);else{if(i=e.current.alternate,!(r&30)&&!kC(i)&&(t=Rc(e,r),t===2&&(s=yd(e),s!==0&&(r=s,t=Vd(e,s))),t===1))throw n=Da,rs(e,0),vi(e,r),An(e,Ot()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(ee(345));case 2:Ki(e,Tn,$r);break;case 3:if(vi(e,r),(r&130023424)===r&&(t=Ip+500-Ot(),10<t)){if(hc(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){xn(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Cd(Ki.bind(null,e,Tn,$r),t);break}Ki(e,Tn,$r);break;case 4:if(vi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-pr(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=Ot()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*SC(r/1960))-r,10<r){e.timeoutHandle=Cd(Ki.bind(null,e,Tn,$r),r);break}Ki(e,Tn,$r);break;case 5:Ki(e,Tn,$r);break;default:throw Error(ee(329))}}}return An(e,Ot()),e.callbackNode===n?ex.bind(null,e):null}function Vd(e,t){var n=aa;return e.current.memoizedState.isDehydrated&&(rs(e,t).flags|=256),e=Rc(e,t),e!==2&&(t=Tn,Tn=n,t!==null&&qd(t)),e}function qd(e){Tn===null?Tn=e:Tn.push.apply(Tn,e)}function kC(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!vr(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function vi(e,t){for(t&=~Ap,t&=~su,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-pr(t),r=1<<n;e[n]=-1,t&=~r}}function ny(e){if(Je&6)throw Error(ee(327));eo();var t=hc(e,0);if(!(t&1))return An(e,Ot()),null;var n=Rc(e,t);if(e.tag!==0&&n===2){var r=yd(e);r!==0&&(t=r,n=Vd(e,r))}if(n===1)throw n=Da,rs(e,0),vi(e,t),An(e,Ot()),n;if(n===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ki(e,Tn,$r),An(e,Ot()),null}function Mp(e,t){var n=Je;Je|=1;try{return e(t)}finally{Je=n,Je===0&&(uo=Ot()+500,tu&&Mi())}}function hs(e){bi!==null&&bi.tag===0&&!(Je&6)&&eo();var t=Je;Je|=1;var n=ir.transition,r=at;try{if(ir.transition=null,at=1,e)return e()}finally{at=r,ir.transition=n,Je=t,!(Je&6)&&Mi()}}function Op(){Hn=qs.current,St(qs)}function rs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,eC(n)),Ft!==null)for(n=Ft.return;n!==null;){var r=n;switch(yp(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&gc();break;case 3:lo(),St(Dn),St(gn),Ep();break;case 5:Cp(r);break;case 4:lo();break;case 13:St(Tt);break;case 19:St(Tt);break;case 10:wp(r.type._context);break;case 22:case 23:Op()}n=n.return}if(en=e,Ft=e=Ri(e.current,null),an=Hn=t,Kt=0,Da=null,Ap=su=us=0,Tn=aa=null,Qi!==null){for(t=0;t<Qi.length;t++)if(n=Qi[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}Qi=null}return e}function tx(e,t){do{var n=Ft;try{if(bp(),Fl.current=Cc,kc){for(var r=Pt.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}kc=!1}if(cs=0,Xt=qt=Pt=null,sa=!1,Ra=0,Lp.current=null,n===null||n.return===null){Kt=1,Da=t,Ft=null;break}e:{var s=e,o=n.return,a=n,c=t;if(t=an,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=a,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=Wg(o);if(p!==null){p.flags&=-257,Ug(p,o,a,s,t),p.mode&1&&Hg(s,u,t),t=p,c=u;var m=t.updateQueue;if(m===null){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}else{if(!(t&1)){Hg(s,u,t),zp();break e}c=Error(ee(426))}}else if(Ct&&a.mode&1){var w=Wg(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Ug(w,o,a,s,t),vp(co(c,a));break e}}s=c=co(c,a),Kt!==4&&(Kt=2),aa===null?aa=[s]:aa.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var v=zw(s,c,t);Mg(s,v);break e;case 1:a=c;var _=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Ni===null||!Ni.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=Bw(s,a,t);Mg(s,S);break e}}s=s.return}while(s!==null)}ix(n)}catch(E){t=E,Ft===n&&n!==null&&(Ft=n=n.return);continue}break}while(!0)}function nx(){var e=Ec.current;return Ec.current=Cc,e===null?Cc:e}function zp(){(Kt===0||Kt===3||Kt===2)&&(Kt=4),en===null||!(us&268435455)&&!(su&268435455)||vi(en,an)}function Rc(e,t){var n=Je;Je|=2;var r=nx();(en!==e||an!==t)&&($r=null,rs(e,t));do try{CC();break}catch(i){tx(e,i)}while(!0);if(bp(),Je=n,Ec.current=r,Ft!==null)throw Error(ee(261));return en=null,an=0,Kt}function CC(){for(;Ft!==null;)rx(Ft)}function EC(){for(;Ft!==null&&!Jk();)rx(Ft)}function rx(e){var t=ox(e.alternate,e,Hn);e.memoizedProps=e.pendingProps,t===null?ix(e):Ft=t,Lp.current=null}function ix(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_C(n,t),n!==null){n.flags&=32767,Ft=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Kt=6,Ft=null;return}}else if(n=vC(n,t,Hn),n!==null){Ft=n;return}if(t=t.sibling,t!==null){Ft=t;return}Ft=t=e}while(t!==null);Kt===0&&(Kt=5)}function Ki(e,t,n){var r=at,i=ir.transition;try{ir.transition=null,at=1,NC(e,t,n,r)}finally{ir.transition=i,at=r}return null}function NC(e,t,n,r){do eo();while(bi!==null);if(Je&6)throw Error(ee(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(a1(e,s),e===en&&(Ft=en=null,an=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||pl||(pl=!0,ax(uc,function(){return eo(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=ir.transition,ir.transition=null;var o=at;at=1;var a=Je;Je|=4,Lp.current=null,wC(e,n),Zw(n,e),K1(Sd),dc=!!xd,Sd=xd=null,e.current=n,xC(n),Zk(),Je=a,at=o,ir.transition=s}else e.current=n;if(pl&&(pl=!1,bi=e,jc=i),s=e.pendingLanes,s===0&&(Ni=null),t1(n.stateNode),An(e,Ot()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Nc)throw Nc=!1,e=Wd,Wd=null,e;return jc&1&&e.tag!==0&&eo(),s=e.pendingLanes,s&1?e===Ud?la++:(la=0,Ud=e):la=0,Mi(),null}function eo(){if(bi!==null){var e=zb(jc),t=ir.transition,n=at;try{if(ir.transition=null,at=16>e?16:e,bi===null)var r=!1;else{if(e=bi,bi=null,jc=0,Je&6)throw Error(ee(331));var i=Je;for(Je|=4,ve=e.current;ve!==null;){var s=ve,o=s.child;if(ve.flags&16){var a=s.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(ve=u;ve!==null;){var d=ve;switch(d.tag){case 0:case 11:case 15:oa(8,d,s)}var h=d.child;if(h!==null)h.return=d,ve=h;else for(;ve!==null;){d=ve;var f=d.sibling,p=d.return;if(Gw(d),d===u){ve=null;break}if(f!==null){f.return=p,ve=f;break}ve=p}}}var m=s.alternate;if(m!==null){var g=m.child;if(g!==null){m.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}ve=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,ve=o;else e:for(;ve!==null;){if(s=ve,s.flags&2048)switch(s.tag){case 0:case 11:case 15:oa(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,ve=v;break e}ve=s.return}}var _=e.current;for(ve=_;ve!==null;){o=ve;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,ve=y;else e:for(o=_;ve!==null;){if(a=ve,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:iu(9,a)}}catch(E){At(a,a.return,E)}if(a===o){ve=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,ve=S;break e}ve=a.return}}if(Je=i,Mi(),Pr&&typeof Pr.onPostCommitFiberRoot=="function")try{Pr.onPostCommitFiberRoot(Xc,e)}catch{}r=!0}return r}finally{at=n,ir.transition=t}}return!1}function ry(e,t,n){t=co(n,t),t=zw(e,t,1),e=Ei(e,t,1),t=xn(),e!==null&&($a(e,1,t),An(e,t))}function At(e,t,n){if(e.tag===3)ry(e,e,n);else for(;t!==null;){if(t.tag===3){ry(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ni===null||!Ni.has(r))){e=co(n,e),e=Bw(t,e,1),t=Ei(t,e,1),e=xn(),t!==null&&($a(t,1,e),An(t,e));break}}t=t.return}}function jC(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=xn(),e.pingedLanes|=e.suspendedLanes&n,en===e&&(an&n)===n&&(Kt===4||Kt===3&&(an&130023424)===an&&500>Ot()-Ip?rs(e,0):Ap|=n),An(e,t)}function sx(e,t){t===0&&(e.mode&1?(t=il,il<<=1,!(il&130023424)&&(il=4194304)):t=1);var n=xn();e=Xr(e,t),e!==null&&($a(e,t,n),An(e,n))}function RC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sx(e,n)}function TC(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ee(314))}r!==null&&r.delete(t),sx(e,n)}var ox;ox=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Dn.current)Pn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Pn=!1,yC(e,t,n);Pn=!!(e.flags&131072)}else Pn=!1,Ct&&t.flags&1048576&&uw(t,_c,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wl(e,t),e=t.pendingProps;var i=so(t,gn.current);Qs(t,n),i=jp(null,t,r,e,i,n);var s=Rp();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ln(r)?(s=!0,yc(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Sp(t),i.updater=ru,t.stateNode=i,i._reactInternals=t,Dd(t,r,e,n),t=Id(null,t,r,!0,s,n)):(t.tag=0,Ct&&s&&gp(t),bn(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wl(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=DC(r),e=hr(r,e),i){case 0:t=Ad(null,t,r,e,n);break e;case 1:t=Kg(null,t,r,e,n);break e;case 11:t=Vg(null,t,r,e,n);break e;case 14:t=qg(null,t,r,hr(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hr(r,i),Ad(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hr(r,i),Kg(e,t,r,i,n);case 3:e:{if(Ww(t),e===null)throw Error(ee(387));r=t.pendingProps,s=t.memoizedState,i=s.element,gw(e,t),xc(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=co(Error(ee(423)),t),t=Yg(e,t,r,n,i);break e}else if(r!==i){i=co(Error(ee(424)),t),t=Yg(e,t,r,n,i);break e}else for(Wn=Ci(t.stateNode.containerInfo.firstChild),Un=t,Ct=!0,fr=null,n=pw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(oo(),r===i){t=Jr(e,t,n);break e}bn(e,t,r,n)}t=t.child}return t;case 5:return yw(t),e===null&&Rd(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,kd(r,i)?o=null:s!==null&&kd(r,s)&&(t.flags|=32),Hw(e,t),bn(e,t,o,n),t.child;case 6:return e===null&&Rd(t),null;case 13:return Uw(e,t,n);case 4:return kp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ao(t,null,r,n):bn(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hr(r,i),Vg(e,t,r,i,n);case 7:return bn(e,t,t.pendingProps,n),t.child;case 8:return bn(e,t,t.pendingProps.children,n),t.child;case 12:return bn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,yt(bc,r._currentValue),r._currentValue=o,s!==null)if(vr(s.value,o)){if(s.children===i.children&&!Dn.current){t=Jr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var c=a.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=qr(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Td(s.return,n,t),a.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ee(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Td(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}bn(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Qs(t,n),i=or(i),r=r(i),t.flags|=1,bn(e,t,r,n),t.child;case 14:return r=t.type,i=hr(r,t.pendingProps),i=hr(r.type,i),qg(e,t,r,i,n);case 15:return $w(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:hr(r,i),Wl(e,t),t.tag=1,Ln(r)?(e=!0,yc(t)):e=!1,Qs(t,n),Ow(t,r,i),Dd(t,r,i,n),Id(null,t,r,!0,e,n);case 19:return Vw(e,t,n);case 22:return Fw(e,t,n)}throw Error(ee(156,t.tag))};function ax(e,t){return Ab(e,t)}function PC(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(e,t,n,r){return new PC(e,t,n,r)}function Bp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function DC(e){if(typeof e=="function")return Bp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ip)return 11;if(e===sp)return 14}return 2}function Ri(e,t){var n=e.alternate;return n===null?(n=rr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ql(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Bp(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ms:return is(n.children,i,s,t);case rp:o=8,i|=8;break;case nd:return e=rr(12,n,t,i|2),e.elementType=nd,e.lanes=s,e;case rd:return e=rr(13,n,t,i),e.elementType=rd,e.lanes=s,e;case id:return e=rr(19,n,t,i),e.elementType=id,e.lanes=s,e;case yb:return ou(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case mb:o=10;break e;case gb:o=9;break e;case ip:o=11;break e;case sp:o=14;break e;case pi:o=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=rr(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function is(e,t,n,r){return e=rr(7,e,r,t),e.lanes=n,e}function ou(e,t,n,r){return e=rr(22,e,r,t),e.elementType=yb,e.lanes=n,e.stateNode={isHidden:!1},e}function sh(e,t,n){return e=rr(6,e,null,t),e.lanes=n,e}function oh(e,t,n){return t=rr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function LC(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$u(0),this.expirationTimes=$u(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$u(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $p(e,t,n,r,i,s,o,a,c){return e=new LC(e,t,n,a,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=rr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sp(s),e}function AC(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Is,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function lx(e){if(!e)return Di;e=e._reactInternals;e:{if(vs(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ln(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var n=e.type;if(Ln(n))return lw(e,n,t)}return t}function cx(e,t,n,r,i,s,o,a,c){return e=$p(n,r,!0,e,i,s,o,a,c),e.context=lx(null),n=e.current,r=xn(),i=ji(n),s=qr(r,i),s.callback=t??null,Ei(n,s,i),e.current.lanes=i,$a(e,i,r),An(e,r),e}function au(e,t,n,r){var i=t.current,s=xn(),o=ji(i);return n=lx(n),t.context===null?t.context=n:t.pendingContext=n,t=qr(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ei(i,t,o),e!==null&&(mr(e,i,o,s),$l(e,i,o)),o}function Tc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function iy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Fp(e,t){iy(e,t),(e=e.alternate)&&iy(e,t)}function IC(){return null}var ux=typeof reportError=="function"?reportError:function(e){console.error(e)};function Hp(e){this._internalRoot=e}lu.prototype.render=Hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));au(e,t,null,null)};lu.prototype.unmount=Hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hs(function(){au(null,e,null,null)}),t[Gr]=null}};function lu(e){this._internalRoot=e}lu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fb();e={blockedOn:null,target:e,priority:t};for(var n=0;n<yi.length&&t!==0&&t<yi[n].priority;n++);yi.splice(n,0,e),n===0&&Wb(e)}};function Wp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function cu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function sy(){}function MC(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var u=Tc(o);s.call(u)}}var o=cx(t,r,e,0,null,!1,!1,"",sy);return e._reactRootContainer=o,e[Gr]=o.current,ka(e.nodeType===8?e.parentNode:e),hs(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var u=Tc(c);a.call(u)}}var c=$p(e,0,!1,null,null,!1,!1,"",sy);return e._reactRootContainer=c,e[Gr]=c.current,ka(e.nodeType===8?e.parentNode:e),hs(function(){au(t,c,n,r)}),c}function uu(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var c=Tc(o);a.call(c)}}au(t,o,e,i)}else o=MC(n,t,e,i,r);return Tc(o)}Bb=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Uo(t.pendingLanes);n!==0&&(lp(t,n|1),An(t,Ot()),!(Je&6)&&(uo=Ot()+500,Mi()))}break;case 13:hs(function(){var r=Xr(e,1);if(r!==null){var i=xn();mr(r,e,1,i)}}),Fp(e,1)}};cp=function(e){if(e.tag===13){var t=Xr(e,134217728);if(t!==null){var n=xn();mr(t,e,134217728,n)}Fp(e,134217728)}};$b=function(e){if(e.tag===13){var t=ji(e),n=Xr(e,t);if(n!==null){var r=xn();mr(n,e,t,r)}Fp(e,t)}};Fb=function(){return at};Hb=function(e,t){var n=at;try{return at=e,t()}finally{at=n}};pd=function(e,t,n){switch(t){case"input":if(ad(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=eu(r);if(!i)throw Error(ee(90));_b(r),ad(r,i)}}}break;case"textarea":wb(e,n);break;case"select":t=n.value,t!=null&&Gs(e,!!n.multiple,t,!1)}};jb=Mp;Rb=hs;var OC={usingClientEntryPoint:!1,Events:[Ha,$s,eu,Eb,Nb,Mp]},Po={findFiberByHostInstance:Zi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},zC={bundleType:Po.bundleType,version:Po.version,rendererPackageName:Po.rendererPackageName,rendererConfig:Po.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Zr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Db(e),e===null?null:e.stateNode},findFiberByHostInstance:Po.findFiberByHostInstance||IC,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ml=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ml.isDisabled&&ml.supportsFiber)try{Xc=ml.inject(zC),Pr=ml}catch{}}Kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=OC;Kn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wp(t))throw Error(ee(200));return AC(e,t,null,n)};Kn.createRoot=function(e,t){if(!Wp(e))throw Error(ee(299));var n=!1,r="",i=ux;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=$p(e,1,!1,null,null,n,!1,r,i),e[Gr]=t.current,ka(e.nodeType===8?e.parentNode:e),new Hp(t)};Kn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=Db(t),e=e===null?null:e.stateNode,e};Kn.flushSync=function(e){return hs(e)};Kn.hydrate=function(e,t,n){if(!cu(t))throw Error(ee(200));return uu(null,e,t,!0,n)};Kn.hydrateRoot=function(e,t,n){if(!Wp(e))throw Error(ee(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=ux;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=cx(t,null,e,1,n??null,i,!1,s,o),e[Gr]=t.current,ka(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new lu(t)};Kn.render=function(e,t,n){if(!cu(t))throw Error(ee(200));return uu(null,e,t,!1,n)};Kn.unmountComponentAtNode=function(e){if(!cu(e))throw Error(ee(40));return e._reactRootContainer?(hs(function(){uu(null,null,e,!1,function(){e._reactRootContainer=null,e[Gr]=null})}),!0):!1};Kn.unstable_batchedUpdates=Mp;Kn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!cu(n))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return uu(e,t,n,!1,r)};Kn.version="18.3.1-next-f1338f8080-20240426";function hx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(hx)}catch(e){console.error(e)}}hx(),hb.exports=Kn;var dx=hb.exports;const fx=za(dx);var oy=dx;ed.createRoot=oy.createRoot,ed.hydrateRoot=oy.hydrateRoot;function BC(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $C=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HC={};function ay(e,t){return(HC.jsx?FC:$C).test(e)}const WC=/[ \t\n\f\r]/g;function UC(e){return typeof e=="object"?e.type==="text"?ly(e.value):!1:ly(e)}function ly(e){return e.replace(WC,"")===""}class Ua{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ua.prototype.normal={};Ua.prototype.property={};Ua.prototype.space=void 0;function px(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ua(n,r,t)}function Kd(e){return e.toLowerCase()}class In{constructor(t,n){this.attribute=n,this.property=t}}In.prototype.attribute="";In.prototype.booleanish=!1;In.prototype.boolean=!1;In.prototype.commaOrSpaceSeparated=!1;In.prototype.commaSeparated=!1;In.prototype.defined=!1;In.prototype.mustUseProperty=!1;In.prototype.number=!1;In.prototype.overloadedBoolean=!1;In.prototype.property="";In.prototype.spaceSeparated=!1;In.prototype.space=void 0;let VC=0;const Le=_s(),zt=_s(),Yd=_s(),ne=_s(),gt=_s(),to=_s(),Fn=_s();function _s(){return 2**++VC}const Gd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:zt,commaOrSpaceSeparated:Fn,commaSeparated:to,number:ne,overloadedBoolean:Yd,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),ah=Object.keys(Gd);class Up extends In{constructor(t,n,r,i){let s=-1;if(super(t,n),cy(this,"space",i),typeof r=="number")for(;++s<ah.length;){const o=ah[s];cy(this,ah[s],(r&Gd[o])===Gd[o])}}}Up.prototype.defined=!0;function cy(e,t,n){n&&(e[t]=n)}function yo(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new Up(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Kd(r)]=r,n[Kd(s.attribute)]=r}return new Ua(t,n,e.space)}const mx=yo({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:ne,ariaColIndex:ne,ariaColSpan:ne,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:gt,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:ne,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:ne,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:gt,ariaRowCount:ne,ariaRowIndex:ne,ariaRowSpan:ne,ariaSelected:zt,ariaSetSize:ne,ariaSort:null,ariaValueMax:ne,ariaValueMin:ne,ariaValueNow:ne,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function gx(e,t){return t in e?e[t]:t}function yx(e,t){return gx(e,t.toLowerCase())}const qC=yo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:to,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:gt,autoFocus:Le,autoPlay:Le,blocking:gt,capture:null,charSet:null,checked:Le,cite:null,className:gt,cols:ne,colSpan:null,content:null,contentEditable:zt,controls:Le,controlsList:gt,coords:ne|to,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:Yd,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:gt,height:ne,hidden:Yd,high:ne,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:gt,itemRef:gt,itemScope:Le,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:ne,manifest:null,max:null,maxLength:ne,media:null,method:null,min:null,minLength:ne,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Le,optimum:ne,pattern:null,ping:gt,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:gt,required:Le,reversed:Le,rows:ne,rowSpan:ne,sandbox:gt,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:ne,sizes:null,slot:null,span:ne,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ne,step:null,style:null,tabIndex:ne,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:zt,width:ne,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:ne,borderColor:null,bottomMargin:ne,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:ne,leftMargin:ne,link:null,longDesc:null,lowSrc:null,marginHeight:ne,marginWidth:ne,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:ne,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:ne,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ne,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:ne,security:null,unselectable:null},space:"html",transform:yx}),KC=yo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Fn,accentHeight:ne,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ne,amplitude:ne,arabicForm:null,ascent:ne,attributeName:null,attributeType:null,azimuth:ne,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ne,by:null,calcMode:null,capHeight:ne,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ne,diffuseConstant:ne,direction:null,display:null,dur:null,divisor:ne,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:ne,enableBackground:null,end:null,event:null,exponent:ne,externalResourcesRequired:null,fill:null,fillOpacity:ne,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:to,g2:to,glyphName:to,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ne,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ne,horizOriginX:ne,horizOriginY:ne,id:null,ideographic:ne,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ne,k:ne,k1:ne,k2:ne,k3:ne,k4:ne,kernelMatrix:Fn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ne,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ne,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ne,overlineThickness:ne,paintOrder:null,panose1:null,path:null,pathLength:ne,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ne,pointsAtY:ne,pointsAtZ:ne,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fn,rev:Fn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fn,requiredFeatures:Fn,requiredFonts:Fn,requiredFormats:Fn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ne,specularExponent:ne,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ne,strikethroughThickness:ne,string:null,stroke:null,strokeDashArray:Fn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ne,strokeOpacity:ne,strokeWidth:null,style:null,surfaceScale:ne,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fn,tabIndex:ne,tableValues:null,target:null,targetX:ne,targetY:ne,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ne,underlineThickness:ne,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ne,values:null,vAlphabetic:ne,vMathematical:ne,vectorEffect:null,vHanging:ne,vIdeographic:ne,version:null,vertAdvY:ne,vertOriginX:ne,vertOriginY:ne,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ne,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gx}),vx=yo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),_x=yo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yx}),bx=yo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),YC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},GC=/[A-Z]/g,uy=/-[a-z]/g,XC=/^data[-\w.:]+$/i;function JC(e,t){const n=Kd(t);let r=t,i=In;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&XC.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(uy,QC);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!uy.test(s)){let o=s.replace(GC,ZC);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Up}return new i(r,t)}function ZC(e){return"-"+e.toLowerCase()}function QC(e){return e.charAt(1).toUpperCase()}const eE=px([mx,qC,vx,_x,bx],"html"),Vp=px([mx,KC,vx,_x,bx],"svg");function tE(e){return e.join(" ").trim()}var qp={},hy=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,nE=/\n/g,rE=/^\s*/,iE=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,sE=/^:\s*/,oE=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,aE=/^[;\s]*/,lE=/^\s+|\s+$/g,cE=`
|
|
41
|
+
`,dy="/",fy="*",Ji="",uE="comment",hE="declaration";function dE(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var g=m.match(nE);g&&(n+=g.length);var w=m.lastIndexOf(cE);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(g){return g.position=new o(m),u(),g}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(m){var g=new Error(t.source+":"+n+":"+r+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var w=g[0];return i(w),e=e.slice(w.length),g}}function u(){c(rE)}function d(m){var g;for(m=m||[];g=h();)g!==!1&&m.push(g);return m}function h(){var m=s();if(!(dy!=e.charAt(0)||fy!=e.charAt(1))){for(var g=2;Ji!=e.charAt(g)&&(fy!=e.charAt(g)||dy!=e.charAt(g+1));)++g;if(g+=2,Ji===e.charAt(g-1))return a("End of comment missing");var w=e.slice(2,g-2);return r+=2,i(w),e=e.slice(g),r+=2,m({type:uE,comment:w})}}function f(){var m=s(),g=c(iE);if(g){if(h(),!c(sE))return a("property missing ':'");var w=c(oE),v=m({type:hE,property:py(g[0].replace(hy,Ji)),value:w?py(w[0].replace(hy,Ji)):Ji});return c(aE),v}}function p(){var m=[];d(m);for(var g;g=f();)g!==!1&&(m.push(g),d(m));return m}return u(),p()}function py(e){return e?e.replace(lE,Ji):Ji}var fE=dE,pE=oc&&oc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qp,"__esModule",{value:!0});qp.default=gE;const mE=pE(fE);function gE(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,mE.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var hu={};Object.defineProperty(hu,"__esModule",{value:!0});hu.camelCase=void 0;var yE=/^--[a-zA-Z0-9_-]+$/,vE=/-([a-z])/g,_E=/^[^-]+$/,bE=/^-(webkit|moz|ms|o|khtml)-/,wE=/^-(ms)-/,xE=function(e){return!e||_E.test(e)||yE.test(e)},SE=function(e,t){return t.toUpperCase()},my=function(e,t){return"".concat(t,"-")},kE=function(e,t){return t===void 0&&(t={}),xE(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(wE,my):e=e.replace(bE,my),e.replace(vE,SE))};hu.camelCase=kE;var CE=oc&&oc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},EE=CE(qp),NE=hu;function Xd(e,t){var n={};return!e||typeof e!="string"||(0,EE.default)(e,function(r,i){r&&i&&(n[(0,NE.camelCase)(r,t)]=i)}),n}Xd.default=Xd;var jE=Xd;const RE=za(jE),wx=xx("end"),Kp=xx("start");function xx(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function TE(e){const t=Kp(e),n=wx(e);if(t&&n)return{start:t,end:n}}function ca(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gy(e.position):"start"in e||"end"in e?gy(e):"line"in e||"column"in e?Jd(e):""}function Jd(e){return yy(e&&e.line)+":"+yy(e&&e.column)}function gy(e){return Jd(e&&e.start)+"-"+Jd(e&&e.end)}function yy(e){return e&&typeof e=="number"?e:1}class yn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=ca(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yn.prototype.file="";yn.prototype.name="";yn.prototype.reason="";yn.prototype.message="";yn.prototype.stack="";yn.prototype.column=void 0;yn.prototype.line=void 0;yn.prototype.ancestors=void 0;yn.prototype.cause=void 0;yn.prototype.fatal=void 0;yn.prototype.place=void 0;yn.prototype.ruleId=void 0;yn.prototype.source=void 0;const Yp={}.hasOwnProperty,PE=new Map,DE=/[A-Z]/g,LE=new Set(["table","tbody","thead","tfoot","tr"]),AE=new Set(["td","th"]),Sx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=WE(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=HE(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Vp:eE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=kx(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function kx(e,t,n){if(t.type==="element")return ME(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return OE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BE(e,t,n);if(t.type==="mdxjsEsm")return zE(e,t);if(t.type==="root")return $E(e,t,n);if(t.type==="text")return FE(e,t)}function ME(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Vp,e.schema=i),e.ancestors.push(t);const s=Ex(e,t.tagName,!1),o=UE(e,t);let a=Xp(e,t);return LE.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!UC(c):!0})),Cx(e,o,s,t),Gp(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function OE(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}La(e,t.position)}function zE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);La(e,t.position)}function BE(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Vp,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Ex(e,t.name,!0),o=VE(e,t),a=Xp(e,t);return Cx(e,o,s,t),Gp(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function $E(e,t,n){const r={};return Gp(r,Xp(e,t)),e.create(t,e.Fragment,r,n)}function FE(e,t){return t.value}function Cx(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function HE(e,t,n){return r;function r(i,s,o,a){const u=Array.isArray(o.children)?n:t;return a?u(s,o,a):u(s,o)}}function WE(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),c=Kp(r);return t(i,s,o,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function UE(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Yp.call(t.properties,i)){const s=qE(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&AE.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function VE(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else La(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else La(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Xp(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:PE;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=i.get(c)||0;o=c+"-"+u,i.set(c,u+1)}}const a=kx(e,s,o);a!==void 0&&n.push(a)}return n}function qE(e,t,n){const r=JC(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?BC(n):tE(n)),r.property==="style"){let i=typeof n=="object"?n:KE(e,String(n));return e.stylePropertyNameCase==="css"&&(i=YE(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?YC[r.property]||r.property:r.attribute,n]}}function KE(e,t){try{return RE(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Sx+"#cannot-parse-style-attribute",i}}function Ex(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=ay(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=ay(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Yp.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);La(e)}function La(e,t){const n=new yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Sx+"#cannot-handle-mdx-estrees-without-createevaluater",n}function YE(e){const t={};let n;for(n in e)Yp.call(e,n)&&(t[GE(n)]=e[n]);return t}function GE(e){let t=e.replace(DE,XE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function XE(e){return"-"+e.toLowerCase()}const lh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},JE={};function Jp(e,t){const n=JE,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Nx(e,r,i)}function Nx(e,t,n){if(ZE(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return vy(e.children,t,n)}return Array.isArray(e)?vy(e,t,n):""}function vy(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Nx(e[i],t,n);return r.join("")}function ZE(e){return!!(e&&typeof e=="object")}const _y=document.createElement("i");function Zp(e){const t="&"+e+";";_y.innerHTML=t;const n=_y.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Vn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function nr(e,t){return e.length>0?(Vn(e,e.length,0,t),e):t}const by={}.hasOwnProperty;function jx(e){const t={};let n=-1;for(;++n<e.length;)QE(t,e[n]);return t}function QE(e,t){let n;for(n in t){const i=(by.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){by.call(i,o)||(i[o]=[]);const a=s[o];eN(i[o],Array.isArray(a)?a:a?[a]:[])}}}function eN(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Vn(e,0,0,r)}function Rx(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function gr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const wn=Oi(/[A-Za-z]/),mn=Oi(/[\dA-Za-z]/),tN=Oi(/[#-'*+\--9=?A-Z^-~]/);function Pc(e){return e!==null&&(e<32||e===127)}const Zd=Oi(/\d/),nN=Oi(/[\dA-Fa-f]/),rN=Oi(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function mt(e){return e!==null&&(e<0||e===32)}function We(e){return e===-2||e===-1||e===32}const du=Oi(new RegExp("\\p{P}|\\p{S}","u")),ds=Oi(/\s/);function Oi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function vo(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&mn(e.charCodeAt(n+1))&&mn(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Xe(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return We(c)?(e.enter(n),a(c)):t(c)}function a(c){return We(c)&&s++<i?(e.consume(c),a):(e.exit(n),t(c))}}const iN={tokenize:sN};function sN(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Xe(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Ce(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const oN={tokenize:aN},wy={tokenize:lN};function aN(e){const t=this,n=[];let r=0,i,s,o;return a;function a(y){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(y)}return u(y)}function c(y){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const S=t.events.length;let E=S,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}v(r);let T=S;for(;T<t.events.length;)t.events[T][1].end={...k},T++;return Vn(t.events,E+1,0,t.events.slice(S)),t.events.length=T,u(y)}return a(y)}function u(y){if(r===n.length){if(!i)return f(y);if(i.currentConstruct&&i.currentConstruct.concrete)return m(y);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(wy,d,h)(y)}function d(y){return i&&_(),v(r),f(y)}function h(y){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(y)}function f(y){return t.containerState={},e.attempt(wy,p,m)(y)}function p(y){return r++,n.push([t.currentConstruct,t.containerState]),f(y)}function m(y){if(y===null){i&&_(),v(0),e.consume(y);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(y)}function g(y){if(y===null){w(e.exit("chunkFlow"),!0),v(0),e.consume(y);return}return Ce(y)?(e.consume(y),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(y),g)}function w(y,S){const E=t.sliceStream(y);if(S&&E.push(null),y.previous=s,s&&(s.next=y),s=y,i.defineSkip(y.start),i.write(E),t.parser.lazy[y.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const T=t.events.length;let R=T,O,j;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(O){j=t.events[R][1].end;break}O=!0}for(v(r),k=T;k<t.events.length;)t.events[k][1].end={...j},k++;Vn(t.events,R+1,0,t.events.slice(T)),t.events.length=k}}function v(y){let S=n.length;for(;S-- >y;){const E=n[S];t.containerState=E[1],E[0].exit.call(t,e)}n.length=y}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function lN(e,t,n){return Xe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ho(e){if(e===null||mt(e)||ds(e))return 1;if(du(e))return 2}function fu(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Qd={name:"attention",resolveAll:cN,tokenize:uN};function cN(e,t){let n=-1,r,i,s,o,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},f={...e[n][1].start};xy(h,-c),xy(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=nr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=nr(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=nr(u,fu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=nr(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=nr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Vn(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function uN(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ho(r);let s;return o;function o(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;const u=e.exit("attentionSequence"),d=ho(c),h=!d||d===2&&i||n.includes(c),f=!i||i===2&&d||n.includes(r);return u._open=!!(s===42?h:h&&(i||!f)),u._close=!!(s===42?f:f&&(d||!h)),t(c)}}function xy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hN={name:"autolink",tokenize:dN};function dN(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return wn(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||mn(p)?(r=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||mn(p))&&r++<32?(e.consume(p),a):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Pc(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):tN(p)?(e.consume(p),u):n(p)}function d(p){return mn(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||mn(p))&&r++<63){const m=p===45?f:h;return e.consume(p),m}return n(p)}}const Va={partial:!0,tokenize:fN};function fN(e,t,n){return r;function r(s){return We(s)?Xe(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ce(s)?t(s):n(s)}}const Tx={continuation:{tokenize:mN},exit:gN,name:"blockQuote",tokenize:pN};function pN(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return We(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function mN(e,t,n){const r=this;return i;function i(o){return We(o)?Xe(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Tx,t,n)(o)}}function gN(e){e.exit("blockQuote")}const Px={name:"characterEscape",tokenize:yN};function yN(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return rN(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Dx={name:"characterReference",tokenize:vN};function vN(e,t,n){const r=this;let i=0,s,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,o=mn,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=nN,d):(e.enter("characterReferenceValue"),s=7,o=Zd,d(h))}function d(h){if(h===59&&i){const f=e.exit("characterReferenceValue");return o===mn&&!Zp(r.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&i++<s?(e.consume(h),d):n(h)}}const Sy={partial:!0,tokenize:bN},ky={concrete:!0,name:"codeFenced",tokenize:_N};function _N(e,t,n){const r=this,i={partial:!0,tokenize:E};let s=0,o=0,a;return c;function c(k){return u(k)}function u(k){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===a?(o++,e.consume(k),d):o<3?n(k):(e.exit("codeFencedFenceSequence"),We(k)?Xe(e,h,"whitespace")(k):h(k))}function h(k){return k===null||Ce(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Sy,g,S)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):We(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Xe(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||Ce(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===a?n(k):(e.consume(k),m)}function g(k){return e.attempt(i,S,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),v}function v(k){return s>0&&We(k)?Xe(e,_,"linePrefix",s+1)(k):_(k)}function _(k){return k===null||Ce(k)?e.check(Sy,g,S)(k):(e.enter("codeFlowValue"),y(k))}function y(k){return k===null||Ce(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),y)}function S(k){return e.exit("codeFenced"),t(k)}function E(k,T,R){let O=0;return j;function j(D){return k.enter("lineEnding"),k.consume(D),k.exit("lineEnding"),$}function $(D){return k.enter("codeFencedFence"),We(D)?Xe(k,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):L(D)}function L(D){return D===a?(k.enter("codeFencedFenceSequence"),P(D)):R(D)}function P(D){return D===a?(O++,k.consume(D),P):O>=o?(k.exit("codeFencedFenceSequence"),We(D)?Xe(k,A,"whitespace")(D):A(D)):R(D)}function A(D){return D===null||Ce(D)?(k.exit("codeFencedFence"),T(D)):R(D)}}}function bN(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const ch={name:"codeIndented",tokenize:xN},wN={partial:!0,tokenize:SN};function xN(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Xe(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Ce(u)?e.attempt(wN,o,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||Ce(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function SN(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Xe(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):Ce(o)?i(o):n(o)}}const kN={name:"codeText",previous:EN,resolve:CN,tokenize:NN};function CN(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function EN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NN(e,t,n){let r=0,i,s;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),r++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(s=e.enter("codeTextSequence"),i=0,d(h)):Ce(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||Ce(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",u(h))}}class jN{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Do(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Do(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Do(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Do(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Do(this.left,n.reverse())}}}function Do(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lx(e){const t={};let n=-1,r,i,s,o,a,c,u;const d=new jN(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,RN(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},a=d.slice(i,n),a.unshift(r),d.splice(i,n-i+1,a))}}return Vn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function RN(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,c=[],u={};let d,h,f=-1,p=n,m=0,g=0;const w=[g];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,w.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const v=a.slice(w[f],w[f+1]),_=s.pop();c.push([_,_+v.length-1]),e.splice(_,2,v)}for(c.reverse(),f=-1;++f<c.length;)u[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return u}const TN={resolve:DN,tokenize:LN},PN={partial:!0,tokenize:AN};function DN(e){return Lx(e),e}function LN(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Ce(a)?e.check(PN,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function AN(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Xe(e,s,"linePrefix")}function s(o){if(o===null||Ce(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function Ax(e,t,n,r,i,s,o,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(v){return v===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(v),e.exit(s),f):v===null||v===32||v===41||Pc(v)?n(v):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(v))}function f(v){return v===62?(e.enter(s),e.consume(v),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(a),f(v)):v===null||v===60||Ce(v)?n(v):(e.consume(v),v===92?m:p)}function m(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function g(v){return!d&&(v===null||v===41||mt(v))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,g):v===41?(e.consume(v),d--,g):v===null||v===32||v===40||Pc(v)?n(v):(e.consume(v),v===92?w:g)}function w(v){return v===40||v===41||v===92?(e.consume(v),g):g(v)}}function Ix(e,t,n,r,i,s){const o=this;let a=0,c;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),d}function d(p){return a>999||p===null||p===91||p===93&&!c||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Ce(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!We(p)),p===92?f:h)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function Mx(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,c):n(f)}function c(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),u(f))}function u(f){return f===o?(e.exit(s),c(o)):f===null?n(f):Ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Xe(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||Ce(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function ua(e,t){let n;return r;function r(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):We(i)?Xe(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const IN={name:"definition",tokenize:ON},MN={partial:!0,tokenize:zN};function ON(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return Ix.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=gr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return mt(p)?ua(e,u)(p):u(p)}function u(p){return Ax(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(MN,h,h)(p)}function h(p){return We(p)?Xe(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Ce(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function zN(e,t,n){return r;function r(a){return mt(a)?ua(e,i)(a):n(a)}function i(a){return Mx(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return We(a)?Xe(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Ce(a)?t(a):n(a)}}const BN={name:"hardBreakEscape",tokenize:$N};function $N(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ce(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const FN={name:"headingAtx",resolve:HN,tokenize:WN};function HN(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Vn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function WN(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||mt(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ce(d)?(e.exit("atxHeading"),t(d)):We(d)?Xe(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||mt(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const UN=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Cy=["pre","script","style","textarea"],VN={concrete:!0,name:"htmlFlow",resolveTo:YN,tokenize:GN},qN={partial:!0,tokenize:JN},KN={partial:!0,tokenize:XN};function YN(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function GN(e,t,n){const r=this;let i,s,o,a,c;return u;function u(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),h}function h(x){return x===33?(e.consume(x),f):x===47?(e.consume(x),s=!0,g):x===63?(e.consume(x),i=3,r.interrupt?t:C):wn(x)?(e.consume(x),o=String.fromCharCode(x),w):n(x)}function f(x){return x===45?(e.consume(x),i=2,p):x===91?(e.consume(x),i=5,a=0,m):wn(x)?(e.consume(x),i=4,r.interrupt?t:C):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:C):n(x)}function m(x){const Y="CDATA[";return x===Y.charCodeAt(a++)?(e.consume(x),a===Y.length?r.interrupt?t:L:m):n(x)}function g(x){return wn(x)?(e.consume(x),o=String.fromCharCode(x),w):n(x)}function w(x){if(x===null||x===47||x===62||mt(x)){const Y=x===47,Z=o.toLowerCase();return!Y&&!s&&Cy.includes(Z)?(i=1,r.interrupt?t(x):L(x)):UN.includes(o.toLowerCase())?(i=6,Y?(e.consume(x),v):r.interrupt?t(x):L(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):s?_(x):y(x))}return x===45||mn(x)?(e.consume(x),o+=String.fromCharCode(x),w):n(x)}function v(x){return x===62?(e.consume(x),r.interrupt?t:L):n(x)}function _(x){return We(x)?(e.consume(x),_):j(x)}function y(x){return x===47?(e.consume(x),j):x===58||x===95||wn(x)?(e.consume(x),S):We(x)?(e.consume(x),y):j(x)}function S(x){return x===45||x===46||x===58||x===95||mn(x)?(e.consume(x),S):E(x)}function E(x){return x===61?(e.consume(x),k):We(x)?(e.consume(x),E):y(x)}function k(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),c=x,T):We(x)?(e.consume(x),k):R(x)}function T(x){return x===c?(e.consume(x),c=null,O):x===null||Ce(x)?n(x):(e.consume(x),T)}function R(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||mt(x)?E(x):(e.consume(x),R)}function O(x){return x===47||x===62||We(x)?y(x):n(x)}function j(x){return x===62?(e.consume(x),$):n(x)}function $(x){return x===null||Ce(x)?L(x):We(x)?(e.consume(x),$):n(x)}function L(x){return x===45&&i===2?(e.consume(x),M):x===60&&i===1?(e.consume(x),W):x===62&&i===4?(e.consume(x),re):x===63&&i===3?(e.consume(x),C):x===93&&i===5?(e.consume(x),H):Ce(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(qN,Q,P)(x)):x===null||Ce(x)?(e.exit("htmlFlowData"),P(x)):(e.consume(x),L)}function P(x){return e.check(KN,A,Q)(x)}function A(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),D}function D(x){return x===null||Ce(x)?P(x):(e.enter("htmlFlowData"),L(x))}function M(x){return x===45?(e.consume(x),C):L(x)}function W(x){return x===47?(e.consume(x),o="",N):L(x)}function N(x){if(x===62){const Y=o.toLowerCase();return Cy.includes(Y)?(e.consume(x),re):L(x)}return wn(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),N):L(x)}function H(x){return x===93?(e.consume(x),C):L(x)}function C(x){return x===62?(e.consume(x),re):x===45&&i===2?(e.consume(x),C):L(x)}function re(x){return x===null||Ce(x)?(e.exit("htmlFlowData"),Q(x)):(e.consume(x),re)}function Q(x){return e.exit("htmlFlow"),t(x)}}function XN(e,t,n){const r=this;return i;function i(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function JN(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Va,t,n)}}const ZN={name:"htmlText",tokenize:QN};function QN(e,t,n){const r=this;let i,s,o;return a;function a(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),E):C===63?(e.consume(C),y):wn(C)?(e.consume(C),R):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),s=0,m):wn(C)?(e.consume(C),_):n(C)}function d(C){return C===45?(e.consume(C),p):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),f):Ce(C)?(o=h,W(C)):(e.consume(C),h)}function f(C){return C===45?(e.consume(C),p):h(C)}function p(C){return C===62?M(C):C===45?f(C):h(C)}function m(C){const re="CDATA[";return C===re.charCodeAt(s++)?(e.consume(C),s===re.length?g:m):n(C)}function g(C){return C===null?n(C):C===93?(e.consume(C),w):Ce(C)?(o=g,W(C)):(e.consume(C),g)}function w(C){return C===93?(e.consume(C),v):g(C)}function v(C){return C===62?M(C):C===93?(e.consume(C),v):g(C)}function _(C){return C===null||C===62?M(C):Ce(C)?(o=_,W(C)):(e.consume(C),_)}function y(C){return C===null?n(C):C===63?(e.consume(C),S):Ce(C)?(o=y,W(C)):(e.consume(C),y)}function S(C){return C===62?M(C):y(C)}function E(C){return wn(C)?(e.consume(C),k):n(C)}function k(C){return C===45||mn(C)?(e.consume(C),k):T(C)}function T(C){return Ce(C)?(o=T,W(C)):We(C)?(e.consume(C),T):M(C)}function R(C){return C===45||mn(C)?(e.consume(C),R):C===47||C===62||mt(C)?O(C):n(C)}function O(C){return C===47?(e.consume(C),M):C===58||C===95||wn(C)?(e.consume(C),j):Ce(C)?(o=O,W(C)):We(C)?(e.consume(C),O):M(C)}function j(C){return C===45||C===46||C===58||C===95||mn(C)?(e.consume(C),j):$(C)}function $(C){return C===61?(e.consume(C),L):Ce(C)?(o=$,W(C)):We(C)?(e.consume(C),$):O(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,P):Ce(C)?(o=L,W(C)):We(C)?(e.consume(C),L):(e.consume(C),A)}function P(C){return C===i?(e.consume(C),i=void 0,D):C===null?n(C):Ce(C)?(o=P,W(C)):(e.consume(C),P)}function A(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||mt(C)?O(C):(e.consume(C),A)}function D(C){return C===47||C===62||mt(C)?O(C):n(C)}function M(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function W(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),N}function N(C){return We(C)?Xe(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):H(C)}function H(C){return e.enter("htmlTextData"),o(C)}}const Qp={name:"labelEnd",resolveAll:rj,resolveTo:ij,tokenize:sj},ej={tokenize:oj},tj={tokenize:aj},nj={tokenize:lj};function rj(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Vn(e,0,e.length,n),e}function ij(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=nr(a,e.slice(s+1,s+r+3)),a=nr(a,[["enter",d,t]]),a=nr(a,fu(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=nr(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=nr(a,e.slice(o+1)),a=nr(a,[["exit",c,t]]),Vn(e,s,e.length,a),e}function sj(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?h(f):(o=r.parser.defined.includes(gr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),c):n(f)}function c(f){return f===40?e.attempt(ej,d,o?d:h)(f):f===91?e.attempt(tj,d,o?u:h)(f):o?d(f):h(f)}function u(f){return e.attempt(nj,d,h)(f)}function d(f){return t(f)}function h(f){return s._balanced=!0,n(f)}}function oj(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return mt(h)?ua(e,s)(h):s(h)}function s(h){return h===41?d(h):Ax(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return mt(h)?ua(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?Mx(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return mt(h)?ua(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function aj(e,t,n){const r=this;return i;function i(a){return Ix.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(gr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function lj(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const cj={name:"labelStartImage",resolveAll:Qp.resolveAll,tokenize:uj};function uj(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const hj={name:"labelStartLink",resolveAll:Qp.resolveAll,tokenize:dj};function dj(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const uh={name:"lineEnding",tokenize:fj};function fj(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Xe(e,t,"linePrefix")}}const Kl={name:"thematicBreak",tokenize:pj};function pj(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ce(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),We(u)?Xe(e,a,"whitespace")(u):a(u))}}const Rn={continuation:{tokenize:vj},exit:bj,name:"list",tokenize:yj},mj={partial:!0,tokenize:wj},gj={partial:!0,tokenize:_j};function yj(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Zd(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Kl,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Zd(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Va,r.interrupt?n:d,e.attempt(mj,f,h))}function d(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function h(p){return We(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function vj(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Va,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Xe(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!We(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(gj,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Xe(e,e.attempt(Rn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function _j(e,t,n){const r=this;return Xe(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function bj(e){e.exit(this.containerState.type)}function wj(e,t,n){const r=this;return Xe(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!We(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Ey={name:"setextUnderline",resolveTo:xj,tokenize:Sj};function xj(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Sj(e,t,n){const r=this;let i;return s;function s(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),We(u)?Xe(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ce(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const kj={tokenize:Cj};function Cj(e){const t=this,n=e.attempt(Va,r,e.attempt(this.parser.constructs.flowInitial,i,Xe(e,e.attempt(this.parser.constructs.flow,i,e.attempt(TN,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Ej={resolveAll:zx()},Nj=Ox("string"),jj=Ox("text");function Ox(e){return{resolveAll:zx(e==="text"?Rj:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=i[d];let f=-1;if(h)for(;++f<h.length;){const p=h[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function zx(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function Rj(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,c;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Tj={42:Rn,43:Rn,45:Rn,48:Rn,49:Rn,50:Rn,51:Rn,52:Rn,53:Rn,54:Rn,55:Rn,56:Rn,57:Rn,62:Tx},Pj={91:IN},Dj={[-2]:ch,[-1]:ch,32:ch},Lj={35:FN,42:Kl,45:[Ey,Kl],60:VN,61:Ey,95:Kl,96:ky,126:ky},Aj={38:Dx,92:Px},Ij={[-5]:uh,[-4]:uh,[-3]:uh,33:cj,38:Dx,42:Qd,60:[hN,ZN],91:hj,92:[BN,Px],93:Qp,95:Qd,96:kN},Mj={null:[Qd,Ej]},Oj={null:[42,95]},zj={null:[]},Bj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Oj,contentInitial:Pj,disable:zj,document:Tj,flow:Lj,flowInitial:Dj,insideSpan:Mj,string:Aj,text:Ij},Symbol.toStringTag,{value:"Module"}));function $j(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const c={attempt:T(E),check:T(k),consume:_,enter:y,exit:S,interrupt:T(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function h($){return o=nr(o,$),w(),o[o.length-1]!==null?[]:(R(t,0),u.events=fu(s,u.events,u),u.events)}function f($,L){return Hj(p($),L)}function p($){return Fj(o,$)}function m(){const{_bufferIndex:$,_index:L,line:P,column:A,offset:D}=r;return{_bufferIndex:$,_index:L,line:P,column:A,offset:D}}function g($){i[$.line]=$.column,j()}function w(){let $;for(;r._index<o.length;){const L=o[r._index];if(typeof L=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<L.length;)v(L.charCodeAt(r._bufferIndex));else v(L)}}function v($){d=d($)}function _($){Ce($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,j()):$!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=$}function y($,L){const P=L||{};return P.type=$,P.start=m(),u.events.push(["enter",P,u]),a.push(P),P}function S($){const L=a.pop();return L.end=m(),u.events.push(["exit",L,u]),L}function E($,L){R($,L.from)}function k($,L){L.restore()}function T($,L){return P;function P(A,D,M){let W,N,H,C;return Array.isArray(A)?Q(A):"tokenize"in A?Q([A]):re(A);function re(oe){return me;function me(Ee){const U=Ee!==null&&oe[Ee],ye=Ee!==null&&oe.null,we=[...Array.isArray(U)?U:U?[U]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return Q(we)(Ee)}}function Q(oe){return W=oe,N=0,oe.length===0?M:x(oe[N])}function x(oe){return me;function me(Ee){return C=O(),H=oe,oe.partial||(u.currentConstruct=oe),oe.name&&u.parser.constructs.disable.null.includes(oe.name)?Z():oe.tokenize.call(L?Object.assign(Object.create(u),L):u,c,Y,Z)(Ee)}}function Y(oe){return $(H,C),D}function Z(oe){return C.restore(),++N<W.length?x(W[N]):M}}}function R($,L){$.resolveAll&&!s.includes($)&&s.push($),$.resolve&&Vn(u.events,L,u.events.length-L,$.resolve(u.events.slice(L),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function O(){const $=m(),L=u.previous,P=u.currentConstruct,A=u.events.length,D=Array.from(a);return{from:A,restore:M};function M(){r=$,u.previous=L,u.currentConstruct=P,u.events.length=A,a=D,j()}}function j(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Fj(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function Hj(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
42
|
+
`;break}case-3:{o=`\r
|
|
43
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function Wj(e){const r={constructs:jx([Bj,...(e||{}).extensions||[]]),content:i(iN),defined:[],document:i(oN),flow:i(kj),lazy:{},string:i(Nj),text:i(jj)};return r;function i(s){return o;function o(a){return $j(r,s,a)}}}function Uj(e){for(;!Lx(e););return e}const Ny=/[\0\t\n\r]/g;function Vj(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const c=[];let u,d,h,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),h=0,t="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(Ny.lastIndex=h,u=Ny.exec(s),f=u&&u.index!==void 0?u.index:s.length,p=s.charCodeAt(f),!u){t=s.slice(h);break}if(p===10&&h===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<f&&(c.push(s.slice(h,f)),e+=f-h),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=f+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const qj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Kj(e){return e.replace(qj,Yj)}function Yj(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Rx(n.slice(s?2:1),s?16:10)}return Zp(n)||e}const Bx={}.hasOwnProperty;function Gj(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Xj(n)(Uj(Wj(n).document().write(Vj()(e,t,!0))))}function Xj(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(le),autolinkProtocol:O,autolinkEmail:O,atxHeading:s(qe),blockQuote:s(ye),characterEscape:O,characterReference:O,codeFenced:s(we),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(we,o),codeText:s(Se,o),codeTextData:O,data:O,codeFlowValue:O,definition:s(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(it),hardBreakEscape:s(Oe),hardBreakTrailing:s(Oe),htmlFlow:s(I,o),htmlFlowData:O,htmlText:s(I,o),htmlTextData:O,image:s(ie),label:o,link:s(le),listItem:s(He),listItemValue:f,listOrdered:s(ge,h),listUnordered:s(ge),paragraph:s(Pe),reference:x,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(qe),strong:s(Ve),thematicBreak:s(ut)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:U,autolinkProtocol:Ee,blockQuote:c(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:oe,characterReference:me,codeFenced:c(w),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:j,codeIndented:c(v),codeText:c(D),codeTextData:j,data:j,definition:c(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(L),hardBreakTrailing:c(L),htmlFlow:c(P),htmlFlowData:j,htmlText:c(A),htmlTextData:j,image:c(W),label:H,labelText:N,lineEnding:$,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Y,resourceDestinationString:C,resourceTitleString:re,resource:Q,setextHeading:c(R),setextHeadingLineSequence:T,setextHeadingText:k,strong:c(),thematicBreak:c()}};$x(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(F){let G={type:"root",children:[]};const ue={stack:[G],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},ke=[];let X=-1;for(;++X<F.length;)if(F[X][1].type==="listOrdered"||F[X][1].type==="listUnordered")if(F[X][0]==="enter")ke.push(X);else{const De=ke.pop();X=i(F,De,X)}for(X=-1;++X<F.length;){const De=t[F[X][0]];Bx.call(De,F[X][1].type)&&De[F[X][1].type].call(Object.assign({sliceSerialize:F[X][2].sliceSerialize},ue),F[X][1])}if(ue.tokenStack.length>0){const De=ue.tokenStack[ue.tokenStack.length-1];(De[1]||jy).call(ue,void 0,De[0])}for(G.position={start:li(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:li(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},X=-1;++X<t.transforms.length;)G=t.transforms[X](G)||G;return G}function i(F,G,ue){let ke=G-1,X=-1,De=!1,st,Re,Qe,vt;for(;++ke<=ue;){const ht=F[ke];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?X++:X--,vt=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(st&&!vt&&!X&&!Qe&&(Qe=ke),vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vt=void 0}if(!X&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||X===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(st){let Ke=ke;for(Re=void 0;Ke--;){const _t=F[Ke];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;Re&&(F[Re][1].type="lineEndingBlank",De=!0),_t[1].type="lineEnding",Re=Ke}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}Qe&&(!Re||Qe<Re)&&(st._spread=!0),st.end=Object.assign({},Re?F[Re][1].start:ht[1].end),F.splice(Re||ke,0,["exit",st,ht[2]]),ke++,ue++}if(ht[1].type==="listItemPrefix"){const Ke={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};st=Ke,F.splice(ke,0,["enter",Ke,ht[2]]),ke++,ue++,Qe=void 0,vt=!0}}}return F[G][1]._spread=De,ue}function s(F,G){return ue;function ue(ke){a.call(this,F(ke),ke),G&&G.call(this,ke)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(F,G,ue){this.stack[this.stack.length-1].children.push(F),this.stack.push(F),this.tokenStack.push([G,ue||void 0]),F.position={start:li(G.start),end:void 0}}function c(F){return G;function G(ue){F&&F.call(this,ue),u.call(this,ue)}}function u(F,G){const ue=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==F.type&&(G?G.call(this,F,ke[0]):(ke[1]||jy).call(this,F,ke[0]));else throw new Error("Cannot close `"+F.type+"` ("+ca({start:F.start,end:F.end})+"): it’s not open");ue.position.end=li(F.end)}function d(){return Jp(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(F){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(F),10),this.data.expectingFirstListItemValue=void 0}}function p(){const F=this.resume(),G=this.stack[this.stack.length-1];G.lang=F}function m(){const F=this.resume(),G=this.stack[this.stack.length-1];G.meta=F}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F.replace(/(\r?\n|\r)$/g,"")}function _(F){const G=this.resume(),ue=this.stack[this.stack.length-1];ue.label=G,ue.identifier=gr(this.sliceSerialize(F)).toLowerCase()}function y(){const F=this.resume(),G=this.stack[this.stack.length-1];G.title=F}function S(){const F=this.resume(),G=this.stack[this.stack.length-1];G.url=F}function E(F){const G=this.stack[this.stack.length-1];if(!G.depth){const ue=this.sliceSerialize(F).length;G.depth=ue}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(F){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(F).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function O(F){const ue=this.stack[this.stack.length-1].children;let ke=ue[ue.length-1];(!ke||ke.type!=="text")&&(ke=Ze(),ke.position={start:li(F.start),end:void 0},ue.push(ke)),this.stack.push(ke)}function j(F){const G=this.stack.pop();G.value+=this.sliceSerialize(F),G.position.end=li(F.end)}function $(F){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=G.children[G.children.length-1];ue.position.end=li(F.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(O.call(this,F),j.call(this,F))}function L(){this.data.atHardBreak=!0}function P(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F}function A(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F}function D(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F}function M(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=G,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function W(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=G,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function N(F){const G=this.sliceSerialize(F),ue=this.stack[this.stack.length-2];ue.label=Kj(G),ue.identifier=gr(G).toLowerCase()}function H(){const F=this.stack[this.stack.length-1],G=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const ke=F.children;ue.children=ke}else ue.alt=G}function C(){const F=this.resume(),G=this.stack[this.stack.length-1];G.url=F}function re(){const F=this.resume(),G=this.stack[this.stack.length-1];G.title=F}function Q(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function Y(F){const G=this.resume(),ue=this.stack[this.stack.length-1];ue.label=G,ue.identifier=gr(this.sliceSerialize(F)).toLowerCase(),this.data.referenceType="full"}function Z(F){this.data.characterReferenceType=F.type}function oe(F){const G=this.sliceSerialize(F),ue=this.data.characterReferenceType;let ke;ue?(ke=Rx(G,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Zp(G);const X=this.stack[this.stack.length-1];X.value+=ke}function me(F){const G=this.stack.pop();G.position.end=li(F.end)}function Ee(F){j.call(this,F);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(F)}function U(F){j.call(this,F);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(F)}function ye(){return{type:"blockquote",children:[]}}function we(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function Oe(){return{type:"break"}}function I(){return{type:"html",value:""}}function ie(){return{type:"image",title:null,url:"",alt:null}}function le(){return{type:"link",title:null,url:"",children:[]}}function ge(F){return{type:"list",ordered:F.type==="listOrdered",start:null,spread:F._spread,children:[]}}function He(F){return{type:"listItem",spread:F._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function Ve(){return{type:"strong",children:[]}}function Ze(){return{type:"text",value:""}}function ut(){return{type:"thematicBreak"}}}function li(e){return{line:e.line,column:e.column,offset:e.offset}}function $x(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?$x(e,r):Jj(e,r)}}function Jj(e,t){let n;for(n in t)if(Bx.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function jy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ca({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ca({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ca({start:t.start,end:t.end})+") is still open")}function Zj(e){const t=this;t.parser=n;function n(r){return Gj(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Qj(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function e2(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
44
|
+
`}]}function t2(e,t){const n=t.value?t.value+`
|
|
45
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function n2(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function r2(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function i2(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=vo(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function s2(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o2(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Fx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function a2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fx(e,t);const i={src:vo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function l2(e,t){const n={src:vo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function c2(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function u2(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fx(e,t);const i={href:vo(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function h2(e,t){const n={href:vo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function d2(e,t,n){const r=e.all(t),i=n?f2(n):Hx(t),s={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(i||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
|
|
46
|
+
`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
47
|
+
`});const u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)}function f2(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Hx(n[r])}return t}function Hx(e){const t=e.spread;return t??e.children.length>1}function p2(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function m2(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function g2(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function y2(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v2(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Kp(t.children[1]),c=wx(t.children[t.children.length-1]);a&&c&&(o.position={start:a,end:c}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function _2(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],f={},p=o?o[c]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};h&&(m.children=e.all(h),e.patch(h,m),m=e.applyData(h,m)),u.push(m)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function b2(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ry=9,Ty=32;function w2(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Py(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Py(t.slice(i),i>0,!1)),s.join("")}function Py(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Ry||s===Ty;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Ry||s===Ty;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function x2(e,t){const n={type:"text",value:w2(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function S2(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const k2={blockquote:Qj,break:e2,code:t2,delete:n2,emphasis:r2,footnoteReference:i2,heading:s2,html:o2,imageReference:a2,image:l2,inlineCode:c2,linkReference:u2,link:h2,listItem:d2,list:p2,paragraph:m2,root:g2,strong:y2,table:v2,tableCell:b2,tableRow:_2,text:x2,thematicBreak:S2,toml:gl,yaml:gl,definition:gl,footnoteDefinition:gl};function gl(){}const Wx=-1,pu=0,ha=1,Dc=2,em=3,tm=4,nm=5,rm=6,Ux=7,Vx=8,C2=typeof self=="object"?self:globalThis,Dy=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new C2[e](t)},E2=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case pu:case Wx:return n(o,i);case ha:{const a=n([],i);for(const c of o)a.push(r(c));return a}case Dc:{const a=n({},i);for(const[c,u]of o)a[r(c)]=r(u);return a}case em:return n(new Date(o),i);case tm:{const{source:a,flags:c}=o;return n(new RegExp(a,c),i)}case nm:{const a=n(new Map,i);for(const[c,u]of o)a.set(r(c),r(u));return a}case rm:{const a=n(new Set,i);for(const c of o)a.add(r(c));return a}case Ux:{const{name:a,message:c}=o;return n(Dy(a,c),i)}case Vx:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(Dy(s,o),i)};return r},Ly=e=>E2(new Map,e)(0),Ns="",{toString:N2}={},{keys:j2}=Object,Lo=e=>{const t=typeof e;if(t!=="object"||!e)return[pu,t];const n=N2.call(e).slice(8,-1);switch(n){case"Array":return[ha,Ns];case"Object":return[Dc,Ns];case"Date":return[em,Ns];case"RegExp":return[tm,Ns];case"Map":return[nm,Ns];case"Set":return[rm,Ns];case"DataView":return[ha,n]}return n.includes("Array")?[ha,n]:n.includes("Error")?[Ux,n]:[Dc,n]},yl=([e,t])=>e===pu&&(t==="function"||t==="symbol"),R2=(e,t,n,r)=>{const i=(o,a)=>{const c=r.push(o)-1;return n.set(a,c),c},s=o=>{if(n.has(o))return n.get(o);let[a,c]=Lo(o);switch(a){case pu:{let d=o;switch(c){case"bigint":a=Vx,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([Wx],o)}return i([a,d],o)}case ha:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),i([c,[...f]],o)}const d=[],h=i([a,d],o);for(const f of o)d.push(s(f));return h}case Dc:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const d=[],h=i([a,d],o);for(const f of j2(o))(e||!yl(Lo(o[f])))&&d.push([s(f),s(o[f])]);return h}case em:return i([a,o.toISOString()],o);case tm:{const{source:d,flags:h}=o;return i([a,{source:d,flags:h}],o)}case nm:{const d=[],h=i([a,d],o);for(const[f,p]of o)(e||!(yl(Lo(f))||yl(Lo(p))))&&d.push([s(f),s(p)]);return h}case rm:{const d=[],h=i([a,d],o);for(const f of o)(e||!yl(Lo(f)))&&d.push(s(f));return h}}const{message:u}=o;return i([a,{name:c,message:u}],o)};return s},Ay=(e,{json:t,lossy:n}={})=>{const r=[];return R2(!(t||n),!!t,new Map,r)(e),r},Lc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ly(Ay(e,t)):structuredClone(e):(e,t)=>Ly(Ay(e,t));function T2(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function P2(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function D2(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||T2,r=e.options.footnoteBackLabel||P2,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),f=vo(h.toLowerCase());let p=0;const m=[],g=e.footnoteCounts.get(h);for(;g!==void 0&&++p<=g;){m.length>0&&m.push({type:"text",value:" "});let _=typeof n=="string"?n:n(c,p);typeof _=="string"&&(_={type:"text",value:_}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const _=w.children[w.children.length-1];_&&_.type==="text"?_.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...m)}else d.push(...m);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(u,v),a.push(v)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Lc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
48
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
49
|
+
`}]}}const mu=function(e){if(e==null)return M2;if(typeof e=="function")return gu(e);if(typeof e=="object")return Array.isArray(e)?L2(e):A2(e);if(typeof e=="string")return I2(e);throw new Error("Expected function, string, or object as test")};function L2(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=mu(e[n]);return gu(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function A2(e){const t=e;return gu(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function I2(e){return gu(t);function t(n){return n&&n.type===e}}function gu(e){return t;function t(n,r,i){return!!(O2(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function M2(){return!0}function O2(e){return e!==null&&typeof e=="object"&&"type"in e}const qx=[],z2=!0,ef=!1,B2="skip";function Kx(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=mu(i),o=r?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=qx,m,g,w;if((!t||s(c,u,d[d.length-1]||void 0))&&(p=$2(n(c,d)),p[0]===ef))return p;if("children"in c&&c.children){const v=c;if(v.children&&p[0]!==B2)for(g=(r?v.children.length:-1)+o,w=d.concat(v);g>-1&&g<v.children.length;){const _=v.children[g];if(m=a(_,g,w)(),m[0]===ef)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function $2(e){return Array.isArray(e)?e:typeof e=="number"?[z2,e]:e==null?qx:[e]}function im(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),Kx(e,s,a,i);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return o(c,h,d)}}const tf={}.hasOwnProperty,F2={};function H2(e,t){const n=t||F2,r=new Map,i=new Map,s=new Map,o={...k2,...n.handlers},a={all:u,applyData:U2,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:c,options:n,patch:W2,wrap:q2};return im(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),a;function c(d,h){const f=d.type,p=a.handlers[f];if(tf.call(a.handlers,f)&&p)return p(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in d){const{children:g,...w}=d,v=Lc(w);return v.children=a.all(d),v}return Lc(d)}return(a.options.unknownHandler||V2)(a,d,h)}function u(d){const h=[];if("children"in d){const f=d.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],d);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Iy(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=Iy(g.value))}Array.isArray(m)?h.push(...m):h.push(m)}}}return h}}function W2(e,t){e.position&&(t.position=TE(e))}function U2(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,Lc(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function V2(e,t){const n=t.data||{},r="value"in t&&!(tf.call(n,"hProperties")||tf.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function q2(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
50
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
51
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
52
|
+
`}),n}function Iy(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function My(e,t){const n=H2(e,t),r=n.one(e,void 0),i=D2(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
53
|
+
`},i),s}function K2(e,t){return e&&"run"in e?async function(n,r){const i=My(n,{file:r,...t});await e.run(i,r)}:function(n,r){return My(n,{file:r,...e||t})}}function Oy(e){if(e)throw e}var Yl=Object.prototype.hasOwnProperty,Yx=Object.prototype.toString,zy=Object.defineProperty,By=Object.getOwnPropertyDescriptor,$y=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Yx.call(t)==="[object Array]"},Fy=function(t){if(!t||Yx.call(t)!=="[object Object]")return!1;var n=Yl.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Yl.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Yl.call(t,i)},Hy=function(t,n){zy&&n.name==="__proto__"?zy(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Wy=function(t,n){if(n==="__proto__")if(Yl.call(t,n)){if(By)return By(t,n).value}else return;return t[n]},Y2=function e(){var t,n,r,i,s,o,a=arguments[0],c=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},c=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=Wy(a,n),i=Wy(t,n),a!==i&&(d&&i&&(Fy(i)||(s=$y(i)))?(s?(s=!1,o=r&&$y(r)?r:[]):o=r&&Fy(r)?r:{},Hy(a,{name:n,newValue:e(d,o,i)})):typeof i<"u"&&Hy(a,{name:n,newValue:i}));return a};const hh=za(Y2);function nf(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function G2(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(c,...u){const d=e[++s];let h=-1;if(c){o(c);return}for(;++h<i.length;)(u[h]===null||u[h]===void 0)&&(u[h]=i[h]);i=u,d?X2(d,a)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function X2(e,t){let n;return r;function r(...o){const a=e.length>o.length;let c;a&&o.push(i);try{c=e.apply(this,o)}catch(u){const d=u;if(a&&n)throw d;return i(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const Cr={basename:J2,dirname:Z2,extname:Q2,join:eR,sep:"/"};function J2(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');qa(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Z2(e){if(qa(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Q2(e){qa(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function eR(...e){let t=-1,n;for(;++t<e.length;)qa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":tR(n)}function tR(e){qa(e);const t=e.codePointAt(0)===47;let n=nR(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nR(e,t){let n="",r=0,i=-1,s=0,o=-1,a,c;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function qa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rR={cwd:iR};function iR(){return"/"}function rf(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function sR(e){if(typeof e=="string")e=new URL(e);else if(!rf(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return oR(e)}function oR(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const dh=["history","path","basename","stem","extname","dirname"];class Gx{constructor(t){let n;t?rf(t)?n={path:t}:typeof t=="string"||aR(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":rR.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<dh.length;){const s=dh[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)dh.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Cr.basename(this.path):void 0}set basename(t){ph(t,"basename"),fh(t,"basename"),this.path=Cr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Cr.dirname(this.path):void 0}set dirname(t){Uy(this.basename,"dirname"),this.path=Cr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Cr.extname(this.path):void 0}set extname(t){if(fh(t,"extname"),Uy(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Cr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){rf(t)&&(t=sR(t)),ph(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Cr.basename(this.path,this.extname):void 0}set stem(t){ph(t,"stem"),fh(t,"stem"),this.path=Cr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new yn(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function fh(e,t){if(e&&e.includes(Cr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Cr.sep+"`")}function ph(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Uy(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function aR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lR=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},cR={}.hasOwnProperty;class sm extends lR{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=G2()}copy(){const t=new sm;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(hh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(yh("data",this.frozen),this.namespace[t]=n,this):cR.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yh("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=vl(t),r=this.parser||this.Parser;return mh("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),mh("process",this.parser||this.Parser),gh("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=vl(t),c=r.parse(a);r.run(c,a,function(d,h,f){if(d||!h||!f)return u(d);const p=h,m=r.stringify(p,f);dR(m)?f.value=m:f.result=m,u(d,f)});function u(d,h){d||!h?o(d):s?s(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),mh("processSync",this.parser||this.Parser),gh("processSync",this.compiler||this.Compiler),this.process(t,i),qy("processSync","process",n),r;function i(s,o){n=!0,Oy(s),r=o}}run(t,n,r){Vy(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const c=vl(n);i.run(t,c,u);function u(d,h,f){const p=h||t;d?a(d):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),qy("runSync","run",r),i;function s(o,a){Oy(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=vl(n),i=this.compiler||this.Compiler;return gh("stringify",i),Vy(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(yh("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(i.settings=hh(!0,i.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,f=-1;for(;++h<r.length;)if(r[h][0]===u){f=h;break}if(f===-1)r.push([u,...d]);else if(d.length>0){let[p,...m]=d;const g=r[f][1];nf(g)&&nf(p)&&(p=hh(!0,g,p)),r[f]=[u,p,...m]}}}}const uR=new sm().freeze();function mh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function gh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yh(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Vy(e){if(!nf(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function qy(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vl(e){return hR(e)?e:new Gx(e)}function hR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function dR(e){return typeof e=="string"||fR(e)}function fR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ky=[],Yy={allowDangerousHtml:!0},mR=/^(https?|ircs?|mailto|xmpp)$/i,gR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function yR(e){const t=vR(e),n=_R(e);return bR(t.runSync(t.parse(n),n),e)}function vR(e){const t=e.rehypePlugins||Ky,n=e.remarkPlugins||Ky,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yy}:Yy;return uR().use(Zj).use(n).use(K2,r).use(t)}function _R(e){const t=e.children||"",n=new Gx;return typeof t=="string"&&(n.value=t),n}function bR(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||wR;for(const d of gR)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+pR+d.id,void 0);return im(e,u),IE(e,{Fragment:l.Fragment,components:i,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in lh)if(Object.hasOwn(lh,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=lh[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,f)),p&&f&&typeof h=="number")return a&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function wR(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||mR.test(e.slice(0,t))?e:""}function Gy(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function xR(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function SR(e,t,n){const i=mu((n||{}).ignore||[]),s=kR(t);let o=-1;for(;++o<s.length;)Kx(e,"text",a);function a(u,d){let h=-1,f;for(;++h<d.length;){const p=d[h],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return c(u,d)}function c(u,d){const h=d[d.length-1],f=s[o][0],p=s[o][1];let m=0;const w=h.children.indexOf(u);let v=!1,_=[];f.lastIndex=0;let y=f.exec(u.value);for(;y;){const S=y.index,E={index:y.index,input:y.input,stack:[...d,u]};let k=p(...y,E);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?f.lastIndex=S+1:(m!==S&&_.push({type:"text",value:u.value.slice(m,S)}),Array.isArray(k)?_.push(...k):k&&_.push(k),m=S+y[0].length,v=!0),!f.global)break;y=f.exec(u.value)}return v?(m<u.value.length&&_.push({type:"text",value:u.value.slice(m)}),h.children.splice(w,1,..._)):_=[u],w+_.length}}function kR(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([CR(i[0]),ER(i[1])])}return t}function CR(e){return typeof e=="string"?new RegExp(xR(e),"g"):e}function ER(e){return typeof e=="function"?e:function(){return e}}const vh="phrasing",_h=["autolink","link","image","label"];function NR(){return{transforms:[AR],enter:{literalAutolink:RR,literalAutolinkEmail:bh,literalAutolinkHttp:bh,literalAutolinkWww:bh},exit:{literalAutolink:LR,literalAutolinkEmail:DR,literalAutolinkHttp:TR,literalAutolinkWww:PR}}}function jR(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:vh,notInConstruct:_h},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:vh,notInConstruct:_h},{character:":",before:"[ps]",after:"\\/",inConstruct:vh,notInConstruct:_h}]}}function RR(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bh(e){this.config.enter.autolinkProtocol.call(this,e)}function TR(e){this.config.exit.autolinkProtocol.call(this,e)}function PR(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function DR(e){this.config.exit.autolinkEmail.call(this,e)}function LR(e){this.exit(e)}function AR(e){SR(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,IR],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),MR]],{ignore:["link","linkReference"]})}function IR(e,t,n,r,i){let s="";if(!Xx(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!OR(n)))return!1;const o=zR(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function MR(e,t,n,r){return!Xx(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function OR(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function zR(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=Gy(e,"(");let s=Gy(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Xx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ds(n)||du(n))&&(!t||n!==47)}Jx.peek=KR;function BR(){this.buffer()}function $R(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function FR(){this.buffer()}function HR(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function WR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function UR(e){this.exit(e)}function VR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qR(e){this.exit(e)}function KR(){return"["}function Jx(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function YR(){return{enter:{gfmFootnoteCallString:BR,gfmFootnoteCall:$R,gfmFootnoteDefinitionLabelString:FR,gfmFootnoteDefinition:HR},exit:{gfmFootnoteCallString:WR,gfmFootnoteCall:UR,gfmFootnoteDefinitionLabelString:VR,gfmFootnoteDefinition:qR}}}function GR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Jx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let c=a.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=a.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),c+=a.move((t?`
|
|
54
|
+
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?Zx:XR))),u(),c}}function XR(e,t,n){return t===0?e:Zx(e,t,n)}function Zx(e,t,n){return(n?"":" ")+e}const JR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Qx.peek=nT;function ZR(){return{canContainEols:["delete"],enter:{strikethrough:eT},exit:{strikethrough:tT}}}function QR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:JR}],handlers:{delete:Qx}}}function eT(e){this.enter({type:"delete",children:[]},e)}function tT(e){this.exit(e)}function Qx(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function nT(){return"~"}function rT(e){return e.length}function iT(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||rT,s=[],o=[],a=[],c=[];let u=0,d=-1;for(;++d<e.length;){const g=[],w=[];let v=-1;for(e[d].length>u&&(u=e[d].length);++v<e[d].length;){const _=sT(e[d][v]);if(n.alignDelimiters!==!1){const y=i(_);w[v]=y,(c[v]===void 0||y>c[v])&&(c[v]=y)}g.push(_)}o[d]=g,a[d]=w}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<u;)s[h]=Xy(r[h]);else{const g=Xy(r);for(;++h<u;)s[h]=g}h=-1;const f=[],p=[];for(;++h<u;){const g=s[h];let w="",v="";g===99?(w=":",v=":"):g===108?w=":":g===114&&(v=":");let _=n.alignDelimiters===!1?1:Math.max(1,c[h]-w.length-v.length);const y=w+"-".repeat(_)+v;n.alignDelimiters!==!1&&(_=w.length+_+v.length,_>c[h]&&(c[h]=_),p[h]=_),f[h]=y}o.splice(1,0,f),a.splice(1,0,p),d=-1;const m=[];for(;++d<o.length;){const g=o[d],w=a[d];h=-1;const v=[];for(;++h<u;){const _=g[h]||"";let y="",S="";if(n.alignDelimiters!==!1){const E=c[h]-(w[h]||0),k=s[h];k===114?y=" ".repeat(E):k===99?E%2?(y=" ".repeat(E/2+.5),S=" ".repeat(E/2-.5)):(y=" ".repeat(E/2),S=y):S=" ".repeat(E)}n.delimiterStart!==!1&&!h&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||h)&&v.push(" "),n.alignDelimiters!==!1&&v.push(y),v.push(_),n.alignDelimiters!==!1&&v.push(S),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&v.push("|")}m.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return m.join(`
|
|
55
|
+
`)}function sT(e){return e==null?"":String(e)}function Xy(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function oT(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),aT);return i(),o}function aT(e,t,n){return">"+(n?"":" ")+e}function lT(e,t){return Jy(e,t.inConstruct,!0)&&!Jy(e,t.notInConstruct,!1)}function Jy(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Zy(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
56
|
+
`&&lT(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
57
|
+
`}function cT(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function uT(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function hT(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function dT(e,t,n,r){const i=hT(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(uT(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(s,fT);return h(),f}const a=n.createTracker(r),c=i.repeat(Math.max(cT(s,i)+1,3)),u=n.enter("codeFenced");let d=a.move(c);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
|
|
58
|
+
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
|
|
59
|
+
`),s&&(d+=a.move(s+`
|
|
60
|
+
`)),d+=a.move(c),u(),d}function fT(e,t,n){return(n?"":" ")+e}function om(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function pT(e,t,n,r){const i=om(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
61
|
+
`,...c.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),a()),o(),u}function mT(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Aa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ac(e,t,n){const r=ho(e),i=ho(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}eS.peek=gT;function eS(e,t,n,r){const i=mT(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let c=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const u=c.charCodeAt(0),d=Ac(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Aa(u)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Ac(r.after.charCodeAt(0),h,i);f.inside&&(c=c.slice(0,-1)+Aa(h));const p=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+c+p}function gT(e,t,n){return n.options.emphasis||"*"}function yT(e,t){let n=!1;return im(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ef}),!!((!e.depth||e.depth<3)&&Jp(e)&&(t.options.setext||n))}function vT(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(yT(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...s.current(),before:`
|
|
62
|
+
`,after:`
|
|
63
|
+
`});return h(),d(),f+`
|
|
64
|
+
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
65
|
+
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),c=n.enter("phrasing");s.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
66
|
+
`,...s.current()});return/^[\t ]/.test(u)&&(u=Aa(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),a(),u}tS.peek=_T;function tS(e){return e.value||""}function _T(){return"<"}nS.peek=bT;function nS(e,t,n,r){const i=om(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(a=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),a()),u+=c.move(")"),o(),u}function bT(){return"!"}rS.peek=wT;function rS(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let c=a.move("![");const u=n.safe(e.alt,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,s(),i==="full"||!u||u!==h?c+=a.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function wT(){return"!"}iS.peek=xT;function iS(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let c;if(o.atBreak)for(;c=a.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return i+r+i}function xT(){return"`"}function sS(e,t){const n=Jp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}oS.peek=ST;function oS(e,t,n,r){const i=om(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,c;if(sS(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${s}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),c()),u+=o.move(")"),a(),u}function ST(e,t,n){return sS(e,n)?"<":"["}aS.peek=kT;function aS(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let c=a.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...a.current()});c+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...a.current()});return o(),n.stack=d,s(),i==="full"||!u||u!==h?c+=a.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=a.move("]"),c}function kT(){return"["}function am(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function CT(e){const t=am(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ET(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function lS(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function NT(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?ET(n):am(n);const a=e.ordered?o==="."?")":".":CT(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),lS(n)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),u}function jT(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function RT(e,t,n,r){const i=jT(n);let s=n.bulletCurrent||am(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return c(),u;function d(h,f,p){return f?(p?"":" ".repeat(o))+h:(p?s:s+" ".repeat(o-s.length))+h}}function TT(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const PT=mu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DT(e,t,n,r){return(e.children.some(function(o){return PT(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function LT(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}cS.peek=AT;function cS(e,t,n,r){const i=LT(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let c=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const u=c.charCodeAt(0),d=Ac(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Aa(u)+c.slice(1));const h=c.charCodeAt(c.length-1),f=Ac(r.after.charCodeAt(0),h,i);f.inside&&(c=c.slice(0,-1)+Aa(h));const p=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+c+p}function AT(e,t,n){return n.options.strong||"*"}function IT(e,t,n,r){return n.safe(e.value,r)}function MT(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function OT(e,t,n){const r=(lS(n)+(n.options.ruleSpaces?" ":"")).repeat(MT(n));return n.options.ruleSpaces?r.slice(0,-1):r}const uS={blockquote:oT,break:Zy,code:dT,definition:pT,emphasis:eS,hardBreak:Zy,heading:vT,html:tS,image:nS,imageReference:rS,inlineCode:iS,link:oS,linkReference:aS,list:NT,listItem:RT,paragraph:TT,root:DT,strong:cS,text:IT,thematicBreak:OT};function zT(){return{enter:{table:BT,tableData:Qy,tableHeader:Qy,tableRow:FT},exit:{codeText:HT,table:$T,tableData:wh,tableHeader:wh,tableRow:wh}}}function BT(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function $T(e){this.exit(e),this.data.inTable=void 0}function FT(e){this.enter({type:"tableRow",children:[]},e)}function wh(e){this.exit(e)}function Qy(e){this.enter({type:"tableCell",children:[]},e)}function HT(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,WT));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function WT(e,t){return t==="|"?t:e}function UT(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
67
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:a}};function o(p,m,g,w){return u(d(p,g,w),p.align)}function a(p,m,g,w){const v=h(p,g,w),_=u([v]);return _.slice(0,_.indexOf(`
|
|
68
|
+
`))}function c(p,m,g,w){const v=g.enter("tableCell"),_=g.enter("phrasing"),y=g.containerPhrasing(p,{...w,before:s,after:s});return _(),v(),y}function u(p,m){return iT(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function d(p,m,g){const w=p.children;let v=-1;const _=[],y=m.enter("table");for(;++v<w.length;)_[v]=h(w[v],m,g);return y(),_}function h(p,m,g){const w=p.children;let v=-1;const _=[],y=m.enter("tableRow");for(;++v<w.length;)_[v]=c(w[v],p,m,g);return y(),_}function f(p,m,g){let w=uS.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function VT(){return{exit:{taskListCheckValueChecked:ev,taskListCheckValueUnchecked:ev,paragraph:KT}}}function qT(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:YT}}}function ev(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function KT(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function YT(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let c=uS.listItem(e,t,n,{...r,...a.current()});return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(d){return d+o}}function GT(){return[NR(),YR(),ZR(),zT(),VT()]}function XT(e){return{extensions:[jR(),GR(e),QR(),UT(e),qT()]}}const JT={tokenize:rP,partial:!0},hS={tokenize:iP,partial:!0},dS={tokenize:sP,partial:!0},fS={tokenize:oP,partial:!0},ZT={tokenize:aP,partial:!0},pS={name:"wwwAutolink",tokenize:tP,previous:gS},mS={name:"protocolAutolink",tokenize:nP,previous:yS},Qr={name:"emailAutolink",tokenize:eP,previous:vS},Mr={};function QT(){return{text:Mr}}let Hi=48;for(;Hi<123;)Mr[Hi]=Qr,Hi++,Hi===58?Hi=65:Hi===91&&(Hi=97);Mr[43]=Qr;Mr[45]=Qr;Mr[46]=Qr;Mr[95]=Qr;Mr[72]=[Qr,mS];Mr[104]=[Qr,mS];Mr[87]=[Qr,pS];Mr[119]=[Qr,pS];function eP(e,t,n){const r=this;let i,s;return o;function o(h){return!sf(h)||!vS.call(r,r.previous)||lm(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return sf(h)?(e.consume(h),a):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(ZT,d,u)(h):h===45||h===95||mn(h)?(s=!0,e.consume(h),c):d(h)}function u(h){return e.consume(h),i=!0,c}function d(h){return s&&i&&wn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function tP(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!gS.call(r,r.previous)||lm(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(JT,e.attempt(hS,e.attempt(dS,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function nP(e,t,n){const r=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&yS.call(r,r.previous)&&!lm(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(wn(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),s?u:(s=!0,c)):n(h)}function u(h){return h===null||Pc(h)||mt(h)||ds(h)||du(h)?n(h):e.attempt(hS,e.attempt(dS,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function rP(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function iP(e,t,n){let r,i,s;return o;function o(u){return u===46||u===95?e.check(fS,c,a)(u):u===null||mt(u)||ds(u)||u!==45&&du(u)?c(u):(s=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function c(u){return i||r||!s?n(u):t(u)}}function sP(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(fS,t,s)(o):o===null||mt(o)||ds(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function oP(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||mt(a)||ds(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||mt(a)||ds(a)?t(a):r(a)}function s(a){return wn(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):wn(a)?(e.consume(a),o):n(a)}}function aP(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return mn(s)?n(s):t(s)}}function gS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||mt(e)}function yS(e){return!wn(e)}function vS(e){return!(e===47||sf(e))}function sf(e){return e===43||e===45||e===46||e===95||mn(e)}function lm(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const lP={tokenize:gP,partial:!0};function cP(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fP,continuation:{tokenize:pP},exit:mP}},text:{91:{name:"gfmFootnoteCall",tokenize:dP},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uP,resolveTo:hP}}}}function uP(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return a;function a(c){if(!o||!o._balanced)return n(c);const u=gr(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function hP(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function dP(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(s>999||h===93&&!o||h===null||h===91||mt(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(gr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return mt(h)||(o=!0),s++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),s++,u):u(h)}}function fP(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(o>999||m===93&&!a||m===null||m===91||mt(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=gr(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return mt(m)||(a=!0),o++,e.consume(m),m===92?h:d}function h(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Xe(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function pP(e,t,n){return e.check(Va,t,e.attempt(lP,t,n))}function mP(e){e.exit("gfmFootnoteDefinition")}function gP(e,t,n){const r=this;return Xe(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function yP(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},f=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&Vn(f,f.length,0,fu(p,o.slice(u+1,c),a)),Vn(f,f.length,0,[["exit",h,a],["enter",o[c][1],a],["exit",o[c][1],a],["exit",d,a]]),Vn(o,u-1,c-u+3,f),c=u+f.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function s(o,a,c){const u=this.previous,d=this.events;let h=0;return f;function f(m){return u===126&&d[d.length-1][1].type!=="characterEscape"?c(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=ho(u);if(m===126)return h>1?c(m):(o.consume(m),h++,p);if(h<2&&!n)return c(m);const w=o.exit("strikethroughSequenceTemporary"),v=ho(m);return w._open=!v||v===2&&!!g,w._close=!g||g===2&&!!v,a(m)}}}class vP{constructor(){this.map=[]}add(t,n,r){_P(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function _P(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function bP(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function wP(){return{flow:{null:{name:"table",tokenize:xP,resolveAll:SP}}}}function xP(e,t,n){const r=this;let i=0,s=0,o;return a;function a(j){let $=r.events.length-1;for(;$>-1;){const A=r.events[$][1].type;if(A==="lineEnding"||A==="linePrefix")$--;else break}const L=$>-1?r.events[$][1].type:null,P=L==="tableHead"||L==="tableRow"?k:c;return P===k&&r.parser.lazy[r.now().line]?n(j):P(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),u(j)}function u(j){return j===124||(o=!0,s+=1),d(j)}function d(j){return j===null?n(j):Ce(j)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),p):n(j):We(j)?Xe(e,d,"whitespace")(j):(s+=1,o&&(o=!1,i+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(j)))}function h(j){return j===null||j===124||mt(j)?(e.exit("data"),d(j)):(e.consume(j),j===92?f:h)}function f(j){return j===92||j===124?(e.consume(j),h):h(j)}function p(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),o=!1,We(j)?Xe(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):m(j))}function m(j){return j===45||j===58?w(j):j===124?(o=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),g):E(j)}function g(j){return We(j)?Xe(e,w,"whitespace")(j):w(j)}function w(j){return j===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),v):j===45?(s+=1,v(j)):j===null||Ce(j)?S(j):E(j)}function v(j){return j===45?(e.enter("tableDelimiterFiller"),_(j)):E(j)}function _(j){return j===45?(e.consume(j),_):j===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(j))}function y(j){return We(j)?Xe(e,S,"whitespace")(j):S(j)}function S(j){return j===124?m(j):j===null||Ce(j)?!o||i!==s?E(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):E(j)}function E(j){return n(j)}function k(j){return e.enter("tableRow"),T(j)}function T(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),T):j===null||Ce(j)?(e.exit("tableRow"),t(j)):We(j)?Xe(e,T,"whitespace")(j):(e.enter("data"),R(j))}function R(j){return j===null||j===124||mt(j)?(e.exit("data"),T(j)):(e.consume(j),j===92?O:R)}function O(j){return j===92||j===124?(e.consume(j),R):R(j)}}function SP(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,c=0,u,d,h;const f=new vP;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,c!==0&&(tv(f,t,c,u,d),d=void 0,c=0),u={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,h=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",d,t]])),i=m.type==="tableDelimiterRow"?2:d?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=_l(f,t,s,i,void 0,h),s=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],h=_l(f,t,s,i,void 0,h)),s=o,o=[s[1],n,0,0])):m.type==="tableHead"?(a=!0,c=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(c=n,s[1]!==0?(o[0]=o[1],h=_l(f,t,s,i,n,h)):o[1]!==0&&(h=_l(f,t,o,i,n,h)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&tv(f,t,c,u,d),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=bP(t.events,n))}return e}function _l(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Ls(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const c=Ls(t.events,n[1]);if(s={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Ls(t.events,n[2]),d=Ls(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(s.end=Object.assign({},Ls(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function tv(e,t,n,r,i){const s=[],o=Ls(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Ls(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const kP={name:"tasklistCheck",tokenize:EP};function CP(){return{text:{91:kP}}}function EP(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return mt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(c)}function a(c){return Ce(c)?t(c):We(c)?e.check({tokenize:NP},t,n)(c):n(c)}}function NP(e,t,n){return Xe(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function jP(e){return jx([QT(),cP(),yP(e),wP(),CP()])}const RP={};function TP(e){const t=this,n=e||RP,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(jP(n)),s.push(GT()),o.push(XT(n))}function _S(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=_S(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function _o(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=_S(e))&&(r&&(r+=" "),r+=t);return r}var PP=Object.create,yu=Object.defineProperty,DP=Object.defineProperties,LP=Object.getOwnPropertyDescriptor,AP=Object.getOwnPropertyDescriptors,bS=Object.getOwnPropertyNames,Ic=Object.getOwnPropertySymbols,IP=Object.getPrototypeOf,cm=Object.prototype.hasOwnProperty,wS=Object.prototype.propertyIsEnumerable,nv=(e,t,n)=>t in e?yu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lr=(e,t)=>{for(var n in t||(t={}))cm.call(t,n)&&nv(e,n,t[n]);if(Ic)for(var n of Ic(t))wS.call(t,n)&&nv(e,n,t[n]);return e},vu=(e,t)=>DP(e,AP(t)),xS=(e,t)=>{var n={};for(var r in e)cm.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ic)for(var r of Ic(e))t.indexOf(r)<0&&wS.call(e,r)&&(n[r]=e[r]);return n},MP=(e,t)=>function(){return t||(0,e[bS(e)[0]])((t={exports:{}}).exports,t),t.exports},OP=(e,t)=>{for(var n in t)yu(e,n,{get:t[n],enumerable:!0})},zP=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bS(t))!cm.call(e,i)&&i!==n&&yu(e,i,{get:()=>t[i],enumerable:!(r=LP(t,i))||r.enumerable});return e},BP=(e,t,n)=>(n=e!=null?PP(IP(e)):{},zP(!e||!e.__esModule?yu(n,"default",{value:e,enumerable:!0}):n,e)),$P=MP({"../../node_modules/.pnpm/prismjs@1.29.0_patch_hash=vrxx3pzkik6jpmgpayxfjunetu/node_modules/prismjs/prism.js"(e,t){var n=function(){var r=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,s={},o={util:{encode:function m(g){return g instanceof a?new a(g.type,m(g.content),g.alias):Array.isArray(g)?g.map(m):g.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++i}),m.__id},clone:function m(g,w){w=w||{};var v,_;switch(o.util.type(g)){case"Object":if(_=o.util.objId(g),w[_])return w[_];v={},w[_]=v;for(var y in g)g.hasOwnProperty(y)&&(v[y]=m(g[y],w));return v;case"Array":return _=o.util.objId(g),w[_]?w[_]:(v=[],w[_]=v,g.forEach(function(S,E){v[E]=m(S,w)}),v);default:return g}},getLanguage:function(m){for(;m;){var g=r.exec(m.className);if(g)return g[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,g){m.className=m.className.replace(RegExp(r,"gi"),""),m.classList.add("language-"+g)},isActive:function(m,g,w){for(var v="no-"+g;m;){var _=m.classList;if(_.contains(g))return!0;if(_.contains(v))return!1;m=m.parentElement}return!!w}},languages:{plain:s,plaintext:s,text:s,txt:s,extend:function(m,g){var w=o.util.clone(o.languages[m]);for(var v in g)w[v]=g[v];return w},insertBefore:function(m,g,w,v){v=v||o.languages;var _=v[m],y={};for(var S in _)if(_.hasOwnProperty(S)){if(S==g)for(var E in w)w.hasOwnProperty(E)&&(y[E]=w[E]);w.hasOwnProperty(S)||(y[S]=_[S])}var k=v[m];return v[m]=y,o.languages.DFS(o.languages,function(T,R){R===k&&T!=m&&(this[T]=y)}),y},DFS:function m(g,w,v,_){_=_||{};var y=o.util.objId;for(var S in g)if(g.hasOwnProperty(S)){w.call(g,S,g[S],v||S);var E=g[S],k=o.util.type(E);k==="Object"&&!_[y(E)]?(_[y(E)]=!0,m(E,w,null,_)):k==="Array"&&!_[y(E)]&&(_[y(E)]=!0,m(E,w,S,_))}}},plugins:{},highlight:function(m,g,w){var v={code:m,grammar:g,language:w};if(o.hooks.run("before-tokenize",v),!v.grammar)throw new Error('The language "'+v.language+'" has no grammar.');return v.tokens=o.tokenize(v.code,v.grammar),o.hooks.run("after-tokenize",v),a.stringify(o.util.encode(v.tokens),v.language)},tokenize:function(m,g){var w=g.rest;if(w){for(var v in w)g[v]=w[v];delete g.rest}var _=new d;return h(_,_.head,m),u(m,_,g,_.head,0),p(_)},hooks:{all:{},add:function(m,g){var w=o.hooks.all;w[m]=w[m]||[],w[m].push(g)},run:function(m,g){var w=o.hooks.all[m];if(!(!w||!w.length))for(var v=0,_;_=w[v++];)_(g)}},Token:a};function a(m,g,w,v){this.type=m,this.content=g,this.alias=w,this.length=(v||"").length|0}a.stringify=function m(g,w){if(typeof g=="string")return g;if(Array.isArray(g)){var v="";return g.forEach(function(k){v+=m(k,w)}),v}var _={type:g.type,content:m(g.content,w),tag:"span",classes:["token",g.type],attributes:{},language:w},y=g.alias;y&&(Array.isArray(y)?Array.prototype.push.apply(_.classes,y):_.classes.push(y)),o.hooks.run("wrap",_);var S="";for(var E in _.attributes)S+=" "+E+'="'+(_.attributes[E]||"").replace(/"/g,""")+'"';return"<"+_.tag+' class="'+_.classes.join(" ")+'"'+S+">"+_.content+"</"+_.tag+">"};function c(m,g,w,v){m.lastIndex=g;var _=m.exec(w);if(_&&v&&_[1]){var y=_[1].length;_.index+=y,_[0]=_[0].slice(y)}return _}function u(m,g,w,v,_,y){for(var S in w)if(!(!w.hasOwnProperty(S)||!w[S])){var E=w[S];E=Array.isArray(E)?E:[E];for(var k=0;k<E.length;++k){if(y&&y.cause==S+","+k)return;var T=E[k],R=T.inside,O=!!T.lookbehind,j=!!T.greedy,$=T.alias;if(j&&!T.pattern.global){var L=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,L+"g")}for(var P=T.pattern||T,A=v.next,D=_;A!==g.tail&&!(y&&D>=y.reach);D+=A.value.length,A=A.next){var M=A.value;if(g.length>m.length)return;if(!(M instanceof a)){var W=1,N;if(j){if(N=c(P,D,m,O),!N||N.index>=m.length)break;var Q=N.index,H=N.index+N[0].length,C=D;for(C+=A.value.length;Q>=C;)A=A.next,C+=A.value.length;if(C-=A.value.length,D=C,A.value instanceof a)continue;for(var re=A;re!==g.tail&&(C<H||typeof re.value=="string");re=re.next)W++,C+=re.value.length;W--,M=m.slice(D,C),N.index-=D}else if(N=c(P,0,M,O),!N)continue;var Q=N.index,x=N[0],Y=M.slice(0,Q),Z=M.slice(Q+x.length),oe=D+M.length;y&&oe>y.reach&&(y.reach=oe);var me=A.prev;Y&&(me=h(g,me,Y),D+=Y.length),f(g,me,W);var Ee=new a(S,R?o.tokenize(x,R):x,$,x);if(A=h(g,me,Ee),Z&&h(g,A,Z),W>1){var U={cause:S+","+k,reach:oe};u(m,g,w,A.prev,D,U),y&&U.reach>y.reach&&(y.reach=U.reach)}}}}}}function d(){var m={value:null,prev:null,next:null},g={value:null,prev:m,next:null};m.next=g,this.head=m,this.tail=g,this.length=0}function h(m,g,w){var v=g.next,_={value:w,prev:g,next:v};return g.next=_,v.prev=_,m.length++,_}function f(m,g,w){for(var v=g.next,_=0;_<w&&v!==m.tail;_++)v=v.next;g.next=v,v.prev=g,m.length-=_}function p(m){for(var g=[],w=m.head.next;w!==m.tail;)g.push(w.value),w=w.next;return g}return o}();t.exports=n,n.default=n}}),V=BP($P());V.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},V.languages.markup.tag.inside["attr-value"].inside.entity=V.languages.markup.entity,V.languages.markup.doctype.inside["internal-subset"].inside=V.languages.markup,V.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(V.languages.markup.tag,"addInlined",{value:function(e,r){var n={},n=(n["language-"+r]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:V.languages[r]},n.cdata=/^<!\[CDATA\[|\]\]>$/i,{"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}}),r=(n["language-"+r]={pattern:/[\s\S]+/,inside:V.languages[r]},{});r[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},V.languages.insertBefore("markup","cdata",r)}}),Object.defineProperty(V.languages.markup.tag,"addAttribute",{value:function(e,t){V.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:V.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),V.languages.html=V.languages.markup,V.languages.mathml=V.languages.markup,V.languages.svg=V.languages.markup,V.languages.xml=V.languages.extend("markup",{}),V.languages.ssml=V.languages.xml,V.languages.atom=V.languages.xml,V.languages.rss=V.languages.xml,function(e){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},n=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,r="(?:[^\\\\-]|"+n.source+")",r=RegExp(r+"-"+r),i={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};e.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:r,inside:{escape:n,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":t,"char-set":{pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},escape:n}},"special-escape":t,"char-set":{pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":i}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:n,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]|<?[=!]|[idmnsuxU]+(?:-[idmnsuxU]+)?:?))?/,alias:"punctuation",inside:{"group-name":i}},{pattern:/\)/,alias:"punctuation"}],quantifier:{pattern:/(?:[+*?]|\{\d+(?:,\d*)?\})[?+]?/,alias:"number"},alternation:{pattern:/\|/,alias:"keyword"}}}(V),V.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},V.languages.javascript=V.languages.extend("clike",{"class-name":[V.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),V.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,V.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:V.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:V.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:V.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:V.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:V.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),V.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:V.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),V.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),V.languages.markup&&(V.languages.markup.tag.addInlined("script","javascript"),V.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),V.languages.js=V.languages.javascript,V.languages.actionscript=V.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),V.languages.actionscript["class-name"].alias="function",delete V.languages.actionscript.parameter,delete V.languages.actionscript["literal-property"],V.languages.markup&&V.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:V.languages.markup}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(V),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(n,r){(n=typeof n=="string"?[n]:n).forEach(function(i){var s=function(h){h.inside||(h.inside={}),h.inside.rest=r},o="doc-comment";if(a=e.languages[i]){var a,c=a[o];if((c=c||(a=e.languages.insertBefore(i,"comment",{"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,lookbehind:!0,alias:"comment"}}))[o])instanceof RegExp&&(c=a[o]={pattern:c}),Array.isArray(c))for(var u=0,d=c.length;u<d;u++)c[u]instanceof RegExp&&(c[u]={pattern:c[u]}),s(c[u]);else s(c)}})}}),t.addSupport(["java","javascript","php"],t)}(V),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,t=(e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup);t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(V),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,t=(e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp(`\\[(?:[^[\\]"']|`+t.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}}),{pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0}),n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|RebeccaPurple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,number:n})}(V),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+n.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),s=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(a,c){c=(c||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return a});return RegExp(u,c)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+i+"|"+s+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(s),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(V),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(u){return u=u.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source,o=(e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(d){u!==d&&(e.languages.markdown[u].inside.content.inside[d]=e.languages.markdown[d])})}),e.hooks.add("after-tokenize",function(u){u.language!=="markdown"&&u.language!=="md"||function d(h){if(h&&typeof h!="string")for(var f=0,p=h.length;f<p;f++){var m,g=h[f];g.type!=="code"?d(g.content):(m=g.content[1],g=g.content[3],m&&g&&m.type==="code-language"&&g.type==="code-block"&&typeof m.content=="string"&&(m=m.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),m="language-"+(m=(/[a-z][\w-]*/i.exec(m)||[""])[0].toLowerCase()),g.alias?typeof g.alias=="string"?g.alias=[g.alias,m]:g.alias.push(m):g.alias=[m]))}}(u.tokens)}),e.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var d="",h=0,f=u.classes.length;h<f;h++){var p=u.classes[h],p=/language-(.+)/.exec(p);if(p){d=p[1];break}}var m,g=e.languages[d];g?u.content=e.highlight(function(w){return w=w.replace(o,""),w=w.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(v,_){var y;return(_=_.toLowerCase())[0]==="#"?(y=_[1]==="x"?parseInt(_.slice(2),16):Number(_.slice(1)),c(y)):a[_]||v})}(u.content),g,d):d&&d!=="none"&&e.plugins.autoloader&&(m="md-"+new Date().valueOf()+"-"+Math.floor(1e16*Math.random()),u.attributes.id=m,e.plugins.autoloader.loadLanguages(d,function(){var w=document.getElementById(m);w&&(w.innerHTML=e.highlight(w.textContent,e.languages[d],d))}))}}),RegExp(e.languages.markup.tag.pattern.source,"gi")),a={amp:"&",lt:"<",gt:">",quot:'"'},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(V),V.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:V.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},V.hooks.add("after-tokenize",function(e){if(e.language==="graphql")for(var t=e.tokens.filter(function(m){return typeof m!="string"&&m.type!=="comment"&&m.type!=="scalar"}),n=0;n<t.length;){var r=t[n++];if(r.type==="keyword"&&r.content==="mutation"){var i=[];if(h(["definition-mutation","punctuation"])&&d(1).content==="("){n+=2;var s=f(/^\($/,/^\)$/);if(s===-1)continue;for(;n<s;n++){var o=d(0);o.type==="variable"&&(p(o,"variable-input"),i.push(o.content))}n=s+1}if(h(["punctuation","property-query"])&&d(0).content==="{"&&(n++,p(d(0),"property-mutation"),0<i.length)){var a=f(/^\{$/,/^\}$/);if(a!==-1)for(var c=n;c<a;c++){var u=t[c];u.type==="variable"&&0<=i.indexOf(u.content)&&p(u,"variable-input")}}}}function d(m){return t[n+m]}function h(m,g){g=g||0;for(var w=0;w<m.length;w++){var v=d(w+g);if(!v||v.type!==m[w])return}return 1}function f(m,g){for(var w=1,v=n;v<t.length;v++){var _=t[v],y=_.content;if(_.type==="punctuation"&&typeof y=="string"){if(m.test(y))w++;else if(g.test(y)&&--w===0)return v}}return-1}function p(m,g){var w=m.alias;w?Array.isArray(w)||(m.alias=w=[w]):m.alias=w=[],w.push(g)}}),V.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,i=r.inside["interpolation-punctuation"],s=r.pattern.source;function o(h,f){if(e.languages[h])return{pattern:RegExp("((?:"+f+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:h}}}}function a(h,f,p){return h={code:h,grammar:f,language:p},e.hooks.run("before-tokenize",h),h.tokens=e.tokenize(h.code,h.grammar),e.hooks.run("after-tokenize",h),h.tokens}function c(h,f,p){var w=e.tokenize(h,{interpolation:{pattern:RegExp(s),lookbehind:!0}}),m=0,g={},w=a(w.map(function(_){if(typeof _=="string")return _;for(var y,S,_=_.content;h.indexOf((S=m++,y="___"+p.toUpperCase()+"_"+S+"___"))!==-1;);return g[y]=_,y}).join(""),f,p),v=Object.keys(g);return m=0,function _(y){for(var S=0;S<y.length;S++){if(m>=v.length)return;var E,k,T,R,O,j,$,L=y[S];typeof L=="string"||typeof L.content=="string"?(E=v[m],($=(j=typeof L=="string"?L:L.content).indexOf(E))!==-1&&(++m,k=j.substring(0,$),O=g[E],T=void 0,(R={})["interpolation-punctuation"]=i,(R=e.tokenize(O,R)).length===3&&((T=[1,1]).push.apply(T,a(R[1],e.languages.javascript,"javascript")),R.splice.apply(R,T)),T=new e.Token("interpolation",R,r.alias,O),R=j.substring($+E.length),O=[],k&&O.push(k),O.push(T),R&&(_(j=[R]),O.push.apply(O,j)),typeof L=="string"?(y.splice.apply(y,[S,1].concat(O)),S+=O.length-1):L.content=O)):($=L.content,Array.isArray($)?_($):_([$]))}}(w),new e.Token(p,w,"language-"+p,h)}e.languages.javascript["template-string"]=[o("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),o("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),o("svg",/\bsvg/.source),o("markdown",/\b(?:markdown|md)/.source),o("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),o("sql",/\bsql/.source),t].filter(Boolean);var u={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function d(h){return typeof h=="string"?h:Array.isArray(h)?h.map(d).join(""):d(h.content)}e.hooks.add("after-tokenize",function(h){h.language in u&&function f(p){for(var m=0,g=p.length;m<g;m++){var w,v,_,y=p[m];typeof y!="string"&&(w=y.content,Array.isArray(w)?y.type==="template-string"?(y=w[1],w.length===3&&typeof y!="string"&&y.type==="embedded-code"&&(v=d(y),y=y.alias,y=Array.isArray(y)?y[0]:y,_=e.languages[y])&&(w[1]=c(v,_,y))):f(w):typeof w!="string"&&f([w]))}}(h.tokens)})}(V),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(V),function(e){var t=e.languages.javascript,n=/\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})+\}/.source,r="(@(?:arg|argument|param|property)\\s+(?:"+n+"\\s+)?)";e.languages.jsdoc=e.languages.extend("javadoclike",{parameter:{pattern:RegExp(r+/(?:(?!\s)[$\w\xA0-\uFFFF.])+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(r+/\[(?:(?!\s)[$\w\xA0-\uFFFF.])+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp(/(@(?:augments|class|extends|interface|memberof!?|template|this|typedef)\s+(?:<TYPE>\s+)?)[A-Z]\w*(?:\.[A-Z]\w*)*/.source.replace(/<TYPE>/g,function(){return n})),lookbehind:!0,inside:{punctuation:/\./}},{pattern:RegExp("(@[a-z]+\\s+)"+n),lookbehind:!0,inside:{string:t.string,number:t.number,boolean:t.boolean,keyword:e.languages.typescript.keyword,operator:/=>|\.\.\.|[&|?:*]/,punctuation:/[.,;=<>{}()[\]]/}}],example:{pattern:/(@example\s+(?!\s))(?:[^@\s]|\s+(?!\s))+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^([\t ]*(?:\*\s*)?)\S.*$/m,lookbehind:!0,inside:t,alias:"language-javascript"}}}}),e.languages.javadoclike.addSupport("javascript",e.languages.jsdoc)}(V),function(e){e.languages.flow=e.languages.extend("javascript",{}),e.languages.insertBefore("flow","keyword",{type:[{pattern:/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,alias:"class-name"}]}),e.languages.flow["function-variable"].pattern=/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,delete e.languages.flow.parameter,e.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,lookbehind:!0})}(V),V.languages.n4js=V.languages.extend("javascript",{keyword:/\b(?:Array|any|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),V.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),V.languages.n4jsd=V.languages.n4js,function(e){function t(o,a){return RegExp(o.replace(/<ID>/g,function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source}),a)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?<ID>/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r<n.length;r++){var s=n[r],i=e.languages.javascript[s],s=(i=e.util.type(i)==="RegExp"?e.languages.javascript[s]={pattern:i}:i).inside||{};(i.inside=s)["maybe-class-name"]=/^[A-Z][\s\S]*/}}(V),function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,i=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function s(c,u){return c=c.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(c,u)}i=s(i).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=s(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:s(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:s(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);function o(c){for(var u=[],d=0;d<c.length;d++){var h=c[d],f=!1;typeof h!="string"&&(h.type==="tag"&&h.content[0]&&h.content[0].type==="tag"?h.content[0].content[0].content==="</"?0<u.length&&u[u.length-1].tagName===a(h.content[0].content[1])&&u.pop():h.content[h.content.length-1].content!=="/>"&&u.push({tagName:a(h.content[0].content[1]),openedBraces:0}):0<u.length&&h.type==="punctuation"&&h.content==="{"?u[u.length-1].openedBraces++:0<u.length&&0<u[u.length-1].openedBraces&&h.type==="punctuation"&&h.content==="}"?u[u.length-1].openedBraces--:f=!0),(f||typeof h=="string")&&0<u.length&&u[u.length-1].openedBraces===0&&(f=a(h),d<c.length-1&&(typeof c[d+1]=="string"||c[d+1].type==="plain-text")&&(f+=a(c[d+1]),c.splice(d+1,1)),0<d&&(typeof c[d-1]=="string"||c[d-1].type==="plain-text")&&(f=a(c[d-1])+f,c.splice(d-1,1),d--),c[d]=new e.Token("plain-text",f,null,f)),h.content&&typeof h.content!="string"&&o(h.content)}}var a=function(c){return c?typeof c=="string"?c:typeof c.content=="string"?c.content:c.content.map(a).join(""):""};e.hooks.add("after-tokenize",function(c){c.language!=="jsx"&&c.language!=="tsx"||o(c.tokens)})}(V),function(e){var t=e.util.clone(e.languages.typescript),t=(e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"],e.languages.tsx.tag);t.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+t.pattern.source+")",t.pattern.flags),t.lookbehind=!0}(V),V.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},V.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=V.languages.swift}),function(e){e.languages.kotlin=e.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete e.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:e.languages.kotlin}};e.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete e.languages.kotlin.string,e.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),e.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),e.languages.kt=e.languages.kotlin,e.languages.kts=e.languages.kotlin}(V),V.languages.c=V.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),V.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),V.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},V.languages.c.string],char:V.languages.c.char,comment:V.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:V.languages.c}}}}),V.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete V.languages.c.boolean,V.languages.objectivec=V.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete V.languages.objectivec["class-name"],V.languages.objc=V.languages.objectivec,V.languages.reason=V.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),V.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete V.languages.reason.function,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(V),V.languages.go=V.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),V.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete V.languages.go["class-name"],function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(V),V.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},V.languages.python["string-interpolation"].inside.interpolation.inside.rest=V.languages.python,V.languages.py=V.languages.python,V.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},V.languages.webmanifest=V.languages.json;var um={};OP(um,{dracula:()=>HP,duotoneDark:()=>UP,duotoneLight:()=>qP,github:()=>YP,gruvboxMaterialDark:()=>SD,gruvboxMaterialLight:()=>CD,jettwaveDark:()=>mD,jettwaveLight:()=>yD,nightOwl:()=>XP,nightOwlLight:()=>ZP,oceanicNext:()=>eD,okaidia:()=>nD,oneDark:()=>_D,oneLight:()=>wD,palenight:()=>iD,shadesOfPurple:()=>oD,synthwave84:()=>lD,ultramin:()=>uD,vsDark:()=>SS,vsLight:()=>fD});var FP={plain:{color:"#F8F8F2",backgroundColor:"#282A36"},styles:[{types:["prolog","constant","builtin"],style:{color:"rgb(189, 147, 249)"}},{types:["inserted","function"],style:{color:"rgb(80, 250, 123)"}},{types:["deleted"],style:{color:"rgb(255, 85, 85)"}},{types:["changed"],style:{color:"rgb(255, 184, 108)"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["string","char","tag","selector"],style:{color:"rgb(255, 121, 198)"}},{types:["keyword","variable"],style:{color:"rgb(189, 147, 249)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)"}},{types:["attr-name"],style:{color:"rgb(241, 250, 140)"}}]},HP=FP,WP={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},UP=WP,VP={plain:{backgroundColor:"#faf8f5",color:"#728fcb"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#b6ad9a"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#063289"}},{types:["property","function"],style:{color:"#b29762"}},{types:["tag-id","selector","atrule-id"],style:{color:"#2d2006"}},{types:["attr-name"],style:{color:"#896724"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","atrule"],style:{color:"#728fcb"}},{types:["placeholder","variable"],style:{color:"#93abdc"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#896724"}}]},qP=VP,KP={plain:{color:"#393A34",backgroundColor:"#f6f8fa"},styles:[{types:["comment","prolog","doctype","cdata"],style:{color:"#999988",fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}},{types:["string","attr-value"],style:{color:"#e3116c"}},{types:["punctuation","operator"],style:{color:"#393A34"}},{types:["entity","url","symbol","number","boolean","variable","constant","property","regex","inserted"],style:{color:"#36acaa"}},{types:["atrule","keyword","attr-name","selector"],style:{color:"#00a4db"}},{types:["function","deleted","tag"],style:{color:"#d73a49"}},{types:["function-variable"],style:{color:"#6f42c1"}},{types:["tag","selector","keyword"],style:{color:"#00009f"}}]},YP=KP,GP={plain:{color:"#d6deeb",backgroundColor:"#011627"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(99, 119, 119)",fontStyle:"italic"}},{types:["string","url"],style:{color:"rgb(173, 219, 103)"}},{types:["variable"],style:{color:"rgb(214, 222, 235)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation"],style:{color:"rgb(199, 146, 234)"}},{types:["selector","doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(255, 203, 139)"}},{types:["tag","operator","keyword"],style:{color:"rgb(127, 219, 202)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["property"],style:{color:"rgb(128, 203, 196)"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}}]},XP=GP,JP={plain:{color:"#403f53",backgroundColor:"#FBFBFB"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)",fontStyle:"italic"}},{types:["inserted","attr-name"],style:{color:"rgb(72, 118, 214)",fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(152, 159, 177)",fontStyle:"italic"}},{types:["string","builtin","char","constant","url"],style:{color:"rgb(72, 118, 214)"}},{types:["variable"],style:{color:"rgb(201, 103, 101)"}},{types:["number"],style:{color:"rgb(170, 9, 130)"}},{types:["punctuation"],style:{color:"rgb(153, 76, 195)"}},{types:["function","selector","doctype"],style:{color:"rgb(153, 76, 195)",fontStyle:"italic"}},{types:["class-name"],style:{color:"rgb(17, 17, 17)"}},{types:["tag"],style:{color:"rgb(153, 76, 195)"}},{types:["operator","property","keyword","namespace"],style:{color:"rgb(12, 150, 155)"}},{types:["boolean"],style:{color:"rgb(188, 84, 84)"}}]},ZP=JP,zn={char:"#D8DEE9",comment:"#999999",keyword:"#c5a5c5",primitive:"#5a9bcf",string:"#8dc891",variable:"#d7deea",boolean:"#ff8b50",tag:"#fc929e",function:"#79b6f2",className:"#FAC863"},QP={plain:{backgroundColor:"#282c34",color:"#ffffff"},styles:[{types:["attr-name"],style:{color:zn.keyword}},{types:["attr-value"],style:{color:zn.string}},{types:["comment","block-comment","prolog","doctype","cdata","shebang"],style:{color:zn.comment}},{types:["property","number","function-name","constant","symbol","deleted"],style:{color:zn.primitive}},{types:["boolean"],style:{color:zn.boolean}},{types:["tag"],style:{color:zn.tag}},{types:["string"],style:{color:zn.string}},{types:["punctuation"],style:{color:zn.string}},{types:["selector","char","builtin","inserted"],style:{color:zn.char}},{types:["function"],style:{color:zn.function}},{types:["operator","entity","url","variable"],style:{color:zn.variable}},{types:["keyword"],style:{color:zn.keyword}},{types:["atrule","class-name"],style:{color:zn.className}},{types:["important"],style:{fontWeight:"400"}},{types:["bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["namespace"],style:{opacity:.7}}]},eD=QP,tD={plain:{color:"#f8f8f2",backgroundColor:"#272822"},styles:[{types:["changed"],style:{color:"rgb(162, 191, 252)",fontStyle:"italic"}},{types:["deleted"],style:{color:"#f92672",fontStyle:"italic"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)",fontStyle:"italic"}},{types:["comment"],style:{color:"#8292a2",fontStyle:"italic"}},{types:["string","url"],style:{color:"#a6e22e"}},{types:["variable"],style:{color:"#f8f8f2"}},{types:["number"],style:{color:"#ae81ff"}},{types:["builtin","char","constant","function","class-name"],style:{color:"#e6db74"}},{types:["punctuation"],style:{color:"#f8f8f2"}},{types:["selector","doctype"],style:{color:"#a6e22e",fontStyle:"italic"}},{types:["tag","operator","keyword"],style:{color:"#66d9ef"}},{types:["boolean"],style:{color:"#ae81ff"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)",opacity:.7}},{types:["tag","property"],style:{color:"#f92672"}},{types:["attr-name"],style:{color:"#a6e22e !important"}},{types:["doctype"],style:{color:"#8292a2"}},{types:["rule"],style:{color:"#e6db74"}}]},nD=tD,rD={plain:{color:"#bfc7d5",backgroundColor:"#292d3e"},styles:[{types:["comment"],style:{color:"rgb(105, 112, 152)",fontStyle:"italic"}},{types:["string","inserted"],style:{color:"rgb(195, 232, 141)"}},{types:["number"],style:{color:"rgb(247, 140, 108)"}},{types:["builtin","char","constant","function"],style:{color:"rgb(130, 170, 255)"}},{types:["punctuation","selector"],style:{color:"rgb(199, 146, 234)"}},{types:["variable"],style:{color:"rgb(191, 199, 213)"}},{types:["class-name","attr-name"],style:{color:"rgb(255, 203, 107)"}},{types:["tag","deleted"],style:{color:"rgb(255, 85, 114)"}},{types:["operator"],style:{color:"rgb(137, 221, 255)"}},{types:["boolean"],style:{color:"rgb(255, 88, 116)"}},{types:["keyword"],style:{fontStyle:"italic"}},{types:["doctype"],style:{color:"rgb(199, 146, 234)",fontStyle:"italic"}},{types:["namespace"],style:{color:"rgb(178, 204, 214)"}},{types:["url"],style:{color:"rgb(221, 221, 221)"}}]},iD=rD,sD={plain:{color:"#9EFEFF",backgroundColor:"#2D2A55"},styles:[{types:["changed"],style:{color:"rgb(255, 238, 128)"}},{types:["deleted"],style:{color:"rgba(239, 83, 80, 0.56)"}},{types:["inserted"],style:{color:"rgb(173, 219, 103)"}},{types:["comment"],style:{color:"rgb(179, 98, 255)",fontStyle:"italic"}},{types:["punctuation"],style:{color:"rgb(255, 255, 255)"}},{types:["constant"],style:{color:"rgb(255, 98, 140)"}},{types:["string","url"],style:{color:"rgb(165, 255, 144)"}},{types:["variable"],style:{color:"rgb(255, 238, 128)"}},{types:["number","boolean"],style:{color:"rgb(255, 98, 140)"}},{types:["attr-name"],style:{color:"rgb(255, 180, 84)"}},{types:["keyword","operator","property","namespace","tag","selector","doctype"],style:{color:"rgb(255, 157, 0)"}},{types:["builtin","char","constant","function","class-name"],style:{color:"rgb(250, 208, 0)"}}]},oD=sD,aD={plain:{backgroundColor:"linear-gradient(to bottom, #2a2139 75%, #34294f)",backgroundImage:"#34294f",color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"},styles:[{types:["comment","block-comment","prolog","doctype","cdata"],style:{color:"#495495",fontStyle:"italic"}},{types:["punctuation"],style:{color:"#ccc"}},{types:["tag","attr-name","namespace","number","unit","hexcode","deleted"],style:{color:"#e2777a"}},{types:["property","selector"],style:{color:"#72f1b8",textShadow:"0 0 2px #100c0f, 0 0 10px #257c5575, 0 0 35px #21272475"}},{types:["function-name"],style:{color:"#6196cc"}},{types:["boolean","selector-id","function"],style:{color:"#fdfdfd",textShadow:"0 0 2px #001716, 0 0 3px #03edf975, 0 0 5px #03edf975, 0 0 8px #03edf975"}},{types:["class-name","maybe-class-name","builtin"],style:{color:"#fff5f6",textShadow:"0 0 2px #000, 0 0 10px #fc1f2c75, 0 0 5px #fc1f2c75, 0 0 25px #fc1f2c75"}},{types:["constant","symbol"],style:{color:"#f92aad",textShadow:"0 0 2px #100c0f, 0 0 5px #dc078e33, 0 0 10px #fff3"}},{types:["important","atrule","keyword","selector-class"],style:{color:"#f4eee4",textShadow:"0 0 2px #393a33, 0 0 8px #f39f0575, 0 0 2px #f39f0575"}},{types:["string","char","attr-value","regex","variable"],style:{color:"#f87c32"}},{types:["parameter"],style:{fontStyle:"italic"}},{types:["entity","url"],style:{color:"#67cdcc"}},{types:["operator"],style:{color:"ffffffee"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["entity"],style:{cursor:"help"}},{types:["inserted"],style:{color:"green"}}]},lD=aD,cD={plain:{color:"#282a2e",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(197, 200, 198)"}},{types:["string","number","builtin","variable"],style:{color:"rgb(150, 152, 150)"}},{types:["class-name","function","tag","attr-name"],style:{color:"rgb(40, 42, 46)"}}]},uD=cD,hD={plain:{color:"#9CDCFE",backgroundColor:"#1E1E1E"},styles:[{types:["prolog"],style:{color:"rgb(0, 0, 128)"}},{types:["comment"],style:{color:"rgb(106, 153, 85)"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"rgb(86, 156, 214)"}},{types:["number","inserted"],style:{color:"rgb(181, 206, 168)"}},{types:["constant"],style:{color:"rgb(100, 102, 149)"}},{types:["attr-name","variable"],style:{color:"rgb(156, 220, 254)"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"rgb(206, 145, 120)"}},{types:["selector"],style:{color:"rgb(215, 186, 125)"}},{types:["tag"],style:{color:"rgb(78, 201, 176)"}},{types:["tag"],languages:["markup"],style:{color:"rgb(86, 156, 214)"}},{types:["punctuation","operator"],style:{color:"rgb(212, 212, 212)"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"rgb(220, 220, 170)"}},{types:["class-name"],style:{color:"rgb(78, 201, 176)"}},{types:["char"],style:{color:"rgb(209, 105, 105)"}}]},SS=hD,dD={plain:{color:"#000000",backgroundColor:"#ffffff"},styles:[{types:["comment"],style:{color:"rgb(0, 128, 0)"}},{types:["builtin"],style:{color:"rgb(0, 112, 193)"}},{types:["number","variable","inserted"],style:{color:"rgb(9, 134, 88)"}},{types:["operator"],style:{color:"rgb(0, 0, 0)"}},{types:["constant","char"],style:{color:"rgb(129, 31, 63)"}},{types:["tag"],style:{color:"rgb(128, 0, 0)"}},{types:["attr-name"],style:{color:"rgb(255, 0, 0)"}},{types:["deleted","string"],style:{color:"rgb(163, 21, 21)"}},{types:["changed","punctuation"],style:{color:"rgb(4, 81, 165)"}},{types:["function","keyword"],style:{color:"rgb(0, 0, 255)"}},{types:["class-name"],style:{color:"rgb(38, 127, 153)"}}]},fD=dD,pD={plain:{color:"#f8fafc",backgroundColor:"#011627"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#569CD6"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#f8fafc"}},{types:["attr-name","variable"],style:{color:"#9CDCFE"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#cbd5e1"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#D4D4D4"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#7dd3fc"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},mD=pD,gD={plain:{color:"#0f172a",backgroundColor:"#f1f5f9"},styles:[{types:["prolog"],style:{color:"#000080"}},{types:["comment"],style:{color:"#6A9955"}},{types:["builtin","changed","keyword","interpolation-punctuation"],style:{color:"#0c4a6e"}},{types:["number","inserted"],style:{color:"#B5CEA8"}},{types:["constant"],style:{color:"#0f172a"}},{types:["attr-name","variable"],style:{color:"#0c4a6e"}},{types:["deleted","string","attr-value","template-punctuation"],style:{color:"#64748b"}},{types:["selector"],style:{color:"#D7BA7D"}},{types:["tag"],style:{color:"#0ea5e9"}},{types:["tag"],languages:["markup"],style:{color:"#0ea5e9"}},{types:["punctuation","operator"],style:{color:"#475569"}},{types:["punctuation"],languages:["markup"],style:{color:"#808080"}},{types:["function"],style:{color:"#0e7490"}},{types:["class-name"],style:{color:"#0ea5e9"}},{types:["char"],style:{color:"#D16969"}}]},yD=gD,vD={plain:{backgroundColor:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(220, 10%, 40%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(220, 14%, 71%)"}},{types:["attr-name","class-name","maybe-class-name","boolean","constant","number","atrule"],style:{color:"hsl(29, 54%, 61%)"}},{types:["keyword"],style:{color:"hsl(286, 60%, 67%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(355, 65%, 65%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value"],style:{color:"hsl(95, 38%, 62%)"}},{types:["variable","operator","function"],style:{color:"hsl(207, 82%, 66%)"}},{types:["url"],style:{color:"hsl(187, 47%, 55%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(220, 14%, 71%)"}}]},_D=vD,bD={plain:{backgroundColor:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)"},styles:[{types:["comment","prolog","cdata"],style:{color:"hsl(230, 4%, 64%)"}},{types:["doctype","punctuation","entity"],style:{color:"hsl(230, 8%, 24%)"}},{types:["attr-name","class-name","boolean","constant","number","atrule"],style:{color:"hsl(35, 99%, 36%)"}},{types:["keyword"],style:{color:"hsl(301, 63%, 40%)"}},{types:["property","tag","symbol","deleted","important"],style:{color:"hsl(5, 74%, 59%)"}},{types:["selector","string","char","builtin","inserted","regex","attr-value","punctuation"],style:{color:"hsl(119, 34%, 47%)"}},{types:["variable","operator","function"],style:{color:"hsl(221, 87%, 60%)"}},{types:["url"],style:{color:"hsl(198, 99%, 37%)"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"hsl(230, 8%, 24%)"}}]},wD=bD,xD={plain:{color:"#ebdbb2",backgroundColor:"#292828"},styles:[{types:["imports","class-name","maybe-class-name","constant","doctype","builtin","function"],style:{color:"#d8a657"}},{types:["property-access"],style:{color:"#7daea3"}},{types:["tag"],style:{color:"#e78a4e"}},{types:["attr-name","char","url","regex"],style:{color:"#a9b665"}},{types:["attr-value","string"],style:{color:"#89b482"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#ea6962"}},{types:["entity","number","symbol"],style:{color:"#d3869b"}}]},SD=xD,kD={plain:{color:"#654735",backgroundColor:"#f9f5d7"},styles:[{types:["delimiter","boolean","keyword","selector","important","atrule","property","variable","deleted"],style:{color:"#af2528"}},{types:["imports","class-name","maybe-class-name","constant","doctype","builtin"],style:{color:"#b4730e"}},{types:["string","attr-value"],style:{color:"#477a5b"}},{types:["property-access"],style:{color:"#266b79"}},{types:["function","attr-name","char","url"],style:{color:"#72761e"}},{types:["tag"],style:{color:"#b94c07"}},{types:["comment","prolog","cdata","operator","inserted"],style:{color:"#a89984"}},{types:["entity","number","symbol"],style:{color:"#924f79"}}]},CD=kD,ED=e=>b.useCallback(t=>{var n=t,{className:r,style:i,line:s}=n,o=xS(n,["className","style","line"]);const a=vu(Lr({},o),{className:_o("token-line",r)});return typeof e=="object"&&"plain"in e&&(a.style=e.plain),typeof i=="object"&&(a.style=Lr(Lr({},a.style||{}),i)),a},[e]),ND=e=>{const t=b.useCallback(({types:n,empty:r})=>{if(e!=null){{if(n.length===1&&n[0]==="plain")return r!=null?{display:"inline-block"}:void 0;if(n.length===1&&r!=null)return e[n[0]]}return Object.assign(r!=null?{display:"inline-block"}:{},...n.map(i=>e[i]))}},[e]);return b.useCallback(n=>{var r=n,{token:i,className:s,style:o}=r,a=xS(r,["token","className","style"]);const c=vu(Lr({},a),{className:_o("token",...i.types,s),children:i.content,style:t(i)});return o!=null&&(c.style=Lr(Lr({},c.style||{}),o)),c},[t])},jD=/\r\n|\r|\n/,rv=e=>{e.length===0?e.push({types:["plain"],content:`
|
|
69
|
+
`,empty:!0}):e.length===1&&e[0].content===""&&(e[0].content=`
|
|
70
|
+
`,e[0].empty=!0)},iv=(e,t)=>{const n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},RD=e=>{const t=[[]],n=[e],r=[0],i=[e.length];let s=0,o=0,a=[];const c=[a];for(;o>-1;){for(;(s=r[o]++)<i[o];){let u,d=t[o];const f=n[o][s];if(typeof f=="string"?(d=o>0?d:["plain"],u=f):(d=iv(d,f.type),f.alias&&(d=iv(d,f.alias)),u=f.content),typeof u!="string"){o++,t.push(d),n.push(u),r.push(0),i.push(u.length);continue}const p=u.split(jD),m=p.length;a.push({types:d,content:p[0]});for(let g=1;g<m;g++)rv(a),c.push(a=[]),a.push({types:d,content:p[g]})}o--,t.pop(),n.pop(),r.pop(),i.pop()}return rv(a),c},sv=RD,TD=({prism:e,code:t,grammar:n,language:r})=>b.useMemo(()=>{if(n==null)return sv([t]);const i={code:t,grammar:n,language:r,tokens:[]};return e.hooks.run("before-tokenize",i),i.tokens=e.tokenize(t,n),e.hooks.run("after-tokenize",i),sv(i.tokens)},[t,n,r,e]),PD=(e,t)=>{const{plain:n}=e,r=e.styles.reduce((i,s)=>{const{languages:o,style:a}=s;return o&&!o.includes(t)||s.types.forEach(c=>{const u=Lr(Lr({},i[c]),a);i[c]=u}),i},{});return r.root=n,r.plain=vu(Lr({},n),{backgroundColor:void 0}),r},DD=PD,LD=({children:e,language:t,code:n,theme:r,prism:i})=>{const s=t.toLowerCase(),o=DD(r,s),a=ED(o),c=ND(o),u=i.languages[s],d=TD({prism:i,language:s,code:n,grammar:u});return e({tokens:d,className:`prism-code language-${s}`,style:o!=null?o.root:{},getLineProps:a,getTokenProps:c})},kS=e=>b.createElement(LD,vu(Lr({},e),{prism:e.prism||V,theme:e.theme||SS,code:e.code,language:e.language}));/*! Bundled license information:
|
|
71
|
+
|
|
72
|
+
prismjs/prism.js:
|
|
73
|
+
(**
|
|
74
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
75
|
+
*
|
|
76
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
77
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
78
|
+
* @namespace
|
|
79
|
+
* @public
|
|
80
|
+
*)
|
|
81
|
+
*/const AD={sh:"bash",shell:"bash",zsh:"bash",console:"bash",yml:"yaml",md:"markdown",mjs:"javascript",cjs:"javascript",node:"javascript",js:"javascript",ts:"typescript",py:"python",rs:"rust",html:"markup",xml:"markup",txt:"text"};function ID(e){if(!e)return"text";const t=String(e).toLowerCase();return AD[t]||t}function MD({code:e,language:t}){const[n,r]=b.useState(!1),i=ID(t),s=b.useCallback(()=>{var o;try{(o=navigator.clipboard)==null||o.writeText(e),r(!0),setTimeout(()=>r(!1),1400)}catch{}},[e]);return l.jsxs("div",{className:"code-block","data-testid":"code-block",children:[l.jsxs("div",{className:"code-block-head",children:[l.jsx("span",{className:"code-lang",children:i==="text"?"code":i}),l.jsx("button",{className:"code-copy",onClick:s,title:"Copy to clipboard",children:n?"✓ copied":"Copy"})]}),l.jsx(kS,{theme:um.vsDark,code:e,language:i,children:({tokens:o,getLineProps:a,getTokenProps:c})=>l.jsx("pre",{className:"code-block-body",children:o.map((u,d)=>l.jsx("div",{...a({line:u}),children:u.map((h,f)=>l.jsx("span",{...c({token:h})},f))},d))})})]})}const OD={pre({children:e}){const t=Array.isArray(e)?e[0]:e,n=(t==null?void 0:t.props)||{},r=/language-([\w-]+)/.exec(n.className||""),i=n.children,s=(Array.isArray(i)?i.join(""):String(i??"")).replace(/\n+$/,"");return l.jsx(MD,{code:s,language:r?r[1]:""})},code({children:e}){return l.jsx("code",{className:"md-code-inline",children:e})},a({href:e,children:t}){return l.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t})},table({children:e}){return l.jsx("div",{className:"md-table-wrap",children:l.jsx("table",{children:e})})}};function zD({text:e}){return l.jsx("div",{className:"markdown",children:l.jsx(yR,{remarkPlugins:[TP],components:OD,children:e||""})})}const CS=b.memo(zD);class BD{diff(t,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(t,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,c,r,i)}diffWithOptionsObj(t,n,r,i){var s;const o=_=>{if(_=this.postProcess(_,r),i){setTimeout(function(){i(_)},0);return}else return _},a=n.length,c=t.length;let u=1,d=a+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&m+1>=a)return o(this.buildValues(p[0].lastComponent,n,t));let g=-1/0,w=1/0;const v=()=>{for(let _=Math.max(g,-u);_<=Math.min(w,u);_+=2){let y;const S=p[_-1],E=p[_+1];S&&(p[_-1]=void 0);let k=!1;if(E){const R=E.oldPos-_;k=E&&0<=R&&R<a}const T=S&&S.oldPos+1<c;if(!k&&!T){p[_]=void 0;continue}if(!T||k&&S.oldPos<E.oldPos?y=this.addToPath(E,!0,!1,0,r):y=this.addToPath(S,!1,!0,1,r),m=this.extractCommon(y,n,t,_,r),y.oldPos+1>=c&&m+1>=a)return o(this.buildValues(y.lastComponent,n,t))||!0;p[_]=y,y.oldPos+1>=c&&(w=Math.min(w,_-1)),m+1>=a&&(g=Math.max(g,_+1))}u++};if(i)(function _(){setTimeout(function(){if(u>d||Date.now()>f)return i(void 0);v()||_()},0)})();else for(;u<=d&&Date.now()<=f;){const _=v();if(_)return _}}addToPath(t,n,r,i,s){const o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(t,n,r,i,s){const o=n.length,a=r.length;let c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<a&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const i=[];let s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();const o=i.length;let a=0,c=0,u=0;for(;a<o;a++){const d=i[a];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(c,c+d.count);h=h.map(function(f,p){const m=r[u+p];return m.length>f.length?m:f}),d.value=this.join(h)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}}class $D extends BD{constructor(){super(...arguments),this.tokenize=WD}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
82
|
+
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
83
|
+
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
84
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
85
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const FD=new $D;function HD(e,t,n){return FD.diff(e,t,n)}function WD(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
86
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function UD(e,t){const n=HD(e??"",t??""),r=[];for(const i of n){const s=i.added?"add":i.removed?"del":"ctx",o=i.value.split(`
|
|
87
|
+
`);o.length>1&&o[o.length-1]===""&&o.pop();for(const a of o)r.push({type:s,text:a})}return r}const VD={add:"+",del:"−",ctx:" "};function Gl({oldText:e,newText:t,maxRows:n=80}){const r=UD(e,t),i=r.reduce((a,c)=>a+(c.type==="add"?1:0),0),s=r.reduce((a,c)=>a+(c.type==="del"?1:0),0),o=r.slice(0,n);return l.jsxs("div",{className:"diff-view","data-testid":"diff-view",children:[l.jsxs("div",{className:"diff-stat",children:[l.jsxs("span",{className:"diff-stat-add",children:["+",i]}),l.jsxs("span",{className:"diff-stat-del",children:["−",s]})]}),l.jsx("pre",{className:"diff-body",children:o.map((a,c)=>l.jsxs("div",{className:`diff-line ${a.type}`,children:[l.jsx("span",{className:"diff-gutter",children:VD[a.type]}),l.jsx("span",{className:"diff-text",children:a.text===""?" ":a.text})]},c))}),r.length>n&&l.jsxs("div",{className:"diff-more",children:["+",r.length-n," more lines"]})]})}function ov(e){if(!e)return"";const t=String(e).split(/[\\/]+/).filter(Boolean);return t.length>2?"…/"+t.slice(-2).join("/"):t.join("/")}function qD(e){if(!e||typeof e!="object")return"";for(const t of Object.values(e))if(typeof t=="string"&&t)return t;return""}const KD={Read:{icon:"📄",verb:"Read"},Edit:{icon:"✏️",verb:"Edit"},MultiEdit:{icon:"✏️",verb:"Edit"},Write:{icon:"📝",verb:"Write"},NotebookEdit:{icon:"📓",verb:"Edit notebook"},Bash:{icon:"▶",verb:"Run"},PowerShell:{icon:"▶",verb:"Run"},Glob:{icon:"🔍",verb:"Find"},Grep:{icon:"🔍",verb:"Search"},Task:{icon:"🤖",verb:"Agent"},WebFetch:{icon:"🌐",verb:"Fetch"},WebSearch:{icon:"🌐",verb:"Web search"},Skill:{icon:"✨",verb:"Skill"},TodoWrite:{icon:"☑",verb:"Plan"}};function YD(e,t){if(!t)return"";switch(e){case"Read":case"Edit":case"MultiEdit":case"Write":return ov(t.file_path);case"NotebookEdit":return ov(t.notebook_path);case"Bash":case"PowerShell":return t.command||"";case"Glob":case"Grep":return t.pattern||"";case"Task":return t.description||t.subagent_type||"";case"WebFetch":return t.url||"";case"WebSearch":return t.query||"";case"Skill":return t.command||t.name||"";default:return qD(t)}}function GD({name:e,input:t}){return(t==null?void 0:t._raw)!=null?l.jsx("pre",{className:"tool-raw",children:String(t._raw)}):e==="Edit"?l.jsx(Gl,{oldText:t.old_string||"",newText:t.new_string||""}):e==="MultiEdit"&&Array.isArray(t.edits)?l.jsx(l.Fragment,{children:t.edits.map((n,r)=>l.jsx(Gl,{oldText:n.old_string||"",newText:n.new_string||""},r))}):e==="Write"?l.jsx(Gl,{oldText:"",newText:t.content||""}):(e==="Bash"||e==="PowerShell")&&t.description?l.jsx("div",{className:"tool-desc",children:t.description}):null}function XD({content:e,isError:t}){if(e==null)return null;const n=String(e);if(!n.trim()&&!t)return null;const i=n.length>4e3?n.slice(0,4e3)+`
|
|
88
|
+
… (truncated)`:n,s=n.split(`
|
|
89
|
+
`).find(o=>o.trim())||(t?"error":"done");return l.jsxs("details",{className:`tool-result ${t?"err":""}`,open:t,children:[l.jsxs("summary",{children:[t?"✗ ":"",s.slice(0,140)]}),l.jsx("pre",{children:i})]})}function JD({block:e}){const{name:t,input:n={},result:r,done:i,isError:s}=e,o=KD[t]||{icon:"⚙",verb:t},a=YD(t,n),c=i?s?"error":"done":"running";return l.jsxs("div",{className:`tool-card ${c}`,"data-testid":"tool-card","data-tool":t,children:[l.jsxs("div",{className:"tool-head",children:[l.jsx("span",{className:"tool-icon",children:o.icon}),l.jsx("span",{className:"tool-verb",children:o.verb}),a&&l.jsx("code",{className:"tool-target",children:a}),t==="Edit"&&n.replace_all&&l.jsx("span",{className:"tool-tag",children:"all"}),l.jsx("span",{className:"tool-status","data-status":c,children:c==="running"?l.jsx("span",{className:"tool-spinner","aria-label":"running"}):c==="error"?"✗":"✓"})]}),l.jsx(GD,{name:t,input:n}),l.jsx(XD,{content:r,isError:s})]})}function ES(e={}){var s,o;const t=(s=e.vetting)==null?void 0:s.verdict;let n,r;if(t==="auto"||t==="reviewed")n="Verified",r="ok";else if(t==="scanned")n="Scanned",r="ok";else if(t==="flagged")n="Flagged",r="warn";else if(t==="unscanned"||t==="unvetted")n="New",r="neutral";else{const a=e.safetyBadge;a==="verified"?(n="Verified",r="ok"):a==="tested"?(n="Tested",r="ok"):(n="New",r="neutral")}const i=((o=e.attestation)==null?void 0:o.privacy)==="not-attested"?"This producer hasn't confirmed how it handles your data's privacy.":null;return{label:n,tone:r,note:i}}function Mc(e={}){const t=Array.isArray(e.builtFrom)?e.builtFrom[0]:null;return(t==null?void 0:t.note)||null}function NS(e){return`$${(Number(e)||0).toFixed(2)}`}const hm=()=>l.jsx("span",{className:"bz-represented",title:"No real money moves yet — this is a preview of how earnings would work.",children:"represented · settles later"});function ZD({block:e,bazaarState:t,canReply:n,onQuickReply:r}){var c;const{tool:i,phase:s,data:o}=e;if(s!=="result")return l.jsx(tL,{tool:i,input:e.input});if(!o||o.kind==="error")return null;switch(i){case"search_shelf":return l.jsx(nL,{data:o});case"open_recipe":return l.jsx(rL,{data:o});case"launch_preview":return l.jsx(iL,{data:o});case"record_use":return l.jsxs(l.Fragment,{children:[((c=o.recipe)==null?void 0:c.riskClass)==="C"&&l.jsx(sL,{recipe:o.recipe}),l.jsx(oL,{data:o,bazaarState:t})]});case"publish_listing":case"publish_draft":return l.jsx(aL,{data:o});case"draft_recipe":return l.jsx(lL,{data:o,canReply:n,onQuickReply:r});default:return null}}const QD={search_shelf:"Searching the bazaar shelf",open_recipe:"Absorbing the recipe",launch_preview:"Opening your live preview",record_use:"Recording the build",publish_listing:"Packaging for the shelf",draft_recipe:"Drafting a recipe from your work",publish_draft:"Publishing to the shelf"},eL={search_shelf:"🛒",open_recipe:"📖",launch_preview:"▶️",record_use:"🧾",publish_listing:"📦",draft_recipe:"📝",publish_draft:"📦"};function tL({tool:e,input:t}){return l.jsxs("div",{className:"bazaar-card bz-call","data-testid":`bazaar-${e}-call`,children:[l.jsx("span",{className:"bz-icon",children:eL[e]||"🛍️"}),l.jsxs("span",{className:"bz-call-label",children:[QD[e]||"Bazaar","…"]}),e==="search_shelf"&&(t==null?void 0:t.need)&&l.jsxs("span",{className:"bz-call-need",children:["“",t.need,"”"]}),l.jsxs("span",{className:"bz-dots",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]})]})}function av(e){return`${Math.round((Number(e)||0)*100)}%`}function nL({data:e}){var r;const t=e.hits||[];if(!t.length)return l.jsxs("div",{className:"bazaar-card bz-empty","data-testid":"bazaar-search-result",children:[l.jsx("span",{className:"bz-icon",children:"🛒"}),l.jsx("span",{children:"Checked the shelf — nothing proven fit this one, so I'll build it from scratch."})]});const n=t[0];return l.jsxs("div",{className:"bazaar-card bz-search","data-testid":"bazaar-search-result",children:[l.jsxs("div",{className:"bz-head",children:[l.jsx("span",{className:"bz-icon",children:"🛒"}),l.jsx("span",{className:"bz-head-title",children:"Found a proven recipe on the shelf"})]}),l.jsxs("div",{className:"bz-hit bz-hit-top",children:[l.jsxs("div",{className:"bz-hit-main",children:[l.jsx("span",{className:"bz-hit-title",children:n.title}),l.jsxs("span",{className:"bz-hit-by",children:["by ",((r=n.producer)==null?void 0:r.name)||"a producer"]})]}),l.jsxs("div",{className:"bz-outcome",title:"How often this recipe actually gets people a working result",children:[l.jsx("strong",{children:av(n.outcomeScore)})," of builds worked"]})]}),n.pitch&&l.jsx("p",{className:"bz-hit-pitch",children:n.pitch}),t.length>1&&l.jsxs("div",{className:"bz-others",children:["also on the shelf:"," ",t.slice(1,3).map((i,s)=>l.jsxs("span",{children:[s>0&&" · ",i.title," (",av(i.outcomeScore),")"]},i.id))]})]})}function rL({data:e}){var n;const t=e.card||{};return l.jsxs("div",{className:"bazaar-card bz-recipe","data-testid":"bazaar-recipe",children:[l.jsx("span",{className:"bz-icon",children:"📖"}),l.jsxs("span",{className:"bz-recipe-text",children:["Absorbed ",l.jsx("strong",{children:t.title})," — ",((n=t.producer)==null?void 0:n.name)||"the producer","'s know-how",(()=>{const r=ES(t);return l.jsx("span",{className:`bz-badge bz-trust-${r.tone}`,title:r.note||void 0,children:r.label})})()]})]})}function iL({data:e}){return l.jsxs("div",{className:"bazaar-card bz-preview","data-testid":"bazaar-preview",children:[l.jsx("span",{className:"bz-icon",children:"▶️"}),l.jsx("span",{children:"Your live preview is open — try it on the right."})]})}function sL({recipe:e}){var u,d;const t=e.dataTouched||{},n=e.attestation||{},r=((u=e.vetting)==null?void 0:u.stakes)==="high",i=((d=e.producer)==null?void 0:d.name)||"a connected service",s=t.egress||[],o=t.paid||{},a=o.model&&o.model!=="none",c=n.privacy==="not-attested";return l.jsxs("div",{className:`bazaar-card bz-receipt${r?" bz-receipt-high":""}`,"data-testid":"bazaar-receipt",children:[l.jsxs("div",{className:"bz-receipt-head",children:[l.jsx("span",{className:"bz-icon",children:r?"⚠️":"🔌"}),l.jsx("span",{className:"bz-receipt-title",children:r?`Heads up before ${i} goes live`:`Now using ${i} — here's what that means`})]}),l.jsxs("ul",{className:"bz-receipt-lines",children:[s.length>0&&l.jsxs("li",{"data-testid":"bazaar-receipt-egress",children:[l.jsx("strong",{children:"Leaves your machine:"})," ",s.join(", ")," — sent to ",i,"."]}),a&&l.jsxs("li",{children:[l.jsx("strong",{children:"Cost:"})," ",o.note||o.model,". ",l.jsx(hm,{})]}),l.jsxs("li",{"data-testid":"bazaar-receipt-privacy",className:c?"bz-receipt-warn":"",children:[l.jsx("strong",{children:"Privacy:"})," ",c?`${i} hasn't confirmed how it handles your data's privacy.`:`${i} has attested how it handles your data.`]}),l.jsx("li",{className:"bz-receipt-foot",children:"You can switch this off anytime — review it later in one place."})]}),r&&l.jsx("div",{className:"bz-receipt-confirm","data-testid":"bazaar-receipt-confirm",children:"This service moves money or takes a real-world action — make sure you're happy before it runs."})]})}function oL({data:e,bazaarState:t}){var u;const n=e.threeWay||{},r=(u=e.recipe)==null?void 0:u.producer,i=e.credit||{},s=((t==null?void 0:t.earnings)||[]).find(d=>d.handle===(r==null?void 0:r.handle)),o=(s==null?void 0:s.total)??i.oneTime??0,a=(s==null?void 0:s.matches)??0,c=!!e.service;return l.jsxs("div",{className:"bazaar-card bz-threeway","data-testid":"bazaar-threeway",children:[l.jsxs("div",{className:"bz-tw-head",children:[l.jsx("span",{className:"bz-tw-spark",children:"✦"})," Everyone just won"]}),l.jsxs("div",{className:"bz-tw-cols",children:[l.jsxs("div",{className:"bz-tw-col bz-tw-you",children:[l.jsx("div",{className:"bz-tw-who",children:"👤 You"}),l.jsx("div",{className:"bz-tw-what",children:n.you})]}),l.jsxs("div",{className:"bz-tw-col bz-tw-producer",children:[l.jsxs("div",{className:"bz-tw-who",children:["🏷️ ",(r==null?void 0:r.name)||"The producer"]}),l.jsx("div",{className:"bz-tw-what",children:n.producer}),l.jsxs("div",{className:"bz-tw-meter","data-testid":"bazaar-meter",children:[l.jsx("span",{className:"bz-meter-amount",children:NS(o)}),l.jsx("span",{className:"bz-meter-sub",children:c?`${a} ${a===1?"match":"matches"} so far`:"one-time"})]}),l.jsx(hm,{})]}),l.jsxs("div",{className:"bz-tw-col bz-tw-vw",children:[l.jsx("div",{className:"bz-tw-who",children:"🟣 VentureWild"}),l.jsx("div",{className:"bz-tw-what",children:n.platform})]})]})]})}function aL({data:e}){const t=e.listing||{},n=e.earning||{};return l.jsxs("div",{className:"bazaar-card bz-publish","data-testid":"bazaar-publish",children:[l.jsxs("div",{className:"bz-head",children:[l.jsx("span",{className:"bz-icon",children:"📦"}),l.jsx("span",{className:"bz-head-title",children:"You're a producer now"})]}),l.jsxs("p",{className:"bz-publish-text",children:[l.jsx("strong",{children:t.title})," is on the shelf. You'll earn when other people build on it."]}),l.jsxs("div",{className:"bz-tw-meter",children:[l.jsx("span",{className:"bz-meter-amount",children:NS(n.oneTimeValue)}),l.jsxs("span",{className:"bz-meter-sub",children:["per build · ",l.jsx(hm,{})]})]})]})}function lL({data:e,canReply:t,onQuickReply:n}){var i;const r=e.draft||{};return l.jsxs("div",{className:"bazaar-card bz-draft","data-testid":"bazaar-draft",children:[l.jsxs("div",{className:"bz-head",children:[l.jsx("span",{className:"bz-icon",children:"📝"}),l.jsx("span",{className:"bz-head-title",children:"Draft recipe — review before it goes on the shelf"})]}),l.jsx("div",{className:"bz-hit-main",children:l.jsx("span",{className:"bz-hit-title",children:r.title})}),r.pitch&&l.jsx("p",{className:"bz-hit-pitch",children:r.pitch}),r.sourceNote&&l.jsxs("div",{className:"bz-draft-source",children:["Generalized from: ",r.sourceNote]}),((i=r.tags)==null?void 0:i.length)>0&&l.jsx("div",{className:"bz-others",children:r.tags.slice(0,8).join(" · ")}),r.knowHow&&l.jsxs("details",{className:"bz-draft-knowhow",children:[l.jsx("summary",{children:"Preview the know-how — check it for any client specifics"}),l.jsx("pre",{children:r.knowHow})]}),n?l.jsxs("div",{className:"bz-draft-actions",children:[l.jsx("button",{type:"button",className:"bz-build-btn",disabled:!t,"data-testid":"bazaar-draft-publish",onClick:()=>t&&n(`Publish the “${r.title}” draft to my shelf.`),children:"Publish to my shelf →"}),l.jsx("button",{type:"button",className:"bz-draft-skip",disabled:!t,"data-testid":"bazaar-draft-skip",onClick:()=>t&&n(`Skip the “${r.title}” draft — don't publish that one.`),children:"Skip this one"}),l.jsx("span",{className:"bz-draft-hint",children:"Nothing's published until you choose."})]}):l.jsx("div",{className:"bz-draft-hint",children:"Nothing's published yet — tell me which drafts to put on your shelf."})]})}function jS(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function lv(e,t){if(!e)return"";const n=jS((t??Date.now())-e);return n?`${n} ago`:"just now"}function dm(e,t=Date.now()){const n=(e==null?void 0:e.status)||"running",r=n==="running",i=e!=null&&e.startedAt?(r?t:e.endedAt||t)-e.startedAt:0,s=jS(i);if(n==="completed")return{kind:"completed",glyph:"✓",label:"Done",cls:"ok",detail:s?`ran ${s}`:""};if(n==="failed")return{kind:"failed",glyph:"✗",label:`Failed${Number.isFinite(e==null?void 0:e.exitCode)?` (exit ${e.exitCode})`:""}`,cls:"err",detail:s?`ran ${s}`:""};if(n==="killed")return{kind:"killed",glyph:"◼",label:"Stopped",cls:"muted",detail:s?`ran ${s}`:""};if(e!=null&&e.quiet)return{kind:"quiet",glyph:"⏳",label:"Running",cls:"warn",detail:`no output for ${(e.lastOutputAt?lv(e.lastOutputAt,t):`${s} so far`).replace(/ ago$/,"")} · may be working or stuck`};const o=e!=null&&e.lastOutputAt?` · output ${lv(e.lastOutputAt,t)}`:"";return{kind:"running",glyph:"●",label:"Running",cls:"live",detail:`${s}${o}`}}function _u(e){return((e==null?void 0:e.status)||"running")==="running"}async function cL(e,t){if(!e)return null;const n=t?{Authorization:`Bearer ${t}`}:{};try{const r=await fetch(`/api/workspace/tasks/${encodeURIComponent(e)}/stop`,{method:"POST",headers:n});return r.ok?r.json():null}catch{return null}}function fm(e){const t=((e==null?void 0:e.description)||"").trim();return t||((e==null?void 0:e.command)||"").trim()||"Background task"}function pm({task:e,token:t,className:n=""}){const[r,i]=b.useState(!1);if(!_u(e))return null;const s=async o=>{o.stopPropagation(),!r&&(i(!0),await cL(e.id,t),i(!1))};return l.jsx("button",{className:`task-stop ${n}`,onClick:s,disabled:r,"data-testid":"task-stop",title:"Stop this background task",children:r?"…":"⏹ Stop"})}function uL({task:e,token:t}){const[n,r]=b.useState(!1),[i,s]=b.useState(null),[o,a]=b.useState(()=>Date.now()),c=b.useRef(null),u=((e==null?void 0:e.status)||"running")==="running";if(b.useEffect(()=>{if(!u)return;const f=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(f)},[u]),b.useEffect(()=>{if(!n||!(e!=null&&e.id))return;let f=!1;const p=t?{Authorization:`Bearer ${t}`}:{},m=()=>{fetch(`/api/workspace/tasks/${encodeURIComponent(e.id)}/output?bytes=20000`,{headers:p}).then(w=>w.ok?w.json():null).then(w=>{f||s(w?w.output:"")}).catch(()=>{f||s("")})};m();const g=u?setInterval(m,3e3):null;return()=>{f=!0,g&&clearInterval(g)}},[n,e==null?void 0:e.id,t,u]),b.useEffect(()=>{const f=c.current;f&&(f.scrollTop=f.scrollHeight)},[i]),!e)return null;const d=dm(e,o),h=fm(e);return l.jsxs("div",{className:`bgtask-card ${d.cls}`,"data-testid":"bgtask-card","data-status":e.status||"running",children:[l.jsxs("div",{className:"bgtask-headrow",children:[l.jsxs("button",{className:"bgtask-head",onClick:()=>r(f=>!f),"data-testid":"bgtask-toggle",title:e.command,children:[l.jsx("span",{className:`bgtask-glyph ${d.cls}`,"aria-hidden":!0,children:d.glyph}),l.jsxs("span",{className:"bgtask-main",children:[l.jsx("span",{className:"bgtask-title",children:h}),l.jsx("span",{className:"bgtask-detail",children:d.detail})]}),l.jsx("span",{className:`bgtask-pill ${d.cls}`,children:d.label}),l.jsx("span",{className:"bgtask-caret","aria-hidden":!0,children:n?"▴":"▾"})]}),l.jsx(pm,{task:e,token:t})]}),n&&l.jsxs("div",{className:"bgtask-body",children:[e.command&&l.jsx("pre",{className:"bgtask-cmd","data-testid":"bgtask-cmd",children:e.command}),i===null&&l.jsxs("div",{className:"bgtask-msg",children:[l.jsx("span",{className:"spinner"})," loading output…"]}),i===""&&l.jsx("div",{className:"bgtask-msg",children:"No output captured yet."}),i&&l.jsx("pre",{className:"bgtask-out","data-testid":"bgtask-out",ref:c,children:i}),e.shellId&&l.jsxs("div",{className:"bgtask-foot",children:["shell ",l.jsx("code",{children:e.shellId})]})]})]})}const js=[{who:"Two HR people",occ:"recruiting team",built:"an AI platform that matches candidates to roles — no engineers on the team"},{who:"A freight-forwarding team",occ:"logistics",built:"an analytics brain that answers plain-language questions about their shipments"},{who:"A game-studio founder",occ:"games",built:"a world of AI agents that play and learn together"},{who:"A solo consultant",occ:"business consulting",built:"turned a year of client work into a product — this one"}],hL="Most of the people building here have never written a line of code.",dL=4200;function fL(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function bu({variant:e="ambient"}){const t=e==="ambient"&&js.length>1&&!fL(),[n,r]=b.useState(()=>Math.floor(Math.random()*js.length));b.useEffect(()=>{if(!t)return;const s=setInterval(()=>r(o=>(o+1)%js.length),dL);return()=>clearInterval(s)},[t]);const i=e==="block"?js:[js[n%js.length]];return l.jsxs("div",{className:`peer-stream peer-stream-${e}`,"data-testid":"peer-stream",children:[i.map((s,o)=>l.jsxs("div",{className:"peer-item",children:[l.jsxs("span",{className:"peer-who",children:[s.who,s.occ?l.jsxs("span",{className:"peer-occ",children:[" · ",s.occ]}):null]}),l.jsx("span",{className:"peer-built",children:s.quote?`“${s.quote}”`:s.built})]},`${s.who}-${o}-${e==="ambient"?n:"all"}`)),l.jsx("p",{className:"peer-honest",children:hL})]})}const Oc="wild-workspace.chat.v2";function xh({id:e,isDefault:t}={},n){const r=t||!e?Oc:`${Oc}:${e}`;return n?`${r}:${n}`:r}function pL({messageId:e,userText:t,agentText:n}={}){return!e||!t||!n?[]:[{id:`u-${e}`,role:"user",text:t},{id:e,role:"agent",blocks:[{type:"text",text:n}]}]}function mL(e,t=globalThis.localStorage,n=Oc){const r=pL(e);if(!r.length||!t)return!1;try{const i=t.getItem(n),s=i?JSON.parse(i):[];return Array.isArray(s)&&s.length>0?!1:(t.setItem(n,JSON.stringify(r)),!0)}catch{return!1}}const of="wild:workspace:id";let no=null;try{no=typeof sessionStorage<"u"&&sessionStorage.getItem(of)||null}catch{no=null}function da(){return no}function gL(e){no=e||null;try{no?sessionStorage.setItem(of,no):sessionStorage.removeItem(of)}catch{}}function yL(e,t){var i,s;const n=e.blocks?e.blocks.slice():[],r=n[n.length-1];switch(t.type){case"text":return r&&r.type==="text"?n[n.length-1]={...r,text:r.text+t.text}:n.push({type:"text",text:t.text}),{...e,blocks:n};case"thinking":return r&&r.type==="thinking"?n[n.length-1]={...r,text:r.text+t.text}:n.push({type:"thinking",text:t.text}),{...e,blocks:n};case"tool-use":return t.name==="Bash"&&((i=t.input)!=null&&i.run_in_background)?(n.push({type:"bgtask",id:t.id,command:t.input.command||"",description:t.input.description||"",status:"running"}),{...e,blocks:n}):(n.push({type:"tool",id:t.id,name:t.name,input:t.input||{},done:!1}),{...e,blocks:n});case"tool-result":{const o=n.findIndex(c=>c.type==="bgtask"&&c.id===t.id);if(o>=0)return n[o]={...n[o],launched:!0},{...e,blocks:n};const a=n.findIndex(c=>c.type==="tool"&&c.id===t.id);return a>=0&&(n[a]={...n[a],result:t.content,isError:t.isError,done:!0}),{...e,blocks:n}}case"usage":return{...e,usage:t.usage,costUsd:(s=t.usage)==null?void 0:s.cost_usd,durationMs:t.durationMs};case"error":return n.push({type:"error",text:t.message||"agent error"}),{...e,blocks:n};case"bazaar":{if(t.phase==="call")return n.push({type:"bazaar",id:t.id,tool:t.tool,phase:"call",input:t.input||{}}),{...e,blocks:n};if(t.phase==="result"){const o=n.findIndex(a=>a.type==="bazaar"&&a.id===t.id);return o>=0?n[o]={...n[o],phase:"result",data:t.data,isError:t.isError}:n.push({type:"bazaar",id:t.id,tool:t.tool,phase:"result",data:t.data}),{...e,blocks:n}}return e}case"canvas":{if(t.phase==="call")return n.push({type:"canvas",id:t.id,tool:t.tool,phase:"call"}),{...e,blocks:n};if(t.phase==="result"){const o=n.findIndex(c=>c.type==="canvas"&&c.id===t.id),a={type:"canvas",id:t.id,tool:t.tool,phase:"result",data:t.data,isError:t.isError};return o>=0?n[o]={...n[o],...a}:n.push(a),{...e,blocks:n}}return e}default:return e}}function cv(e,t,n){const r=e.findIndex(s=>s.id===t);if(r<0)return e;const i=e.slice();return i[r]=yL(i[r],n),i}function vL(e,t,n){if(!n||!n.trim())return e;const r=e.findIndex(s=>s.id===t);if(r<0)return e;const i=e.slice();return i[r]={...i[r],stderr:(i[r].stderr||"")+n},i}function _L({role:e,capabilities:t,token:n,onBazaarEvent:r,inject:i,onInjectConsumed:s,agentName:o,storageKey:a,threadId:c,sessionId:u,onOpenReading:d,contextPct:h=0}){const f=a||Oc,[p,m]=b.useState(()=>{try{const U=localStorage.getItem(f);if(U)return JSON.parse(U)}catch{}return[]}),[g,w]=b.useState(null),[v,_]=b.useState(!1),[y,S]=b.useState(""),[E,k]=b.useState(!1),[T,R]=b.useState(!1),[O,j]=b.useState(null),[$,L]=b.useState({}),P=b.useRef(null),A=b.useRef(null),D=b.useRef(!0),M=b.useRef(r),W=b.useRef(null),N=b.useRef(null),H=b.useRef(null);b.useEffect(()=>{M.current=r},[r]),b.useEffect(()=>{try{localStorage.setItem(f,JSON.stringify(p.slice(-120)))}catch{}},[p]);const C=u||"main",re=b.useRef(p);b.useEffect(()=>{re.current=p},[p]),b.useEffect(()=>{let U=!1;const ye=`wild:migrated:${f}`,we=(()=>{try{return!!localStorage.getItem(ye)}catch{return!1}})();return fetch(`/api/sessions/${encodeURIComponent(C)}/messages`).then(Se=>Se.ok?Se.json():null).then(Se=>{if(U||!Se)return;const fe=Array.isArray(Se.messages)?Se.messages:[];fe.length?m(fe):re.current.length&&t.chatWrite&&!we&&fetch(`/api/sessions/${encodeURIComponent(C)}/messages`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({messages:re.current.slice(-200)})}).catch(()=>{});try{localStorage.setItem(ye,"1")}catch{}}).catch(()=>{}),()=>{U=!0}},[C]);const Q=(U=!1)=>fetch(`/api/sessions/${encodeURIComponent(C)}/messages`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({messages:re.current.slice(-200)}),keepalive:U}).catch(()=>{});b.useEffect(()=>{if(!t.chatWrite||!p.length)return;const U=setTimeout(()=>Q(!1),800);return()=>clearTimeout(U)},[p,C,t.chatWrite]),b.useEffect(()=>{if(t.chatWrite)return()=>{Q(!0)}},[C,t.chatWrite]),b.useEffect(()=>{const U=A.current;U&&D.current&&(U.scrollTop=U.scrollHeight)},[p]);function x(){const U=A.current;U&&(D.current=U.scrollHeight-U.scrollTop-U.clientHeight<90)}b.useEffect(()=>{let U=!1,ye=0,we=null,Se=null;const fe=()=>{if(U)return;const it=window.location.protocol==="https:"?"wss":"ws",qe=new URL(`${it}://${window.location.host}/ws/chat`);n&&qe.searchParams.set("t",n);const Oe=da();Oe&&qe.searchParams.set("workspace",Oe),c&&qe.searchParams.set("thread",c),Se=new WebSocket(qe.toString()),P.current=Se,Se.onopen=()=>{ye=0,k(!0)},Se.onmessage=I=>{var le,ge,He,Pe,Ve,Ze,ut,F,G,ue,ke;let ie;try{ie=JSON.parse(I.data)}catch{return}if(!(ie.threadId&&ie.threadId!==c)){if(ie.type==="chunk"){const X=ie.chunk;if(m(De=>cv(De,ie.messageId,X)),(X==null?void 0:X.type)==="bazaar"&&X.phase==="result"&&!X.isError){const De=X.data||{};if(X.tool==="launch_preview"||X.tool==="record_use"&&De.preview){const st=De.url||((le=De.preview)==null?void 0:le.url)||"/preview/";(ge=M.current)==null||ge.call(M,{type:"preview",url:st,ts:Date.now()}),W.current=st}}(X==null?void 0:X.type)==="canvas"&&X.phase==="result"&&!X.isError&&((He=X.data)==null?void 0:He.kind)==="block"&&X.data.block&&((Pe=M.current)==null||Pe.call(M,{type:"block",op:X.data.op||"make",block:X.data.block})),(X==null?void 0:X.type)==="canvas"&&X.phase==="result"&&!X.isError&&((Ve=X.data)==null?void 0:Ve.kind)==="theme"&&X.data.op==="set"&&X.data.theme&&((Ze=M.current)==null||Ze.call(M,{type:"theme",theme:X.data.theme})),(X==null?void 0:X.type)==="bazaar"&&X.phase==="result"&&!X.isError&&((ut=X.data)==null?void 0:ut.kind)==="theme-applied"&&X.data.theme&&((F=M.current)==null||F.call(M,{type:"theme",theme:X.data.theme}))}else if(ie.type==="bazaar")ie.phase==="meter"&&(j(ie.state),(G=M.current)==null||G.call(M,{type:"meter",state:ie.state}));else if(ie.type==="task"){const X=ie.task;X&&X.id&&(L(De=>({...De,[X.id]:X})),(ue=M.current)==null||ue.call(M,{type:"task",task:X}))}else if(ie.type==="usage")(ke=M.current)==null||ke.call(M,{type:"usage",state:ie.state});else if(ie.type==="stderr")m(X=>vL(X,ie.messageId,ie.text));else if(ie.type==="end"){if(w(null),_(!1),W.current){let X=W.current;W.current=null;try{X=new URL(X,window.location.origin).href}catch{}m(De=>[...De,{id:`win-${Date.now()}`,role:"win",url:X}])}}else if(ie.type==="error")w(null),_(!1),W.current=null,ie.messageId?m(X=>cv(X,ie.messageId,{type:"error",message:ie.message||"agent error"})):m(X=>[...X,{id:`err-${Date.now()}`,role:"error",text:ie.message||"agent error"}]);else if(ie.type==="turn-begin")W.current=null,m(X=>{if(X.some(st=>st.id===ie.messageId))return X;const De=[];return ie.userText&&De.push({id:`u-${ie.messageId}`,role:"user",text:ie.userText}),ie.note&&De.push({id:`note-${ie.messageId}`,role:"system",text:ie.note}),De.push({id:ie.messageId,role:"agent",blocks:[]}),[...X,...De]}),w(ie.messageId),_(!0);else if(ie.type==="reset"){m([]),w(null),_(!1),W.current=null;try{localStorage.removeItem(f)}catch{}}}},Se.onerror=()=>_(!1),Se.onclose=()=>{if(k(!1),_(!1),w(null),U)return;const I=Math.min(1e3*2**ye,1e4);ye+=1,we=setTimeout(fe,I)}};return fe(),()=>{U=!0,clearTimeout(we);try{Se==null||Se.close()}catch{}}},[n,c]);function Y(U,ye){if(!t.chatWrite)return;const we=(typeof U=="string"?U:y).trim();if(!we||v)return;const Se=typeof ye=="string"&&ye.trim()||we,fe=P.current,it=fe==null?void 0:fe.readyState;if(!fe||it!==WebSocket.OPEN&&it!==WebSocket.CONNECTING){m(I=>[...I,{id:`err-${Date.now()}`,role:"error",text:"reconnecting to your agent — try again in a few seconds"}]);return}const qe=`m-${Date.now()}`;D.current=!0,m(I=>[...I,{id:`u-${qe}`,role:"user",text:Se},{id:qe,role:"agent",blocks:[]}]),w(qe),_(!0),S("");const Oe=JSON.stringify({type:"send",text:we,messageId:qe,...c?{threadId:c}:{}});it===WebSocket.OPEN?fe.send(Oe):fe.addEventListener("open",()=>{try{fe.send(Oe)}catch{}},{once:!0})}N.current=Y,b.useEffect(()=>{var U;!(i!=null&&i.text)||H.current===i.ts||(H.current=i.ts,D.current=!0,(U=N.current)==null||U.call(N,i.text),s==null||s())},[i,s]);function Z(){var U;((U=P.current)==null?void 0:U.readyState)===WebSocket.OPEN&&P.current.send(JSON.stringify({type:"cancel",...c?{threadId:c}:{}})),_(!1),w(null)}function oe(){var U;((U=P.current)==null?void 0:U.readyState)===WebSocket.OPEN&&P.current.send(JSON.stringify({type:"reset",...c?{threadId:c}:{}})),m([]),w(null),_(!1),W.current=null;try{localStorage.removeItem(f)}catch{}}function me(U){U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),Y())}const Ee=p.length===0;return l.jsxs(l.Fragment,{children:[!Ee&&(d||t.chatWrite)&&l.jsxs("div",{className:"chat-toolbar","data-testid":"chat-toolbar",children:[d&&l.jsxs("button",{className:"chat-aabtn",onClick:d,"data-testid":"reading-open-btn",title:"Reading — choose a font & size for the chat",children:[l.jsx("span",{className:"chat-aa-glyph","aria-hidden":"true",children:"Aa"})," Reading"]}),l.jsx("span",{className:"chat-toolbar-spacer"}),t.chatWrite&&l.jsx("button",{className:"chat-newbtn",onClick:oe,disabled:v,"data-testid":"new-chat-btn",title:"Start a fresh conversation — the agent forgets the current thread",children:"+ New chat"})]}),l.jsxs("div",{className:"chat-messages",ref:A,onScroll:x,"data-testid":"chat-messages",children:[Ee&&l.jsx(jL,{role:e,connected:E,agentName:o,canSend:t.chatWrite&&!v,onSend:Y}),p.map(U=>l.jsx(bL,{message:U,streaming:U.id===g,bazaarState:O,canReply:t.chatWrite&&!v,onQuickReply:Y,liveTasks:$,token:n},U.id))]}),t.chatWrite&&h>=50&&!T&&l.jsxs("div",{className:`chat-ctx-hint${h>=75?" urgent":""}`,"data-testid":"chat-ctx-hint",children:[l.jsx("span",{children:h>=75?"This chat is very full — start a fresh one so the agent stays sharp.":"This chat's getting long — a fresh one keeps the agent sharper."}),l.jsx("button",{onClick:()=>R(!0),"data-testid":"chat-ctx-hint-dismiss","aria-label":"Dismiss",children:"✕"})]}),t.chatWrite&&l.jsxs("div",{className:"chat-input","data-testid":"chat-input",children:[l.jsx("textarea",{"data-testid":"chat-textarea",placeholder:e==="client"?"Describe the change you’d like…":"Ask the agent to build, fix, or explain something — Enter to send",value:y,onChange:U=>S(U.target.value),onKeyDown:me,disabled:v,rows:2}),v?l.jsx("button",{onClick:Z,"data-testid":"cancel-btn",children:"Stop"}):l.jsx("button",{className:"primary send-btn",onClick:Y,disabled:!y.trim(),"data-testid":"send-btn",children:"Send"})]}),!t.chatWrite&&e==="viewer"&&l.jsx("div",{className:"chat-readonly-banner",children:"You’re viewing a shared workspace (read-only)."})]})}function bL({message:e,streaming:t,bazaarState:n,canReply:r,onQuickReply:i,liveTasks:s,token:o}){if(e.role==="user")return l.jsx("div",{className:"chat-msg user","data-testid":"chat-msg-user",children:l.jsx("div",{className:"msg-plain",children:e.text})});if(e.role==="system")return l.jsx("div",{className:"chat-msg system","data-testid":"chat-msg-system",children:e.text});if(e.role==="win")return l.jsx(CL,{url:e.url});if(e.role==="error")return l.jsxs("div",{className:"chat-msg error","data-testid":"chat-msg-error",children:["⚠ ",e.text]});const a=e.blocks||[],c=a[a.length-1],u=t&&(c==null?void 0:c.type)==="text"?a.length-1:-1,d=t&&(a.length===0||(c==null?void 0:c.type)==="tool"&&c.done);return l.jsxs("div",{className:"chat-msg agent","data-testid":"chat-msg-agent",children:[a.map((h,f)=>l.jsx(wL,{block:h,cursor:f===u,bazaarState:n,canReply:r,onQuickReply:i,liveTasks:s,token:o},h.id||`${h.type}-${f}`)),d&&l.jsx(EL,{}),e.usage&&l.jsx(NL,{usage:e.usage,costUsd:e.costUsd,durationMs:e.durationMs}),e.stderr&&l.jsxs("details",{className:"stderr-block",children:[l.jsx("summary",{children:"stderr"}),l.jsx("pre",{children:e.stderr})]})]})}function wL({block:e,cursor:t,bazaarState:n,canReply:r,onQuickReply:i,liveTasks:s,token:o}){var a;if(e.type==="bgtask"){const u=s&&s[e.id]||null||{id:e.id,command:e.command,description:e.description,status:e.status||"running"};return l.jsx(uL,{task:u,token:o})}return e.type==="bazaar"?l.jsx(ZD,{block:e,bazaarState:n,canReply:r,onQuickReply:i}):e.type==="text"?l.jsxs("div",{className:"agent-text",children:[l.jsx(CS,{text:e.text}),t&&l.jsx("span",{className:"stream-cursor"})]}):e.type==="thinking"?l.jsxs("details",{className:"thinking-block",children:[l.jsx("summary",{children:"💭 Thought process"}),l.jsx("div",{className:"thinking-body",children:e.text})]}):e.type==="tool"?e.name==="AskUserQuestion"&&Array.isArray((a=e.input)==null?void 0:a.questions)&&e.input.questions.length?l.jsx(SL,{block:e,canReply:r,onQuickReply:i}):l.jsx(JD,{block:e}):e.type==="canvas"?l.jsx(xL,{block:e}):e.type==="error"?l.jsxs("div",{className:"agent-error",children:["⚠ ",e.text]}):null}function xL({block:e}){var r,i,s,o;if(e.phase==="result"&&!e.isError&&((r=e.data)==null?void 0:r.kind)==="theme"&&e.data.op==="set"){const a=(i=e.data.theme)==null?void 0:i.name;return l.jsxs("div",{className:"canvas-card","data-testid":"canvas-card",children:[l.jsx("span",{className:"canvas-card-icon",children:"🎨"}),l.jsxs("span",{className:"canvas-card-text",children:["Restyled your workspace",a?l.jsxs(l.Fragment,{children:[" — ",l.jsx("strong",{children:a})]}):null]})]})}const t=(s=e.data)==null?void 0:s.block;if(e.phase==="call"||!t)return l.jsx("div",{className:"canvas-card is-pending","data-testid":"canvas-card",children:"🧩 Building a block…"});if(e.isError)return l.jsx("div",{className:"canvas-card is-error","data-testid":"canvas-card",children:"⚠ Couldn’t build that block."});const n=((o=e.data)==null?void 0:o.op)==="update"?"Updated":"Added";return l.jsxs("div",{className:"canvas-card","data-testid":"canvas-card",children:[l.jsx("span",{className:"canvas-card-icon",children:t.icon||"🧩"}),l.jsxs("span",{className:"canvas-card-text",children:[n," ",l.jsx("strong",{children:t.title})," to your canvas"]})]})}function SL({block:e,canReply:t,onQuickReply:n}){const r=e.input.questions;return l.jsxs("div",{className:"ask-card","data-testid":"ask-card",children:[l.jsxs("div",{className:"ask-head",children:[l.jsx("span",{className:"ask-icon",children:"🤔"}),l.jsx("span",{children:"Your call"})]}),r.map((i,s)=>l.jsx(kL,{q:i,canReply:t,onQuickReply:n},s)),l.jsx("div",{className:"ask-foot",children:"…or just type your answer below."})]})}function kL({q:e,canReply:t,onQuickReply:n}){const[r,i]=b.useState([]),s=!!e.multiSelect,o=Array.isArray(e.options)?e.options:[],a=c=>i(u=>u.includes(c)?u.filter(d=>d!==c):[...u,c]);return l.jsxs("div",{className:"ask-q",children:[e.header&&l.jsx("span",{className:"ask-q-header",children:e.header}),e.question&&l.jsx("p",{className:"ask-q-text",children:e.question}),l.jsx("div",{className:"ask-options",children:o.map((c,u)=>s?l.jsxs("button",{type:"button",className:`ask-opt${r.includes(c.label)?" sel":""}`,disabled:!t,onClick:()=>a(c.label),title:c.description||"",children:[l.jsx("span",{className:"ask-opt-check",children:r.includes(c.label)?"☑":"☐"}),l.jsxs("span",{className:"ask-opt-main",children:[l.jsx("span",{className:"ask-opt-label",children:c.label}),c.description&&l.jsx("span",{className:"ask-opt-desc",children:c.description})]})]},u):l.jsxs("button",{type:"button",className:"ask-opt",disabled:!t,onClick:()=>t&&n(c.label),title:c.description||"",children:[l.jsxs("span",{className:"ask-opt-main",children:[l.jsx("span",{className:"ask-opt-label",children:c.label}),c.description&&l.jsx("span",{className:"ask-opt-desc",children:c.description})]}),l.jsx("span",{className:"ask-opt-go",children:"→"})]},u))}),s&&l.jsxs("button",{type:"button",className:"primary ask-send",disabled:!t||!r.length,onClick:()=>t&&r.length&&n(r.join(", ")),children:["Send",r.length?` (${r.length})`:""]})]})}function CL({url:e}){let t=e;try{const n=new URL(e);t=`${n.host}${n.pathname==="/"?"":n.pathname}`}catch{}return l.jsxs("div",{className:"chat-msg win-card","data-testid":"win-card",children:[l.jsx("span",{className:"win-spark",children:"✨"}),l.jsxs("div",{className:"win-body",children:[l.jsx("span",{className:"win-lead",children:"It’s live — this is yours:"}),l.jsx("a",{className:"win-url",href:e,target:"_blank",rel:"noreferrer",children:t}),l.jsx("span",{className:"win-sub",children:"Open it, or send it to someone."})]})]})}function EL(){return l.jsxs("div",{className:"agent-working","data-testid":"agent-working",children:[l.jsxs("span",{className:"dots",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}),"working"]})}function NL({usage:e,costUsd:t,durationMs:n}){const r=typeof t=="number"?t:e==null?void 0:e.cost_usd;return l.jsxs("div",{className:"usage-footer","data-testid":"usage-footer",children:[(e==null?void 0:e.output_tokens)!=null&&l.jsxs("span",{title:"output tokens",children:["↑ ",e.output_tokens.toLocaleString()]}),typeof r=="number"&&r>0&&l.jsxs("span",{title:"cost (USD)",children:["$",r.toFixed(4)]}),n!=null&&l.jsxs("span",{children:[(n/1e3).toFixed(1),"s"]})]})}function jL({role:e,connected:t,agentName:n,canSend:r,onSend:i}){if(e==="client")return l.jsxs("div",{className:"chat-empty","data-testid":"chat-empty",children:[l.jsx("div",{className:"chat-empty-mark",children:"✦"}),l.jsx("p",{className:"chat-empty-title",children:"Describe what you’d like changed"}),l.jsx("p",{className:"chat-empty-sub",children:"The team’s AI agent will pick it up and you’ll see it here."}),!t&&l.jsx("p",{className:"chat-empty-warn",children:"connecting to the agent bridge…"})]});const s=n&&n!=="Chat"?n:null,o=[{label:"✦ Build my workspace for me",display:"Build my workspace for me.",primary:!0,prompt:"Set up a friendly starter workspace for me. Use your canvas tools to add a couple of useful blocks — for example a short welcome note, a quick getting-started checklist, and maybe a tips block — and pick a warm, welcoming theme if you'd like. Narrate as you go in short plain lines (one line per step, no jargon) so I can watch it come together. Then say a brief, friendly hello telling me what you set up. Keep it light."},{label:"Show me around",display:"Show me around.",prompt:"What's in this workspace? Give me a quick, friendly tour."},{label:"Make something I can show off",display:"Make something I can show off.",prompt:"Build me a simple, good-looking landing page, and put a Live view on my canvas so I can watch it come together. Narrate as you go in short plain lines — one line per step, no jargon. When it’s done, tell me where to see it."}];return l.jsxs("div",{className:"chat-empty","data-testid":"chat-empty",children:[l.jsx("div",{className:"chat-empty-mark",children:"✦"}),l.jsx("p",{className:"chat-empty-title",children:s?`Hi — I’m ${s}.`:"Hi — I’m your agent."}),l.jsx("p",{className:"chat-empty-sub",children:"Tell me what you’re working on and I’ll set it up for you — I can build, write, and arrange your workspace as we go. Not sure where to start?"}),l.jsx("div",{className:"chat-empty-starters",children:o.map(a=>l.jsx("button",{type:"button",className:`chat-empty-starter${a.primary?" primary":""}`,onClick:()=>i==null?void 0:i(a.prompt,a.display),disabled:!r||!t,"data-testid":"chat-empty-starter",children:a.label},a.label))}),!t&&l.jsx("p",{className:"chat-empty-warn",children:"connecting to the agent bridge…"}),l.jsx(bu,{variant:"ambient"})]})}const qo="main";function RL(e){return e&&e!=="local"?e:"this device"}function TL(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<45)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function uv(e){return e.title||(e.id===qo?"Main":"Untitled")}function PL({workspaceKey:e,activeSessionId:t,onSelect:n,canWrite:r}){const[i,s]=b.useState(!1),[o,a]=b.useState([]),[c,u]=b.useState(!1),[d,h]=b.useState(null),[f,p]=b.useState(""),m=b.useRef(null),g=t||qo;async function w(){u(!0);try{const T=await(await fetch("/api/sessions")).json().catch(()=>null);a(Array.isArray(T==null?void 0:T.sessions)?T.sessions:[])}catch{a([])}finally{u(!1)}}b.useEffect(()=>{i&&w()},[i,e]),b.useEffect(()=>{if(!i)return;const k=T=>{m.current&&!m.current.contains(T.target)&&s(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]);const v=o.find(k=>k.id===g),_=v?uv(v):g===qo?"Main":"Chat";async function y(){var k;try{const R=await(await fetch("/api/sessions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})})).json().catch(()=>null);(k=R==null?void 0:R.session)!=null&&k.id&&(s(!1),n(R.session.id))}catch{}}async function S(k){const T=f.trim();h(null);try{await fetch(`/api/sessions/${encodeURIComponent(k)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({title:T})})}catch{}w()}async function E(k){try{await fetch(`/api/sessions/${encodeURIComponent(k)}`,{method:"DELETE"})}catch{}g===k&&n(qo),w()}return l.jsxs("div",{className:"session-picker",ref:m,children:[l.jsxs("button",{className:"session-picker-toggle",onClick:()=>s(k=>!k),"data-testid":"session-picker-toggle",title:"Switch chat sessions",children:[l.jsx("span",{className:"session-picker-label",children:_}),(v==null?void 0:v.live)&&l.jsx("span",{className:"session-live-dot","aria-hidden":!0}),l.jsx("span",{"aria-hidden":!0,children:"▾"})]}),i&&l.jsxs("div",{className:"session-menu","data-testid":"session-menu",children:[c?l.jsx("div",{className:"session-empty",children:"Loading…"}):o.length===0?l.jsx("div",{className:"session-empty",children:"No sessions yet"}):o.map(k=>l.jsxs("div",{className:`session-row${k.id===g?" active":""}`,"data-testid":`session-row-${k.id}`,children:[d===k.id?l.jsx("input",{className:"session-rename",autoFocus:!0,value:f,onChange:T=>p(T.target.value),onKeyDown:T=>{T.key==="Enter"&&S(k.id),T.key==="Escape"&&h(null)},onBlur:()=>S(k.id),"data-testid":`session-rename-${k.id}`}):l.jsxs("button",{className:"session-open",onClick:()=>{s(!1),n(k.id)},"data-testid":`session-open-${k.id}`,children:[l.jsx("span",{className:"session-title",children:uv(k)}),k.live&&l.jsx("span",{className:"session-live-dot",title:"active now","aria-hidden":!0}),l.jsxs("span",{className:"session-meta",children:[RL(k.account)," · ",TL(k.lastActivityAt)]})]}),r&&k.id!==qo&&d!==k.id&&l.jsxs("span",{className:"session-actions",children:[l.jsx("button",{title:"Rename",onClick:()=>{h(k.id),p(k.title||"")},"data-testid":`session-rename-btn-${k.id}`,children:"✎"}),l.jsx("button",{title:"Delete",onClick:()=>E(k.id),"data-testid":`session-delete-${k.id}`,children:"🗑"})]})]},k.id)),r&&l.jsx("button",{className:"session-new",onClick:y,"data-testid":"session-new",children:"+ New session"})]})]})}function RS(e){const t=Number(e)||0;return t>=75?"red":t>=50?"amber":"ok"}function TS(e,t,n=0){const[r,i]=b.useState([]),[s,o]=b.useState(!1),[a,c]=b.useState(!1),u=t?{Authorization:`Bearer ${t}`}:{},d=b.useCallback(async()=>{o(!0);try{const w=await(await fetch("/api/sessions",{headers:u})).json().catch(()=>null);i(Array.isArray(w==null?void 0:w.sessions)?w.sessions:[])}catch{}finally{o(!1)}},[t]),h=b.useCallback(async()=>{var g;try{const v=await(await fetch("/api/providers",{headers:u})).json().catch(()=>null);c(!!((g=v==null?void 0:v.glm)!=null&&g.connected))}catch{}},[t]);b.useEffect(()=>{d(),h()},[d,h,e,n]);const f=b.useCallback(async(g="claude",w=null)=>{try{const _=await(await fetch("/api/sessions",{method:"POST",headers:{"content-type":"application/json",...u},body:JSON.stringify({provider:g,...w?{title:w}:{}})})).json().catch(()=>null);return await d(),(_==null?void 0:_.session)||null}catch{return null}},[d,t]),p=b.useCallback(async(g,w)=>{try{await fetch(`/api/sessions/${encodeURIComponent(g)}`,{method:"PATCH",headers:{"content-type":"application/json",...u},body:JSON.stringify({title:w})})}catch{}d()},[d,t]),m=b.useCallback(async g=>{try{await fetch(`/api/sessions/${encodeURIComponent(g)}`,{method:"DELETE",headers:u})}catch{}d()},[d,t]);return{sessions:r,loading:s,glmConnected:a,reload:d,create:f,rename:p,remove:m}}const Xl="main";function DL(e){return e.title||(e.id===Xl?"Main":"New chat")}function LL({provider:e}){return e!=="glm"?null:l.jsx("span",{className:"sess-provider","data-testid":"sess-provider-glm",children:"GLM"})}function AL({pct:e}){const t=Math.round(Number(e)||0);return t<1?null:l.jsxs("span",{className:`sess-ctx sess-ctx-${RS(t)}`,title:`${t}% of this chat's context window in use`,children:[t,"%"]})}function IL({workspaceName:e,workspaceKey:t,token:n,activeSessionId:r,onSelect:i,canWrite:s,onClose:o,refreshKey:a}){const{sessions:c,loading:u,glmConnected:d,create:h,rename:f,remove:p}=TS(t,n,a),[m,g]=b.useState(!1),[w,v]=b.useState(null),[_,y]=b.useState(""),S=r||Xl;async function E(R){g(!1);const O=await h(R);O!=null&&O.id&&i(O.id)}function k(){d?g(R=>!R):E("claude")}async function T(R){const O=_.trim();v(null),await f(R,O)}return l.jsxs("aside",{className:"session-sidebar","data-testid":"session-sidebar",children:[l.jsxs("div",{className:"sess-head",children:[l.jsx("span",{className:"sess-ws",title:e,children:e||"Workspace"}),o&&l.jsx("button",{className:"sess-collapse",onClick:o,"data-testid":"sidebar-collapse",title:"Hide chats","aria-label":"Hide chats",children:"«"})]}),s&&l.jsxs("div",{className:"sess-new-wrap",children:[l.jsx("button",{className:"sess-new primary",onClick:k,"data-testid":"sidebar-new-chat","aria-haspopup":d?"menu":void 0,"aria-expanded":d?m:void 0,children:"+ New chat"}),m&&l.jsxs("div",{className:"sess-provider-menu","data-testid":"sidebar-provider-menu",children:[l.jsx("button",{onClick:()=>E("claude"),"data-testid":"sidebar-new-claude",children:"🟣 Claude"}),l.jsx("button",{onClick:()=>E("glm"),"data-testid":"sidebar-new-glm",children:"🟦 GLM"})]})]}),l.jsx("div",{className:"sess-list","data-testid":"sidebar-session-list",children:u&&c.length===0?l.jsx("div",{className:"sess-empty",children:"Loading…"}):c.length===0?l.jsx("div",{className:"sess-empty",children:"No chats yet"}):c.map(R=>l.jsxs("div",{className:`sess-row${R.id===S?" active":""}`,"data-testid":`sidebar-session-${R.id}`,children:[w===R.id?l.jsx("input",{className:"sess-rename",autoFocus:!0,value:_,onChange:O=>y(O.target.value),onKeyDown:O=>{O.key==="Enter"&&T(R.id),O.key==="Escape"&&v(null)},onBlur:()=>T(R.id),"data-testid":`sidebar-rename-${R.id}`}):l.jsxs("button",{className:"sess-open",onClick:()=>i(R.id),"data-testid":`sidebar-open-${R.id}`,children:[l.jsxs("span",{className:"sess-title-row",children:[l.jsx("span",{className:"sess-title",children:DL(R)}),R.live&&l.jsx("span",{className:"session-live-dot",title:"active now","aria-hidden":!0})]}),l.jsxs("span",{className:"sess-meta-row",children:[l.jsx(LL,{provider:R.provider}),l.jsx(AL,{pct:R.contextPct})]})]}),s&&R.id!==Xl&&w!==R.id&&l.jsxs("span",{className:"sess-actions",children:[l.jsx("button",{title:"Rename",onClick:()=>{v(R.id),y(R.title||"")},"data-testid":`sidebar-rename-btn-${R.id}`,children:"✎"}),l.jsx("button",{title:"Delete",onClick:async()=>{await p(R.id),R.id===S&&i(Xl)},"data-testid":`sidebar-delete-${R.id}`,children:"🗑"})]})]},R.id))})]})}const Jl="main",ML=e=>e.title||(e.id===Jl?"Main":"New chat");function OL({workspaceKey:e,token:t,activeSessionId:n,onSelect:r,canWrite:i,refreshKey:s}){const{sessions:o,loading:a,glmConnected:c,create:u,remove:d}=TS(e,t,s),[h,f]=b.useState(!1),p=n||Jl;async function m(g){f(!1);const w=await u(g);w!=null&&w.id&&r&&r(w.id)}return l.jsxs("div",{className:"sessions-block","data-testid":"sessions-block",children:[i&&l.jsxs("div",{className:"sblock-new-wrap",children:[l.jsx("button",{className:"sblock-new",onClick:()=>c?f(g=>!g):m("claude"),"data-testid":"sblock-new-chat","aria-haspopup":c?"menu":void 0,"aria-expanded":c?h:void 0,children:"+ New chat"}),h&&l.jsxs("div",{className:"sess-provider-menu","data-testid":"sblock-provider-menu",children:[l.jsx("button",{onClick:()=>m("claude"),"data-testid":"sblock-new-claude",children:"🟣 Claude"}),l.jsx("button",{onClick:()=>m("glm"),"data-testid":"sblock-new-glm",children:"🟦 GLM"})]})]}),l.jsx("div",{className:"sblock-list",children:a&&o.length===0?l.jsx("div",{className:"sess-empty",children:"Loading…"}):o.length===0?l.jsx("div",{className:"sess-empty",children:"No chats yet"}):o.map(g=>{const w=Math.round(Number(g.contextPct)||0);return l.jsxs("div",{className:`sblock-row${g.id===p?" active":""}`,"data-testid":`sblock-session-${g.id}`,children:[l.jsxs("button",{className:"sblock-open",onClick:()=>r&&r(g.id),"data-testid":`sblock-open-${g.id}`,children:[l.jsx("span",{className:"sblock-title",children:ML(g)}),g.live&&l.jsx("span",{className:"session-live-dot","aria-hidden":!0}),l.jsxs("span",{className:"sblock-meta",children:[g.provider==="glm"&&l.jsx("span",{className:"sess-provider",children:"GLM"}),w>=1&&l.jsxs("span",{className:`sess-ctx sess-ctx-${RS(w)}`,children:[w,"%"]})]})]}),i&&g.id!==Jl&&l.jsx("button",{className:"sblock-del",title:"Delete",onClick:async()=>{await d(g.id),g.id===p&&r&&r(Jl)},"data-testid":`sblock-delete-${g.id}`,children:"🗑"})]},g.id)})})]})}const zL=["feature","bug","question","chore","other"],BL=["open","planned","in-progress","done","wont-do"],hv={feature:"✨",bug:"🐞",question:"❓",chore:"🧹",other:"📌"};function $L(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function FL({token:e,canWrite:t=!0}){const[n,r]=b.useState([]),[i,s]=b.useState(!0),[o,a]=b.useState(""),[c,u]=b.useState("feature"),[d,h]=b.useState(!1),f=e?{Authorization:`Bearer ${e}`}:{},p=b.useCallback(async()=>{try{const v=await(await fetch("/api/workspace/tickets",{headers:f})).json().catch(()=>null);v&&Array.isArray(v.tickets)&&r(v.tickets)}catch{}finally{s(!1)}},[e]);b.useEffect(()=>{p();const w=setInterval(p,2e4);return()=>clearInterval(w)},[p]);async function m(){const w=o.trim();if(!(!w||d)){h(!0);try{await fetch("/api/workspace/tickets",{method:"POST",headers:{...f,"content-type":"application/json"},body:JSON.stringify({title:w,category:c})}),a("")}catch{}h(!1),p()}}async function g(w,v){try{await fetch(`/api/workspace/tickets/${encodeURIComponent(w)}`,{method:"PATCH",headers:{...f,"content-type":"application/json"},body:JSON.stringify({status:v})})}catch{}p()}return l.jsxs("div",{className:"requests-block","data-testid":"requests-block",children:[t&&l.jsxs("div",{className:"req-new",children:[l.jsx("input",{className:"req-title",value:o,onChange:w=>a(w.target.value),onKeyDown:w=>{w.key==="Enter"&&m()},placeholder:"Request a feature or report a bug…","data-testid":"req-title",disabled:d}),l.jsx("select",{value:c,onChange:w=>u(w.target.value),"data-testid":"req-category","aria-label":"category",children:zL.map(w=>l.jsxs("option",{value:w,children:[hv[w]," ",w]},w))}),l.jsx("button",{onClick:m,disabled:d||!o.trim(),"data-testid":"req-file",children:"File"})]}),l.jsx("div",{className:"req-list","data-testid":"req-list",children:i&&n.length===0?l.jsx("div",{className:"req-empty",children:"Loading…"}):n.length===0?l.jsx("div",{className:"req-empty",children:"No requests yet. File one above — or just ask your agent for something the workspace is missing, and it can log it for you."}):n.map(w=>l.jsxs("div",{className:`req-row req-status-${w.status}`,"data-testid":`req-row-${w.id}`,children:[l.jsx("span",{className:"req-glyph","aria-hidden":!0,children:hv[w.category]||"📌"}),l.jsxs("span",{className:"req-body",children:[l.jsx("span",{className:"req-row-title",children:w.title}),l.jsxs("span",{className:"req-meta",children:[w.source==="agent"?"filed by your agent":"you"," · ",$L(w.updatedAt||w.createdAt)]})]}),t?l.jsx("select",{className:"req-status-pick",value:w.status,onChange:v=>g(w.id,v.target.value),"data-testid":`req-status-${w.id}`,"aria-label":"status",children:BL.map(v=>l.jsx("option",{value:v,children:v},v))}):l.jsx("span",{className:`req-badge req-badge-${w.status}`,children:w.status})]},w.id))})]})}function HL({onPick:e,onCancel:t,busy:n=!1}){var g,w,v;const[r,i]=b.useState(null),[s,o]=b.useState(null),[a,c]=b.useState(!0),[u,d]=b.useState(null),[h,f]=b.useState("");b.useEffect(()=>{let _=!1;c(!0),d(null);const y=r?`?path=${encodeURIComponent(r)}`:"";return fetch(`/api/lobby/browse${y}`).then(async S=>{const E=await S.json().catch(()=>null);if(!_){if(!S.ok){d((E==null?void 0:E.message)||(E==null?void 0:E.error)||`couldn’t open that folder (HTTP ${S.status})`);return}o(E)}}).catch(S=>{_||d(String((S==null?void 0:S.message)||S))}).finally(()=>{_||c(!1)}),()=>{_=!0}},[r]);const p=()=>{s!=null&&s.path&&!n&&e(s.path)},m=()=>{const _=h.trim();_&&!n&&e(_)};return l.jsxs("div",{"data-testid":"folder-picker",style:WL,children:[((g=s==null?void 0:s.drives)==null?void 0:g.length)>0&&l.jsxs("div",{style:dv,children:[l.jsx("span",{style:UL,children:"This PC"}),s.drives.map(_=>l.jsxs("button",{"data-testid":`fp-drive-${_.name.replace(/[^a-zA-Z0-9]/g,"")}`,onClick:()=>i(_.dir),disabled:n,style:fv,title:_.dir,children:["🖴 ",_.name]},_.dir))]}),((w=s==null?void 0:s.roots)==null?void 0:w.length)>0&&l.jsx("div",{style:dv,children:s.roots.map(_=>l.jsx("button",{"data-testid":`fp-root-${_.name}`,onClick:()=>i(_.dir),disabled:n,style:fv,title:_.dir,children:_.name},_.dir))}),l.jsxs("div",{style:VL,children:[l.jsx("button",{"data-testid":"fp-up",onClick:()=>(s==null?void 0:s.parent)&&i(s.parent),disabled:n||a||!(s!=null&&s.parent),style:qL,title:"Up one folder",children:"⬆"}),l.jsx("span",{"data-testid":"fp-path",style:KL,title:(s==null?void 0:s.path)||"",children:(s==null?void 0:s.path)||"…"})]}),l.jsx("div",{"data-testid":"fp-list",style:YL,children:a?l.jsxs("div",{style:Sh,children:[l.jsx("span",{className:"spinner"})," Loading…"]}):u?l.jsx("div",{"data-testid":"fp-error",style:{...Sh,color:"var(--error)"},children:u}):(v=s==null?void 0:s.entries)!=null&&v.length?s.entries.map(_=>l.jsxs("button",{"data-testid":`fp-entry-${_.name}`,onClick:()=>i(_.dir),disabled:n,style:{...GL,..._.hasWork?JL:{}},title:_.hasWork?`Has your work: ${_.signals.join(", ")}`:_.name,children:[l.jsx("span",{"aria-hidden":!0,children:_.hasWork?"📂":"📁"}),l.jsx("span",{style:XL,children:_.name}),_.hasWork&&l.jsx("span",{"data-testid":`fp-work-${_.name}`,style:ZL,children:_.signals.slice(0,2).join(" · ")})]},_.dir)):l.jsx("div",{style:Sh,children:"No sub-folders here — open this folder, or go up."})}),l.jsxs("div",{style:QL,children:[l.jsx("button",{className:"primary","data-testid":"fp-open-current",onClick:p,disabled:n||a||!(s!=null&&s.path),children:"Open this folder"}),l.jsx("button",{"data-testid":"fp-cancel",onClick:t,disabled:n,children:"Cancel"})]}),l.jsxs("div",{style:{display:"flex",gap:8,marginTop:8},children:[l.jsx("input",{"data-testid":"fp-manual-path",value:h,onChange:_=>f(_.target.value),onKeyDown:_=>{_.key==="Enter"&&m()},placeholder:"…or paste a folder path",style:eA,disabled:n}),l.jsx("button",{"data-testid":"fp-manual-open",onClick:m,disabled:n||!h.trim(),children:"Open"})]})]})}const WL={marginTop:8,padding:12,borderRadius:10,border:"1px solid var(--border)",background:"var(--surface-2, var(--surface, transparent))"},dv={display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,marginBottom:8},UL={fontSize:11,color:"var(--text-muted)",marginRight:2,textTransform:"uppercase",letterSpacing:.4},fv={fontSize:12,padding:"3px 9px",borderRadius:999,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit",cursor:"pointer",whiteSpace:"nowrap"},VL={display:"flex",alignItems:"center",gap:8,marginBottom:6},qL={fontSize:13,lineHeight:1,padding:"4px 8px",borderRadius:8,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit",cursor:"pointer"},KL={fontSize:12,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,direction:"rtl",textAlign:"left"},YL={maxHeight:220,overflowY:"auto",border:"1px solid var(--border)",borderRadius:8,background:"var(--surface, transparent)"},GL={display:"flex",alignItems:"center",gap:8,width:"100%",textAlign:"left",padding:"8px 10px",background:"none",border:"none",borderBottom:"1px solid var(--border)",color:"inherit",font:"inherit",cursor:"pointer"},XL={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},JL={background:"color-mix(in srgb, var(--accent) 8%, transparent)"},ZL={marginLeft:"auto",flex:"none",fontSize:10.5,fontWeight:600,padding:"1px 7px",borderRadius:999,background:"color-mix(in srgb, var(--accent) 16%, transparent)",color:"var(--accent-hot, var(--accent))",whiteSpace:"nowrap"},Sh={padding:"12px 10px",fontSize:13,color:"var(--text-muted)"},QL={display:"flex",gap:8,marginTop:8},eA={flex:1,padding:"8px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit"};function tA(e){var n;const t=(n=e==null?void 0:e.session)==null?void 0:n.source;return t==="localhost"||t==="loopback"}function nA(e){return(String(e||"?").split("@")[0].replace(/[^a-zA-Z0-9]/g,"").slice(0,2)||"?").toUpperCase()}function rA(e){let t=0;const n=String(e||"");for(let r=0;r<n.length;r+=1)t=(t*31+n.charCodeAt(r))%360;return`hsl(${t} 52% 42%)`}function iA(e){if(!e)return"";const t=String(e).split(/[\\/]/).filter(Boolean);return t[t.length-1]||e}function sA({session:e,onEnter:t,onClose:n}){var qe,Oe;const[r,i]=b.useState(null),[s,o]=b.useState(null),[a,c]=b.useState(!1),[u,d]=b.useState(0),[h,f]=b.useState(""),[p,m]=b.useState(!1),[g,w]=b.useState(null),[v,_]=b.useState(null),[y,S]=b.useState(""),[E,k]=b.useState(null),[T,R]=b.useState(null),[O,j]=b.useState(""),[$,L]=b.useState(""),[P,A]=b.useState(null),[D,M]=b.useState(""),[W,N]=b.useState(null),[H,C]=b.useState({}),re=b.useRef(null),Q=tA(e),x=!!((qe=e==null?void 0:e.account)!=null&&qe.email),Y=Q||!!((Oe=e==null?void 0:e.capabilities)!=null&&Oe.fileTree);async function Z(){try{const I=await fetch("/api/lobby/workspaces");if(!I.ok)throw new Error(`HTTP ${I.status}`);const ie=await I.json();i(Array.isArray(ie.workspaces)?ie.workspaces:[])}catch(I){o(String((I==null?void 0:I.message)||I)),i([])}}b.useEffect(()=>{Z()},[]),b.useEffect(()=>{var I;r&&r.length&&((I=re.current)==null||I.focus())},[r]);async function oe(I){if(!(!I||a)){if(I.joinable){ye(I);return}c(!0);try{await fetch(`/api/lobby/workspaces/${encodeURIComponent(I.id)}/open`,{method:"POST"})}catch{}t(I.id)}}async function me({name:I,dir:ie}){if(!a){c(!0),o(null);try{const le=await fetch("/api/lobby/workspaces",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(I?{name:I}:{dir:ie})}),ge=await le.json().catch(()=>null);if(!le.ok){o((ge==null?void 0:ge.message)||(ge==null?void 0:ge.error)||`create failed (HTTP ${le.status})`),c(!1);return}t(ge.workspace.id)}catch(le){o(String((le==null?void 0:le.message)||le)),c(!1)}}}async function Ee(I){if(!a){c(!0),o(null);try{const ie=await fetch(`/api/lobby/workspaces/${encodeURIComponent(I.id)}/share`,{method:"POST"}),le=await ie.json().catch(()=>null);if(!ie.ok){o((le==null?void 0:le.message)||(le==null?void 0:le.error)||`couldn’t share (HTTP ${ie.status})`);return}w(null),await Z(),_(I.id),k(null),S("")}catch(ie){o(String((ie==null?void 0:ie.message)||ie))}finally{c(!1)}}}async function U(I){const ie=y.trim();if(!(!ie||a)){c(!0),k(null);try{const le=await fetch(`/api/lobby/workspaces/${encodeURIComponent(I.id)}/invite`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:ie})}),ge=await le.json().catch(()=>null);if(!le.ok){k({ok:!1,text:(ge==null?void 0:ge.message)||(ge==null?void 0:ge.error)||`invite failed (HTTP ${le.status})`});return}k({ok:!0,text:ge!=null&&ge.pending?`Invited ${ie}. They’ll see this workspace the next time they sign in to VentureWild — just let them know to sign in.`:`${ie} is in — they’ll see this workspace when they sign in.`}),S("")}catch(le){k({ok:!1,text:String((le==null?void 0:le.message)||le)})}finally{c(!1)}}}function ye(I){R(ie=>ie===I.id?null:I.id),j(I.name||""),L(""),o(null)}async function we(I){const ie=W!==I.id;if(N(ie?I.id:null),!(!ie||H[I.id])){C(le=>({...le,[I.id]:{loading:!0,members:[]}}));try{const ge=await(await fetch(`/api/lobby/workspaces/${encodeURIComponent(I.id)}/members`)).json().catch(()=>null);C(He=>({...He,[I.id]:{loading:!1,members:Array.isArray(ge==null?void 0:ge.members)?ge.members:[]}}))}catch{C(le=>({...le,[I.id]:{loading:!1,members:[]}}))}}}b.useEffect(()=>{if(!W)return;const I=W;let ie=!1;const ge=setInterval(async()=>{try{const Pe=await(await fetch(`/api/lobby/workspaces/${encodeURIComponent(I)}/members`)).json().catch(()=>null);if(ie||!Array.isArray(Pe==null?void 0:Pe.members))return;C(Ve=>({...Ve,[I]:{loading:!1,members:Pe.members}}))}catch{}},2e4);return()=>{ie=!0,clearInterval(ge)}},[W]);async function Se(I){var ie;if(!a){c(!0),o(null);try{const le=$.trim(),ge={slug:((ie=I.shared)==null?void 0:ie.slug)||I.slug};le?ge.dir=le:ge.name=O.trim()||I.name;const He=await fetch("/api/lobby/workspaces/join",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(ge)}),Pe=await He.json().catch(()=>null);if(!He.ok){o((Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||`couldn’t join (HTTP ${He.status})`);return}(r||[]).filter(Ze=>!Ze.joinable).length===0&&Y?A({wsId:Pe.workspace.id}):t(Pe.workspace.id)}catch(le){o(String((le==null?void 0:le.message)||le))}finally{c(!1)}}}function fe(I){var ie;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{...yv,...aA},children:[l.jsxs("div",{style:{...vv,cursor:"default"},children:[l.jsx("span",{style:{fontWeight:600},children:I.name}),l.jsx("span",{"data-testid":`lobby-shared-${I.id}`,style:_v,children:"shared"}),l.jsx("span",{style:{flex:1}}),l.jsx("span",{style:{color:"var(--text-muted)",fontSize:12},children:(ie=I.shared)!=null&&ie.ownerEmail?`invited by ${I.shared.ownerEmail}`:"shared with you"})]}),Q?l.jsx("button",{"data-testid":`lobby-join-${I.id}`,onClick:()=>ye(I),disabled:a,style:bl,title:"Save it to a folder on this computer",children:"Join"}):l.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",paddingRight:4},children:"join from your computer"})]}),T===I.id&&l.jsxs("div",{"data-testid":`lobby-join-panel-${I.id}`,style:wl,children:[l.jsxs("p",{style:{margin:"0 0 8px",fontSize:13,lineHeight:1.5},children:["Pick where ",l.jsx("strong",{children:I.name})," lives on this computer — your agent here joins the shared brain."]}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("input",{"data-testid":`lobby-join-name-${I.id}`,value:O,onChange:le=>j(le.target.value),onKeyDown:le=>{le.key==="Enter"&&Se(I)},placeholder:"Folder name…",style:Ao,disabled:a}),l.jsx("button",{className:"primary","data-testid":`lobby-join-confirm-${I.id}`,onClick:()=>Se(I),disabled:a,children:"Join"})]}),l.jsx("input",{"data-testid":`lobby-join-path-${I.id}`,value:$,onChange:le=>L(le.target.value),placeholder:"…or paste an existing folder path",style:{...Ao,marginTop:8,width:"100%"},disabled:a})]})]})}function it(I){!r||!r.length||(I.key==="ArrowDown"?(I.preventDefault(),d(ie=>Math.min(r.length-1,ie+1))):I.key==="ArrowUp"?(I.preventDefault(),d(ie=>Math.max(0,ie-1))):I.key==="Enter"&&(I.preventDefault(),oe(r[u])))}return P?l.jsx("div",{className:"app lobby fd-wallpaper","data-testid":"lobby",style:pv,children:l.jsxs("div",{style:mv,children:[l.jsx("header",{style:{marginBottom:14},children:l.jsxs("span",{className:"fd-brand",children:[l.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]})}),l.jsxs("div",{"data-testid":"lobby-offer-personal",style:gv,children:[l.jsx("div",{style:{fontSize:26,marginBottom:6},children:"🎉"}),l.jsx("p",{style:{margin:"0 0 4px",fontSize:16,fontWeight:650},children:"You’re in!"}),l.jsx("p",{style:{margin:"0 0 12px",color:"var(--text-muted)",fontSize:13,lineHeight:1.5},children:"Want a workspace of your own too? Your agent can build you anything from scratch — it’s yours, separate from the one you just joined."}),l.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[l.jsx("input",{"data-testid":"lobby-offer-name",value:D,onChange:I=>M(I.target.value),onKeyDown:I=>{I.key==="Enter"&&D.trim()&&me({name:D.trim()})},placeholder:"Name your own workspace…",style:{...Ao,flex:1},disabled:a}),l.jsx("button",{className:"primary","data-testid":"lobby-offer-create",onClick:()=>D.trim()&&me({name:D.trim()}),disabled:a||!D.trim(),children:"Create mine"})]}),s&&l.jsx("p",{"data-testid":"lobby-error",style:{color:"var(--error)",fontSize:13,margin:"10px 0 0"},children:s}),l.jsx("button",{"data-testid":"lobby-offer-skip",onClick:()=>t(P.wsId),style:{marginTop:12,background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:13},disabled:a,children:"Not now — take me to the shared workspace →"})]})]})}):l.jsx("div",{className:"app lobby fd-wallpaper","data-testid":"lobby",style:pv,children:l.jsxs("div",{style:mv,children:[l.jsxs("header",{style:{marginBottom:18},children:[l.jsx("div",{style:{marginBottom:12},children:l.jsxs("span",{className:"fd-brand",children:[l.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]})}),l.jsx("h1",{style:{margin:0,fontSize:22},children:"Your workspaces"}),l.jsxs("p",{style:{margin:"6px 0 0",color:"var(--text-muted)",fontSize:13},children:["Pick one to dive in",Q?", or start a new one":"",". Each keeps its own files and its own agent."]})]}),s&&l.jsx("p",{"data-testid":"lobby-error",style:{color:"var(--error)",fontSize:13},children:s}),r===null?l.jsxs("div",{style:{color:"var(--text-muted)",padding:12},children:[l.jsx("span",{className:"spinner"})," Loading…"]}):r.length===0?l.jsxs("div",{"data-testid":"lobby-empty",style:gv,children:[l.jsx("div",{style:{fontSize:26,marginBottom:6},children:"✦"}),l.jsx("p",{style:{margin:"0 0 4px",fontSize:16,fontWeight:600},children:Q?"Let's create your first workspace":"No workspaces here yet"}),l.jsx("p",{style:{margin:0,color:"var(--text-muted)",fontSize:13,lineHeight:1.5},children:Q?"A workspace is just a folder your agent works in. Name one below — your agent meets you inside.":"Create one on your computer to get started; its files live there."})]}):l.jsx("ul",{ref:re,tabIndex:0,onKeyDown:it,"data-testid":"lobby-list",style:{listStyle:"none",margin:0,padding:0,outline:"none"},children:r.map((I,ie)=>{var le,ge,He,Pe;return l.jsx("li",{children:I.joinable?fe(I):l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{...yv,...ie===u?oA:null},children:[l.jsxs("button",{"data-testid":`lobby-card-${I.id}`,onClick:()=>{d(ie),oe(I)},disabled:a,style:vv,children:[l.jsx("span",{style:{fontWeight:600},children:I.name}),I.isDefault&&l.jsx("span",{style:lA,children:"default"}),I.kind==="shared"&&l.jsx("span",{"data-testid":`lobby-shared-${I.id}`,style:_v,children:"shared"}),I.kind==="shared"&&l.jsx("span",{"data-testid":`lobby-sync-${I.id}`,style:(le=I.shared)!=null&&le.projectCode?PS:cA,title:(ge=I.shared)!=null&&ge.projectCode?"Files replicate to teammates via VentureWild":"File sync starts when this computer’s sync service is online",children:(He=I.shared)!=null&&He.projectCode?"⟳ synced":"sync pending"}),l.jsx("span",{style:{flex:1}}),l.jsxs("span",{style:{color:"var(--text-muted)",fontSize:12},title:I.dir,children:["📁 ",iA(I.dir)]})]}),Q&&x&&I.kind!=="shared"&&l.jsx("button",{"data-testid":`lobby-share-${I.id}`,onClick:()=>{w(I.id),_(null)},disabled:a,style:bl,title:"Make this a shared workspace",children:"Share"}),Q&&x&&I.kind==="shared"&&((Pe=I.shared)==null?void 0:Pe.role)==="owner"&&l.jsx("button",{"data-testid":`lobby-invite-toggle-${I.id}`,onClick:()=>{_(Ve=>Ve===I.id?null:I.id),k(null)},disabled:a,style:bl,title:"Invite a teammate",children:"+ Invite"}),x&&I.kind==="shared"&&l.jsx("button",{"data-testid":`lobby-members-toggle-${I.id}`,onClick:()=>we(I),disabled:a,style:bl,title:"See who's in this workspace",children:"Members"})]}),W===I.id&&I.kind==="shared"&&l.jsx("div",{"data-testid":`lobby-roster-${I.id}`,style:wl,children:(()=>{const Ve=H[I.id];return!Ve||Ve.loading?l.jsx("p",{style:bv,children:"Loading members…"}):Ve.members.length?l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Ve.members.map((Ze,ut)=>{const F=Ze.status==="invited",G=!F&&!!Ze.online;return l.jsxs("div",{"data-testid":`lobby-roster-member-${I.id}-${ut}`,style:{display:"flex",alignItems:"center",gap:8},children:[l.jsxs("span",{style:{position:"relative",display:"inline-flex"},children:[l.jsx("span",{"aria-hidden":!0,style:{...hA,background:rA(Ze.email),opacity:F?.5:G?1:.55},children:nA(Ze.email)}),G&&l.jsx("span",{"aria-hidden":!0,"data-testid":`lobby-roster-online-${I.id}-${ut}`,style:dA})]}),l.jsx("span",{style:uA,children:Ze.email}),l.jsx("span",{style:F?gA:Ze.role==="owner"?pA:mA,children:F?"invited":Ze.role}),G&&l.jsx("span",{style:fA,title:"Active now",children:"online"})]},Ze.account_id||Ze.email||ut)})}):l.jsx("p",{style:bv,children:"Just you so far — invite a teammate to grow the team."})})()}),g===I.id&&l.jsxs("div",{"data-testid":`lobby-share-prompt-${I.id}`,style:wl,children:[l.jsxs("p",{style:{margin:"0 0 8px",fontSize:13,lineHeight:1.5},children:["Make ",l.jsx("strong",{children:I.name})," a shared workspace? Teammates you invite become ",l.jsx("strong",{children:"equal members"})," — they get the files ",l.jsx("strong",{children:"and"})," ","everything your agent has learned about this work. That shared memory is the point."]}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{className:"primary","data-testid":`lobby-share-confirm-${I.id}`,onClick:()=>Ee(I),disabled:a,children:"Share it"}),l.jsx("button",{onClick:()=>w(null),disabled:a,children:"Cancel"})]})]}),v===I.id&&I.kind==="shared"&&l.jsxs("div",{"data-testid":`lobby-invite-${I.id}`,style:wl,children:[l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("input",{"data-testid":`lobby-invite-email-${I.id}`,type:"email",value:y,onChange:Ve=>S(Ve.target.value),onKeyDown:Ve=>{Ve.key==="Enter"&&y.trim()&&U(I)},placeholder:"teammate@email.com",style:Ao,disabled:a}),l.jsx("button",{className:"primary","data-testid":`lobby-invite-send-${I.id}`,onClick:()=>U(I),disabled:a||!y.trim(),children:"Send invite"})]}),E&&l.jsx("p",{"data-testid":`lobby-invite-msg-${I.id}`,style:{margin:"8px 0 0",fontSize:12,color:E.ok?"var(--accent, #0891b2)":"var(--error)"},children:E.text})]})]})},I.id)})}),Y&&l.jsxs("div",{style:{marginTop:18,borderTop:"1px solid var(--border)",paddingTop:16},children:[l.jsxs("div",{style:{marginBottom:4},children:[l.jsx("div",{style:{fontSize:15,fontWeight:650,color:"var(--text)"},children:"Pick up where you left off"}),l.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginTop:2},children:"Open a folder you’ve already been working in — your agent reads what’s there and continues. We never change your files."})]}),p?l.jsx(HL,{onPick:I=>I&&me({dir:I}),onCancel:()=>m(!1),busy:a}):l.jsx("button",{className:"primary","data-testid":"lobby-open-toggle",onClick:()=>m(!0),style:{marginTop:8,width:"100%"},disabled:a,children:"📂 Open a folder with your work"}),l.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginTop:14},children:[l.jsx("span",{style:{fontSize:12.5,color:"var(--text-muted)",flex:"none"},children:"or start fresh:"}),l.jsx("input",{"data-testid":"lobby-new-name",value:h,onChange:I=>f(I.target.value),onKeyDown:I=>{I.key==="Enter"&&h.trim()&&me({name:h.trim()})},placeholder:"Name a new workspace…",style:{...Ao,flex:1},disabled:a}),l.jsx("button",{"data-testid":"lobby-create",onClick:()=>h.trim()&&me({name:h.trim()}),disabled:a||!h.trim(),children:"+ New"})]})]}),n&&l.jsx("div",{style:{marginTop:18},children:l.jsx("button",{"data-testid":"lobby-close",onClick:n,children:"← Back to my workspace"})})]})})}const pv={display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"10vh 16px",height:"100%",overflow:"auto"},mv={width:"100%",maxWidth:640,background:"var(--surface)",border:"1px solid var(--border)",borderRadius:"var(--r-xl)",boxShadow:"var(--shadow-lg)",padding:"28px 32px"},gv={textAlign:"center",padding:"20px 16px 24px",border:"1px dashed var(--border)",borderRadius:12,marginBottom:8},yv={display:"flex",alignItems:"center",gap:8,width:"100%",marginBottom:8,borderRadius:10,border:"1px solid var(--border)",background:"var(--surface, transparent)",boxShadow:"var(--shadow-sm)",paddingRight:10},vv={display:"flex",alignItems:"center",gap:10,flex:1,minWidth:0,textAlign:"left",padding:"12px 14px",background:"none",border:"none",borderRadius:10,color:"inherit",font:"inherit",cursor:"pointer"},oA={border:"1px solid var(--accent, #4a90d9)",boxShadow:"0 0 0 1px var(--accent, #4a90d9)"},aA={borderStyle:"dashed"},lA={fontSize:11,padding:"1px 6px",borderRadius:6,border:"1px solid var(--border)",color:"var(--text-muted)"},_v={fontSize:11,padding:"1px 6px",borderRadius:6,border:"1px solid var(--accent, #0891b2)",color:"var(--accent, #0891b2)"},PS={fontSize:11,padding:"1px 6px",borderRadius:6,color:"var(--text-muted)"},cA={...PS,fontStyle:"italic",opacity:.75},bl={fontSize:12,padding:"5px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit",cursor:"pointer",whiteSpace:"nowrap"},wl={margin:"-2px 0 10px",padding:"10px 12px",borderRadius:10,border:"1px solid var(--border)",background:"var(--surface-2, var(--surface, transparent))"},Ao={flex:1,padding:"8px 10px",borderRadius:8,border:"1px solid var(--border)",background:"var(--surface, transparent)",color:"inherit"},bv={margin:0,fontSize:12,color:"var(--text-muted)"},uA={fontSize:13,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},hA={display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:999,flexShrink:0,fontSize:10,fontWeight:700,color:"#fff",letterSpacing:.3},dA={position:"absolute",right:-1,bottom:-1,width:8,height:8,borderRadius:999,background:"#22c55e",border:"1.5px solid var(--surface, #fff)"},fA={fontSize:10,color:"#16a34a",fontWeight:600,whiteSpace:"nowrap"},mm={fontSize:10,padding:"1px 6px",borderRadius:6,whiteSpace:"nowrap"},pA={...mm,border:"1px solid var(--accent, #0891b2)",color:"var(--accent, #0891b2)"},mA={...mm,border:"1px solid var(--border)",color:"var(--text-muted)"},gA={...mm,border:"1px dashed var(--border)",color:"var(--text-muted)",fontStyle:"italic"};function fs(e){const{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function Er(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function xl(e,t,n,r,i,s,o){const{margin:a,containerPadding:c,rowHeight:u}=e,d=fs(e);let h,f,p,m;if(o?(h=Math.round(o.width),f=Math.round(o.height)):(h=Er(r,d,a[0]),f=Er(i,u,a[1])),s?(p=Math.round(s.top),m=Math.round(s.left)):o?(p=Math.round(o.top),m=Math.round(o.left)):(p=Math.round((u+a[1])*n+c[1]),m=Math.round((d+a[0])*t+c[0])),!s&&!o){if(Number.isFinite(r)){const w=Math.round((d+a[0])*(t+r)+c[0])-m-h;w!==a[0]&&(h+=w-a[0])}if(Number.isFinite(i)){const w=Math.round((u+a[1])*(n+i)+c[1])-p-f;w!==a[1]&&(f+=w-a[1])}}return{top:p,left:m,width:h,height:f}}function yA(e,t,n,r,i){const{margin:s,containerPadding:o,cols:a,rowHeight:c,maxRows:u}=e,d=fs(e);let h=Math.round((n-o[0])/(d+s[0])),f=Math.round((t-o[1])/(c+s[1]));return h=zc(h,0,a-r),f=zc(f,0,u-i),{x:h,y:f}}function Sl(e,t,n){const{margin:r,containerPadding:i,rowHeight:s}=e,o=fs(e),a=Math.round((n-i[0])/(o+r[0])),c=Math.round((t-i[1])/(s+r[1]));return{x:a,y:c}}function vA(e,t,n){const{margin:r,rowHeight:i}=e,s=fs(e),o=Math.max(1,Math.round((t+r[0])/(s+r[0]))),a=Math.max(1,Math.round((n+r[1])/(i+r[1])));return{w:o,h:a}}function zc(e,t,n){return Math.max(Math.min(e,n),t)}function gm(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function ss(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r!==void 0&&gm(r,t))return r}}function DS(e,t){return e.filter(n=>gm(n,t))}function _A(e,t){return t==="horizontal"?LS(e):t==="vertical"||t==="wrap"?af(e):[...e]}function af(e){return[...e].sort((t,n)=>t.y!==n.y?t.y-n.y:t.x-n.x)}function LS(e){return[...e].sort((t,n)=>t.x!==n.x?t.x-n.x:t.y-n.y)}function wu(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(r!==void 0){const i=r.y+r.h;i>t&&(t=i)}}return t}function Yi(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r!==void 0&&r.i===t)return r}}function xu(e){return e.filter(t=>t.static===!0)}function ps(e){return{i:e.i,x:e.x,y:e.y,w:e.w,h:e.h,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,constraints:e.constraints,isBounded:e.isBounded}}function Li(e){const t=new Array(e.length);for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&(t[n]=ps(r))}return t}function bA(e,t){const n=new Array(e.length);for(let r=0;r<e.length;r++){const i=e[r];i!==void 0&&(t.i===i.i?n[r]=t:n[r]=i)}return n}function wA(e,t,n){let r=Yi(e,t);return r?(r=n(ps(r)),[bA(e,r),r]):[[...e],null]}function ym(e,t){const n=xu(e);for(let r=0;r<e.length;r++){const i=e[r];if(i!==void 0)if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;ss(n,i);)i.y++}return e}function ts(e,t,n,r,i,s,o,a,c){if(t.static&&t.isDraggable!==!0)return[...e];if(t.y===r&&t.x===n)return[...e];const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=_A(e,o);(o==="vertical"&&typeof r=="number"?d>=r:o==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const p=DS(h,t),m=p.length>0;if(m&&c)return Li(e);if(m&&s)return t.x=u,t.y=d,t.moved=!1,e;let g=[...e];for(let w=0;w<p.length;w++){const v=p[w];v!==void 0&&(v.moved||(v.static?g=wv(g,v,t,i,o):g=wv(g,t,v,i,o)))}return g}function wv(e,t,n,r,i,s){const o=i==="horizontal",a=i==="vertical",c=t.static;if(r){r=!1;const h={x:o?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},f=ss(e,h),p=f!==void 0&&f.y+f.h>t.y,m=f!==void 0&&t.x+t.w>f.x;if(!f)return ts(e,n,o?h.x:void 0,a?h.y:void 0,r,c,i);if(p&&a)return ts(e,n,void 0,n.y+1,r,c,i);if(p&&i===null)return t.y=n.y,n.y=n.y+n.h,[...e];if(m&&o)return ts(e,t,n.x,void 0,r,c,i)}const u=o?n.x+1:void 0,d=a?n.y+1:void 0;return u===void 0&&d===void 0?[...e]:ts(e,n,u,d,r,c,i)}function Ks(e,t,n){return Math.max(t,Math.min(n,e))}var xA={name:"gridBounds",constrainPosition(e,t,n,{cols:r,maxRows:i}){return{x:Ks(t,0,Math.max(0,r-e.w)),y:Ks(n,0,Math.max(0,i-e.h))}},constrainSize(e,t,n,r,{cols:i,maxRows:s}){const o=r==="w"||r==="nw"||r==="sw"?e.x+e.w:i-e.x,a=r==="n"||r==="nw"||r==="ne"?e.y+e.h:s-e.y;return{w:Ks(t,1,Math.max(1,o)),h:Ks(n,1,Math.max(1,a))}}},SA={name:"minMaxSize",constrainSize(e,t,n){return{w:Ks(t,e.minW??1,e.maxW??1/0),h:Ks(n,e.minH??1,e.maxH??1/0)}}},AS=[xA,SA];function kl(e,t,n,r,i){let s={x:n,y:r};for(const o of e)o.constrainPosition&&(s=o.constrainPosition(t,s.x,s.y,i));if(t.constraints)for(const o of t.constraints)o.constrainPosition&&(s=o.constrainPosition(t,s.x,s.y,i));return s}function kA(e,t,n,r,i,s){let o={w:n,h:r};for(const a of e)a.constrainSize&&(o=a.constrainSize(t,o.w,o.h,i,s));if(t.constraints)for(const a of t.constraints)a.constrainSize&&(o=a.constrainSize(t,o.w,o.h,i,s));return o}function vm({top:e,left:t,width:n,height:r}){const i=`translate(${t}px,${e}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${n}px`,height:`${r}px`,position:"absolute"}}function IS({top:e,left:t,width:n,height:r}){return{top:`${e}px`,left:`${t}px`,width:`${n}px`,height:`${r}px`,position:"absolute"}}function xv(e){return e*100+"%"}function CA(e,t,n,r){return e+n>r?t:n}function MS(e,t,n){return e<0?t:n}function EA(e){return Math.max(0,e)}function Bc(e){return Math.max(0,e)}var _m=(e,t,n)=>{const{left:r,height:i,width:s}=t,o=e.top-(i-e.height);return{left:r,width:s,height:MS(o,e.height,i),top:Bc(o)}},bm=(e,t,n)=>{const{top:r,left:i,height:s,width:o}=t;return{top:r,height:s,width:CA(e.left,e.width,o,n),left:EA(i)}},wm=(e,t,n)=>{const{top:r,height:i,width:s}=t,o=e.left+e.width-s;return o<0?{height:i,width:e.left+e.width,top:Bc(r),left:0}:{height:i,width:s,top:Bc(r),left:o}},xm=(e,t,n)=>{const{top:r,left:i,height:s,width:o}=t;return{width:o,left:i,height:MS(r,e.height,s),top:Bc(r)}},NA=(e,t,n)=>_m(e,bm(e,t,n)),jA=(e,t,n)=>_m(e,wm(e,t)),RA=(e,t,n)=>xm(e,bm(e,t,n)),TA=(e,t,n)=>xm(e,wm(e,t)),PA={n:_m,ne:NA,e:bm,se:RA,s:xm,sw:TA,w:wm,nw:jA};function DA(e,t,n,r){const i=PA[e];return i?i(t,{...t,...n},r):n}var OS={type:"transform",scale:1,calcStyle(e){return vm(e)}},LA={type:"absolute",scale:1,calcStyle(e){return IS(e)}};function AA(e){return{type:"transform",scale:e,calcStyle(t){return vm(t)},calcDragPosition(t,n,r,i){return{left:(t-r)/e,top:(n-i)/e}}}}var IA=OS,MA={cols:12,rowHeight:150,margin:[10,10],containerPadding:null,maxRows:1/0},OA={enabled:!0,bounded:!1,threshold:3},zA={enabled:!0,handles:["se"]},BA={enabled:!1,defaultItem:{w:1,h:1}};function Sm(e,t,n,r,i){const s=r==="x"?"w":"h";t[r]+=1;const o=e.findIndex(c=>c.i===t.i),a=i??xu(e).length>0;for(let c=o+1;c<e.length;c++){const u=e[c];if(u!==void 0&&!u.static){if(!a&&u.y>t.y+t.h)break;gm(t,u)&&Sm(e,u,n+t[s],r,a)}}t[r]=n}function $A(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0),t.y=Math.min(r,t.y);t.y>0&&!ss(e,t);)t.y--;let i;for(;(i=ss(e,t))!==void 0;)Sm(n,t,i.y+i.h,"y");return t.y=Math.max(t.y,0),t}function FA(e,t,n,r){for(t.x=Math.max(t.x,0),t.y=Math.max(t.y,0);t.x>0&&!ss(e,t);)t.x--;let i;for(;(i=ss(e,t))!==void 0;)if(Sm(r,t,i.x+i.w,"x"),t.x+t.w>n)for(t.x=n-t.w,t.y++;t.x>0&&!ss(e,t);)t.x--;return t.x=Math.max(t.x,0),t}var zS={type:"vertical",allowOverlap:!1,compact(e,t){const n=xu(e);let r=wu(n);const i=af(e),s=new Array(e.length);for(let o=0;o<i.length;o++){const a=i[o];if(a===void 0)continue;let c=ps(a);c.static||(c=$A(n,c,i,r),r=Math.max(r,c.y+c.h),n.push(c));const u=e.indexOf(a);s[u]=c,c.moved=!1}return s}},BS={type:"horizontal",allowOverlap:!1,compact(e,t){const n=xu(e),r=LS(e),i=new Array(e.length);for(let s=0;s<r.length;s++){const o=r[s];if(o===void 0)continue;let a=ps(o);a.static||(a=FA(n,a,t,r),n.push(a));const c=e.indexOf(o);i[c]=a,a.moved=!1}return i}},$S={type:null,allowOverlap:!1,compact(e,t){return Li(e)}},HA={...zS,allowOverlap:!0,compact(e,t){return Li(e)}},WA={...BS,allowOverlap:!0,compact(e,t){return Li(e)}},UA={...$S,allowOverlap:!0};function Su(e,t=!1,n=!1){let r;return t?e==="vertical"?r=HA:e==="horizontal"?r=WA:r=UA:e==="vertical"?r=zS:e==="horizontal"?r=BS:r=$S,n?{...r,preventCollision:n}:r}function FS(e){return Object.keys(e).sort((n,r)=>e[n]-e[r])}function Sv(e,t){const n=FS(e);let r=n[0];if(r===void 0)throw new Error("No breakpoints defined");for(let i=1;i<n.length;i++){const s=n[i];if(s===void 0)continue;const o=e[s];t>o&&(r=s)}return r}function kv(e,t){const n=t[e];if(n===void 0)throw new Error(`ResponsiveReactGridLayout: \`cols\` entry for breakpoint ${String(e)} is missing!`);return n}function kh(e,t,n,r,i,s){const o=e[n];if(o)return Li(o);let a=e[r];const c=FS(t),u=c.slice(c.indexOf(n));for(let p=0;p<u.length;p++){const m=u[p];if(m===void 0)continue;const g=e[m];if(g){a=g;break}}const d=Li(a||[]),h=ym(d,{cols:i});return(typeof s=="object"&&s!==null?s:Su(s)).compact(h,i)}function Cl(e,t){if(Array.isArray(e))return e;const n=e,r=n[t];if(r!==void 0)return r;const i=Object.keys(n);for(const s of i){const o=n[s];if(o!==void 0)return o}return[10,10]}var HS={exports:{}},VA="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",qA=VA,KA=qA;function WS(){}function US(){}US.resetWarningCache=WS;var YA=function(){function e(r,i,s,o,a,c){if(c!==KA){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:US,resetWarningCache:WS};return n.PropTypes=n,n};HS.exports=YA();var km=HS.exports;const Me=za(km);var GA={};function lf(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function Cv(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Ko(e){return typeof e=="number"&&!isNaN(e)}function fn(e){return parseInt(e,10)}function ro(e,t,n){if(e[t])return new Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var Ch=["Moz","Webkit","O","ms"];function XA(e="transform"){var t,n;if(typeof window>"u")return"";const r=(n=(t=window.document)==null?void 0:t.documentElement)==null?void 0:n.style;if(!r||e in r)return"";for(let i=0;i<Ch.length;i++)if(VS(e,Ch[i])in r)return Ch[i];return""}function VS(e,t){return t?`${t}${JA(e)}`:e}function JA(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):e[r]==="-"?n=!0:t+=e[r];return t}var ZA=XA(),Eh="";function QA(e,t){var n;Eh||(Eh=(n=lf(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(i){return Cv(e[i])}))!=null?n:"");const r=e[Eh];return Cv(r)?!!r.call(e,t):!1}function Ev(e,t,n){let r=e;do{if(QA(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function Nh(e,t,n,r){if(!e)return;const i={capture:!0,...r},s=n;e.addEventListener?e.addEventListener(t,s,i):e.attachEvent?e.attachEvent("on"+t,s):e["on"+t]=s}function Wi(e,t,n,r){if(!e)return;const i={capture:!0,...r},s=n;e.removeEventListener?e.removeEventListener(t,s,i):e.detachEvent?e.detachEvent("on"+t,s):e["on"+t]=null}function eI(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=fn(n.borderTopWidth),t+=fn(n.borderBottomWidth),t}function tI(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=fn(n.borderLeftWidth),t+=fn(n.borderRightWidth),t}function nI(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=fn(n.paddingTop),t-=fn(n.paddingBottom),t}function rI(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=fn(n.paddingLeft),t-=fn(n.paddingRight),t}function iI(e,t,n){const i=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),s=(e.clientX+t.scrollLeft-i.left)/n,o=(e.clientY+t.scrollTop-i.top)/n;return{x:s,y:o}}function sI(e,t){const n=qS(e,t,"px");return{[VS("transform",ZA)]:n}}function oI(e,t){return qS(e,t,"")}function qS({x:e,y:t},n,r){let i=`translate(${e}${r},${t}${r})`;if(n){const s=`${typeof n.x=="string"?n.x:n.x+r}`,o=`${typeof n.y=="string"?n.y:n.y+r}`;i=`translate(${s}, ${o})`+i}return i}function aI(e,t){return e.targetTouches&&lf(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&lf(e.changedTouches,n=>t===n.identifier)}function lI(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function cI(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
90
|
+
`,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
91
|
+
`,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&uI(e.body,"react-draggable-transparent-selection")}function Nv(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{jv(e)}):jv(e)}function jv(e){if(e)try{e.body&&hI(e.body,"react-draggable-transparent-selection");const t=e.selection;if(t)t.empty();else{const n=(e.defaultView||window).getSelection();n&&n.type!=="Caret"&&n.removeAllRanges()}}catch{}}function uI(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function hI(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g"),"")}function dI(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r=="string"?r:mI(r);const i=Cm(e);if(typeof r=="string"){const{ownerDocument:s}=i,o=s.defaultView;if(!o)throw new Error("Cannot resolve the owner window of the draggable node.");let a;if(r==="parent"?a=i.parentNode:a=i.getRootNode().querySelector(r),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const c=a,u=o.getComputedStyle(i),d=o.getComputedStyle(c);r={left:-i.offsetLeft+fn(d.paddingLeft)+fn(u.marginLeft),top:-i.offsetTop+fn(d.paddingTop)+fn(u.marginTop),right:rI(c)-tI(i)-i.offsetLeft+fn(d.paddingRight)-fn(u.marginRight),bottom:nI(c)-eI(i)-i.offsetTop+fn(d.paddingBottom)-fn(u.marginBottom)}}return Ko(r.right)&&(t=Math.min(t,r.right)),Ko(r.bottom)&&(n=Math.min(n,r.bottom)),Ko(r.left)&&(t=Math.max(t,r.left)),Ko(r.top)&&(n=Math.max(n,r.top)),[t,n]}function Rv(e,t,n){const r=Math.round(t/e[0])*e[0],i=Math.round(n/e[1])*e[1];return[r,i]}function fI(e){return e.props.axis==="both"||e.props.axis==="x"}function pI(e){return e.props.axis==="both"||e.props.axis==="y"}function jh(e,t,n){const r=typeof t=="number"?aI(e,t):null;if(typeof t=="number"&&!r)return null;const i=Cm(n),s=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return iI(r||e,s,n.props.scale)}function Rh(e,t,n){const r=!Ko(e.lastX),i=Cm(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function Th(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function mI(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function Cm(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}function Nr(...e){GA.DRAGGABLE_DEBUG&&console.log(...e)}var cr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},ci=cr.mouse,zi=class extends b.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button=="number"&&e.button!==0||e.ctrlKey))return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!Ev(e.target,this.props.handle,t)||this.props.cancel&&Ev(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const r=lI(e);this.touchIdentifier=r;const i=jh(e,r,this);if(i==null)return;const{x:s,y:o}=i,a=Rh(this,s,o);Nr("DraggableCore: handleDragStart: %j",a),Nr("calling",this.props.onStart),!(this.props.onStart(e,a)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&cI(n),this.dragging=!0,this.lastX=s,this.lastY=o,Nh(n,ci.move,this.handleDrag),Nh(n,ci.stop,this.handleDragStop))},this.handleDrag=e=>{const t=jh(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let o=n-this.lastX,a=r-this.lastY;if([o,a]=Rv(this.props.grid,o,a),!o&&!a)return;n=this.lastX+o,r=this.lastY+a}const i=Rh(this,n,r);if(Nr("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const o=document.createEvent("MouseEvents");o.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(o)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;const t=jh(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let a=n-this.lastX||0,c=r-this.lastY||0;[a,c]=Rv(this.props.grid,a,c),n=this.lastX+a,r=this.lastY+c}const i=Rh(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const o=this.findDOMNode();o&&this.props.enableUserSelectHack&&Nv(o.ownerDocument),Nr("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,o&&(Nr("DraggableCore: Removing handlers"),Wi(o.ownerDocument,ci.move,this.handleDrag),Wi(o.ownerDocument,ci.stop,this.handleDragStop))},this.onMouseDown=e=>(ci=cr.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(ci=cr.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(ci=cr.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(ci=cr.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&Nh(e,cr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;Wi(t,cr.mouse.move,this.handleDrag),Wi(t,cr.touch.move,this.handleDrag),Wi(t,cr.mouse.stop,this.handleDragStop),Wi(t,cr.touch.stop,this.handleDragStop),Wi(e,cr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&Nv(t)}}findDOMNode(){var e;if((e=this.props)!=null&&e.nodeRef)return this.props.nodeRef.current;const t=fx;return typeof t.findDOMNode=="function"?t.findDOMNode(this):(Nr("react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef"),null)}render(){return b.cloneElement(b.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};zi.displayName="DraggableCore";zi.propTypes={allowAnyClick:Me.bool,allowMobileScroll:Me.bool,children:Me.node.isRequired,disabled:Me.bool,enableUserSelectHack:Me.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Me.arrayOf(Me.number),handle:Me.string,cancel:Me.string,nodeRef:Me.object,onStart:Me.func,onDrag:Me.func,onStop:Me.func,onMouseDown:Me.func,scale:Me.number,className:ro,style:ro,transform:ro};zi.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var ku=class extends b.Component{constructor(e){super(e),this.onDragStart=(t,n)=>{if(Nr("Draggable: onDragStart: %j",n),this.props.onStart(t,Th(this,n))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(t,n)=>{if(!this.state.dragging)return!1;Nr("Draggable: onDrag: %j",n);const r=Th(this,n),i={x:r.x,y:r.y,slackX:0,slackY:0};if(this.props.bounds){const{x:o,y:a}=i;i.x+=this.state.slackX,i.y+=this.state.slackY;const[c,u]=dI(this,i.x,i.y);i.x=c,i.y=u,i.slackX=this.state.slackX+(o-i.x),i.slackY=this.state.slackY+(a-i.y),r.x=i.x,r.y=i.y,r.deltaX=i.x-this.state.x,r.deltaY=i.y-this.state.y}if(this.props.onDrag(t,r)===!1)return!1;this.setState(i)},this.onDragStop=(t,n)=>{if(!this.state.dragging||this.props.onStop(t,Th(this,n))===!1)return!1;Nr("Draggable: onDragStop: %j",n);const i={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:o,y:a}=this.props.position;i.x=o,i.y=a}this.setState(i)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Nr("Draggable: getDerivedStateFromProps %j",{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var e;if((e=this.props)!=null&&e.nodeRef)return this.props.nodeRef.current;const t=fx;return typeof t.findDOMNode=="function"?t.findDOMNode(this):null}render(){const{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:s,defaultClassNameDragged:o,position:a,positionOffset:c,scale:u,...d}=this.props;let h={},f=null;const m=!!!a||this.state.dragging,g=a||r,w={x:fI(this)&&m?this.state.x:g.x,y:pI(this)&&m?this.state.y:g.y};this.state.isElementSVG?f=oI(w,c):h=sI(w,c);const v=b.Children.only(n),_=_o(v.props.className||"",i,{[s]:this.state.dragging,[o]:this.state.dragged});return b.createElement(zi,{...d,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},b.cloneElement(v,{className:_,style:{...v.props.style,...h},transform:f}))}};ku.displayName="Draggable";ku.propTypes={...zi.propTypes,axis:Me.oneOf(["both","x","y","none"]),bounds:Me.oneOfType([Me.shape({left:Me.number,right:Me.number,top:Me.number,bottom:Me.number}),Me.string,Me.oneOf([!1])]),defaultClassName:Me.string,defaultClassNameDragging:Me.string,defaultClassNameDragged:Me.string,defaultPosition:Me.shape({x:Me.number,y:Me.number}),positionOffset:Me.shape({x:Me.oneOfType([Me.number,Me.string]),y:Me.oneOfType([Me.number,Me.string])}),position:Me.shape({x:Me.number,y:Me.number}),className:ro,style:ro,transform:ro};ku.defaultProps={...zi.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1};var gI=ku;const yI=Object.freeze(Object.defineProperty({__proto__:null,DraggableCore:zi,default:gI},Symbol.toStringTag,{value:"Module"}));var Em={exports:{}},Ka={};const vI=fk(yI);var Nm={};Nm.__esModule=!0;Nm.cloneElement=kI;var _I=bI(b);function bI(e){return e&&e.__esModule?e:{default:e}}function Tv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tv(Object(n),!0).forEach(function(r){wI(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wI(e,t,n){return(t=xI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xI(e){var t=SI(e,"string");return typeof t=="symbol"?t:t+""}function SI(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kI(e,t){return t.style&&e.props.style&&(t.style=Pv(Pv({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),_I.default.cloneElement(e,t)}var Ya={};Ya.__esModule=!0;Ya.resizableProps=void 0;var Ie=CI(km);function CI(e){return e&&e.__esModule?e:{default:e}}Ya.resizableProps={axis:Ie.default.oneOf(["both","x","y","none"]),className:Ie.default.string,children:Ie.default.element.isRequired,draggableOpts:Ie.default.shape({allowAnyClick:Ie.default.bool,cancel:Ie.default.string,children:Ie.default.node,disabled:Ie.default.bool,enableUserSelectHack:Ie.default.bool,offsetParent:typeof Element<"u"?Ie.default.instanceOf(Element):Ie.default.any,grid:Ie.default.arrayOf(Ie.default.number),handle:Ie.default.string,nodeRef:Ie.default.object,onStart:Ie.default.func,onDrag:Ie.default.func,onStop:Ie.default.func,onMouseDown:Ie.default.func,scale:Ie.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t[0];return r.axis==="both"||r.axis==="y"?Ie.default.number.isRequired(...t):Ie.default.number(...t)},handle:Ie.default.oneOfType([Ie.default.node,Ie.default.func]),handleSize:Ie.default.arrayOf(Ie.default.number),lockAspectRatio:Ie.default.bool,maxConstraints:Ie.default.arrayOf(Ie.default.number),minConstraints:Ie.default.arrayOf(Ie.default.number),onResizeStop:Ie.default.func,onResizeStart:Ie.default.func,onResize:Ie.default.func,resizeHandles:Ie.default.arrayOf(Ie.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:Ie.default.number,width:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t[0];return r.axis==="both"||r.axis==="x"?Ie.default.number.isRequired(...t):Ie.default.number(...t)}};Ka.__esModule=!0;Ka.default=void 0;var Rs=KS(b),EI=vI,NI=Nm,jI=Ya;const RI=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function KS(e,t){if(typeof WeakMap=="function")var n=new WeakMap,r=new WeakMap;return(KS=function(i,s){if(!s&&i&&i.__esModule)return i;var o,a,c={__proto__:null,default:i};if(i===null||typeof i!="object"&&typeof i!="function")return c;if(o=s?r:n){if(o.has(i))return o.get(i);o.set(i,c)}for(const u in i)u!=="default"&&{}.hasOwnProperty.call(i,u)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(i,u))&&(a.get||a.set)?o(c,u,a):c[u]=i[u]);return c})(e,t)}function cf(){return cf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cf.apply(null,arguments)}function TI(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Dv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ph(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dv(Object(n),!0).forEach(function(r){PI(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PI(e,t,n){return(t=DI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DI(e){var t=LI(e,"string");return typeof t=="symbol"?t:t+""}function LI(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}let jm=class extends Rs.Component{constructor(){super(...arguments),this.handleRefs={},this.lastHandleRect=null,this.slack=null,this.lastSize=null}componentWillUnmount(){this.resetData()}resetData(){this.lastHandleRect=this.slack=this.lastSize=null}runConstraints(t,n){const r=this.props,i=r.minConstraints,s=r.maxConstraints,o=r.lockAspectRatio;if(!i&&!s&&!o)return[t,n];if(o){const f=this.props.width/this.props.height,p=t-this.props.width,m=n-this.props.height;Math.abs(p)>Math.abs(m*f)?n=t/f:t=n*f}const a=t,c=n;let u=this.slack||[0,0],d=u[0],h=u[1];return t+=d,n+=h,i&&(t=Math.max(i[0],t),n=Math.max(i[1],n)),s&&(t=Math.min(s[0],t),n=Math.min(s[1],n)),this.slack=[d+(a-t),h+(c-n)],[t,n]}resizeHandler(t,n){return(r,i)=>{var s,o,a,c;let u=i.node,d=i.deltaX,h=i.deltaY;t==="onResizeStart"&&this.resetData();const f=(this.props.axis==="both"||this.props.axis==="x")&&n!=="n"&&n!=="s",p=(this.props.axis==="both"||this.props.axis==="y")&&n!=="e"&&n!=="w";if(!f&&!p)return;const m=n[0],g=n[n.length-1],w=u.getBoundingClientRect();if(this.lastHandleRect!=null){if(g==="w"){const j=w.left-this.lastHandleRect.left;d+=j}if(m==="n"){const j=w.top-this.lastHandleRect.top;h+=j}}this.lastHandleRect=w,g==="w"&&(d=-d),m==="n"&&(h=-h);const v=(s=(o=this.lastSize)==null?void 0:o.width)!=null?s:this.props.width,_=(a=(c=this.lastSize)==null?void 0:c.height)!=null?a:this.props.height;let y=v+(f?d/this.props.transformScale:0),S=_+(p?h/this.props.transformScale:0);var E=this.runConstraints(y,S);if(y=E[0],S=E[1],t==="onResizeStop"&&this.lastSize){var k=this.lastSize;y=k.width,S=k.height}const T=y!==v||S!==_;t!=="onResizeStop"&&(this.lastSize={width:y,height:S});const R=typeof this.props[t]=="function"?this.props[t]:null;R&&!(t==="onResize"&&!T)&&(r.persist==null||r.persist(),R(r,{node:u,size:{width:y,height:S},handle:n})),t==="onResizeStop"&&this.resetData()}}renderResizeHandle(t,n){const r=this.props.handle;if(!r)return Rs.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+t,ref:n});if(typeof r=="function")return r(t,n);const i=typeof r.type=="string",s=Ph({ref:n},i?{}:{handleAxis:t});return Rs.cloneElement(r,s)}render(){const t=this.props,n=t.children,r=t.className,i=t.draggableOpts;t.width,t.height,t.handle,t.handleSize,t.lockAspectRatio,t.axis,t.minConstraints,t.maxConstraints,t.onResize,t.onResizeStop,t.onResizeStart;const s=t.resizeHandles;t.transformScale;const o=TI(t,RI);return(0,NI.cloneElement)(n,Ph(Ph({},o),{},{className:(r?r+" ":"")+"react-resizable",children:[...Rs.Children.toArray(n.props.children),...s.map(a=>{var c;const u=(c=this.handleRefs[a])!=null?c:this.handleRefs[a]=Rs.createRef();return Rs.createElement(EI.DraggableCore,cf({},i,{nodeRef:u,key:"resizableHandle-"+a,onStop:this.resizeHandler("onResizeStop",a),onStart:this.resizeHandler("onResizeStart",a),onDrag:this.resizeHandler("onResize",a)}),this.renderResizeHandle(a,u))})]}))}};Ka.default=jm;jm.propTypes=jI.resizableProps;jm.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var Cu={};Cu.__esModule=!0;Cu.default=void 0;var Dh=GS(b),AI=YS(km),II=YS(Ka),MI=Ya;const OI=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function YS(e){return e&&e.__esModule?e:{default:e}}function GS(e,t){if(typeof WeakMap=="function")var n=new WeakMap,r=new WeakMap;return(GS=function(i,s){if(!s&&i&&i.__esModule)return i;var o,a,c={__proto__:null,default:i};if(i===null||typeof i!="object"&&typeof i!="function")return c;if(o=s?r:n){if(o.has(i))return o.get(i);o.set(i,c)}for(const u in i)u!=="default"&&{}.hasOwnProperty.call(i,u)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(i,u))&&(a.get||a.set)?o(c,u,a):c[u]=i[u]);return c})(e,t)}function uf(){return uf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uf.apply(null,arguments)}function Lv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $c(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lv(Object(n),!0).forEach(function(r){zI(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zI(e,t,n){return(t=BI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BI(e){var t=$I(e,"string");return typeof t=="symbol"?t:t+""}function $I(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FI(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}class XS extends Dh.Component{constructor(){super(...arguments),this.state={width:this.props.width,height:this.props.height,propsWidth:this.props.width,propsHeight:this.props.height},this.onResize=(t,n)=>{const r=n.size;this.props.onResize?(t.persist==null||t.persist(),this.setState(r,()=>this.props.onResize&&this.props.onResize(t,n))):this.setState(r)}}static getDerivedStateFromProps(t,n){return n.propsWidth!==t.width||n.propsHeight!==t.height?{width:t.width,height:t.height,propsWidth:t.width,propsHeight:t.height}:null}render(){const t=this.props,n=t.handle,r=t.handleSize;t.onResize;const i=t.onResizeStart,s=t.onResizeStop,o=t.draggableOpts,a=t.minConstraints,c=t.maxConstraints,u=t.lockAspectRatio,d=t.axis;t.width,t.height;const h=t.resizeHandles,f=t.style,p=t.transformScale,m=FI(t,OI);return Dh.createElement(II.default,{axis:d,draggableOpts:o,handle:n,handleSize:r,height:this.state.height,lockAspectRatio:u,maxConstraints:c,minConstraints:a,onResizeStart:i,onResize:this.onResize,onResizeStop:s,resizeHandles:h,transformScale:p,width:this.state.width},Dh.createElement("div",uf({},m,{style:$c($c({},f),{},{width:this.state.width+"px",height:this.state.height+"px"})})))}}Cu.default=XS;XS.propTypes=$c($c({},MI.resizableProps),{},{children:AI.default.element});Em.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};var HI=Em.exports.Resizable=Ka.default;Em.exports.ResizableBox=Cu.default;function JS(e){return function(n,r,i,s,o,a,c){return e(n,r,c)}}function Eu(e){return function(n,r,i,s){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i,s);var o=s.get(n),a=s.get(r);if(o&&a)return o===r&&a===n;s.set(n,r),s.set(r,n);var c=e(n,r,i,s);return s.delete(n),s.delete(r),c}}function ZS(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function Av(e){return e.constructor===Object||e.constructor==null}function Iv(e){return typeof e.then=="function"}function Nu(e,t){return e===t||e!==e&&t!==t}var WI="[object Arguments]",UI="[object Boolean]",VI="[object Date]",qI="[object RegExp]",KI="[object Map]",YI="[object Number]",GI="[object Object]",XI="[object Set]",JI="[object String]",Mv=Object.prototype.toString;function ju(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,i=e.areObjectsEqual,s=e.areRegExpsEqual,o=e.areSetsEqual,a=e.createIsNestedEqual,c=a(u);function u(d,h,f){if(d===h)return!0;if(!d||!h||typeof d!="object"||typeof h!="object")return d!==d&&h!==h;if(Av(d)&&Av(h))return i(d,h,c,f);var p=Array.isArray(d),m=Array.isArray(h);if(p||m)return p===m&&t(d,h,c,f);var g=Mv.call(d);return g!==Mv.call(h)?!1:g===VI?n(d,h,c,f):g===qI?s(d,h,c,f):g===KI?r(d,h,c,f):g===XI?o(d,h,c,f):g===GI||g===WI?Iv(d)||Iv(h)?!1:i(d,h,c,f):g===UI||g===YI||g===JI?Nu(d.valueOf(),h.valueOf()):!1}return u}function QS(e,t,n,r){var i=e.length;if(t.length!==i)return!1;for(;i-- >0;)if(!n(e[i],t[i],i,i,e,t,r))return!1;return!0}var ZI=Eu(QS);function e0(e,t){return Nu(e.valueOf(),t.valueOf())}function t0(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var s={},o=0;return e.forEach(function(a,c){if(i){var u=!1,d=0;t.forEach(function(h,f){!u&&!s[d]&&(u=n(c,f,o,d,e,t,r)&&n(a,h,c,f,e,t,r))&&(s[d]=!0),d++}),o++,i=u}}),i}var QI=Eu(t0),eM="_owner",tM=Object.prototype.hasOwnProperty;function n0(e,t,n,r){var i=Object.keys(e),s=i.length;if(Object.keys(t).length!==s)return!1;for(var o;s-- >0;){if(o=i[s],o===eM){var a=!!e.$$typeof,c=!!t.$$typeof;if((a||c)&&a!==c)return!1}if(!tM.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var nM=Eu(n0);function r0(e,t){return e.source===t.source&&e.flags===t.flags}function i0(e,t,n,r){var i=e.size===t.size;if(!i)return!1;if(!e.size)return!0;var s={};return e.forEach(function(o,a){if(i){var c=!1,u=0;t.forEach(function(d,h){!c&&!s[u]&&(c=n(o,d,a,h,e,t,r))&&(s[u]=!0),u++}),i=c}}),i}var rM=Eu(i0),s0=Object.freeze({areArraysEqual:QS,areDatesEqual:e0,areMapsEqual:t0,areObjectsEqual:n0,areRegExpsEqual:r0,areSetsEqual:i0,createIsNestedEqual:JS}),o0=Object.freeze({areArraysEqual:ZI,areDatesEqual:e0,areMapsEqual:QI,areObjectsEqual:nM,areRegExpsEqual:r0,areSetsEqual:rM,createIsNestedEqual:JS}),iM=ju(s0);function Hr(e,t){return iM(e,t,void 0)}ju(ZS(s0,{createIsNestedEqual:function(){return Nu}}));ju(o0);ju(ZS(o0,{createIsNestedEqual:function(){return Nu}}));function Ov(e){const{children:t,cols:n,containerWidth:r,margin:i,containerPadding:s,rowHeight:o,maxRows:a,isDraggable:c,isResizable:u,isBounded:d,static:h,useCSSTransforms:f=!0,usePercentages:p=!1,transformScale:m=1,positionStrategy:g,dragThreshold:w=0,droppingPosition:v,className:_="",style:y,handle:S="",cancel:E="",x:k,y:T,w:R,h:O,minW:j=1,maxW:$=1/0,minH:L=1,maxH:P=1/0,i:A,resizeHandles:D,resizeHandle:M,constraints:W=AS,layoutItem:N,layout:H=[],onDragStart:C,onDrag:re,onDragStop:Q,onResizeStart:x,onResize:Y,onResizeStop:Z}=e,[oe,me]=b.useState(!1),[Ee,U]=b.useState(!1),ye=b.useRef(null),we=b.useRef({left:0,top:0}),Se=b.useRef({top:0,left:0,width:0,height:0}),fe=b.useRef(void 0),it=b.useRef(H);it.current=H;const qe=b.useRef(null),Oe=b.useRef(null),I=b.useRef(!1),ie=b.useRef({x:0,y:0}),le=b.useRef(!1),ge=b.useMemo(()=>({cols:n,containerPadding:s,containerWidth:r,margin:i,maxRows:a,rowHeight:o}),[n,s,r,i,a,o]),He=b.useMemo(()=>({cols:n,maxRows:a,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,a,r,o,i]),Pe=b.useCallback(()=>({...He,layout:it.current}),[He]),Ve=b.useMemo(()=>N??{i:A,x:k,y:T,w:R,h:O,minW:j,maxW:$,minH:L,maxH:P},[N,A,k,T,R,O,j,$,L,P]),Ze=b.useCallback(Ae=>{if(g!=null&&g.calcStyle)return g.calcStyle(Ae);if(f)return vm(Ae);const te=IS(Ae);return p?{...te,left:xv(Ae.left/r),width:xv(Ae.width/r)}:te},[g,f,p,r]),ut=b.useCallback((Ae,{node:te})=>{if(!C)return;const{offsetParent:dt}=te;if(!dt)return;const et=dt.getBoundingClientRect(),tt=te.getBoundingClientRect(),lt=tt.left/m,kt=et.left/m,bt=tt.top/m,Ht=et.top/m;let ot;if(g!=null&&g.calcDragPosition){const Te=Ae;ot=g.calcDragPosition(Te.clientX,Te.clientY,Te.clientX-tt.left,Te.clientY-tt.top)}else ot={left:lt-kt+dt.scrollLeft,top:bt-Ht+dt.scrollTop};if(we.current=ot,w>0){const Te=Ae;ie.current={x:Te.clientX,y:Te.clientY},I.current=!0,le.current=!1,me(!0);return}me(!0);const On=Sl(ge,ot.top,ot.left),{x:Nn,y:_e}=kl(W,Ve,On.x,On.y,Pe());C(A,Nn,_e,{e:Ae,node:te,newPosition:ot})},[C,m,ge,g,w,W,Ve,Pe,A]),F=b.useCallback((Ae,{node:te,deltaX:dt,deltaY:et})=>{if(!re||!oe)return;const tt=Ae;if(I.current&&!le.current){const Nn=tt.clientX-ie.current.x,_e=tt.clientY-ie.current.y;if(Math.hypot(Nn,_e)<w)return;if(le.current=!0,I.current=!1,C){const xe=Sl(ge,we.current.top,we.current.left),{x:B,y:ce}=kl(W,Ve,xe.x,xe.y,Pe());C(A,B,ce,{e:Ae,node:te,newPosition:we.current})}}let lt=we.current.top+et,kt=we.current.left+dt;if(d){const{offsetParent:Nn}=te;if(Nn){const _e=Nn.clientHeight-Er(O,o,i[1]);lt=zc(lt,0,_e);const Te=fs(ge),xe=r-Er(R,Te,i[0]);kt=zc(kt,0,xe)}}const bt={top:lt,left:kt};we.current=bt;const Ht=Sl(ge,lt,kt),{x:ot,y:On}=kl(W,Ve,Ht.x,Ht.y,Pe());re(A,ot,On,{e:Ae,node:te,newPosition:bt})},[re,C,oe,w,d,O,o,i,ge,r,R,A,W,Ve,Pe]),G=b.useCallback((Ae,{node:te})=>{if(!Q||!oe)return;const dt=I.current;if(I.current=!1,le.current=!1,ie.current={x:0,y:0},dt){me(!1),we.current={left:0,top:0};return}const{left:et,top:tt}=we.current,lt={top:tt,left:et};me(!1),we.current={left:0,top:0};const kt=Sl(ge,tt,et),{x:bt,y:Ht}=kl(W,Ve,kt.x,kt.y,Pe());Q(A,bt,Ht,{e:Ae,node:te,newPosition:lt})},[Q,oe,ge,W,Ve,Pe,A]);qe.current=ut,Oe.current=F;const ue=b.useCallback((Ae,{node:te,size:dt,handle:et},tt,lt)=>{const kt=lt==="onResizeStart"?x:lt==="onResize"?Y:Z;if(!kt)return;let bt;te?bt=DA(et,tt,dt,r):bt={...dt,top:tt.top,left:tt.left},Se.current=bt;const Ht=vA(ge,bt.width,bt.height),{w:ot,h:On}=kA(W,Ve,Ht.w,Ht.h,et,Pe());kt(A,ot,On,{e:Ae.nativeEvent,node:te,size:bt,handle:et})},[x,Y,Z,r,ge,A,W,Ve,Pe]),ke=b.useCallback((Ae,te)=>{U(!0);const dt=xl(ge,k,T,R,O),et={...te,handle:te.handle};ue(Ae,et,dt,"onResizeStart")},[ue,ge,k,T,R,O]),X=b.useCallback((Ae,te)=>{const dt=xl(ge,k,T,R,O),et={...te,handle:te.handle};ue(Ae,et,dt,"onResize")},[ue,ge,k,T,R,O]),De=b.useCallback((Ae,te)=>{U(!1),Se.current={top:0,left:0,width:0,height:0};const dt=xl(ge,k,T,R,O),et={...te,handle:te.handle};ue(Ae,et,dt,"onResizeStop")},[ue,ge,k,T,R,O]);b.useEffect(()=>{var et,tt;if(!v)return;const Ae=ye.current;if(!Ae)return;const te=fe.current||{left:0,top:0},dt=oe&&(v.left!==te.left||v.top!==te.top);if(oe){if(dt){const lt=v.left-we.current.left,kt=v.top-we.current.top,bt={node:Ae,deltaX:lt,deltaY:kt,lastX:we.current.left,lastY:we.current.top,x:v.left,y:v.top};(tt=Oe.current)==null||tt.call(Oe,v.e,bt)}}else{const lt={node:Ae,deltaX:v.left,deltaY:v.top,lastX:0,lastY:0,x:v.left,y:v.top};(et=qe.current)==null||et.call(qe,v.e,lt)}fe.current=v},[v,oe,A]);const st=xl(ge,k,T,R,O,oe?we.current:null,Ee?Se.current:null),Re=yr.Children.only(t),Qe=fs(ge),vt=[Er(j,Qe,i[0]),Er(L,o,i[1])],ht=[Er($,Qe,i[0]),Er(P,o,i[1])],Ke=Re.props,_t=Ke.className,ni=Ke.style;let Gn=yr.cloneElement(Re,{ref:ye,className:_o("react-grid-item",_t,_,{static:h,resizing:Ee,"react-draggable":c,"react-draggable-dragging":oe,dropping:!!v,cssTransforms:f}),style:{...y,...ni,...Ze(st)}});const Mn=M;return Gn=l.jsx(HI,{draggableOpts:{disabled:!u},className:u?void 0:"react-resizable-hide",width:st.width,height:st.height,minConstraints:vt,maxConstraints:ht,onResizeStart:ke,onResize:X,onResizeStop:De,transformScale:m,resizeHandles:D,handle:Mn,children:Gn}),Gn=l.jsx(zi,{disabled:!c,onStart:ut,onDrag:F,onStop:G,handle:S,cancel:".react-resizable-handle"+(E?","+E:""),scale:m,nodeRef:ye,children:Gn}),Gn}var zr=()=>{},zv="react-grid-layout",a0=!1;try{a0=/firefox/i.test(navigator.userAgent)}catch{}function sM(e,t){const n=yr.Children.toArray(e),r=yr.Children.toArray(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const s=n[i],o=r[i];if((s==null?void 0:s.key)!==(o==null?void 0:o.key))return!1}return!0}function Bv(e,t,n,r){const i=[],s=new Set;yr.Children.forEach(t,a=>{if(!yr.isValidElement(a)||a.key===null)return;const c=String(a.key);s.add(c);const u=e.find(d=>d.i===c);if(u)i.push(ps(u));else{const h=a.props["data-grid"];h?i.push({i:c,x:h.x??0,y:h.y??0,w:h.w??1,h:h.h??1,minW:h.minW,maxW:h.maxW,minH:h.minH,maxH:h.maxH,static:h.static,isDraggable:h.isDraggable,isResizable:h.isResizable,resizeHandles:h.resizeHandles,isBounded:h.isBounded}):i.push({i:c,x:0,y:wu(i),w:1,h:1})}});const o=ym(i,{cols:n});return r.compact(o,n)}function oM(e){const{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:s,dropConfig:o,positionStrategy:a=IA,compactor:c,constraints:u=AS,layout:d=[],droppingItem:h,autoSize:f=!0,className:p="",style:m={},innerRef:g,onLayoutChange:w=zr,onDragStart:v=zr,onDrag:_=zr,onDragStop:y=zr,onResizeStart:S=zr,onResize:E=zr,onResizeStop:k=zr,onDrop:T=zr,onDropDragOver:R=zr}=e,O=b.useMemo(()=>({...MA,...r}),[r]),j=b.useMemo(()=>({...OA,...i}),[i]),$=b.useMemo(()=>({...zA,...s}),[s]),L=b.useMemo(()=>({...BA,...o}),[o]),{cols:P,rowHeight:A,maxRows:D,margin:M,containerPadding:W}=O,{enabled:N,bounded:H,handle:C,cancel:re,threshold:Q}=j,{enabled:x,handles:Y,handleComponent:Z}=$,{enabled:oe,defaultItem:me,onDragOver:Ee}=L,U=c??Su("vertical"),ye=U.type,we=U.allowOverlap,Se=U.preventCollision??!1,fe=b.useMemo(()=>h??{i:"__dropping-elem__",...me},[h,me]),it=a.type==="transform",qe=a.scale,Oe=W??M,[I,ie]=b.useState(!1),[le,ge]=b.useState(()=>Bv(d,t,P,U)),[He,Pe]=b.useState(null),[Ve,Ze]=b.useState(!1),[ut,F]=b.useState(null),[G,ue]=b.useState(),ke=b.useRef(null),X=b.useRef(null),De=b.useRef(null),st=b.useRef(0),Re=b.useRef(le),Qe=b.useRef(d),vt=b.useRef(t),ht=b.useRef(ye),Ke=b.useRef(le);Ke.current=le,b.useEffect(()=>{ie(!0),Hr(le,d)||w(le)},[]),b.useEffect(()=>{if(He||ut)return;const _e=!Hr(d,Qe.current),Te=!sM(t,vt.current),xe=ye!==ht.current;if(_e||Te||xe){const ce=Bv(_e?d:le,t,P,U);Hr(ce,le)||ge(ce)}Qe.current=d,vt.current=t,ht.current=ye},[d,t,P,ye,U,He,ut,le]),b.useEffect(()=>{if(!He&&!Hr(le,Re.current)){Re.current=le;const _e=le.filter(Te=>Te.i!==fe.i);w(_e)}},[le,He,w,fe.i]);const _t=b.useMemo(()=>{if(!f)return;const _e=wu(le),Te=Oe[1];return _e*A+(_e-1)*M[1]+Te*2+"px"},[f,le,A,M,Oe]),ni=b.useCallback((_e,Te,xe,B)=>{const ce=Ke.current,he=Yi(ce,_e);if(!he)return;const be={w:he.w,h:he.h,x:he.x,y:he.y,i:_e};ke.current=ps(he),De.current=ce,Pe(be),v(ce,he,he,null,B.e,B.node)},[v]),Gn=b.useCallback((_e,Te,xe,B)=>{const ce=Ke.current,he=ke.current,be=Yi(ce,_e);if(!be)return;const ze={w:be.w,h:be.h,x:be.x,y:be.y,i:_e},Ye=ts(ce,be,Te,xe,!0,Se,ye,P,we);_(Ye,he,be,ze,B.e,B.node),ge(U.compact(Ye,P)),Pe(ze)},[Se,ye,P,we,U,_]),Mn=b.useCallback((_e,Te,xe,B)=>{if(!He)return;const ce=Ke.current,he=ke.current,be=Yi(ce,_e);if(!be)return;const ze=ts(ce,be,Te,xe,!0,Se,ye,P,we),Ye=U.compact(ze,P);y(Ye,he,be,null,B.e,B.node);const Ge=De.current;ke.current=null,De.current=null,Pe(null),ge(Ye),Ge&&!Hr(Ge,Ye)&&w(Ye)},[He,Se,ye,P,we,U,y,w]),Ae=b.useCallback((_e,Te,xe,B)=>{const ce=Ke.current,he=Yi(ce,_e);he&&(X.current=ps(he),De.current=ce,Ze(!0),S(ce,he,he,null,B.e,B.node))},[S]),te=b.useCallback((_e,Te,xe,B)=>{const ce=Ke.current,he=X.current,{handle:be}=B;let ze=!1,Ye,Ge;const[cn,ft]=wA(ce,_e,pt=>(Ye=pt.x,Ge=pt.y,["sw","w","nw","n","ne"].includes(be)&&(["sw","nw","w"].includes(be)&&(Ye=pt.x+(pt.w-Te),Te=pt.x!==Ye&&Ye<0?pt.w:Te,Ye=Ye<0?0:Ye),["ne","n","nw"].includes(be)&&(Ge=pt.y+(pt.h-xe),xe=pt.y!==Ge&&Ge<0?pt.h:xe,Ge=Ge<0?0:Ge),ze=!0),Se&&!we&&DS(ce,{...pt,w:Te,h:xe,x:Ye??pt.x,y:Ge??pt.y}).filter(xs=>xs.i!==pt.i).length>0&&(Ge=pt.y,xe=pt.h,Ye=pt.x,Te=pt.w,ze=!1),pt.w=Te,pt.h=xe,pt));if(!ft)return;let nn=cn;ze&&Ye!==void 0&&Ge!==void 0&&(nn=ts(cn,ft,Ye,Ge,!0,Se,ye,P,we));const ri={w:ft.w,h:ft.h,x:ft.x,y:ft.y,i:_e,static:!0};E(nn,he,ft,ri,B.e,B.node),ge(U.compact(nn,P)),Pe(ri)},[Se,ye,P,we,U,E]),dt=b.useCallback((_e,Te,xe,B)=>{const ce=Ke.current,he=X.current,be=Yi(ce,_e),ze=U.compact(ce,P);k(ze,he,be??null,null,B.e,B.node);const Ye=De.current;X.current=null,De.current=null,Pe(null),Ze(!1),ge(ze),Ye&&!Hr(Ye,ze)&&w(ze)},[P,U,k,w]),et=b.useCallback(()=>{const _e=Ke.current;if(!_e.some(B=>B.i===fe.i)){F(null),Pe(null),ue(void 0);return}const xe=U.compact(_e.filter(B=>B.i!==fe.i),P);ge(xe),F(null),Pe(null),ue(void 0)},[fe.i,P,U]),tt=b.useCallback(_e=>{var ii;if(_e.preventDefault(),_e.stopPropagation(),a0&&!((ii=_e.nativeEvent.target)!=null&&ii.classList.contains(zv)))return!1;const Te=Ee?Ee(_e.nativeEvent):R(_e);if(Te===!1)return ut&&et(),!1;const{dragOffsetX:xe=0,dragOffsetY:B=0,...ce}=Te??{},he={...fe,...ce},be=_e.currentTarget.getBoundingClientRect(),ze={cols:P,margin:M,maxRows:D,rowHeight:A,containerWidth:n,containerPadding:Oe},Ye=fs(ze),Ge=Er(he.w,Ye,M[0]),cn=Er(he.h,A,M[1]),ft=Ge/2,nn=cn/2,ri=_e.clientX-be.left+xe-ft,pt=_e.clientY-be.top+B-nn,ws=Math.max(0,ri),xs=Math.max(0,pt),Ss={left:ws/qe,top:xs/qe,e:_e.nativeEvent};if(ut)G&&(G.left!==Ss.left||G.top!==Ss.top)&&ue(Ss);else{const nt=yA(ze,xs,ws,he.w,he.h);F(l.jsx("div",{},he.i)),ue(Ss);const si=Ke.current.filter(xo=>xo.i!==he.i);ge([...si,{...he,x:nt.x,y:nt.y,static:!1,isDraggable:!0}])}},[ut,G,fe,Ee,R,et,qe,P,M,D,A,n,Oe]),lt=b.useCallback(_e=>{_e.preventDefault(),_e.stopPropagation(),st.current--,st.current<0&&(st.current=0),st.current===0&&et()},[et]),kt=b.useCallback(_e=>{_e.preventDefault(),_e.stopPropagation(),st.current++},[]),bt=b.useCallback(_e=>{_e.preventDefault(),_e.stopPropagation();const Te=Ke.current,xe=Te.find(B=>B.i===fe.i);st.current=0,et(),T(Te,xe,_e.nativeEvent)},[fe.i,et,T]),Ht=b.useCallback((_e,Te)=>{if(!_e||!_e.key)return null;const xe=Yi(le,String(_e.key));if(!xe)return null;const B=typeof xe.isDraggable=="boolean"?xe.isDraggable:!xe.static&&N,ce=typeof xe.isResizable=="boolean"?xe.isResizable:!xe.static&&x,he=xe.resizeHandles||[...Y],be=B&&H&&xe.isBounded!==!1,ze=Z;return l.jsx(Ov,{containerWidth:n,cols:P,margin:M,containerPadding:Oe,maxRows:D,rowHeight:A,cancel:re,handle:C,onDragStart:ni,onDrag:Gn,onDragStop:Mn,onResizeStart:Ae,onResize:te,onResizeStop:dt,isDraggable:B,isResizable:ce,isBounded:be,useCSSTransforms:it&&I,usePercentages:!I,transformScale:qe,positionStrategy:a,dragThreshold:Q,w:xe.w,h:xe.h,x:xe.x,y:xe.y,i:xe.i,minH:xe.minH,minW:xe.minW,maxH:xe.maxH,maxW:xe.maxW,static:xe.static,droppingPosition:Te?G:void 0,resizeHandles:he,resizeHandle:ze,constraints:u,layoutItem:xe,layout:le,children:_e},xe.i)},[le,n,P,M,Oe,D,A,re,C,ni,Gn,Mn,Ae,te,dt,N,x,H,it,I,qe,a,Q,G,Y,Z,u]),ot=()=>He?l.jsx(Ov,{w:He.w,h:He.h,x:He.x,y:He.y,i:He.i,className:`react-grid-placeholder ${Ve?"placeholder-resizing":""}`,containerWidth:n,cols:P,margin:M,containerPadding:Oe,maxRows:D,rowHeight:A,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:it,transformScale:qe,constraints:u,layout:le,children:l.jsx("div",{})}):null,On=_o(zv,p),Nn={height:_t,...m};return l.jsxs("div",{ref:g,className:On,style:Nn,onDrop:oe?bt:void 0,onDragLeave:oe?lt:void 0,onDragEnter:oe?kt:void 0,onDragOver:oe?tt:void 0,children:[yr.Children.map(t,_e=>yr.isValidElement(_e)?Ht(_e):null),oe&&ut&&Ht(ut,!0),ot()]})}var aM={lg:1200,md:996,sm:768,xs:480,xxs:0},lM={lg:12,md:10,sm:6,xs:4,xxs:2},Lh=()=>{};function cM(e,t,n,r){const i=[];yr.Children.forEach(t,o=>{if(!yr.isValidElement(o)||o.key===null)return;const a=String(o.key),c=e.find(u=>u.i===a);if(c)i.push({...c,i:a});else{const d=o.props["data-grid"];d?i.push({i:a,x:d.x??0,y:d.y??0,w:d.w??1,h:d.h??1,minW:d.minW,maxW:d.maxW,minH:d.minH,maxH:d.maxH,static:d.static,isDraggable:d.isDraggable,isResizable:d.isResizable,resizeHandles:d.resizeHandles,isBounded:d.isBounded}):i.push({i:a,x:0,y:wu(i),w:1,h:1})}});const s=ym(i,{cols:n});return r.compact(s,n)}function uM(e){const{children:t,width:n,breakpoint:r,breakpoints:i=aM,cols:s=lM,layouts:o={},rowHeight:a=150,maxRows:c=1/0,margin:u=[10,10],containerPadding:d=null,compactor:h,onBreakpointChange:f=Lh,onLayoutChange:p=Lh,onWidthChange:m=Lh,...g}=e,w=h??Su("vertical"),v=w.type,_=w.allowOverlap,y=b.useMemo(()=>r??Sv(i,n),[]),S=b.useMemo(()=>kv(y,s),[y,s]),E=b.useMemo(()=>kh(o,i,y,y,S,v),[]),[k,T]=b.useState(y),[R,O]=b.useState(S),[j,$]=b.useState(E),[L,P]=b.useState(o),A=b.useRef(n),D=b.useRef(r),M=b.useRef(i),W=b.useRef(s),N=b.useRef(o),H=b.useRef(v),C=b.useRef(L);b.useEffect(()=>{C.current=L},[L]);const re=b.useMemo(()=>Hr(o,N.current)?null:kh(o,i,k,k,R,w),[o,i,k,R,w]),Q=re??j;b.useEffect(()=>{re!==null&&($(re),P(o),C.current=o,N.current=o)},[re,o]),b.useEffect(()=>{if(v!==H.current){const me=w.compact(Li(Q),R),Ee={...C.current,[k]:me};$(me),P(Ee),C.current=Ee,p(me,Ee),H.current=v}},[v,w,Q,R,_,k,p]),b.useEffect(()=>{const me=n!==A.current,Ee=r!==D.current,U=!Hr(i,M.current),ye=!Hr(s,W.current);if(me||Ee||U||ye){const we=r??Sv(i,n),Se=kv(we,s),fe=k;if(fe!==we||U||ye){const Oe={...C.current};Oe[fe]||(Oe[fe]=Li(j));let I=kh(Oe,i,we,fe,Se,w);I=cM(I,t,Se,w),Oe[we]=I,T(we),O(Se),$(I),P(Oe),C.current=Oe,f(we,Se),p(I,Oe)}const it=Cl(u,we),qe=d?Cl(d,we):null;m(n,it,Se,qe),A.current=n,D.current=r,M.current=i,W.current=s}},[n,r,i,s,k,R,j,t,w,v,_,u,d,f,p,m]);const x=b.useCallback(me=>{const U={...C.current,[k]:me};$(me),P(U),C.current=U,p(me,U)},[k,p]),Y=b.useMemo(()=>Cl(u,k),[u,k]),Z=b.useMemo(()=>d===null?null:Cl(d,k),[d,k]),oe=b.useMemo(()=>({cols:R,rowHeight:a,maxRows:c,margin:Y,containerPadding:Z}),[R,a,c,Y,Z]);return l.jsx(oM,{...g,width:n,gridConfig:oe,compactor:w,onLayoutChange:x,layout:Q,children:t})}function l0(e){const{children:t,width:n,breakpoint:r,breakpoints:i,cols:s,layouts:o,onBreakpointChange:a,onLayoutChange:c,onWidthChange:u,rowHeight:d,maxRows:h,margin:f,containerPadding:p,droppingItem:m,compactType:g,preventCollision:w=!1,allowOverlap:v=!1,verticalCompact:_,isDraggable:y=!0,isBounded:S=!1,draggableHandle:E,draggableCancel:k,isResizable:T=!0,resizeHandles:R=["se"],resizeHandle:O,isDroppable:j=!1,useCSSTransforms:$=!0,transformScale:L=1,autoSize:P,className:A,style:D,innerRef:M,onDragStart:W,onDrag:N,onDragStop:H,onResizeStart:C,onResize:re,onResizeStop:Q,onDrop:x,onDropDragOver:Y}=e;let Z=g===void 0?"vertical":g;_===!1&&(Z=null);const oe={enabled:y,bounded:S,handle:E,cancel:k},me={enabled:T,handles:R,handleComponent:O},Ee={enabled:j};let U;$?L!==1?U=AA(L):U=OS:U=LA;const ye=Su(Z,v,w);return l.jsx(uM,{width:n,breakpoint:r,breakpoints:i,cols:s,layouts:o,rowHeight:d,maxRows:h,margin:f,containerPadding:p,compactor:ye,dragConfig:oe,resizeConfig:me,dropConfig:Ee,positionStrategy:U,droppingItem:m,autoSize:P,className:A,style:D,innerRef:M,onBreakpointChange:a,onLayoutChange:c,onWidthChange:u,onDragStart:W,onDrag:N,onDragStop:H,onResizeStart:C,onResize:re,onResizeStop:Q,onDrop:x,onDropDragOver:Y,children:t})}l0.displayName="ResponsiveReactGridLayout";var hM=l0,dM="react-grid-layout";function fM(e){function t(n){const{measureBeforeMount:r=!1,className:i,style:s,...o}=n,[a,c]=b.useState(1280),[u,d]=b.useState(!1),h=b.useRef(null),f=b.useRef(null);return b.useEffect(()=>{d(!0)},[]),b.useEffect(()=>{const p=h.current;if(!(p instanceof HTMLElement))return;let m=null;const g=new ResizeObserver(w=>{if(w[0]){const v=w[0].contentRect.width;m!==null&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{c(v),m=null})}});return g.observe(p),f.current=g,()=>{m!==null&&cancelAnimationFrame(m),g.unobserve(p),g.disconnect()}},[u]),r&&!u?l.jsx("div",{className:_o(i,dM),style:s,ref:h}):l.jsx(e,{innerRef:h,className:i,style:s,...o,width:a})}return t.displayName=`WidthProvider(${e.displayName||e.name||"Component"})`,t}const pM=fM(hM),mM={lg:12,xxs:1},gM={lg:640,xxs:0},$v=12,hf=20,Zl=16;function yM(e){const t=e-hf*2-($v-1)*Zl;return Math.max(16,t/$v)}function vM({blocks:e,layouts:t,mode:n,onLayoutChange:r,renderBlock:i,blockMeta:s,onRemove:o,onDuplicate:a,canRemove:c=()=>!0,canDuplicate:u=()=>!0}){const d=n==="layout",h=b.useRef(null),[f,p]=b.useState(46);return b.useLayoutEffect(()=>{const m=h.current;if(!m)return;const g=()=>p(yM(m.clientHeight));if(g(),typeof ResizeObserver>"u")return;const w=new ResizeObserver(g);return w.observe(m),()=>w.disconnect()},[]),l.jsx("div",{ref:h,className:`block-canvas ${d?"arranging":""}`,style:{"--row-pitch":`${f+Zl}px`},"data-testid":"block-canvas",children:l.jsx(pM,{className:"rgl",layouts:t,breakpoints:gM,cols:mM,rowHeight:f,margin:[Zl,Zl],containerPadding:[hf,hf],isDraggable:d,isResizable:d,resizeHandles:["se","sw","ne","nw"],draggableHandle:".block-handle",onLayoutChange:(m,g)=>r(g),compactType:"vertical",useCSSTransforms:!0,children:e.map(m=>{const g=s(m);return l.jsxs("div",{className:`block ${d?"is-arranging":""}`,"data-testid":`block-${m.type}`,"data-rgl-id":m.id,children:[l.jsxs("div",{className:`block-header ${d?"block-handle":""}`,children:[l.jsx("span",{className:"block-icon",children:g.icon}),l.jsx("span",{className:"block-title",children:g.title}),l.jsx("span",{className:"spacer"}),d&&l.jsxs("span",{className:"block-actions",children:[u(m)&&l.jsx("button",{title:"Duplicate",onClick:()=>a(m.id),"data-testid":"block-duplicate",children:"⧉"}),c(m)?l.jsx("button",{title:"Remove",onClick:()=>o(m.id),"data-testid":"block-remove",children:"✕"}):l.jsx("span",{className:"block-pin",title:"Chat is always here",children:"📌"})]})]}),l.jsx("div",{className:"block-body",children:i(m)})]},m.id)})})})}function _M({blocks:e,activeId:t,setActiveId:n,mode:r,renderBlock:i,blockMeta:s,onRemove:o,canRemove:a=()=>!0}){const c=e.find(d=>d.id===t)||e[0],u=r==="layout";return l.jsxs("div",{className:"mobile-canvas","data-testid":"mobile-canvas",children:[l.jsx("div",{className:"mobile-tabs","data-testid":"mobile-tabs",children:e.map(d=>{const h=s(d);return l.jsxs("button",{className:`mtab ${d.id===(c==null?void 0:c.id)?"active":""}`,onClick:()=>n(d.id),"data-testid":`mtab-${d.type}`,children:[l.jsx("span",{className:"mtab-icon",children:h.icon}),l.jsx("span",{className:"mtab-label",children:h.title}),u&&a(d)&&l.jsx("span",{className:"mtab-x",role:"button",title:"Remove",onClick:f=>{f.stopPropagation(),o(d.id)},children:"✕"})]},d.id)})}),l.jsx("div",{className:"mobile-block",children:c&&l.jsx("div",{className:"block",children:l.jsx("div",{className:"block-body",children:i(c)})})})]})}function Bi(e){b.useEffect(()=>{if(typeof e!="function")return;const t=n=>{n.key==="Escape"&&(n.stopPropagation(),e())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}function bM({items:e,bazaarItems:t=[],onAdd:n,onClose:r}){return Bi(r),l.jsx("div",{className:"modal-backdrop",onClick:r,"data-testid":"add-gallery-backdrop",children:l.jsxs("div",{className:"modal add-gallery",onClick:i=>i.stopPropagation(),"data-testid":"add-gallery",children:[l.jsx("h2",{children:"Add a block"}),l.jsx("p",{className:"muted",children:"Build your space — drop in whatever's useful. Move and resize it however you like."}),l.jsx("div",{className:"gallery-grid",children:e.map(i=>l.jsxs("button",{className:"gallery-item",disabled:i.soon,onClick:()=>!i.soon&&n(i.type),"data-testid":`gallery-add-${i.type}`,children:[l.jsx("span",{className:"gallery-glyph",children:i.icon}),l.jsx("span",{className:"gallery-name",children:i.title}),l.jsx("span",{className:"gallery-desc",children:i.desc}),i.soon&&l.jsx("span",{className:"gallery-soon",children:"soon"})]},i.type))}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gallery-section",children:"🛍️ from the Bazaar"}),l.jsx("div",{className:"gallery-grid",children:t.map(i=>l.jsxs("button",{className:"gallery-item bazaar",onClick:()=>n(i.type),"data-testid":`gallery-add-${i.type}`,children:[l.jsx("span",{className:"gallery-glyph",children:i.icon}),l.jsx("span",{className:"gallery-name",children:i.title}),l.jsx("span",{className:"gallery-desc",children:i.desc})]},i.type))})]}),l.jsxs("div",{className:"gallery-agent-hint","data-testid":"gallery-agent-hint",children:["✨ Or ask your agent in chat — ",l.jsx("em",{children:"“make me a block that shows today’s signups”"})," — and it builds one for you."]}),l.jsx("div",{className:"actions",children:l.jsx("button",{onClick:r,children:"Done"})})]})})}const wM={chat:{icon:"🗨️",label:"Chat"},liveview:{icon:"👁️",label:"Live view"},notes:{icon:"📝",label:"Notes"},earnings:{icon:"💸",label:"Earnings"},analytics:{icon:"📊",label:"Analytics"},usage:{icon:"🔋",label:"Usage"},powers:{icon:"🧰",label:"Powers"}};function Fv({blocks:e}){return l.jsx("span",{className:"tpl-chips",children:e.map((t,n)=>{const r=wM[t.type]||{icon:"▫️",label:t.type};return l.jsxs("span",{className:"tpl-chip",title:r.label,children:[l.jsx("span",{className:"tpl-chip-icon",children:r.icon}),r.label]},n)})})}function xM({builtins:e=[],saved:t=[],onApply:n,onSaveCurrent:r,onDelete:i,onClose:s}){Bi(s);const[o,a]=b.useState("");function c(){const u=o.trim();u&&(r(u),a(""))}return l.jsx("div",{className:"modal-backdrop",onClick:s,"data-testid":"template-gallery-backdrop",children:l.jsxs("div",{className:"modal template-gallery",onClick:u=>u.stopPropagation(),"data-testid":"template-gallery",children:[l.jsx("h2",{children:"Start from a template"}),l.jsx("p",{className:"muted",children:"Pick a layout to start from — it swaps your current blocks for the template's. Chat always stays."}),l.jsx("div",{className:"gallery-grid",children:e.map(u=>l.jsxs("button",{className:"gallery-item template-card",onClick:()=>n(u),"data-testid":`template-${u.id}`,children:[l.jsx("span",{className:"gallery-glyph",children:u.icon}),l.jsx("span",{className:"gallery-name",children:u.name}),l.jsx("span",{className:"gallery-desc",children:u.desc}),l.jsx(Fv,{blocks:u.blocks})]},u.id))}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"gallery-section",children:"⭐ your templates"}),l.jsx("div",{className:"gallery-grid",children:t.map(u=>l.jsxs("div",{className:"gallery-item template-card saved","data-testid":`template-${u.id}`,children:[l.jsxs("button",{className:"tpl-apply",onClick:()=>n(u),"data-testid":`template-apply-${u.id}`,children:[l.jsx("span",{className:"gallery-glyph",children:u.icon||"⭐"}),l.jsx("span",{className:"gallery-name",children:u.name}),l.jsx(Fv,{blocks:u.blocks})]}),l.jsx("button",{className:"tpl-del",title:"Delete this template",onClick:()=>i(u.id),"data-testid":`template-delete-${u.id}`,children:"✕"})]},u.id))})]}),l.jsxs("div",{className:"tpl-save-row",children:[l.jsx("input",{className:"tpl-save-input",value:o,onChange:u=>a(u.target.value),onKeyDown:u=>u.key==="Enter"&&c(),placeholder:"Save current layout as…","data-testid":"template-save-name",maxLength:40}),l.jsx("button",{className:"primary",onClick:c,disabled:!o.trim(),"data-testid":"template-save-btn",children:"Save layout"})]}),l.jsx("div",{className:"actions",children:l.jsx("button",{onClick:s,children:"Done"})})]})})}const c0="wild:theme",df=[{id:"cyan",name:"VentureWild",accent:"#0891b2",hot:"#0e7490"},{id:"teal",name:"Teal",accent:"#0d9488",hot:"#0f766e"},{id:"blue",name:"Blue",accent:"#2563eb",hot:"#1d4ed8"},{id:"violet",name:"Violet",accent:"#7c3aed",hot:"#6d28d9"},{id:"emerald",name:"Emerald",accent:"#059669",hot:"#047857"},{id:"amber",name:"Amber",accent:"#d97706",hot:"#b45309"},{id:"rose",name:"Rose",accent:"#e11d48",hot:"#be123c"}],SM=[{id:"light",name:"Light",glyph:"☀️",desc:"Bright & warm (default)"},{id:"dark",name:"Dark",glyph:"🌙",desc:"The venturewild.llc look"}],u0={bg:"--bg",bgElev:"--bg-elev",surface:"--surface",border:"--border",text:"--text",textMuted:"--text-muted",canvas1:"--canvas-1",canvas2:"--canvas-2",canvas3:"--canvas-3"},kM=["none","soft","hard","glow"],CM=["flat","glass","paper"],EM=["normal","medium","semibold","bold"],NM=["system","inter","grotesk","serif","mono"],jM={system:'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',inter:'"Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',grotesk:'"Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif',serif:'"Literata Variable", Literata, Georgia, "Times New Roman", serif',mono:'ui-monospace, "JetBrains Mono", "SF Mono", "Fira Code", Consolas, "Courier New", monospace'},RM={none:"none",soft:"0 1px 2px rgba(16,24,40,0.05), 0 10px 28px -14px rgba(16,24,40,0.22)",hard:"4px 4px 0 rgba(0,0,0,0.85)",glow:"0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 38%, transparent)"},TM={normal:"400",medium:"500",semibold:"600",bold:"750"};function Hv(e,t,n){const r=Math.round(Number(e));return Number.isFinite(r)?Math.max(t,Math.min(n,r)):null}function Rm(e){const t={};if(e&&typeof e=="object"){const n=Hv(e.radius,0,32);n!==null&&(t.radius=n);const r=Hv(e.borderWidth,0,6);r!==null&&(t.borderWidth=r),kM.includes(e.shadow)&&(t.shadow=e.shadow),NM.includes(e.fontFamily)&&(t.fontFamily=e.fontFamily),EM.includes(e.fontWeight)&&(t.fontWeight=e.fontWeight),CM.includes(e.surfaceStyle)&&(t.surfaceStyle=e.surfaceStyle)}return t}const Wv=[{id:"fw-neo-brutalism",name:"Neo-Brutalism",glyph:"🟨",blurb:"Raw & bold — square corners, thick black borders, hard offset shadows.",mode:"light",accent:"#2b59ff",hot:"#1d3fd6",tokens:{bg:"#fffdf5",bgElev:"#ffffff",surface:"#ffffff",border:"#0a0a0a",text:"#0a0a0a",textMuted:"#3a3a3a",canvas1:"#ffe600",canvas2:"#ff90e8",canvas3:"#9df6c4"},structure:{radius:0,borderWidth:3,shadow:"hard",fontFamily:"grotesk",fontWeight:"bold",surfaceStyle:"flat"}},{id:"fw-glassmorphism",name:"Glassmorphism",glyph:"🫧",blurb:"Frosted glass — translucent, blurred panels over a vivid gradient.",mode:"light",accent:"#7c3aed",hot:"#6d28d9",tokens:{bg:"#f3f0ff",bgElev:"#ffffff",surface:"#ffffff",border:"#e5e0f5",text:"#1a1530",textMuted:"#6b6486",canvas1:"#a78bfa",canvas2:"#67e8f9",canvas3:"#f0abfc"},structure:{radius:22,borderWidth:1,shadow:"soft",fontFamily:"inter",fontWeight:"medium",surfaceStyle:"glass"}},{id:"fw-swiss",name:"Swiss / Minimal",glyph:"🔴",blurb:"International Typographic — flat, tight grid, no shadow, a single red.",mode:"light",accent:"#e0322a",hot:"#b91c1c",tokens:{bg:"#ffffff",bgElev:"#ffffff",surface:"#ffffff",border:"#e4e4e4",text:"#111111",textMuted:"#6b6b6b",canvas1:"#f5f5f5",canvas2:"#fafafa",canvas3:"#ffffff"},structure:{radius:2,borderWidth:1,shadow:"none",fontFamily:"grotesk",fontWeight:"semibold",surfaceStyle:"flat"}},{id:"fw-retro-terminal",name:"Retro-Terminal",glyph:"🖥️",blurb:"Phosphor CRT — dark, monospace, a green accent that glows.",mode:"dark",accent:"#2ee66b",hot:"#1eb84f",tokens:{bg:"#04140a",bgElev:"#0a1f12",surface:"#0a1f12",border:"#15402a",text:"#9bf7b8",textMuted:"#4f9e6a",canvas1:"#04160c",canvas2:"#06200f",canvas3:"#020a05"},structure:{radius:0,borderWidth:1,shadow:"glow",fontFamily:"mono",fontWeight:"normal",surfaceStyle:"flat"}}],Ql={mode:"light",accent:df[0].accent,hot:df[0].hot,accentManual:!1,tokens:{},structure:{}};function Kr(e){if(typeof e!="string")return null;const t=e.trim();return/^#([0-9a-f]{6})$/i.test(t)?t.toLowerCase():null}function h0(e){const t=Kr(e)||"#000000";return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)]}function Tm(e,t=.16){const[n,r,i]=h0(e),s=1-t,o=a=>Math.max(0,Math.min(255,Math.round(a*s)));return`#${[o(n),o(r),o(i)].map(a=>a.toString(16).padStart(2,"0")).join("")}`}function d0(e){const[t,n,r]=h0(e).map(s=>{const o=s/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r>.42?"#08232b":"#ffffff"}function Pm(e){const t={};if(e&&typeof e=="object")for(const n of Object.keys(u0)){const r=Kr(e[n]);r&&(t[n]=r)}return t}function PM(e,t,n){const r=t&&typeof t=="object"?t:{},i=n?e.accent:Kr(r.accent)||e.accent,s=n?e.hot:Kr(r.hot)||Kr(r.accent)||e.hot;return{...e,mode:r.mode==="dark"?"dark":"light",accent:i,hot:s,tokens:Pm(r.tokens),structure:Rm(r.structure),accentManual:!0}}function DM(){try{const e=localStorage.getItem(c0);if(!e)return{...Ql};const t=JSON.parse(e),n=Kr(t.accent)||Ql.accent;return{mode:t.mode==="dark"?"dark":"light",accent:n,hot:Kr(t.hot)||Tm(n),accentManual:!!t.accentManual,tokens:Pm(t.tokens),structure:Rm(t.structure)}}catch{return{...Ql}}}function LM(e){try{localStorage.setItem(c0,JSON.stringify(e))}catch{}}function AM(e){const t=document.documentElement;e.mode==="dark"?t.dataset.theme="dark":delete t.dataset.theme;const n=Kr(e.accent)||Ql.accent;t.style.setProperty("--accent",n),t.style.setProperty("--accent-hot",Kr(e.hot)||Tm(n)),t.style.setProperty("--accent-ink",d0(n));const r=Pm(e.tokens);for(const[s,o]of Object.entries(u0))r[s]?t.style.setProperty(o,r[s]):t.style.removeProperty(o);const i=Rm(e.structure);i.radius!=null?t.style.setProperty("--radius",`${i.radius}px`):t.style.removeProperty("--radius"),i.borderWidth!=null?t.style.setProperty("--border-w",`${i.borderWidth}px`):t.style.removeProperty("--border-w"),i.shadow?t.style.setProperty("--shadow-theme",RM[i.shadow]):t.style.removeProperty("--shadow-theme"),i.fontFamily?t.style.setProperty("--font-ui",jM[i.fontFamily]):t.style.removeProperty("--font-ui"),i.fontWeight?t.style.setProperty("--font-weight-strong",TM[i.fontWeight]):t.style.removeProperty("--font-weight-strong"),i.surfaceStyle&&i.surfaceStyle!=="flat"?t.dataset.surface=i.surfaceStyle:delete t.dataset.surface}const f0="wild:reading",IM=16,Fc=[{id:"system",name:"System",vibe:"Your device’s own clean sans — feels built-in.",stack:'-apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif'},{id:"inter",name:"Inter",vibe:"Crisp and modern — the no-thought default that disappears.",stack:'"Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif'},{id:"literata",name:"Literata",vibe:"Warm literary serif — reads like a good e-book.",stack:'"Literata Variable", Literata, Georgia, "Palatino Linotype", "Book Antiqua", serif'},{id:"atkinson",name:"Hyperlegible",vibe:"Built for maximum legibility — easiest on the eyes.",stack:'"Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif'},{id:"georgia",name:"Georgia",vibe:"Classic book serif — no download, lovely on any screen.",stack:'Georgia, "Palatino Linotype", "Book Antiqua", Palatino, Constantia, "Times New Roman", serif'},{id:"mono",name:"Focus",vibe:"Monospace — settles the eye on every word.",stack:'"Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", ui-monospace, Menlo, monospace'}],Rr=[{id:"xs",name:"Compact",scale:.85},{id:"s",name:"Small",scale:.92},{id:"m",name:"Default",scale:1},{id:"l",name:"Large",scale:1.1},{id:"xl",name:"Larger",scale:1.24},{id:"xxl",name:"Largest",scale:1.4}],Hc=[{id:"compact",name:"Compact",value:1.4},{id:"cozy",name:"Cozy",value:1.6},{id:"relaxed",name:"Relaxed",value:1.85}],fa={font:"system",size:"m",spacing:"cozy"},MM=new Set(Fc.map(e=>e.id)),OM=new Set(Rr.map(e=>e.id)),zM=new Set(Hc.map(e=>e.id));function p0(e){return Fc.find(t=>t.id===e)||Fc[0]}function m0(e){return Rr.find(t=>t.id===e)||Rr.find(t=>t.id==="m")}function g0(e){return Hc.find(t=>t.id===e)||Hc.find(t=>t.id==="cozy")}function Ru(e){const t=e&&typeof e=="object"?e:{};return{font:MM.has(t.font)?t.font:fa.font,size:OM.has(t.size)?t.size:fa.size,spacing:zM.has(t.spacing)?t.spacing:fa.spacing}}function BM(){try{const e=localStorage.getItem(f0);return e?Ru(JSON.parse(e)):{...fa}}catch{return{...fa}}}function $M(e){try{localStorage.setItem(f0,JSON.stringify(Ru(e)))}catch{}}function FM(e){const t=Ru(e),n=document.documentElement;return n.style.setProperty("--reading-font",p0(t.font).stack),n.style.setProperty("--reading-scale",String(m0(t.size).scale)),n.style.setProperty("--reading-leading",String(g0(t.spacing).value)),t}function Uv(e,t){const n=Rr.findIndex(s=>s.id===e),r=n<0?Rr.findIndex(s=>s.id==="m"):n,i=Math.max(0,Math.min(Rr.length-1,r+t));return Rr[i].id}const HM="Here’s how your conversation will look — comfortable and easy on the eyes.";function y0({reading:e,onChange:t}){const n=p0(e.font),r=m0(e.size),i=g0(e.spacing),s=c=>t({...e,...c}),o=Rr[0].id===r.id,a=Rr[Rr.length-1].id===r.id;return l.jsxs("div",{className:"reading-controls","data-testid":"reading-controls",children:[l.jsx("div",{className:"reading-preview","data-testid":"reading-preview",style:{fontFamily:n.stack,fontSize:`${IM*r.scale}px`,lineHeight:i.value},children:HM}),l.jsx("div",{className:"reading-section",children:"Font"}),l.jsx("div",{className:"reading-fonts","data-testid":"reading-fonts",role:"radiogroup","aria-label":"Reading font",children:Fc.map(c=>{const u=c.id===e.font;return l.jsxs("button",{type:"button",className:`reading-font${u?" active":""}`,style:{fontFamily:c.stack},onClick:()=>s({font:c.id}),role:"radio","aria-checked":u,"data-testid":`reading-font-${c.id}`,title:c.vibe,children:[l.jsx("span",{className:"reading-font-name",children:c.name}),l.jsx("span",{className:"reading-font-vibe",children:c.vibe}),u&&l.jsx("span",{className:"reading-font-check","aria-hidden":"true",children:"✓"})]},c.id)})}),l.jsx("div",{className:"reading-section",children:"Size"}),l.jsxs("div",{className:"reading-sizes","data-testid":"reading-sizes",children:[l.jsxs("button",{type:"button",className:"reading-step",onClick:()=>s({size:Uv(e.size,-1)}),disabled:o,"aria-label":"Smaller text","data-testid":"reading-size-down",children:[l.jsx("span",{className:"reading-step-a small",children:"A"}),l.jsx("span",{className:"reading-step-minus",children:"−"})]}),l.jsx("span",{className:"reading-size-label","data-testid":"reading-size-label",children:r.name}),l.jsxs("button",{type:"button",className:"reading-step",onClick:()=>s({size:Uv(e.size,1)}),disabled:a,"aria-label":"Larger text","data-testid":"reading-size-up",children:[l.jsx("span",{className:"reading-step-a large",children:"A"}),l.jsx("span",{className:"reading-step-plus",children:"+"})]})]}),l.jsx("div",{className:"reading-section",children:"Line spacing"}),l.jsx("div",{className:"reading-spacings","data-testid":"reading-spacings",role:"radiogroup","aria-label":"Line spacing",children:Hc.map(c=>{const u=c.id===e.spacing;return l.jsx("button",{type:"button",className:`reading-spacing${u?" active":""}`,onClick:()=>s({spacing:c.id}),role:"radio","aria-checked":u,"data-testid":`reading-spacing-${c.id}`,children:c.name},c.id)})})]})}const WM=new Set(["theme-neo-brutalism","theme-glassmorphism","theme-swiss","theme-retro-terminal"]);function Vv({bundle:e}){const t=(e==null?void 0:e.tokens)||{},n=(e==null?void 0:e.mode)==="dark",r=`radial-gradient(120% 80% at 15% 0%, ${t.canvas1||(n?"#0b1620":"#e8f7f0")}, transparent 60%),radial-gradient(120% 90% at 100% 0%, ${t.canvas2||(n?"#0c1320":"#e7f0fb")}, transparent 55%),linear-gradient(160deg, ${t.canvas3||(n?"#0a0f14":"#fef8ee")}, ${t.bg||(n?"#0a0c10":"#ffffff")} 75%)`;return l.jsxs("div",{className:"tp-swatch",style:{background:r},"aria-hidden":!0,children:[l.jsxs("span",{className:"tp-swatch-card",style:{background:t.surface||(n?"#11141a":"#fff"),borderColor:t.border||(n?"#1f242d":"#e2e6ee")},children:[l.jsx("span",{className:"tp-swatch-line",style:{background:t.text||(n?"#e8eaed":"#1d2430")}}),l.jsx("span",{className:"tp-swatch-line short",style:{background:t.textMuted||(n?"#8b95a3":"#687083")}})]}),l.jsx("span",{className:"tp-swatch-dot",style:{background:(e==null?void 0:e.accent)||"#0891b2"}})]})}function UM({theme:e,onChange:t,reading:n,onChangeReading:r,onClose:i,onPublish:s,onApplyTheme:o,onRemixTheme:a,onClearRemix:c,remixOf:u,token:d}){Bi(i);const[h,f]=b.useState(e.accent),[p,m]=b.useState(u?`${u.title} (remix)`:""),[g,w]=b.useState(""),[v,_]=b.useState(!1),[y,S]=b.useState(null),[E,k]=b.useState([]),[T,R]=b.useState(null),[O,j]=b.useState(null),[$,L]=b.useState({});b.useEffect(()=>{u&&m(x=>x||`${u.title} (remix)`)},[u]),b.useEffect(()=>{let x=!1;return(async()=>{try{const Y=await fetch("/api/bazaar/shelf");if(!Y.ok||x)return;const Z=await Y.json();if(x)return;const oe=(Z.recipes||[]).filter(me=>me.kind==="theme"&&!WM.has(me.id)).sort((me,Ee)=>(Ee.outcomeScore||0)-(me.outcomeScore||0));k(oe),R(Z.network||null)}catch{}})(),()=>{x=!0}},[]);const P=b.useCallback(()=>d?{Authorization:`Bearer ${d}`}:{},[d]);async function A(){var Y;const x=p.trim();if(!(!x||v)){_(!0),S(null);try{const Z=await s({title:x,pitch:g.trim()});Z&&Z.ok?S({ok:!0,text:`✓ “${((Y=Z.listing)==null?void 0:Y.title)||x}” is published — others can wear it now.`}):S({ok:!1,text:Z&&Z.error?Z.error:"Could not publish — try again."})}catch(Z){S({ok:!1,text:Z.message||"Could not publish — try again."})}finally{_(!1)}}}function D(x){t({...e,mode:x,tokens:{},structure:{}}),c==null||c()}function M(x){f(x.accent),t({...e,accent:x.accent,hot:x.hot,accentManual:!0})}function W(x){f(x),/^#([0-9a-f]{6})$/i.test(x)&&t({...e,accent:x,hot:Tm(x),accentManual:!0})}function N(x){t({...e,mode:x.mode,accent:x.accent,hot:x.hot,tokens:{...x.tokens},structure:{...x.structure},accentManual:!0}),c==null||c()}const H=(()=>{var Y;const x=e.structure||{};return((Y=Wv.find(Z=>Z.structure.surfaceStyle===x.surfaceStyle&&Z.structure.shadow===x.shadow&&Z.structure.radius===x.radius&&Z.accent.toLowerCase()===(e.accent||"").toLowerCase()))==null?void 0:Y.id)||null})();async function C(x){if(!(!o||O)){j(x.id);try{const Y=await fetch(`/api/bazaar/themes/${encodeURIComponent(x.id)}/apply`,{method:"POST",headers:P()}),Z=Y.ok?await Y.json():null,oe=(Z==null?void 0:Z.theme)||x.theme;oe&&(o(oe),i==null||i())}catch{}finally{j(null)}}}async function re(x){if(!$[x.id]){L(Y=>({...Y,[x.id]:!0}));try{await fetch(`/api/bazaar/themes/${encodeURIComponent(x.id)}/report`,{method:"POST",headers:{"content-type":"application/json",...P()},body:JSON.stringify({reason:""})})}catch{}}}const Q=T?T.capable?T.lastSyncOk===!1?"Community looks are offline — showing the built-ins.":T.poolCount===0&&T.lastSyncOk==null?"Checking for community looks…":null:"Sign in to discover and share looks across VentureWild.":null;return l.jsx("div",{className:"modal-backdrop",onClick:i,"data-testid":"theme-picker-backdrop",children:l.jsxs("div",{className:"modal theme-picker",onClick:x=>x.stopPropagation(),"data-testid":"theme-picker",children:[l.jsx("h2",{children:"Make it yours"}),l.jsx("p",{className:"muted",children:"Pick a look. Changes apply live and follow you across your workspaces."}),u&&l.jsxs("p",{className:"theme-remixing muted","data-testid":"theme-remixing",children:["✦ Remixing “",u.title,"” — tweak it below, then publish it as your own."]}),l.jsx("div",{className:"theme-section",children:"Mode"}),l.jsx("div",{className:"theme-modes",children:SM.map(x=>l.jsxs("button",{className:`theme-mode ${e.mode===x.id?"active":""}`,onClick:()=>D(x.id),"data-testid":`theme-mode-${x.id}`,"aria-pressed":e.mode===x.id,children:[l.jsx("span",{className:"theme-mode-glyph",children:x.glyph}),l.jsx("span",{className:"theme-mode-name",children:x.name}),l.jsx("span",{className:"theme-mode-desc",children:x.desc})]},x.id))}),l.jsx("div",{className:"theme-section",children:"Frameworks — a whole design language in one tap"}),l.jsx("div",{className:"theme-frameworks","data-testid":"theme-frameworks",children:Wv.map(x=>l.jsxs("button",{className:`theme-fw ${H===x.id?"active":""}`,onClick:()=>N(x),"data-testid":`theme-framework-${x.id}`,"aria-pressed":H===x.id,title:x.blurb,children:[l.jsx(Vv,{bundle:x}),l.jsxs("span",{className:"theme-fw-name",children:[x.glyph," ",x.name]}),l.jsx("span",{className:"theme-fw-blurb",children:x.blurb})]},x.id))}),l.jsx("div",{className:"theme-section",children:"Accent"}),l.jsx("div",{className:"theme-swatches",children:df.map(x=>{const Y=e.accent.toLowerCase()===x.accent.toLowerCase();return l.jsx("button",{className:`theme-swatch ${Y?"active":""}`,style:{background:x.accent,color:d0(x.accent)},onClick:()=>M(x),title:x.name,"data-testid":`theme-accent-${x.id}`,"aria-pressed":Y,children:Y?"✓":""},x.id)})}),l.jsxs("div",{className:"theme-custom",children:[l.jsx("label",{htmlFor:"theme-hex",className:"muted",children:"Custom"}),l.jsx("input",{id:"theme-hex",type:"color",value:/^#([0-9a-f]{6})$/i.test(h)?h:"#0891b2",onChange:x=>W(x.target.value),"data-testid":"theme-custom-color","aria-label":"Custom accent color"}),l.jsx("input",{className:"theme-hex-input",value:h,onChange:x=>W(x.target.value),placeholder:"#0891b2",maxLength:7,spellCheck:!1,"data-testid":"theme-custom-hex"})]}),(E.length>0||Q)&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"theme-section",children:"Community looks"}),Q&&l.jsx("p",{className:"muted small","data-testid":"theme-community-note",children:Q}),E.length>0&&l.jsx("div",{className:"theme-community","data-testid":"theme-community",children:E.map(x=>{var Z,oe,me;const Y=((Z=x.producer)==null?void 0:Z.handle)==="you"||((oe=x.producer)==null?void 0:oe.kind)==="me";return l.jsxs("div",{className:`tp-look${Y?" mine":""}`,"data-testid":`theme-look-${x.id}`,children:[l.jsx(Vv,{bundle:x.theme}),l.jsxs("div",{className:"tp-look-meta",children:[l.jsx("span",{className:"tp-look-title",children:x.title}),l.jsxs("span",{className:"tp-look-by",children:["by ",((me=x.producer)==null?void 0:me.name)||"a maker",Y&&" (you)"]}),Mc(x)&&l.jsxs("span",{className:"tp-look-lineage","data-testid":`theme-look-lineage-${x.id}`,children:["remixed from ",Mc(x)]})]}),l.jsxs("div",{className:"tp-look-actions",children:[l.jsx("button",{type:"button",className:"tp-look-apply","data-testid":`theme-apply-${x.id}`,disabled:O===x.id,onClick:()=>C(x),children:O===x.id?"Applying…":"Apply"}),a&&x.theme&&l.jsx("button",{type:"button",className:"tp-look-remix","data-testid":`theme-remix-${x.id}`,title:"Load this look to tweak + republish as your own",onClick:()=>a(x),children:"✦ Remix"}),x.source==="rails"&&!Y&&l.jsx("button",{type:"button",className:"tp-look-report","data-testid":`theme-report-${x.id}`,disabled:!!$[x.id],title:"Report this look to VentureWild",onClick:()=>re(x),children:$[x.id]?"Reported ✓":"⚐"})]})]},x.id)})})]}),n&&r&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"theme-section",children:"Reading — chat font & size"}),l.jsx(y0,{reading:n,onChange:r})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"theme-section",children:"Share your look"}),l.jsx("p",{className:"muted theme-publish-sub",children:"Publish this theme so others can wear it — you earn each time they do."}),l.jsxs("div",{className:"theme-publish","data-testid":"theme-publish",children:[l.jsx("input",{className:"theme-hex-input theme-publish-title",value:p,onChange:x=>m(x.target.value),placeholder:"Name your look — e.g. Midnight Focus",maxLength:60,"data-testid":"theme-publish-title","aria-label":"Theme name"}),l.jsx("input",{className:"theme-hex-input theme-publish-pitch",value:g,onChange:x=>w(x.target.value),placeholder:"One line — what's the vibe? (optional)",maxLength:120,"data-testid":"theme-publish-pitch","aria-label":"Theme pitch"}),l.jsx("button",{className:"primary",onClick:A,disabled:!p.trim()||v,"data-testid":"theme-publish-btn",children:v?"Publishing…":"Publish my look"})]}),y&&l.jsx("p",{className:`theme-publish-msg ${y.ok?"ok":"err"}`,"data-testid":"theme-publish-msg",children:y.text})]}),l.jsx("div",{className:"actions",children:l.jsx("button",{className:"primary",onClick:i,"data-testid":"theme-done",children:"Done"})})]})})}const qv=[{id:"check",title:"Check with me",emoji:"🪧",build:!0,desc:"Your agent proposes first — it only acts after you approve. Read-only until you say go."},{id:"work",title:"Work, then show me",emoji:"🛠️",build:!1,desc:"Builds and edits freely, shows you the diff — but still confirms the risky stuff (deploy, delete, send, spend)."},{id:"full",title:"Full autonomy",emoji:"🚀",build:!0,desc:"Does everything on its own, never asks. Fastest — and the least guarded."}];function VM({token:e,session:t,onClose:n,onOpenTheme:r,onOpenReading:i,onClaudeSignedOut:s}){var C,re,Q;Bi(n);const[o,a]=b.useState(null),[c,u]=b.useState(""),[d,h]=b.useState(!1),[f,p]=b.useState(!1),[m,g]=b.useState(null),[w,v]=b.useState(""),[_,y]=b.useState(!1),[S,E]=b.useState(null),[k,T]=b.useState(!1),R=e?{Authorization:`Bearer ${e}`}:{};b.useEffect(()=>{let x=!0;return fetch("/api/settings",{headers:R}).then(Y=>Y.ok?Y.json():null).then(Y=>{x&&Y&&(a(Y),u(Y.conversationTitle||""))}).catch(()=>{}),()=>{x=!1}},[e]);const O=()=>{fetch("/api/providers",{headers:R}).then(x=>x.ok?x.json():null).then(x=>{x&&g(x)}).catch(()=>{})};b.useEffect(O,[e]);async function j(){const x=w.replace(/\s+/g,"");if(x.length<8||_){E({ok:!1,text:"That key looks too short."});return}y(!0),E(null);try{const Y=await fetch("/api/providers/glm",{method:"POST",headers:{...R,"Content-Type":"application/json"},body:JSON.stringify({key:x})}),Z=await Y.json().catch(()=>({}));Y.ok&&Z.connected?(v(""),E({ok:!0,text:"GLM connected."}),O()):E({ok:!1,text:Z.error==="invalid_key"?"That key looks invalid.":"Could not save the key."})}catch{E({ok:!1,text:"Could not save the key."})}finally{y(!1)}}async function $(){y(!0),E(null);try{await fetch("/api/providers/glm",{method:"DELETE",headers:R}),E({ok:!0,text:"GLM disconnected."}),O()}catch{}finally{y(!1)}}async function L(){if(!k){T(!0);try{await fetch("/api/auth/claude/logout",{method:"POST",headers:R})}catch{}if(s){s();return}try{window.location.assign("/")}catch{T(!1)}}}async function P(x){const Y=await fetch("/api/settings",{method:"POST",headers:{...R,"Content-Type":"application/json"},body:JSON.stringify(x)}).then(Z=>Z.ok?Z.json():null).catch(()=>null);return Y&&a(Y),Y}function A(x){const Y=qv.find(Z=>Z.id===x);!Y||!Y.build||(a(Z=>({...Z||{},autonomyLevel:x})),P({autonomyLevel:x}))}async function D(){h(!0);try{await P({conversationTitle:c})}finally{h(!1)}}async function M(){if(!f){p(!0);try{await fetch("/api/auth/logout",{method:"POST",headers:R}).catch(()=>{})}finally{try{window.location.assign("/")}catch{}}}}const W=(o==null?void 0:o.autonomyLevel)??null,N=(t==null?void 0:t.account)||null,H=((C=t==null?void 0:t.identity)==null?void 0:C.name)||((re=t==null?void 0:t.agent)==null?void 0:re.label)||"your agent";return l.jsx("div",{className:"modal-backdrop",onClick:n,"data-testid":"settings-backdrop",children:l.jsxs("div",{className:"modal settings-menu",onClick:x=>x.stopPropagation(),"data-testid":"settings-menu",children:[l.jsx("h2",{children:"Settings"}),l.jsx("p",{className:"muted",children:"The everyday knobs. Your agent handles the rest."}),l.jsx("div",{className:"set-section",children:"Permissions — what can your agent do on its own?"}),l.jsx("div",{className:"autonomy-dial","data-testid":"autonomy-dial",children:qv.map(x=>{const Y=W===x.id;return l.jsxs("button",{className:`autonomy-tier ${Y?"selected":""} ${x.build?"":"coming-soon"}`,onClick:()=>A(x.id),disabled:!x.build,"aria-pressed":Y,"data-testid":`autonomy-${x.id}`,children:[l.jsx("span",{className:"autonomy-emoji",children:x.emoji}),l.jsxs("span",{className:"autonomy-body",children:[l.jsxs("span",{className:"autonomy-title",children:[x.title,!x.build&&l.jsx("span",{className:"autonomy-soon","data-testid":"autonomy-coming-soon",children:"coming soon"}),Y&&l.jsx("span",{className:"autonomy-check",children:"✓"})]}),l.jsx("span",{className:"autonomy-desc",children:x.desc})]})]},x.id)})}),W===null&&l.jsxs("p",{className:"autonomy-note","data-testid":"autonomy-default-note",children:["Default — your agent ",l.jsx("strong",{children:"builds and edits freely"}),". Pick ",l.jsx("em",{children:"Check with me"})," to have it propose first, or ",l.jsx("em",{children:"Full autonomy"})," to lock it in."]}),l.jsx("div",{className:"set-section",children:"Conversation name"}),l.jsxs("div",{className:"set-rename",children:[l.jsx("input",{type:"text",value:c,placeholder:"Auto-named from your chat",onChange:x=>u(x.target.value),"data-testid":"rename-input",maxLength:120}),l.jsx("button",{onClick:D,disabled:d,"data-testid":"rename-save",children:d?"Saving…":"Save"})]}),l.jsx("p",{className:"muted small",children:"Overrides the name we auto-pick for this workspace’s presence label."}),l.jsx("div",{className:"set-section",children:"Appearance"}),l.jsx("button",{className:"set-row",onClick:()=>{r==null||r(),n==null||n()},"data-testid":"settings-open-theme",children:"🎨 Theme — light / dark + accent"}),i&&l.jsxs("button",{className:"set-row",onClick:()=>{i(),n==null||n()},"data-testid":"settings-open-reading",children:[l.jsx("span",{className:"set-row-aa","aria-hidden":"true",children:"Aa"})," Reading — chat font & size"]}),l.jsx("div",{className:"set-section",children:"Providers"}),l.jsxs("div",{className:"set-providers","data-testid":"settings-providers",children:[l.jsxs("div",{className:"set-provider-row",children:[l.jsx("span",{className:"set-provider-name",children:"🟦 GLM (Z.AI)"}),(Q=m==null?void 0:m.glm)!=null&&Q.connected?l.jsxs("span",{className:"set-provider-state",children:[l.jsx("span",{className:"set-provider-ok",children:"connected ✓"}),l.jsx("button",{onClick:$,disabled:_,"data-testid":"glm-disconnect",children:"Disconnect"})]}):l.jsxs("span",{className:"set-provider-connect",children:[l.jsx("input",{type:"password",value:w,onChange:x=>v(x.target.value),placeholder:"Paste your GLM API key","data-testid":"glm-key-input","aria-label":"GLM API key",autoComplete:"off",spellCheck:!1}),l.jsx("button",{className:"primary",onClick:j,disabled:_,"data-testid":"glm-connect",children:_?"Connecting…":"Connect"})]})]}),S&&l.jsx("p",{className:`set-provider-msg ${S.ok?"ok":"err"}`,"data-testid":"glm-msg",children:S.text}),l.jsxs("div",{className:"set-provider-row",children:[l.jsx("span",{className:"set-provider-name",children:"🟣 Claude"}),l.jsx("button",{onClick:L,disabled:k,"data-testid":"claude-signout",children:k?"Signing out…":"Sign out of Claude"})]}),l.jsx("p",{className:"muted small",children:"New chats let you pick Claude or GLM. Connecting GLM stores your key on this machine only. Signing out of Claude switches the account the agent runs under (you'll re-sign-in)."})]}),l.jsx("div",{className:"set-section",children:"Account"}),l.jsxs("div",{className:"set-account","data-testid":"settings-account",children:[l.jsxs("span",{className:"set-account-agent",children:["Your agent: ",l.jsx("strong",{children:H})]}),N!=null&&N.email?l.jsxs("span",{className:"set-account-email",children:["Signed in as ",N.email]}):l.jsx("span",{className:"set-account-email muted",children:"Signed in on this device"})]}),l.jsx("button",{className:"set-row set-signout",onClick:M,disabled:f,"data-testid":"settings-signout",children:f?"Signing out…":"↩ Sign out"}),l.jsx("div",{className:"actions",children:l.jsx("button",{onClick:n,"data-testid":"settings-done",children:"Done"})})]})})}function qM({reading:e,onChange:t,onClose:n}){return l.jsx("div",{className:"modal-backdrop",onClick:n,"data-testid":"reading-panel-backdrop",children:l.jsxs("div",{className:"modal reading-panel",onClick:r=>r.stopPropagation(),"data-testid":"reading-panel",role:"dialog","aria-label":"Reading settings",children:[l.jsxs("h2",{children:[l.jsx("span",{className:"reading-aa","aria-hidden":"true",children:"Aa"})," Reading"]}),l.jsx("p",{className:"muted",children:"Make the chat a pleasure to read. Changes apply live and follow you across your devices."}),l.jsx(y0,{reading:e,onChange:t}),l.jsx("div",{className:"actions",children:l.jsx("button",{className:"primary",onClick:n,"data-testid":"reading-done",children:"Done"})})]})})}const Ah=[{id:"desktop",glyph:"🖥️",label:"Desktop",width:null},{id:"tablet",glyph:"📱",label:"Tablet",width:834},{id:"phone",glyph:"📲",label:"Phone",width:390}];function KM({bazaarPreview:e}){const[t,n]=b.useState(null),[r,i]=b.useState("desktop");b.useEffect(()=>{let c=!1;async function u(){var p;const h=await fetch("/api/preview/ports").catch(()=>null);if(!h||c)return;const f=await h.json().catch(()=>({}));c||!t&&((p=f.ports)==null?void 0:p.length)>0&&n(f.ports[0].port)}u();const d=setInterval(u,2500);return()=>{c=!0,clearInterval(d)}},[t]);const s=e!=null&&e.url?`${e.url}${e.url.includes("?")?"&":"?"}_=${e.ts||""}`:null;if(!s&&!t)return l.jsxs("div",{className:"liveview-empty","data-testid":"liveview-empty",children:[l.jsx("div",{className:"liveview-empty-mark",children:"👁️"}),l.jsx("p",{className:"liveview-empty-title",children:"Nothing to show yet"}),l.jsx("p",{className:"liveview-empty-sub",children:"When your agent builds something, it appears here — live, as it works."}),l.jsx(bu,{variant:"ambient"})]});const o=s?l.jsx("iframe",{className:"liveview-frame",src:s,title:"Live view","data-testid":"liveview-frame",sandbox:"allow-scripts"},`bz-${e.ts}`):l.jsx("iframe",{className:"liveview-frame",src:`http://localhost:${t}`,title:"Live view","data-testid":"liveview-frame"},t),a=Ah.find(c=>c.id===r)||Ah[0];return l.jsxs("div",{className:"liveview-wrap","data-testid":"liveview-wrap",children:[l.jsx("div",{className:"liveview-bar",children:l.jsx("span",{className:"liveview-devices",role:"group","aria-label":"Preview device size",children:Ah.map(c=>l.jsx("button",{className:`liveview-device${r===c.id?" active":""}`,onClick:()=>i(c.id),"data-testid":`liveview-device-${c.id}`,title:c.label,"aria-pressed":r===c.id,children:c.glyph},c.id))})}),l.jsx("div",{className:`liveview-stage liveview-stage-${r}`,children:l.jsx("div",{className:"liveview-device-frame",style:a.width?{width:a.width,maxWidth:"100%"}:{width:"100%",height:"100%"},children:o})})]})}function YM({id:e}){const t=`wild:notes:${e}`,[n,r]=b.useState(()=>{try{return localStorage.getItem(t)||""}catch{return""}});return b.useEffect(()=>{try{localStorage.setItem(t,n)}catch{}},[t,n]),l.jsx("textarea",{className:"notes-block",value:n,onChange:i=>r(i.target.value),placeholder:"Jot anything — a plan, a link, a reminder…","data-testid":"notes-block"})}function GM(e){return`$${(Number(e)||0).toFixed(2)}`}function XM(e=[],t=[]){if(!e.length)return t.length?{name:"You",handle:"you",total:0,uses:0,matches:0,serviceCalls:0}:null;const n=e[0];return(n.total||0)===0&&e.find(r=>r.handle==="you")||n}function JM({live:e,token:t}){const[n,r]=b.useState(e||null);b.useEffect(()=>{let m=!1;const g=t?{Authorization:`Bearer ${t}`}:{};return fetch("/api/bazaar/state",{headers:g}).then(w=>w.ok?w.json():null).then(w=>{!m&&w&&r(v=>v||w)}).catch(()=>{}),()=>{m=!0}},[t]),b.useEffect(()=>{e&&r(e)},[e]);const i=b.useMemo(()=>XM(n==null?void 0:n.earnings,n==null?void 0:n.listings),[n]),s=i==null?void 0:i.handle,o=(i==null?void 0:i.total)??0,a=b.useRef({handle:null,total:null}),[c,u]=b.useState([]);if(b.useEffect(()=>{const m=a.current;if(m.handle!==s){a.current={handle:s,total:o},u([]);return}if(m.total===null){a.current={handle:s,total:o};return}const g=o-m.total;a.current={handle:s,total:o},g>0&&u(w=>[...w,g].slice(-28))},[s,o]),!i)return l.jsxs("div",{className:"earn-empty","data-testid":"earnings-empty",children:[l.jsx("div",{className:"earn-empty-mark",children:"💸"}),l.jsx("p",{className:"earn-empty-title",children:"No earnings yet"}),l.jsx("p",{className:"earn-empty-sub",children:"When someone builds on what you share — or uses a tool you wired in — represented earnings show up here, live."})]});const d=i.handle==="you",h=(i.serviceCalls||0)>0||(i.matches||0)>0,f=h?i.matches||0:i.uses||0,p=h?f===1?"match":"matches":f===1?"build":"builds";return l.jsxs("div",{className:"earn-block","data-testid":"earnings-block",children:[l.jsxs("div",{className:"earn-who",children:[l.jsxs("span",{className:"earn-name",children:[i.name,d&&l.jsx("span",{className:"earn-you-tag",children:"you"})]}),l.jsx("span",{className:"earn-sub",children:d?"your producer earnings":"a producer's earnings, live"})]}),l.jsx("div",{className:"earn-amount","data-testid":"earnings-amount",children:GM(o)}),l.jsxs("div",{className:"earn-meta",children:[l.jsxs("span",{children:[l.jsx("strong",{children:f})," ",p]}),l.jsx("span",{className:"earn-rep",title:"No real money moves yet — a preview of how earnings would work.",children:"represented · settles later"})]}),l.jsx(ZM,{values:c})]})}function ZM({values:e}){const t=e&&e.length>0,n=t?e:Array.from({length:16},()=>0),r=t?Math.max(...e):1;return l.jsxs("div",{className:`earn-spark ${t?"":"is-baseline"}`,"data-testid":"earnings-spark","aria-hidden":"true",children:[l.jsx("div",{className:"earn-bars",children:n.map((i,s)=>l.jsx("span",{className:"earn-bar",style:{height:`${t?8+Math.round(i/r*92):6}%`}},s))}),l.jsx("span",{className:"earn-spark-live",children:"live"})]})}function v0(e){const t=Math.max(0,Math.min(100,Number(e)||0));return Math.round(t)}function Kv(e,t){if(!e)return"";const n=Date.parse(e);if(!Number.isFinite(n))return"";let r=Math.floor((n-t)/1e3);if(r<=0)return"resetting…";const i=Math.floor(r/86400);r-=i*86400;const s=Math.floor(r/3600);r-=s*3600;const o=Math.floor(r/60);return i>0?`resets in ${i}d ${s}h`:s>0?`resets in ${s}h ${o}m`:`resets in ${o}m`}function Ih({label:e,value:t,sub:n,tone:r="accent",testid:i}){const s=v0(t);return l.jsxs("div",{className:"usage-gauge","data-testid":i,children:[l.jsxs("div",{className:"usage-gauge-head",children:[l.jsx("span",{className:"usage-gauge-label",children:e}),l.jsxs("span",{className:"usage-gauge-val",children:[s,"%"]})]}),l.jsx("div",{className:"usage-bar",children:l.jsx("span",{className:`usage-bar-fill tone-${r}`,style:{width:`${s}%`}})}),n?l.jsx("div",{className:"usage-gauge-sub",children:n}):null]})}function QM({live:e,token:t}){var _,y,S,E,k;const[n,r]=b.useState(e||null),[i,s]=b.useState(!1),[o,a]=b.useState(()=>Date.now()),c=b.useRef(!0),u=t?{Authorization:`Bearer ${t}`}:{};b.useEffect(()=>(c.current=!0,fetch("/api/usage/state",{headers:u}).then(T=>T.ok?T.json():null).then(T=>{c.current&&T&&r(R=>R?{...R,...T}:T)}).catch(()=>{}),()=>{c.current=!1}),[t]),b.useEffect(()=>{e&&r(e)},[e]),b.useEffect(()=>{const T=setInterval(()=>a(Date.now()),3e4);return()=>clearInterval(T)},[]);async function d(){s(!0);try{await fetch("/api/usage/ack",{method:"POST",headers:u});const T=await fetch("/api/usage/refresh",{method:"POST",headers:u}).then(R=>R.ok?R.json():null).catch(()=>null);c.current&&r(R=>({...R||{},...T||{},disclosed:!0}))}finally{c.current&&s(!1)}}if(n&&n.disclosed===!1)return l.jsxs("div",{className:"usage-block usage-disclose","data-testid":"usage-disclosure",children:[l.jsx("div",{className:"usage-disclose-mark",children:"📊"}),l.jsx("p",{className:"usage-disclose-title",children:"Show your Claude usage?"}),l.jsxs("p",{className:"usage-disclose-body",children:["To show your plan usage, your workspace reads your Claude login ",l.jsx("strong",{children:"locally"})," and asks Anthropic for your numbers. It never leaves this machine except to Anthropic."]}),l.jsx("button",{className:"usage-disclose-ok",onClick:d,disabled:i,"data-testid":"usage-disclose-ok",children:i?"One sec…":"OK, show my usage"})]});if(!n)return l.jsxs("div",{className:"usage-block","data-testid":"usage-loading",children:[l.jsx("div",{className:"usage-skeleton"}),l.jsx("div",{className:"usage-skeleton"}),l.jsx("div",{className:"usage-skeleton short"})]});const h=n.plan||null,f=n.context||null,p=n.status||"loading",m=!h||p==="unavailable",g=p==="stale",v=!h&&!!!f;return l.jsxs("div",{className:`usage-block ${g?"is-stale":""}`,"data-testid":"usage-block",children:[g&&l.jsx("div",{className:"usage-stale-note","data-testid":"usage-stale",children:"couldn't refresh — showing last known"}),h?l.jsxs(l.Fragment,{children:[l.jsx(Ih,{label:"Session",value:(_=h.five_hour)==null?void 0:_.utilization,sub:Kv((y=h.five_hour)==null?void 0:y.resets_at,o),tone:"accent",testid:"usage-session"}),l.jsx(Ih,{label:"Weekly",value:(S=h.seven_day)==null?void 0:S.utilization,sub:Kv((E=h.seven_day)==null?void 0:E.resets_at,o),tone:"weekly",testid:"usage-weekly"}),(k=h.extra_usage)!=null&&k.is_enabled?l.jsxs("div",{className:"usage-extra","data-testid":"usage-extra",children:["extra usage · ",v0(h.extra_usage.utilization),"% of $",h.extra_usage.monthly_limit]}):null]}):v?l.jsxs("div",{className:"usage-unavailable usage-warming","data-testid":"usage-warming",children:[l.jsx("span",{className:"usage-unavailable-title",children:"Usage appears after your first message"}),l.jsx("span",{className:"usage-unavailable-sub",children:"Send a message and your plan usage shows up here."})]}):l.jsxs("div",{className:"usage-unavailable","data-testid":"usage-unavailable",children:[l.jsx("span",{className:"usage-unavailable-title",children:"Plan usage unavailable"}),l.jsx("span",{className:"usage-unavailable-sub",children:p==="unavailable"?"Sign in to Claude (or a non-Claude model is active).":"Couldn’t reach Anthropic just now."})]}),f?l.jsx(Ih,{label:"Working memory",value:f.pct,sub:`${Math.round((f.used||0)/1e3)}k / ${Math.round((f.window||0)/1e3)}k tokens`,tone:"memory",testid:"usage-context"}):null,l.jsxs("div",{className:"usage-foot",children:[l.jsx("span",{className:"usage-live-dot","data-status":v?"waiting":p}),l.jsx("span",{children:v?"waiting":p==="live"?"live":p})]})]})}function eO({info:e,phase:t="idle",dismissed:n=!1,onApply:r,onDismiss:i}){const s=t==="applying",o=t==="done",a=t==="error",c=t==="uptodate",u=!!(e!=null&&e.available);if(!s&&!o&&!a&&!c&&(!u||n))return null;let d="✨";a?d="⚠️":(c||o)&&(d="✓");let h;return s?h=l.jsxs(l.Fragment,{children:["Updating to ",l.jsxs("strong",{children:["v",e==null?void 0:e.latest]}),"… this only takes a few seconds."]}):o?h=l.jsxs(l.Fragment,{children:["Updated to ",l.jsxs("strong",{children:["v",e==null?void 0:e.latest]})," — reloading…"]}):a?h=l.jsx(l.Fragment,{children:"That update didn’t finish. Try again, or restart your workspace."}):c?h=l.jsxs(l.Fragment,{children:["You’re on the latest version ",l.jsxs("strong",{children:["(v",e==null?void 0:e.current,")"]}),"."]}):h=l.jsxs(l.Fragment,{children:["A new version is ready — ",l.jsxs("strong",{children:["v",e==null?void 0:e.latest]}),"."]}),l.jsxs("div",{className:`update-nudge${a?" is-error":""}${s||o?" is-busy":""}`,"data-testid":"update-nudge",role:"status",children:[l.jsx("span",{className:"update-nudge-spark","aria-hidden":"true",children:d}),l.jsx("span",{className:"update-nudge-text",children:h}),!s&&!o&&!c&&l.jsx("button",{className:"update-nudge-go","data-testid":"update-now",onClick:r,children:a?"Try again":"Update now"}),!s&&!o&&l.jsx("button",{className:"update-nudge-x","data-testid":"update-dismiss",onClick:i,"aria-label":"Dismiss",title:"Later",children:"✕"})]})}function tO({token:e,onRun:t}){const[n,r]=b.useState(null),[i,s]=b.useState(!1),[o,a]=b.useState(null),c=b.useRef(!0),u=e?{Authorization:`Bearer ${e}`}:{};b.useEffect(()=>(c.current=!0,fetch("/api/powers/state",{headers:u}).then(y=>y.ok?y.json():null).then(y=>{c.current&&y&&r(y)}).catch(()=>{}),()=>{c.current=!1}),[e]);function d(){const y=((n==null?void 0:n.skills)||[]).map(E=>E.name),S=((n==null?void 0:n.skills)||[]).filter(E=>E.hidden).map(E=>E.name);a({order:y,hidden:S}),s(!0)}async function h(){const y=o||{order:[],hidden:[]},S=await fetch("/api/powers/curation",{method:"POST",headers:{...u,"Content-Type":"application/json"},body:JSON.stringify(y)}).then(k=>k.ok?k.json():null).catch(()=>null),E=await fetch("/api/powers/state",{headers:u}).then(k=>k.ok?k.json():null).catch(()=>null);return c.current&&(E&&r(E),s(!1),a(null)),S}function f(y){a(S=>{const E=new Set(S.hidden);return E.has(y)?E.delete(y):E.add(y),{...S,hidden:[...E]}})}function p(y,S){a(E=>{const k=[...E.order],T=k.indexOf(y),R=T+S;return T<0||R<0||R>=k.length?E:([k[T],k[R]]=[k[R],k[T]],{...E,order:k})})}if(!n)return l.jsxs("div",{className:"powers-block","data-testid":"powers-loading",children:[l.jsx("div",{className:"powers-skel"}),l.jsx("div",{className:"powers-skel"})]});const m=n.skills||[],g=new Set(i&&o?o.hidden:m.filter(y=>y.hidden).map(y=>y.name)),w=new Map((i&&o?o.order:m.map(y=>y.name)).map((y,S)=>[y,S])),v=[...m].sort((y,S)=>(w.get(y.name)??99)-(w.get(S.name)??99)),_=v.filter(y=>!g.has(y.name));return l.jsxs("div",{className:"powers-block","data-testid":"powers-block",children:[l.jsxs("div",{className:"powers-head",children:[l.jsx("span",{className:"powers-title",children:"Powers"}),m.length>0&&l.jsx("button",{className:"powers-edit",onClick:i?h:d,"data-testid":i?"powers-save":"powers-edit-toggle",children:i?"Done":"Customize"})]}),m.length===0?l.jsxs("div",{className:"powers-empty","data-testid":"powers-empty",children:[l.jsx("div",{className:"powers-empty-mark",children:"🧰"}),l.jsx("p",{className:"powers-empty-title",children:"No powers yet"}),l.jsxs("p",{className:"powers-empty-sub",children:["Skills you add to ",l.jsx("code",{children:".claude/skills"})," — your own or a teammate's — show up here as one-tap actions."]})]}):i?l.jsx("div",{className:"powers-list","data-testid":"powers-edit-list",children:v.map(y=>{const S=g.has(y.name);return l.jsxs("div",{className:`powers-row edit ${S?"is-hidden":""}`,"data-testid":`powers-row-${y.name}`,children:[l.jsxs("span",{className:"powers-reorder",children:[l.jsx("button",{onClick:()=>p(y.name,-1),title:"Move up","data-testid":`powers-up-${y.name}`,children:"▲"}),l.jsx("button",{onClick:()=>p(y.name,1),title:"Move down","data-testid":`powers-down-${y.name}`,children:"▼"})]}),l.jsxs("span",{className:"powers-row-name",children:["/",y.name]}),l.jsx("button",{className:"powers-hide",onClick:()=>f(y.name),"data-testid":`powers-hide-${y.name}`,children:S?"Show":"Hide"})]},y.name)})}):l.jsx("div",{className:"powers-list","data-testid":"powers-run-list",children:_.length===0?l.jsx("p",{className:"powers-allhidden",children:"All powers hidden — tap Customize to bring some back."}):_.map(y=>l.jsxs("button",{className:"powers-run",onClick:()=>t==null?void 0:t(y.name),title:y.description||`Run /${y.name}`,"data-testid":`powers-run-${y.name}`,children:[l.jsxs("span",{className:"powers-run-name",children:["/",y.name]}),y.description?l.jsx("span",{className:"powers-run-desc",children:y.description}):null,y.source==="user"?l.jsx("span",{className:"powers-tag",children:"yours"}):null]},y.name))}),l.jsxs("div",{className:"powers-bazaar","data-testid":"powers-bazaar-locked",children:[l.jsx("div",{className:"powers-divider",children:"─ from Bazaar ─"}),l.jsx("p",{className:"powers-bazaar-note",children:"🔒 Verified marketplace skills land here — coming soon."})]})]})}function Yv(e){return`$${(Number(e)||0).toFixed(2)}`}function nO({live:e,token:t}){const[n,r]=b.useState(e||null);b.useEffect(()=>{let u=!1;const d=t?{Authorization:`Bearer ${t}`}:{};return fetch("/api/bazaar/state",{headers:d}).then(h=>h.ok?h.json():null).then(h=>{!u&&h&&r(f=>f||h)}).catch(()=>{}),()=>{u=!0}},[t]),b.useEffect(()=>{e&&r(e)},[e]);const i=(n==null?void 0:n.earnings)||[],s=(n==null?void 0:n.totals)||{creditPaid:0},o=i.reduce((u,d)=>u+(d.matches||0),0),a=i.reduce((u,d)=>u+(d.uses||0),0),c=Math.max(1,...i.map(u=>u.total||0));return i.length?l.jsxs("div",{className:"analytics-block","data-testid":"analytics-block",children:[l.jsxs("div",{className:"an-stats",children:[l.jsxs("div",{className:"an-stat",children:[l.jsx("span",{className:"an-stat-num",children:Yv(s.creditPaid)}),l.jsx("span",{className:"an-stat-lbl",children:"represented"})]}),l.jsxs("div",{className:"an-stat",children:[l.jsx("span",{className:"an-stat-num",children:o||a}),l.jsx("span",{className:"an-stat-lbl",children:o?"matches":"builds"})]}),l.jsxs("div",{className:"an-stat",children:[l.jsx("span",{className:"an-stat-num",children:i.length}),l.jsx("span",{className:"an-stat-lbl",children:i.length===1?"producer":"producers"})]})]}),l.jsx("div",{className:"an-board",children:i.slice(0,6).map(u=>l.jsxs("div",{className:"an-row","data-testid":`analytics-row-${u.handle}`,children:[l.jsxs("span",{className:"an-row-name",children:[u.name,u.handle==="you"&&l.jsx("span",{className:"earn-you-tag",children:"you"})]}),l.jsx("span",{className:"an-row-bar",children:l.jsx("span",{className:"an-row-fill",style:{width:`${Math.round((u.total||0)/c*100)}%`}})}),l.jsx("span",{className:"an-row-val",children:Yv(u.total)})]},u.handle))}),l.jsx("div",{className:"an-foot",children:"represented · settles later"})]}):l.jsxs("div",{className:"earn-empty","data-testid":"analytics-empty",children:[l.jsx("div",{className:"earn-empty-mark",children:"📊"}),l.jsx("p",{className:"earn-empty-title",children:"No activity yet"}),l.jsx("p",{className:"earn-empty-sub",children:"Once builds and matches start flowing across the shelf, you'll see who's earning and how much, here."})]})}function rO({token:e,selectedFile:t,onOpenFile:n}){const[r,i]=b.useState(null),[s,o]=b.useState(null),[a,c]=b.useState(()=>new Set);b.useEffect(()=>{let h=!1;const f=e?{Authorization:`Bearer ${e}`}:{};return fetch("/api/workspace/tree",{headers:f}).then(p=>p.json()).then(p=>{h||(p.error?o(p.error):i(p.entries||[]))}).catch(p=>!h&&o(p.message||String(p))),()=>{h=!0}},[e]);function u(h){c(f=>{const p=new Set(f);return p.has(h)?p.delete(h):p.add(h),p})}function d(h,f=0){var w;const p=h.type==="dir",m=a.has(h.path),g=!p&&h.path===t;return l.jsxs("div",{children:[l.jsxs("div",{className:`fnode ${p?"dir":""} ${g?"sel":""}`,onClick:()=>p?u(h.path):n==null?void 0:n(h.path),style:{paddingLeft:f*12+6},"data-testid":`files-node-${h.path}`,title:h.path,children:[l.jsx("span",{className:"fnode-tw",children:p?m?"▾":"▸":""}),l.jsx("span",{className:"fnode-ic",children:p?"📁":"📄"}),l.jsx("span",{className:"fnode-nm",children:h.name})]}),p&&m&&((w=h.children)==null?void 0:w.map(v=>d(v,f+1)))]},h.path)}return l.jsxs("div",{className:"files-block","data-testid":"files-block",children:[s&&l.jsx("div",{className:"files-msg err",children:s==="forbidden"?"Files aren't available on this view.":s}),!r&&!s&&l.jsxs("div",{className:"files-msg",children:[l.jsx("span",{className:"spinner"})," loading…"]}),(r==null?void 0:r.length)===0&&l.jsx("div",{className:"files-msg",children:"Empty workspace"}),r==null?void 0:r.map(h=>d(h,0))]})}const iO={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",markdown:"markdown",css:"css",scss:"scss",html:"markup",xml:"markup",svg:"markup",py:"python",rs:"rust",go:"go",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",toml:"toml",sql:"sql",java:"java",c:"c",h:"c",cpp:"cpp",rb:"ruby",php:"php"};function sO(e){const t=String(e||"").split(".").pop().toLowerCase();return iO[t]||"text"}function oO({path:e,token:t,onPickFile:n}){const[r,i]=b.useState(e||""),[s,o]=b.useState({loading:!1});b.useEffect(()=>{i(e||"")},[e]),b.useEffect(()=>{if(!e){o({loading:!1});return}let c=!1;o({loading:!0});const u=t?{Authorization:`Bearer ${t}`}:{};return fetch(`/api/workspace/file?path=${encodeURIComponent(e)}`,{headers:u}).then(d=>d.json()).then(d=>{c||o({loading:!1,...d})}).catch(d=>{c||o({loading:!1,error:d.message||String(d)})}),()=>{c=!0}},[e,t]);const a=sO(e);return l.jsxs("div",{className:"codeblock","data-testid":"code-view-block",children:[l.jsxs("div",{className:"codeblock-bar",children:[l.jsx("input",{className:"codeblock-path",value:r,onChange:c=>i(c.target.value),onKeyDown:c=>c.key==="Enter"&&(n==null?void 0:n(r.trim())),placeholder:"path/to/file",spellCheck:!1,"data-testid":"code-path"}),s.truncated&&l.jsx("span",{className:"codeblock-trunc",title:"Large file — showing the start",children:"truncated"})]}),l.jsxs("div",{className:"codeblock-body",children:[!e&&l.jsx("div",{className:"codeblock-msg",children:"Pick a file in the Files block — or type a path above — to view it here."}),e&&s.loading&&l.jsxs("div",{className:"codeblock-msg",children:[l.jsx("span",{className:"spinner"})," loading…"]}),e&&s.error&&l.jsx("div",{className:"codeblock-msg err",children:s.error==="forbidden"?"Files aren't available on this view.":s.error}),e&&!s.loading&&!s.error&&typeof s.content=="string"&&l.jsx(kS,{theme:um.vsDark,code:s.content,language:a,children:({tokens:c,getLineProps:u,getTokenProps:d})=>l.jsx("pre",{className:"codeblock-pre",children:c.map((h,f)=>l.jsxs("div",{...u({line:h}),className:"codeblock-line",children:[l.jsx("span",{className:"codeblock-ln",children:f+1}),l.jsx("span",{className:"codeblock-lc",children:h.map((p,m)=>l.jsx("span",{...d({token:p})},m))})]},f))})})]})]})}function aO({id:e}){const t=`wild:todo:${e}`,[n,r]=b.useState(()=>{try{const d=JSON.parse(localStorage.getItem(t)||"[]");return Array.isArray(d)?d:[]}catch{return[]}}),[i,s]=b.useState("");b.useEffect(()=>{try{localStorage.setItem(t,JSON.stringify(n))}catch{}},[t,n]);function o(){const d=i.trim();d&&(r(h=>[...h,{id:`${Date.now().toString(36)}-${h.length}`,text:d,done:!1}]),s(""))}function a(d){r(h=>h.map(f=>f.id===d?{...f,done:!f.done}:f))}function c(d){r(h=>h.filter(f=>f.id!==d))}const u=n.filter(d=>!d.done).length;return l.jsxs("div",{className:"todo-block","data-testid":"todo-block",children:[l.jsxs("div",{className:"todo-add",children:[l.jsx("input",{value:i,onChange:d=>s(d.target.value),onKeyDown:d=>d.key==="Enter"&&o(),placeholder:"Add a to-do…","data-testid":"todo-input"}),l.jsx("button",{onClick:o,disabled:!i.trim(),"data-testid":"todo-add-btn",children:"Add"})]}),l.jsxs("div",{className:"todo-list",children:[n.length===0&&l.jsx("div",{className:"todo-msg",children:"Nothing yet — add your first to-do above."}),n.map(d=>l.jsxs("div",{className:`todo-item ${d.done?"done":""}`,"data-testid":"todo-item",children:[l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:d.done,onChange:()=>a(d.id)}),l.jsx("span",{className:"todo-text",children:d.text})]}),l.jsx("button",{className:"todo-del",title:"Remove",onClick:()=>c(d.id),children:"✕"})]},d.id))]}),n.length>0&&l.jsxs("div",{className:"todo-foot",children:[u," left · ",n.length-u," done"]})]})}const lO=4e3,cO="server";function uO({token:e}){const[t,n]=b.useState(null),[r,i]=b.useState(null),[s,o]=b.useState(null),[a,c]=b.useState(null),u=b.useRef(null);return b.useEffect(()=>{let d=!1;const h=e?{Authorization:`Bearer ${e}`}:{};return fetch("/api/workspace/logs",{headers:h}).then(f=>f.json()).then(f=>{if(d)return;if(f.error){c(f.error);return}const p=f.logs||[];n(p);const m=p.filter(w=>w.exists),g=m.find(w=>w.name===cO)||m[0]||p[0];g&&i(g.name)}).catch(f=>!d&&c(f.message||String(f))),()=>{d=!0}},[e]),b.useEffect(()=>{if(!r)return;let d=!1;const h=e?{Authorization:`Bearer ${e}`}:{},f=()=>{typeof document<"u"&&document.hidden||fetch(`/api/workspace/logs?name=${encodeURIComponent(r)}&lines=300`,{headers:h}).then(m=>m.json()).then(m=>{d||(m.error?c(m.error):(c(null),o(m.body||"")))}).catch(m=>!d&&c(m.message||String(m)))};o(null),f();const p=setInterval(f,lO);return()=>{d=!0,clearInterval(p)}},[r,e]),b.useEffect(()=>{const d=u.current;d&&(d.scrollTop=d.scrollHeight)},[s]),a?l.jsx("div",{className:"logs-block","data-testid":"logs-block",children:l.jsx("div",{className:"logs-msg err",children:a==="forbidden"?"Logs aren't available on this view.":String(a)})}):l.jsxs("div",{className:"logs-block","data-testid":"logs-block",children:[t&&l.jsxs("div",{className:"logs-bar",children:[l.jsx("select",{className:"logs-select","data-testid":"logs-select",value:r||"",onChange:d=>i(d.target.value),children:t.map(d=>l.jsxs("option",{value:d.name,children:[d.name,d.exists?"":" · empty"]},d.name))}),l.jsx("span",{className:"logs-hint",children:"live · auto-refresh"})]}),l.jsxs("div",{className:"logs-body",children:[s===null&&l.jsxs("div",{className:"logs-msg",children:[l.jsx("span",{className:"spinner"})," loading…"]}),s===""&&l.jsx("div",{className:"logs-msg",children:"No log output yet."}),s&&l.jsx("pre",{className:"logs-out","data-testid":"logs-out",ref:u,children:s})]})]})}function hO({tasks:e=[],token:t}){const n=e.filter(_u).length;return l.jsxs("div",{className:"tasks-block","data-testid":"tasks-block",children:[l.jsx("div",{className:"tasks-block-bar",children:l.jsxs("span",{className:"tasks-block-count",children:[e.length===0?"No background tasks":`${e.length} task${e.length===1?"":"s"}`,n>0&&l.jsxs("span",{className:"tasks-block-live",children:[" · ",n," running"]})]})}),l.jsxs("div",{className:"tasks-block-list",children:[e.length===0&&l.jsx("div",{className:"tasks-block-empty",children:"When your agent runs something in the background, it shows up here — with live status."}),e.map(r=>l.jsx(dO,{task:r,token:t},r.id))]})]})}function dO({task:e,token:t}){const[n,r]=b.useState(!1),[i,s]=b.useState(null),[o,a]=b.useState(()=>Date.now()),c=b.useRef(null),u=_u(e);b.useEffect(()=>{if(!u)return;const h=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(h)},[u]),b.useEffect(()=>{if(!n||!(e!=null&&e.id))return;let h=!1;const f=t?{Authorization:`Bearer ${t}`}:{},p=()=>{fetch(`/api/workspace/tasks/${encodeURIComponent(e.id)}/output?bytes=20000`,{headers:f}).then(g=>g.ok?g.json():null).then(g=>{h||s(g?g.output:"")}).catch(()=>{h||s("")})};p();const m=u?setInterval(p,3e3):null;return()=>{h=!0,m&&clearInterval(m)}},[n,e==null?void 0:e.id,t,u]),b.useEffect(()=>{const h=c.current;h&&(h.scrollTop=h.scrollHeight)},[i]);const d=dm(e,o);return l.jsxs("div",{className:`tasks-block-row ${d.cls}`,"data-testid":"tasks-block-row","data-status":e.status||"running",children:[l.jsxs("div",{className:"tasks-block-headrow",children:[l.jsxs("button",{className:"tasks-block-row-head",onClick:()=>r(h=>!h),title:e.command,children:[l.jsx("span",{className:`tasks-block-glyph ${d.cls}`,"aria-hidden":!0,children:d.glyph}),l.jsxs("span",{className:"tasks-block-rmain",children:[l.jsx("span",{className:"tasks-block-rtitle",children:fm(e)}),l.jsx("span",{className:"tasks-block-rdetail",children:d.detail})]}),l.jsx("span",{className:`tasks-block-rpill ${d.cls}`,children:d.label})]}),l.jsx(pm,{task:e,token:t})]}),n&&l.jsxs("div",{className:"tasks-block-rbody",children:[e.command&&l.jsx("pre",{className:"tasks-block-cmd",children:e.command}),i===null&&l.jsx("div",{className:"tasks-block-msg",children:"loading output…"}),i===""&&l.jsx("div",{className:"tasks-block-msg",children:"No output captured yet."}),i&&l.jsx("pre",{className:"tasks-block-out",ref:c,children:i})]})]})}function fO({tasks:e=[],token:t}){const[n,r]=b.useState(!1),i=b.useRef(null);b.useEffect(()=>{if(!n)return;const a=u=>{i.current&&!i.current.contains(u.target)&&r(!1)},c=u=>{u.key==="Escape"&&r(!1)};return document.addEventListener("mousedown",a),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",c)}},[n]);const s=e.filter(_u);if(e.length===0)return null;const o=s.length;return l.jsxs("div",{className:"tasks-tray",ref:i,"data-testid":"tasks-tray",children:[l.jsxs("button",{className:`tasks-pill ${o>0?"is-live":""}`,onClick:()=>r(a=>!a),"data-testid":"tasks-pill",title:o>0?`${o} background task${o===1?"":"s"} running`:"Background tasks","aria-expanded":n,children:[l.jsx("span",{className:"tasks-pill-glyph","aria-hidden":!0,children:o>0?"⟳":"⚙"}),l.jsxs("span",{className:"tasks-pill-label",children:[o>0&&l.jsx("span",{className:"tasks-pill-n",children:o}),l.jsx("span",{className:"tasks-pill-word",children:o>0?" running":"Tasks"})]})]}),n&&l.jsxs("div",{className:"tasks-dropdown","data-testid":"tasks-dropdown",children:[l.jsx("div",{className:"tasks-dropdown-head",children:"Background tasks"}),l.jsx("div",{className:"tasks-dropdown-list",children:e.map(a=>l.jsx(pO,{task:a,token:t},a.id))}),l.jsx("div",{className:"tasks-dropdown-foot",children:"Jobs your agent runs in the background. They keep running after the reply ends."})]})]})}function pO({task:e,token:t}){const[n,r]=b.useState(!1),[i,s]=b.useState(null),o=dm(e);return b.useEffect(()=>{if(!n||!(e!=null&&e.id))return;let a=!1;const c=t?{Authorization:`Bearer ${t}`}:{};return fetch(`/api/workspace/tasks/${encodeURIComponent(e.id)}/output?bytes=12000`,{headers:c}).then(u=>u.ok?u.json():null).then(u=>{a||s(u?u.output:"")}).catch(()=>{a||s("")}),()=>{a=!0}},[n,e==null?void 0:e.id,t]),l.jsxs("div",{className:`task-row ${o.cls}`,"data-testid":"task-row","data-status":e.status||"running",children:[l.jsxs("div",{className:"task-row-headrow",children:[l.jsxs("button",{className:"task-row-head",onClick:()=>r(a=>!a),title:e.command,children:[l.jsx("span",{className:`task-row-glyph ${o.cls}`,"aria-hidden":!0,children:o.glyph}),l.jsxs("span",{className:"task-row-main",children:[l.jsx("span",{className:"task-row-title",children:fm(e)}),l.jsx("span",{className:"task-row-detail",children:o.detail})]}),l.jsx("span",{className:`task-row-pill ${o.cls}`,children:o.label})]}),l.jsx(pm,{task:e,token:t})]}),n&&l.jsxs("div",{className:"task-row-body",children:[e.command&&l.jsx("pre",{className:"task-row-cmd",children:e.command}),i===null&&l.jsx("div",{className:"task-row-msg",children:"loading output…"}),i===""&&l.jsx("div",{className:"task-row-msg",children:"No output captured yet."}),i&&l.jsx("pre",{className:"task-row-out",children:i})]})]})}const mO=4e3;function gO(e,t){const[n,r]=b.useState([]),i=b.useRef(n);i.current=n,b.useEffect(()=>{r([])},[t]),b.useEffect(()=>{let o=!1;const a=e?{Authorization:`Bearer ${e}`}:{},c=()=>{typeof document<"u"&&document.hidden||fetch("/api/workspace/tasks",{headers:a}).then(d=>d.ok?d.json():null).then(d=>{!o&&d&&Array.isArray(d.tasks)&&r(d.tasks)}).catch(()=>{})};c();const u=setInterval(c,mO);return()=>{o=!0,clearInterval(u)}},[e,t]);const s=b.useCallback(o=>{!o||!o.id||t&&o.workspaceId&&o.workspaceId!==t||r(a=>{const c=a.findIndex(d=>d.id===o.id);if(c<0)return[o,...a];const u=a.slice();return u[c]=o,u})},[t]);return[n,s]}const El=100;function yO(e){const t=[];let n=[],r="",i=!1;for(let s=0;s<e.length;s+=1){const o=e[s];i?o==='"'?e[s+1]==='"'?(r+='"',s+=1):i=!1:r+=o:o==='"'?i=!0:o===","?(n.push(r),r=""):o===`
|
|
92
|
+
`?(n.push(r),r="",t.push(n),n=[]):o!=="\r"&&(r+=o)}return(r!==""||n.length>0)&&(n.push(r),t.push(n)),t.filter(s=>!(s.length===1&&s[0]===""))}function vO(e,t){const n=e.trim();if(t.endsWith(".json")||!t.endsWith(".csv")&&!t.endsWith(".tsv")&&/^[[{]/.test(n)){let a;try{a=JSON.parse(n)}catch(h){throw new Error(`Invalid JSON: ${h.message}`)}let c=Array.isArray(a)?a:[a];if(c.every(h=>h===null||typeof h!="object"))return{columns:["value"],rows:c.map(h=>({value:h}))};const d=[];for(const h of c)if(h&&typeof h=="object"&&!Array.isArray(h))for(const f of Object.keys(h))d.includes(f)||d.push(f);return d.length===0&&d.push("value"),c=c.map(h=>h&&typeof h=="object"&&!Array.isArray(h)?h:{value:h}),{columns:d,rows:c}}const i=yO(e);if(i.length===0)return{columns:[],rows:[]};const s=i[0].map((a,c)=>a||`col${c+1}`),o=i.slice(1).map(a=>{const c={};return s.forEach((u,d)=>{c[u]=a[d]??""}),c});return{columns:s,rows:o}}function Nl(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function _O({token:e}){const[t,n]=b.useState(""),[r,i]=b.useState(""),[s,o]=b.useState(null),[a,c]=b.useState(null),[u,d]=b.useState(!1),[h,f]=b.useState(""),[p,m]=b.useState(null);function g(_){const y=r.trim();if(!y)return;n(y),d(!0),c(null),o(null),f(""),m(null);const S=e?{Authorization:`Bearer ${e}`}:{};fetch(`/api/workspace/file?path=${encodeURIComponent(y)}`,{headers:S}).then(E=>E.json()).then(E=>{if(E.error){c(E.error==="forbidden"?"Data files aren't available on this view.":E.error);return}try{o(vO(E.content||"",y))}catch(k){c(k.message||String(k))}}).catch(E=>c(E.message||String(E))).finally(()=>d(!1))}function w(_){m(y=>!y||y.col!==_?{col:_,dir:"asc"}:y.dir==="asc"?{col:_,dir:"desc"}:null)}const v=b.useMemo(()=>{if(!s)return null;let _=s.rows;const y=h.trim().toLowerCase();if(y&&(_=_.filter(S=>s.columns.some(E=>Nl(S[E]).toLowerCase().includes(y)))),p){const{col:S,dir:E}=p;_=[..._].sort((k,T)=>{const R=k[S],O=T[S],j=Number(R),$=Number(O);let L;return R!==""&&O!==""&&!Number.isNaN(j)&&!Number.isNaN($)?L=j-$:L=Nl(R).localeCompare(Nl(O)),E==="asc"?L:-L})}return{total:_.length,rows:_.slice(0,El)}},[s,h,p]);return l.jsxs("div",{className:"dtable-block","data-testid":"datatable-block",children:[l.jsxs("div",{className:"dtable-bar",children:[l.jsx("input",{className:"dtable-path","data-testid":"datatable-path",value:r,onChange:_=>i(_.target.value),onKeyDown:_=>{_.key==="Enter"&&g()},placeholder:"data.csv or records.json","aria-label":"File path"}),l.jsx("button",{className:"dtable-load","data-testid":"datatable-load",onClick:()=>g(),disabled:!r.trim()||u,children:u?"…":"Load"}),s&&l.jsx("input",{className:"dtable-filter","data-testid":"datatable-filter",value:h,onChange:_=>f(_.target.value),placeholder:"Filter rows…","aria-label":"Filter rows"})]}),l.jsxs("div",{className:"dtable-body",children:[a&&l.jsx("div",{className:"dtable-msg err","data-testid":"datatable-error",children:a}),u&&l.jsxs("div",{className:"dtable-msg",children:[l.jsx("span",{className:"spinner"})," loading ",t,"…"]}),!u&&!a&&!s&&l.jsx("div",{className:"dtable-msg","data-testid":"datatable-empty",children:"Enter a CSV or JSON file path from your workspace to load it as a table."}),!u&&!a&&s&&s.columns.length===0&&l.jsx("div",{className:"dtable-msg",children:"That file has no rows to show."}),!u&&!a&&v&&s.columns.length>0&&l.jsxs(l.Fragment,{children:[v.total===0?l.jsxs("div",{className:"dtable-msg","data-testid":"datatable-nomatch",children:["No rows match “",h,"”."]}):l.jsx("div",{className:"dtable-scroll",children:l.jsxs("table",{className:"dtable","data-testid":"datatable",children:[l.jsx("thead",{children:l.jsx("tr",{children:s.columns.map(_=>l.jsxs("th",{onClick:()=>w(_),"data-testid":`datatable-th-${_}`,title:"Click to sort",children:[_,(p==null?void 0:p.col)===_?p.dir==="asc"?" ▲":" ▼":""]},_))})}),l.jsx("tbody",{children:v.rows.map((_,y)=>l.jsx("tr",{children:s.columns.map(S=>l.jsx("td",{children:Nl(_[S])},S))},y))})]})}),v.total>0&&l.jsxs("div",{className:"dtable-foot",children:["showing ",Math.min(v.total,El)," of ",v.total," row",v.total===1?"":"s",v.total>El?` (capped at ${El})`:""]})]})]})]})}function bO({canDeploy:e,onSetup:t}){return l.jsxs("div",{className:"deploy-block","data-testid":"deploy-block",children:[l.jsxs("div",{className:"deploy-empty",children:[l.jsx("div",{className:"deploy-icon",children:"🚀"}),l.jsx("p",{className:"deploy-title",children:"No deploy target connected yet"}),l.jsx("p",{className:"deploy-sub",children:"When you’re ready to put this build online, your agent handles the deploy — wiring up a target, building, and shipping it. Nothing here is faked."}),e?l.jsx("button",{className:"deploy-btn primary","data-testid":"deploy-setup",onClick:()=>t==null?void 0:t(),children:"Set up deployment"}):l.jsx("p",{className:"deploy-note","data-testid":"deploy-locked",children:"Ask the workspace owner to set up a deploy target."})]}),l.jsxs("div",{className:"deploy-history",children:[l.jsx("div",{className:"deploy-history-h",children:"Recent deploys"}),l.jsx("div",{className:"deploy-msg","data-testid":"deploy-history-empty",children:"No deployments yet."})]})]})}/**
|
|
93
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
94
|
+
* @license MIT
|
|
95
|
+
*
|
|
96
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
97
|
+
* @license MIT
|
|
98
|
+
*
|
|
99
|
+
* Originally forked from (with the author's permission):
|
|
100
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
101
|
+
* http://bellard.org/jslinux/
|
|
102
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
103
|
+
*/var _0=Object.defineProperty,wO=Object.getOwnPropertyDescriptor,xO=(e,t)=>{for(var n in t)_0(e,n,{get:t[n],enumerable:!0})},It=(e,t,n,r)=>{for(var i=r>1?void 0:r?wO(t,n):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&_0(t,n,i),i},pe=(e,t)=>(n,r)=>t(n,r,e),Gv="Terminal input",ff={get:()=>Gv,set:e=>Gv=e},Xv="Too much output to announce, navigate to rows manually to read",pf={get:()=>Xv,set:e=>Xv=e};function SO(e){return e.replace(/\r?\n/g,"\r")}function kO(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function CO(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function EO(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");b0(i,t,n,r)}}function b0(e,t,n,r){e=SO(e),e=kO(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function w0(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function Jv(e,t,n,r,i){w0(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function gi(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Tu(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var NO=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 s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return this._interim=o,r;let a=e.charCodeAt(s);56320<=a&&a<=57343?t[r++]=(o-55296)*1024+a-56320+65536:(t[r++]=o,t[r++]=a);continue}o!==65279&&(t[r++]=o)}return r}},jO=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=0,i,s,o,a,c=0,u=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,g;for(;(g=this.interim[++m]&63)&&m<4;)p<<=6,p|=g;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=w-m;for(;u<v;){if(u>=n)return 0;if(g=e[u++],(g&192)!==128){u--,f=!0;break}else this.interim[m++]=g,p<<=6,p|=g&63}f||(w===2?p<128?u--:t[r++]=p:w===3?p<2048||p>=55296&&p<=57343||p===65279||(t[r++]=p):p<65536||p>1114111||(t[r++]=p)),this.interim.fill(0)}let d=n-4,h=u;for(;h<n;){for(;h<d&&!((i=e[h])&128)&&!((s=e[h+1])&128)&&!((o=e[h+2])&128)&&!((a=e[h+3])&128);)t[r++]=i,t[r++]=s,t[r++]=o,t[r++]=a,h+=4;if(i=e[h++],i<128)t[r++]=i;else if((i&224)===192){if(h>=n)return this.interim[0]=i,r;if(s=e[h++],(s&192)!==128){h--;continue}if(c=(i&31)<<6|s&63,c<128){h--;continue}t[r++]=c}else if((i&240)===224){if(h>=n)return this.interim[0]=i,r;if(s=e[h++],(s&192)!==128){h--;continue}if(h>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[h++],(o&192)!==128){h--;continue}if(c=(i&15)<<12|(s&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)===240){if(h>=n)return this.interim[0]=i,r;if(s=e[h++],(s&192)!==128){h--;continue}if(h>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[h++],(o&192)!==128){h--;continue}if(h>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,r;if(a=e[h++],(a&192)!==128){h--;continue}if(c=(i&7)<<18|(s&63)<<12|(o&63)<<6|a&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},x0="",wi=" ",Ga=class S0{constructor(){this.fg=0,this.bg=0,this.extended=new Wc}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new S0;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Wc=class k0{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new k0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},sr=class C0 extends Ga{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Wc,this.combinedData=""}static fromCharData(t){let n=new C0;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?gi(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Zv="di$target",mf="di$dependencies",Mh=new Map;function RO(e){return e[mf]||[]}function tn(e){if(Mh.has(e))return Mh.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");TO(t,n,i)};return t._id=e,Mh.set(e,t),t}function TO(e,t,n){t[Zv]===t?t[mf].push({id:e,index:n}):(t[mf]=[{id:e,index:n}],t[Zv]=t)}var Cn=tn("BufferService"),E0=tn("CoreMouseService"),bs=tn("CoreService"),PO=tn("CharsetService"),Dm=tn("InstantiationService"),N0=tn("LogService"),En=tn("OptionsService"),j0=tn("OscLinkService"),DO=tn("UnicodeService"),Xa=tn("DecorationService"),gf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var d;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new sr,o=n.getTrimmedLength(),a=-1,c=-1,u=!1;for(let h=0;h<o;h++)if(!(c===-1&&!n.hasContent(h))){if(n.loadCell(h,s),s.hasExtendedAttrs()&&s.extended.urlId)if(c===-1){c=h,a=s.extended.urlId;continue}else u=s.extended.urlId!==a;else c!==-1&&(u=!0);if(u||c!==-1&&h===o-1){let f=(d=this._oscLinkService.getLinkData(a))==null?void 0:d.uri;if(f){let p={start:{x:c+1,y:e},end:{x:h+(!u&&h===o-1?1:0),y:e}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let g=new URL(f);["http:","https:"].includes(g.protocol)||(m=!0)}catch{m=!0}m||r.push({text:f,range:p,activate:(g,w)=>i?i.activate(g,w,p):LO(g,w),hover:(g,w)=>{var v;return(v=i==null?void 0:i.hover)==null?void 0:v.call(i,g,w,p)},leave:(g,w)=>{var v;return(v=i==null?void 0:i.leave)==null?void 0:v.call(i,g,w,p)}})}u=!1,s.hasExtendedAttrs()&&s.extended.urlId?(c=h,a=s.extended.urlId):(c=-1,a=-1)}}t(r)}};gf=It([pe(0,Cn),pe(1,En),pe(2,j0)],gf);function LO(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
104
|
+
|
|
105
|
+
WARNING: This link could potentially be dangerous`)){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")}}var Pu=tn("CharSizeService"),ei=tn("CoreBrowserService"),Lm=tn("MouseService"),ti=tn("RenderService"),AO=tn("SelectionService"),R0=tn("CharacterJoinerService"),bo=tn("ThemeService"),T0=tn("LinkProviderService"),IO=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Qv.isErrorNoTelemetry(e)?new Qv(e.message+`
|
|
106
|
+
|
|
107
|
+
`+e.stack):new Error(e.message+`
|
|
108
|
+
|
|
109
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},MO=new IO;function ec(e){OO(e)||MO.onUnexpectedError(e)}var yf="Canceled";function OO(e){return e instanceof zO?!0:e instanceof Error&&e.name===yf&&e.message===yf}var zO=class extends Error{constructor(){super(yf),this.name=this.message}};function BO(e){return new Error(`Illegal argument: ${e}`)}var Qv=class vf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof vf)return t;let n=new vf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},_f=class P0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,P0.prototype)}};function Bn(e,t=0){return e[e.length-(1+t)]}var $O;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})($O||($O={}));function FO(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var D0;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(S){yield S}e.single=i;function s(S){return t(S)?S:i(S)}e.wrap=s;function o(S){return S||n}e.from=o;function*a(S){for(let E=S.length-1;E>=0;E--)yield S[E]}e.reverse=a;function c(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=c;function u(S){return S[Symbol.iterator]().next().value}e.first=u;function d(S,E){let k=0;for(let T of S)if(E(T,k++))return!0;return!1}e.some=d;function h(S,E){for(let k of S)if(E(k))return k}e.find=h;function*f(S,E){for(let k of S)E(k)&&(yield k)}e.filter=f;function*p(S,E){let k=0;for(let T of S)yield E(T,k++)}e.map=p;function*m(S,E){let k=0;for(let T of S)yield*E(T,k++)}e.flatMap=m;function*g(...S){for(let E of S)yield*E}e.concat=g;function w(S,E,k){let T=k;for(let R of S)T=E(T,R);return T}e.reduce=w;function*v(S,E,k=S.length){for(E<0&&(E+=S.length),k<0?k+=S.length:k>S.length&&(k=S.length);E<k;E++)yield S[E]}e.slice=v;function _(S,E=Number.POSITIVE_INFINITY){let k=[];if(E===0)return[k,S];let T=S[Symbol.iterator]();for(let R=0;R<E;R++){let O=T.next();if(O.done)return[k,e.empty()];k.push(O.value)}return[k,{[Symbol.iterator](){return T}}]}e.consume=_;async function y(S){let E=[];for await(let k of S)E.push(k);return Promise.resolve(E)}e.asyncToArray=y})(D0||(D0={}));function ms(e){if(D0.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function HO(...e){return Et(()=>ms(e))}function Et(e){return{dispose:FO(()=>{e()})}}var L0=class A0{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ms(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?A0.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};L0.DISABLE_DISPOSED_WARNING=!1;var Ti=L0,$e=class{constructor(){this._store=new Ti,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};$e.None=Object.freeze({dispose(){}});var fo=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Vr=typeof window=="object"?window:globalThis,bf=class wf{constructor(t){this.element=t,this.next=wf.Undefined,this.prev=wf.Undefined}};bf.Undefined=new bf(void 0);var jt=bf,e_=class{constructor(){this._first=jt.Undefined,this._last=jt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===jt.Undefined}clear(){let e=this._first;for(;e!==jt.Undefined;){let t=e.next;e.prev=jt.Undefined,e.next=jt.Undefined,e=t}this._first=jt.Undefined,this._last=jt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new jt(e);if(this._first===jt.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==jt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==jt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==jt.Undefined&&e.next!==jt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===jt.Undefined&&e.next===jt.Undefined?(this._first=jt.Undefined,this._last=jt.Undefined):e.next===jt.Undefined?(this._last=this._last.prev,this._last.next=jt.Undefined):e.prev===jt.Undefined&&(this._first=this._first.next,this._first.prev=jt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==jt.Undefined;)yield e.element,e=e.next}},WO=globalThis.performance&&typeof globalThis.performance.now=="function",UO=class I0{static create(t){return new I0(t)}constructor(t){this._now=WO&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},on;(e=>{e.None=()=>$e.None;function t(L,P){return h(L,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function n(L){return(P,A=null,D)=>{let M=!1,W;return W=L(N=>{if(!M)return W?W.dispose():M=!0,P.call(A,N)},null,D),M&&W.dispose(),W}}e.once=n;function r(L,P,A){return u((D,M=null,W)=>L(N=>D.call(M,P(N)),null,W),A)}e.map=r;function i(L,P,A){return u((D,M=null,W)=>L(N=>{P(N),D.call(M,N)},null,W),A)}e.forEach=i;function s(L,P,A){return u((D,M=null,W)=>L(N=>P(N)&&D.call(M,N),null,W),A)}e.filter=s;function o(L){return L}e.signal=o;function a(...L){return(P,A=null,D)=>{let M=HO(...L.map(W=>W(N=>P.call(A,N))));return d(M,D)}}e.any=a;function c(L,P,A,D){let M=A;return r(L,W=>(M=P(M,W),M),D)}e.reduce=c;function u(L,P){let A,D={onWillAddFirstListener(){A=L(M.fire,M)},onDidRemoveLastListener(){A==null||A.dispose()}},M=new ae(D);return P==null||P.add(M),M.event}function d(L,P){return P instanceof Array?P.push(L):P&&P.add(L),L}function h(L,P,A=100,D=!1,M=!1,W,N){let H,C,re,Q=0,x,Y={leakWarningThreshold:W,onWillAddFirstListener(){H=L(oe=>{Q++,C=P(C,oe),D&&!re&&(Z.fire(C),C=void 0),x=()=>{let me=C;C=void 0,re=void 0,(!D||Q>1)&&Z.fire(me),Q=0},typeof A=="number"?(clearTimeout(re),re=setTimeout(x,A)):re===void 0&&(re=0,queueMicrotask(x))})},onWillRemoveListener(){M&&Q>0&&(x==null||x())},onDidRemoveLastListener(){x=void 0,H.dispose()}},Z=new ae(Y);return N==null||N.add(Z),Z.event}e.debounce=h;function f(L,P=0,A){return e.debounce(L,(D,M)=>D?(D.push(M),D):[M],P,void 0,!0,void 0,A)}e.accumulate=f;function p(L,P=(D,M)=>D===M,A){let D=!0,M;return s(L,W=>{let N=D||!P(W,M);return D=!1,M=W,N},A)}e.latch=p;function m(L,P,A){return[e.filter(L,P,A),e.filter(L,D=>!P(D),A)]}e.split=m;function g(L,P=!1,A=[],D){let M=A.slice(),W=L(C=>{M?M.push(C):H.fire(C)});D&&D.add(W);let N=()=>{M==null||M.forEach(C=>H.fire(C)),M=null},H=new ae({onWillAddFirstListener(){W||(W=L(C=>H.fire(C)),D&&D.add(W))},onDidAddFirstListener(){M&&(P?setTimeout(N):N())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return D&&D.add(H),H.event}e.buffer=g;function w(L,P){return(A,D,M)=>{let W=P(new _);return L(function(N){let H=W.evaluate(N);H!==v&&A.call(D,H)},void 0,M)}}e.chain=w;let v=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(A=>(P(A),A)),this}filter(P){return this.steps.push(A=>P(A)?A:v),this}reduce(P,A){let D=A;return this.steps.push(M=>(D=P(D,M),D)),this}latch(P=(A,D)=>A===D){let A=!0,D;return this.steps.push(M=>{let W=A||!P(M,D);return A=!1,D=M,W?M:v}),this}evaluate(P){for(let A of this.steps)if(P=A(P),P===v)break;return P}}function y(L,P,A=D=>D){let D=(...H)=>N.fire(A(...H)),M=()=>L.on(P,D),W=()=>L.removeListener(P,D),N=new ae({onWillAddFirstListener:M,onDidRemoveLastListener:W});return N.event}e.fromNodeEventEmitter=y;function S(L,P,A=D=>D){let D=(...H)=>N.fire(A(...H)),M=()=>L.addEventListener(P,D),W=()=>L.removeEventListener(P,D),N=new ae({onWillAddFirstListener:M,onDidRemoveLastListener:W});return N.event}e.fromDOMEventEmitter=S;function E(L){return new Promise(P=>n(L)(P))}e.toPromise=E;function k(L){let P=new ae;return L.then(A=>{P.fire(A)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=k;function T(L,P){return L(A=>P.fire(A))}e.forward=T;function R(L,P,A){return P(A),L(D=>P(D))}e.runAndSubscribe=R;class O{constructor(P,A){this._observable=P,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new ae(D),A&&A.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,A){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function j(L,P){return new O(L,P).emitter.event}e.fromObservable=j;function $(L){return(P,A,D)=>{let M=0,W=!1,N={beginUpdate(){M++},endUpdate(){M--,M===0&&(L.reportChanges(),W&&(W=!1,P.call(A)))},handlePossibleChange(){},handleChange(){W=!0}};L.addObserver(N),L.reportChanges();let H={dispose(){L.removeObserver(N)}};return D instanceof Ti?D.add(H):Array.isArray(D)&&D.push(H),H}}e.fromObservableLight=$})(on||(on={}));var xf=class Sf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Sf._idPool++}`,Sf.all.add(this)}start(t){this._stopWatch=new UO,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};xf.all=new Set,xf._idPool=0;var VO=xf,qO=-1,M0=class O0{constructor(t,n,r=(O0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let c=new GO(a,s);this._errorHandler(c)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};M0._idPool=1;var KO=M0,YO=class z0{constructor(t){this.value=t}static create(){let t=new Error;return new z0(t.stack??"")}print(){console.warn(this.value.split(`
|
|
110
|
+
`).slice(2).join(`
|
|
111
|
+
`))}},GO=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},XO=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},JO=0,Oh=class{constructor(e){this.value=e,this.id=JO++}},ZO=2,QO,ae=class{constructor(e){var t,n,r,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new KO((e==null?void 0:e.onListenerError)??ec,((n=this._options)==null?void 0:n.leakWarningThreshold)??qO):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new VO(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,a,c,u,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new XO(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||ec)(p),$e.None}if(this._disposed)return $e.None;t&&(e=e.bind(t));let r=new Oh(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=YO.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Oh?(this._deliveryQueue??(this._deliveryQueue=new ez),this._listeners=[this._listeners,r]):this._listeners.push(r):((c=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||c.call(a,this),this._listeners=r,(d=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||d.call(u,this)),this._size++;let s=Et(()=>{i==null||i(),this._removeListener(r)});return n instanceof Ti?n.add(s):Array.isArray(n)&&n.push(s),s}),this._event}_removeListener(e){var i,s,o,a;if((s=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||s.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ZO<=t.length){let c=0;for(let u=0;u<t.length;u++)t[u]?t[c++]=t[u]:r&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=c}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||ec;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,i;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Oh)this._deliver(this._listeners,e);else{let s=this._deliveryQueue;s.enqueue(this,e,this._listeners.length),this._deliverQueue(s)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},ez=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},kf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};kf.INSTANCE=new kf;var Am=kf;function tz(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Am.INSTANCE.onDidChangeZoomLevel;function nz(e){return Am.INSTANCE.getZoomFactor(e)}Am.INSTANCE.onDidChangeFullscreen;var wo=typeof navigator=="object"?navigator.userAgent:"",Cf=wo.indexOf("Firefox")>=0,rz=wo.indexOf("AppleWebKit")>=0,Im=wo.indexOf("Chrome")>=0,iz=!Im&&wo.indexOf("Safari")>=0;wo.indexOf("Electron/")>=0;wo.indexOf("Android")>=0;var zh=!1;if(typeof Vr.matchMedia=="function"){let e=Vr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Vr.matchMedia("(display-mode: fullscreen)");zh=e.matches,tz(Vr,e,({matches:n})=>{zh&&t.matches||(zh=n)})}var Ys="en",Ef=!1,Nf=!1,tc=!1,B0=!1,jl,nc=Ys,t_=Ys,sz,ur,os=globalThis,sn,J_;typeof os.vscode<"u"&&typeof os.vscode.process<"u"?sn=os.vscode.process:typeof process<"u"&&typeof((J_=process==null?void 0:process.versions)==null?void 0:J_.node)=="string"&&(sn=process);var Z_,oz=typeof((Z_=sn==null?void 0:sn.versions)==null?void 0:Z_.electron)=="string",az=oz&&(sn==null?void 0:sn.type)==="renderer",Q_;if(typeof sn=="object"){Ef=sn.platform==="win32",Nf=sn.platform==="darwin",tc=sn.platform==="linux",tc&&sn.env.SNAP&&sn.env.SNAP_REVISION,sn.env.CI||sn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,jl=Ys,nc=Ys;let e=sn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);jl=t.userLocale,t_=t.osLocale,nc=t.resolvedLanguage||Ys,sz=(Q_=t.languagePack)==null?void 0:Q_.translationsConfigFile}catch{}B0=!0}else typeof navigator=="object"&&!az?(ur=navigator.userAgent,Ef=ur.indexOf("Windows")>=0,Nf=ur.indexOf("Macintosh")>=0,(ur.indexOf("Macintosh")>=0||ur.indexOf("iPad")>=0||ur.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tc=ur.indexOf("Linux")>=0,(ur==null?void 0:ur.indexOf("Mobi"))>=0,nc=globalThis._VSCODE_NLS_LANGUAGE||Ys,jl=navigator.language.toLowerCase(),t_=jl):console.error("Unable to resolve platform.");var $0=Ef,Ar=Nf,lz=tc,n_=B0,Ir=ur,ui=nc,cz;(e=>{function t(){return ui}e.value=t;function n(){return ui.length===2?ui==="en":ui.length>=3?ui[0]==="e"&&ui[1]==="n"&&ui[2]==="-":!1}e.isDefaultVariant=n;function r(){return ui==="en"}e.isDefault=r})(cz||(cz={}));var uz=typeof os.postMessage=="function"&&!os.importScripts;(()=>{if(uz){let e=[];os.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),os.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var hz=!!(Ir&&Ir.indexOf("Chrome")>=0);Ir&&Ir.indexOf("Firefox")>=0;!hz&&Ir&&Ir.indexOf("Safari")>=0;Ir&&Ir.indexOf("Edg/")>=0;Ir&&Ir.indexOf("Android")>=0;var Ts=typeof navigator=="object"?navigator:{};n_||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ts&&Ts.clipboard&&Ts.clipboard.writeText,n_||Ts&&Ts.clipboard&&Ts.clipboard.readText;var Mm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Bh=new Mm,r_=new Mm,i_=new Mm,dz=new Array(230),F0;(e=>{function t(a){return Bh.keyCodeToStr(a)}e.toString=t;function n(a){return Bh.strToKeyCode(a)}e.fromString=n;function r(a){return r_.keyCodeToStr(a)}e.toUserSettingsUS=r;function i(a){return i_.keyCodeToStr(a)}e.toUserSettingsGeneral=i;function s(a){return r_.strToKeyCode(a)||i_.strToKeyCode(a)}e.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Bh.keyCodeToStr(a)}e.toElectronAccelerator=o})(F0||(F0={}));var fz=class H0{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof H0&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new pz([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},pz=class{constructor(e){if(e.length===0)throw BO("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function mz(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return F0.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Cf)switch(t){case 59:return 85;case 60:if(lz)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ar)return 57;break}else if(rz&&(Ar&&t===93||!Ar&&t===92))return 57;return dz[t]||0}var gz=Ar?256:2048,yz=512,vz=1024,_z=Ar?2048:256,s_=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=mz(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=gz),this.altKey&&(t|=yz),this.shiftKey&&(t|=vz),this.metaKey&&(t|=_z),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new fz(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},o_=new WeakMap;function bz(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var wz=class{static getSameOriginWindowChain(e){let t=o_.get(e);if(!t){t=[],o_.set(e,t);let n=e,r;do r=bz(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let a=s.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},Rl=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=wz.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},a_=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Im){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,a=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Cf&&!Ar?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")iz&&$0?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let c=e;c.deltaMode===c.DOM_DELTA_LINE?Cf&&!Ar?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},W0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),xz;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Sz?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:on.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:W0})})(xz||(xz={}));var Sz=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?W0:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Om=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new _f("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new _f("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},kz=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new _f("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Et(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Cz;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(Cz||(Cz={}));var l_=class Zn{static fromArray(t){return new Zn(n=>{n.emitMany(t)})}static fromPromise(t){return new Zn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Zn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Zn(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ae,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await on.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Zn(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return Zn.map(this,t)}static filter(t,n){return new Zn(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return Zn.filter(this,t)}static coalesce(t){return Zn.filter(t,n=>!!n)}coalesce(){return Zn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Zn.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};l_.EMPTY=l_.fromArray([]);var{getWindow:Tr,getWindowId:Ez,onDidRegisterWindow:Nz}=function(){let e=new Map,t={window:Vr,disposables:new Ti};e.set(Vr.vscodeWindowId,t);let n=new ae,r=new ae,i=new ae;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return $e.None;let a=new Ti,c={window:o,disposables:a.add(new Ti)};return e.set(o.vscodeWindowId,c),a.add(Et(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),a.add(je(o,Gt.BEFORE_UNLOAD,()=>{i.fire(o)})),n.fire(c),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var u;let a=o;if((u=a==null?void 0:a.ownerDocument)!=null&&u.defaultView)return a.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:Vr},getDocument(o){return Tr(o).document}}}(),jz=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function je(e,t,n,r){return new jz(e,t,n,r)}var c_=function(e,t,n,r){return je(e,t,n,r)},zm,Rz=class extends kz{constructor(e){super(),this.defaultTarget=e&&Tr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},u_=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ec(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(u_.sort),o.shift().execute();r.set(s,!1)};zm=(s,o,a=0)=>{let c=Ez(s),u=new u_(o,a),d=e.get(c);return d||(d=[],e.set(c,d)),d.push(u),n.get(c)||(n.set(c,!0),s.requestAnimationFrame(()=>i(c))),u}})();function Tz(e){let t=e.getBoundingClientRect(),n=Tr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Gt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Pz=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=jn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=jn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=jn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=jn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=jn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=jn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=jn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=jn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=jn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=jn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=jn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=jn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=jn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=jn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function jn(e){return typeof e=="number"?`${e}px`:e}function pa(e){return new Pz(e)}var U0=class{constructor(){this._hooks=new Ti,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(Et(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=Tr(e)}this._hooks.add(je(s,Gt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(je(s,Gt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function Dz(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var Sr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Sr||(Sr={}));var Yo=class dn extends $e{constructor(){super(),this.dispatched=!1,this.targets=new e_,this.ignoreTargets=new e_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(on.runAndSubscribe(Nz,({window:t,disposables:n})=>{n.add(je(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(je(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(je(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Vr,disposables:this._store}))}static addTarget(t){if(!dn.isTouchDevice())return $e.None;dn.INSTANCE||(dn.INSTANCE=new dn);let n=dn.INSTANCE.targets.push(t);return Et(n)}static ignoreTarget(t){if(!dn.isTouchDevice())return $e.None;dn.INSTANCE||(dn.INSTANCE=new dn);let n=dn.INSTANCE.ignoreTargets.push(t);return Et(n)}static isTouchDevice(){return"ontouchstart"in Vr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(Sr.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let a=n.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],u=Date.now()-c.initialTimeStamp;if(u<dn.HOLD_DELAY&&Math.abs(c.initialPageX-Bn(c.rollingPageX))<30&&Math.abs(c.initialPageY-Bn(c.rollingPageY))<30){let d=this.newGestureEvent(Sr.Tap,c.initialTarget);d.pageX=Bn(c.rollingPageX),d.pageY=Bn(c.rollingPageY),this.dispatchEvent(d)}else if(u>=dn.HOLD_DELAY&&Math.abs(c.initialPageX-Bn(c.rollingPageX))<30&&Math.abs(c.initialPageY-Bn(c.rollingPageY))<30){let d=this.newGestureEvent(Sr.Contextmenu,c.initialTarget);d.pageX=Bn(c.rollingPageX),d.pageY=Bn(c.rollingPageY),this.dispatchEvent(d)}else if(i===1){let d=Bn(c.rollingPageX),h=Bn(c.rollingPageY),f=Bn(c.rollingTimestamps)-c.rollingTimestamps[0],p=d-c.rollingPageX[0],m=h-c.rollingPageY[0],g=[...this.targets].filter(w=>c.initialTarget instanceof Node&&w.contains(c.initialTarget));this.inertia(t,g,r,Math.abs(p)/f,p>0?1:-1,d,Math.abs(m)/f,m>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Sr.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===Sr.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>dn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Sr.Change||t.type===Sr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,a,c,u){this.handle=zm(t,()=>{let d=Date.now(),h=d-r,f=0,p=0,m=!0;i+=dn.SCROLL_FRICTION*h,a+=dn.SCROLL_FRICTION*h,i>0&&(m=!1,f=s*i*h),a>0&&(m=!1,p=c*a*h);let g=this.newGestureEvent(Sr.Change);g.translationX=f,g.translationY=p,n.forEach(w=>w.dispatchEvent(g)),m||this.inertia(t,n,d,i,s,o+f,a,c,u+p)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],a=this.newGestureEvent(Sr.Change,o.initialTarget);a.translationX=s.pageX-Bn(o.rollingPageX),a.translationY=s.pageY-Bn(o.rollingPageY),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Yo.SCROLL_FRICTION=-.005,Yo.HOLD_DELAY=700,Yo.CLEAR_TAP_COUNT_TIME=400,It([Dz],Yo,"isTouchDevice",1);var Lz=Yo,Bm=class extends $e{onclick(e,t){this._register(je(e,Gt.CLICK,n=>t(new Rl(Tr(e),n))))}onmousedown(e,t){this._register(je(e,Gt.MOUSE_DOWN,n=>t(new Rl(Tr(e),n))))}onmouseover(e,t){this._register(je(e,Gt.MOUSE_OVER,n=>t(new Rl(Tr(e),n))))}onmouseleave(e,t){this._register(je(e,Gt.MOUSE_LEAVE,n=>t(new Rl(Tr(e),n))))}onkeydown(e,t){this._register(je(e,Gt.KEY_DOWN,n=>t(new s_(n))))}onkeyup(e,t){this._register(je(e,Gt.KEY_UP,n=>t(new s_(n))))}oninput(e,t){this._register(je(e,Gt.INPUT,t))}onblur(e,t){this._register(je(e,Gt.BLUR,t))}onfocus(e,t){this._register(je(e,Gt.FOCUS,t))}onchange(e,t){this._register(je(e,Gt.CHANGE,t))}ignoreGesture(e){return Lz.ignoreTarget(e)}},h_=11,Az=class extends Bm{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=h_+"px",this.domNode.style.height=h_+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new U0),this._register(c_(this.bgDomNode,Gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(c_(this.domNode,Gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Rz),this._pointerdownScheduleRepeatTimer=this._register(new Om)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Tr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Iz=class jf{constructor(t,n,r,i,s,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=i,this.rawScrollTop=a,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new jf(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new jf(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:c}}},Mz=class extends $e{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Iz(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new f_(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=f_.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},d_=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function $h(e,t){let n=t-e;return function(r){return e+n*Bz(r)}}function Oz(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var f_=class Rf{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),Oz($h(t,i),$h(s,n),.33)}return $h(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new d_(r,i,!1)}return new d_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Rf.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new Rf(t,n,i,r)}};function zz(e){return Math.pow(e,3)}function Bz(e){return 1-zz(1-e)}var $z=class extends $e{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Om)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},Fz=140,V0=class extends Bm{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new $z(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new U0),this._shouldRender=!0,this.domNode=pa(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(je(this.domNode.domNode,Gt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Az(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=pa(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(je(this.slider.domNode,Gt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=Tz(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-n);if($0&&o>Fz){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},q0=class Tf{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Tf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),a=Math.max(0,o-2*n),c=i>0&&i>r;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(r*a/i))),d=(a-u)/(i-r),h=s*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let t=Tf._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},Hz=class extends V0{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new q0(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Wz=class extends V0{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new q0(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Uz=500,p_=50,Vz=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Pf=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Im){let n=Tr(t.browserEvent),r=nz(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new Vz(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),c=Math.max(Math.min(i,o),1),u=Math.max(Math.min(s,a),1),d=Math.max(i,o),h=Math.max(s,a);d%c===0&&h%u===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Pf.INSTANCE=new Pf;var qz=Pf,Kz=class extends Bm{constructor(e,t,n){super(),this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ae),this.onWillScroll=this._onWillScroll.event,this._options=Gz(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Wz(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Hz(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=pa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=pa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=pa(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new Om),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ms(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ar&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new a_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ms(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new a_(n))};this._mouseWheelToDispose.push(je(this._listenOnDomNode,Gt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=qz.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let a=!Ar&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(s){let d=p_*s,h=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(u,h)}if(o){let d=p_*o,h=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(u,h)}u=this._scrollable.validateScrollPosition(u),(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Uz)}},Yz=class extends Kz{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Gz(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ar&&(t.className+=" mac"),t}var Df=class extends $e{constructor(e,t,n,r,i,s,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Mz({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>zm(r.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Yz(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(on.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Et(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Et(()=>this._styleElement.remove())),this._register(on.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
112
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(u=>this._handleScroll(u)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Df=It([pe(2,Cn),pe(3,ei),pe(4,E0),pe(5,bo),pe(6,En),pe(7,ti)],Df);var Lf=class extends $e{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(Et(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Lf=It([pe(1,Cn),pe(2,ei),pe(3,Xa),pe(4,ti)],Lf);var Xz=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},wr={full:0,left:0,center:0,right:0},hi={full:0,left:0,center:0,right:0},Io={full:0,left:0,center:0,right:0},Uc=class extends $e{constructor(e,t,n,r,i,s,o,a){var u;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new Xz,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(u=this._viewportElement.parentElement)==null||u.insertBefore(this._canvas,this._viewportElement),this._register(Et(()=>{var d;return(d=this._canvas)==null?void 0:d.remove()}));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);hi.full=this._canvas.width,hi.left=e,hi.center=t,hi.right=e,this._refreshDrawHeightConstants(),Io.full=1,Io.left=1,Io.center=1+hi.left,Io.right=1+hi.left+hi.center}_refreshDrawHeightConstants(){wr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);wr.left=t,wr.center=t,wr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Io[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-wr[e.position||"full"]/2),hi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+wr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Uc=It([pe(2,Cn),pe(3,Xa),pe(4,ti),pe(5,En),pe(6,bo),pe(7,ei)],Uc);var q;(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=`
|
|
113
|
+
`,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=""))(q||(q={}));var rc;(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=""))(rc||(rc={}));var K0;(e=>e.ST=`${q.ESC}\\`)(K0||(K0={}));var Af=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${q.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Af=It([pe(2,Cn),pe(3,En),pe(4,bs),pe(5,ti)],Af);var Jt=0,Zt=0,Qt=0,Lt=0,m_={css:"#00000000",rgba:0},$t;(e=>{function t(i,s,o,a){return a!==void 0?`#${Ui(i)}${Ui(s)}${Ui(o)}${Ui(a)}`:`#${Ui(i)}${Ui(s)}${Ui(o)}`}e.toCss=t;function n(i,s,o,a=255){return(i<<24|s<<16|o<<8|a)>>>0}e.toRgba=n;function r(i,s,o,a){return{css:e.toCss(i,s,o,a),rgba:e.toRgba(i,s,o,a)}}e.toColor=r})($t||($t={}));var xt;(e=>{function t(c,u){if(Lt=(u.rgba&255)/255,Lt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,h=u.rgba>>16&255,f=u.rgba>>8&255,p=c.rgba>>24&255,m=c.rgba>>16&255,g=c.rgba>>8&255;Jt=p+Math.round((d-p)*Lt),Zt=m+Math.round((h-m)*Lt),Qt=g+Math.round((f-g)*Lt);let w=$t.toCss(Jt,Zt,Qt),v=$t.toRgba(Jt,Zt,Qt);return{css:w,rgba:v}}e.blend=t;function n(c){return(c.rgba&255)===255}e.isOpaque=n;function r(c,u,d){let h=ic.ensureContrastRatio(c.rgba,u.rgba,d);if(h)return $t.toColor(h>>24&255,h>>16&255,h>>8&255)}e.ensureContrastRatio=r;function i(c){let u=(c.rgba|255)>>>0;return[Jt,Zt,Qt]=ic.toChannels(u),{css:$t.toCss(Jt,Zt,Qt),rgba:u}}e.opaque=i;function s(c,u){return Lt=Math.round(u*255),[Jt,Zt,Qt]=ic.toChannels(c.rgba),{css:$t.toCss(Jt,Zt,Qt,Lt),rgba:$t.toRgba(Jt,Zt,Qt,Lt)}}e.opacity=s;function o(c,u){return Lt=c.rgba&255,s(c,Lt*u/255)}e.multiplyOpacity=o;function a(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=a})(xt||(xt={}));var Rt;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return Jt=parseInt(i.slice(1,2).repeat(2),16),Zt=parseInt(i.slice(2,3).repeat(2),16),Qt=parseInt(i.slice(3,4).repeat(2),16),$t.toColor(Jt,Zt,Qt);case 5:return Jt=parseInt(i.slice(1,2).repeat(2),16),Zt=parseInt(i.slice(2,3).repeat(2),16),Qt=parseInt(i.slice(3,4).repeat(2),16),Lt=parseInt(i.slice(4,5).repeat(2),16),$t.toColor(Jt,Zt,Qt,Lt);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return Jt=parseInt(s[1]),Zt=parseInt(s[2]),Qt=parseInt(s[3]),Lt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),$t.toColor(Jt,Zt,Qt,Lt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jt,Zt,Qt,Lt]=t.getImageData(0,0,1,1).data,Lt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:$t.toRgba(Jt,Zt,Qt,Lt),css:i}}e.toColor=r})(Rt||(Rt={}));var _n;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/255,a=i/255,c=s/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+h*.0722}e.relativeLuminance2=n})(_n||(_n={}));var ic;(e=>{function t(o,a){if(Lt=(a&255)/255,Lt===1)return a;let c=a>>24&255,u=a>>16&255,d=a>>8&255,h=o>>24&255,f=o>>16&255,p=o>>8&255;return Jt=h+Math.round((c-h)*Lt),Zt=f+Math.round((u-f)*Lt),Qt=p+Math.round((d-p)*Lt),$t.toRgba(Jt,Zt,Qt)}e.blend=t;function n(o,a,c){let u=_n.relativeLuminance(o>>8),d=_n.relativeLuminance(a>>8);if(Br(u,d)<c){if(d<u){let p=r(o,a,c),m=Br(u,_n.relativeLuminance(p>>8));if(m<c){let g=i(o,a,c),w=Br(u,_n.relativeLuminance(g>>8));return m>w?p:g}return p}let h=i(o,a,c),f=Br(u,_n.relativeLuminance(h>>8));if(f<c){let p=r(o,a,c),m=Br(u,_n.relativeLuminance(p>>8));return f>m?h:p}return h}}e.ensureContrastRatio=n;function r(o,a,c){let u=o>>24&255,d=o>>16&255,h=o>>8&255,f=a>>24&255,p=a>>16&255,m=a>>8&255,g=Br(_n.relativeLuminance2(f,p,m),_n.relativeLuminance2(u,d,h));for(;g<c&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),g=Br(_n.relativeLuminance2(f,p,m),_n.relativeLuminance2(u,d,h));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=r;function i(o,a,c){let u=o>>24&255,d=o>>16&255,h=o>>8&255,f=a>>24&255,p=a>>16&255,m=a>>8&255,g=Br(_n.relativeLuminance2(f,p,m),_n.relativeLuminance2(u,d,h));for(;g<c&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),g=Br(_n.relativeLuminance2(f,p,m),_n.relativeLuminance2(u,d,h));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(ic||(ic={}));function Ui(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Br(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Jz=class extends Ga{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Vc=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new sr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,s=0,o=0,a=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==c){if(u-i>1){let d=this._getJoinedRanges(r,o,s,t,i);for(let h=0;h<d.length;h++)n.push(d[h])}i=u,o=s,a=this._workCell.fg,c=this._workCell.bg}s+=this._workCell.getChars().length||wi.length}if(this._bufferService.cols-i>1){let u=this._getJoinedRanges(r,o,s,t,i);for(let d=0;d<u.length;d++)n.push(u[d])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(s)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let c=this._characterJoiners[a].handler(s);for(let u=0;u<c.length;u++)Vc._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let a=n;a<this._bufferService.cols;a++){let c=t.getWidth(a),u=t.getString(a).length||wi.length;if(c!==0){if(!i&&o[0]<=s&&(o[0]=a,i=!0),o[1]<=s){if(o[1]=a,o=e[++r],!o)break;o[0]<=s?(o[0]=a,i=!0):i=!1}s+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Vc=It([pe(0,Cn)],Vc);function Zz(e){return 57508<=e&&e<=57558}function Qz(e){return 9472<=e&&e<=9631}function eB(e){return Zz(e)||Qz(e)}function tB(){return{css:{canvas:Tl(),cell:Tl()},device:{canvas:Tl(),cell:Tl(),char:{width:0,height:0,left:0,top:0}}}}function Tl(){return{width:0,height:0}}var If=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new sr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,a,c,u,d){let h=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<s+1&&(m=s+1);let g,w=0,v="",_=0,y=0,S=0,E=0,k=!1,T=0,R=!1,O=0,j=0,$=[],L=u!==-1&&d!==-1;for(let P=0;P<m;P++){e.loadCell(P,this._workCell);let A=this._workCell.getWidth();if(A===0)continue;let D=!1,M=P>=j,W=P,N=this._workCell;if(f.length>0&&P===f[0][0]&&M){let fe=f.shift(),it=this._isCellInSelection(fe[0],t);for(_=fe[0]+1;_<fe[1];_++)M&&(M=it===this._isCellInSelection(_,t));M&&(M=!n||s<fe[0]||s>=fe[1]),M?(D=!0,N=new Jz(this._workCell,e.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),W=fe[1]-1,A=N.getWidth()):j=fe[1]}let H=this._isCellInSelection(P,t),C=n&&P===s,re=L&&P>=u&&P<=d,Q=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,fe=>{Q=!0});let x=N.getChars()||wi;if(x===" "&&(N.isUnderline()||N.isOverline())&&(x=" "),O=A*a-c.get(x,N.isBold(),N.isItalic()),!g)g=this._document.createElement("span");else if(w&&(H&&R||!H&&!R&&N.bg===y)&&(H&&R&&p.selectionForeground||N.fg===S)&&N.extended.ext===E&&re===k&&O===T&&!C&&!D&&!Q&&M){N.isInvisible()?v+=wi:v+=x,w++;continue}else w&&(g.textContent=v),g=this._document.createElement("span"),w=0,v="";if(y=N.bg,S=N.fg,E=N.extended.ext,k=re,T=O,R=H,D&&s>=P&&s<=W&&(s=P),!this._coreService.isCursorHidden&&C&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&$.push("xterm-cursor-blink"),$.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(N.isBold()&&$.push("xterm-bold"),N.isItalic()&&$.push("xterm-italic"),N.isDim()&&$.push("xterm-dim"),N.isInvisible()?v=wi:v=N.getChars()||wi,N.isUnderline()&&($.push(`xterm-underline-${N.extended.underlineStyle}`),v===" "&&(v=" "),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${Ga.toColorRGB(N.getUnderlineColor()).join(",")})`;else{let fe=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&fe<8&&(fe+=8),g.style.textDecorationColor=p.ansi[fe].css}N.isOverline()&&($.push("xterm-overline"),v===" "&&(v=" ")),N.isStrikethrough()&&$.push("xterm-strikethrough"),re&&(g.style.textDecoration="underline");let Y=N.getFgColor(),Z=N.getFgColorMode(),oe=N.getBgColor(),me=N.getBgColorMode(),Ee=!!N.isInverse();if(Ee){let fe=Y;Y=oe,oe=fe;let it=Z;Z=me,me=it}let U,ye,we=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,fe=>{fe.options.layer!=="top"&&we||(fe.backgroundColorRGB&&(me=50331648,oe=fe.backgroundColorRGB.rgba>>8&16777215,U=fe.backgroundColorRGB),fe.foregroundColorRGB&&(Z=50331648,Y=fe.foregroundColorRGB.rgba>>8&16777215,ye=fe.foregroundColorRGB),we=fe.options.layer==="top")}),!we&&H&&(U=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,oe=U.rgba>>8&16777215,me=50331648,we=!0,p.selectionForeground&&(Z=50331648,Y=p.selectionForeground.rgba>>8&16777215,ye=p.selectionForeground)),we&&$.push("xterm-decoration-top");let Se;switch(me){case 16777216:case 33554432:Se=p.ansi[oe],$.push(`xterm-bg-${oe}`);break;case 50331648:Se=$t.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(g,`background-color:#${g_((oe>>>0).toString(16),"0",6)}`);break;case 0:default:Ee?(Se=p.foreground,$.push("xterm-bg-257")):Se=p.background}switch(U||N.isDim()&&(U=xt.multiplyOpacity(Se,.5)),Z){case 16777216:case 33554432:N.isBold()&&Y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Y+=8),this._applyMinimumContrast(g,Se,p.ansi[Y],N,U,void 0)||$.push(`xterm-fg-${Y}`);break;case 50331648:let fe=$t.toColor(Y>>16&255,Y>>8&255,Y&255);this._applyMinimumContrast(g,Se,fe,N,U,ye)||this._addStyle(g,`color:#${g_(Y.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(g,Se,p.foreground,N,U,ye)||Ee&&$.push("xterm-fg-257")}$.length&&(g.className=$.join(" "),$.length=0),!C&&!D&&!Q&&M?w++:g.textContent=v,O!==this.defaultSpacing&&(g.style.letterSpacing=`${O}px`),h.push(g),P=W}return g&&w&&(g.textContent=v),h}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||eB(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!i&&!s&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=xt.ensureContrastRatio(i||t,s||n,c),o.setColor((i||t).rgba,(s||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};If=It([pe(1,R0),pe(2,En),pe(3,ei),pe(4,bs),pe(5,Xa),pe(6,bo)],If);function g_(e,t,n){for(;e.length<n;)e=t+e;return e}var nB=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},rB=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[1]-i,a=Math.max(s,0),c=Math.min(o,e.rows-1);if(a>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function iB(){return new rB}var Fh="xterm-dom-renderer-owner-",Jn="xterm-rows",Pl="xterm-fg-",y_="xterm-bg-",Mo="xterm-focus",Dl="xterm-selection",sB=1,Mf=class extends $e{constructor(e,t,n,r,i,s,o,a,c,u,d,h,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=c,this._optionsService=u,this._bufferService=d,this._coreService=h,this._coreBrowserService=f,this._themeService=p,this._terminalClass=sB++,this._rowElements=[],this._selectionRenderModel=iB(),this.onRequestRedraw=this._register(new ae).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Jn),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(Dl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=tB(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(If,document),this._element.classList.add(Fh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(Et(()=>{this._element.classList.remove(Fh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new nB(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Jn} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Jn} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Jn} .xterm-dim { color: ${xt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Jn}.${Mo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Jn}.${Mo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Jn}.${Mo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Jn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Jn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Jn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Jn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Jn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Dl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Dl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Dl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Pl}${s} { color: ${o.css}; }${this._terminalSelector} .${Pl}${s}.xterm-dim { color: ${xt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${y_}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Pl}257 { color: ${xt.opaque(e.background).css}; }${this._terminalSelector} .${Pl}257.xterm-dim { color: ${xt.multiplyOpacity(xt.opaque(e.background),.5).css}; }${this._terminalSelector} .${y_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Mo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Mo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let c=e[0]>t[0];a.appendChild(this._createSelectionElement(s,c?t[0]:e[0],c?e[0]:t[0],o-s+1))}else{let c=r===s?e[0]:0,u=s===i?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,c,u));let d=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,d)),s!==o){let h=i===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let u=c+n.ydisp,d=this._rowElements[c],h=n.lines.get(u);if(!d||!h)break;d.replaceChildren(...this._rowFactory.createRow(h,u,u===r,o,a,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Fh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let a=this._bufferService.buffer,c=a.ybase+a.y,u=Math.min(a.x,i-1),d=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=n;p<=r;++p){let m=p+a.ydisp,g=this._rowElements[p],w=a.lines.get(m);if(!g||!w)break;g.replaceChildren(...this._rowFactory.createRow(w,m,m===c,h,f,u,d,this.dimensions.css.cell.width,this._widthCache,s?p===n?e:0:-1,s?(p===r?t:i)-1:-1))}}};Mf=It([pe(7,Dm),pe(8,Pu),pe(9,En),pe(10,Cn),pe(11,bs),pe(12,ei),pe(13,bo)],Mf);var Of=class extends $e{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ae),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new aB(this._optionsService))}catch{this._measureStrategy=this._register(new oB(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Of=It([pe(2,En)],Of);var Y0=class extends $e{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},oB=class extends Y0{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},aB=class extends Y0{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},lB=class extends $e{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new cB(this._window)),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ae),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(on.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(je(this._textarea,"focus",()=>this._isFocused=!0)),this._register(je(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},cB=class extends $e{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fo),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Et(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=je(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},uB=class extends $e{constructor(){super(),this.linkProviders=[],this._register(Et(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function $m(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function hB(e,t,n,r,i,s,o,a,c){if(!s)return;let u=$m(e,t,n);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/a),u[0]=Math.min(Math.max(u[0],1),r+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),i),u}var zf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return hB(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=$m(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};zf=It([pe(0,ti),pe(1,Pu)],zf);var dB=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},G0={};xO(G0,{getSafariVersion:()=>pB,isChromeOS:()=>Q0,isFirefox:()=>X0,isIpad:()=>mB,isIphone:()=>gB,isLegacyEdge:()=>fB,isLinux:()=>Fm,isMac:()=>qc,isNode:()=>Du,isSafari:()=>J0,isWindows:()=>Z0});var Du=typeof process<"u"&&"title"in process,Ja=Du?"node":navigator.userAgent,Za=Du?"node":navigator.platform,X0=Ja.includes("Firefox"),fB=Ja.includes("Edge"),J0=/^((?!chrome|android).)*safari/i.test(Ja);function pB(){if(!J0)return 0;let e=Ja.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qc=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Za),mB=Za==="iPad",gB=Za==="iPhone",Z0=["Windows","Win16","Win32","WinCE"].includes(Za),Fm=Za.indexOf("Linux")>=0,Q0=/\bCrOS\b/.test(Ja),ek=class{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),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(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=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},yB=class extends ek{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},vB=class extends ek{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Kc=!Du&&"requestIdleCallback"in window?vB:yB,_B=class{constructor(){this._queue=new Kc}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Bf=class extends $e{constructor(e,t,n,r,i,s,o,a,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=a,this._renderer=this._register(new fo),this._pausedResizeTask=new _B,this._observerDisposable=this._register(new fo),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new ae),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ae),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ae),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new dB((u,d)=>this._renderRows(u,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new bB(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Et(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var u;return(u=this._renderer.value)==null?void 0:u.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(u=>this._registerIntersectionObserver(u,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Et(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Bf=It([pe(2,En),pe(3,Pu),pe(4,bs),pe(5,Xa),pe(6,Cn),pe(7,ei),pe(8,bo)],Bf);var bB=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function wB(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return kB(i,s,e,t,n,r)+Lu(s,t,n,r)+CB(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",Ma(Math.abs(i-e),Ia(o,r));o=s>t?"D":"C";let a=Math.abs(s-t),c=SB(s>t?e:i,n)+(a-1)*n.cols+1+xB(s>t?i:e);return Ma(c,Ia(o,r))}function xB(e,t){return e-1}function SB(e,t){return t.cols-e}function kB(e,t,n,r,i,s){return Lu(t,r,i,s).length===0?"":Ma(nk(e,t,e,t-gs(t,i),!1,i).length,Ia("D",s))}function Lu(e,t,n,r){let i=e-gs(e,n),s=t-gs(t,n),o=Math.abs(i-s)-EB(e,t,n);return Ma(o,Ia(tk(e,t),r))}function CB(e,t,n,r,i,s){let o;Lu(t,r,i,s).length>0?o=r-gs(r,i):o=t;let a=r,c=NB(e,t,n,r,i,s);return Ma(nk(e,o,n,a,c==="C",i).length,Ia(c,s))}function EB(e,t,n){var o;let r=0,i=e-gs(e,n),s=t-gs(t,n);for(let a=0;a<Math.abs(i-s);a++){let c=tk(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+c*a))!=null&&o.isWrapped&&r++}return r}function gs(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function NB(e,t,n,r,i,s){let o;return Lu(n,r,i,s).length>0?o=r-gs(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function tk(e,t){return e>t?"A":"B"}function nk(e,t,n,r,i,s){let o=e,a=t,c="";for(;(o!==n||a!==r)&&a>=0&&a<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(c+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!i&&o<0&&(c+=s.buffer.translateBufferLineToString(a,!1,0,e+1),o=s.cols-1,e=o,a--);return c+s.buffer.translateBufferLineToString(a,!1,e,o)}function Ia(e,t){let n=t?"O":"[";return q.ESC+n+e}function Ma(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var jB=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function v_(e,t){if(e.start.y>e.end.y)throw new 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)}var Hh=50,RB=15,TB=50,PB=500,DB=" ",LB=new RegExp(DB,"g"),$f=class extends $e{constructor(e,t,n,r,i,s,o,a,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=a,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new sr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ae),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ae),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=u=>this._handleMouseMove(u),this._mouseUpListener=u=>this._handleMouseUp(u),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(u=>this._handleTrim(u)),this._register(this._bufferService.buffers.onBufferActivate(u=>this._handleBufferActivate(u))),this.enable(),this._model=new jB(this._bufferService),this._activeSelectionMode=0,this._register(Et(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(u=>{u.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=n.translateBufferLineToString(o,!0,i,s);r.push(a)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),a=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=a:r.push(a)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace(LB," ")).join(Z0?`\r
|
|
114
|
+
`:`
|
|
115
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Fm&&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?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1: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){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=v_(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):!1}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=$m(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,-Hh),Hh),t/=Hh,t/Math.abs(t)+Math.round(t*(RB-1)))}shouldForceSelection(e){return qc?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(),TB)}_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&&!(qc&&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){this.refresh(!0);return}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 r=n.lines.get(this._model.selectionEnd[1]);r&&r.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<PB&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=wB(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!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]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!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)}_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(t=>this._handleTrim(t))}_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,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e[0]),c=a,u=e[0]-a,d=0,h=0,f=0,p=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;c<o.length&&o.charAt(c+1)===" ";)c++}else{let w=e[0],v=e[0];s.getWidth(w)===0&&(d++,w--),s.getWidth(v)===2&&(h++,v++);let _=s.getString(v).length;for(_>1&&(p+=_-1,c+=_-1);w>0&&a>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,w--):y>1&&(f+=y-1,a-=y-1),a--,w--}for(;v<s.length&&c+1<o.length&&!this._isCharWordSeparator(s.loadCell(v+1,this._workCell));){s.loadCell(v+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,v++):y>1&&(p+=y-1,c+=y-1),c++,v++}}c++;let m=a+u-d+f,g=Math.min(this._bufferService.cols,c-a+d+h-f-p);if(!(!t&&o.slice(a,c).trim()==="")){if(n&&m===0&&s.getCodePoint(0)!==32){let w=i.lines.get(e[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let v=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(v){let _=this._bufferService.cols-v.start;m-=_,g+=_}}}if(r&&m+g===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=i.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let v=this._getWordAt([0,e[1]+1],!1,!1,!0);v&&(g+=v.length)}}return{start:m,length:g}}}_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?!1: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=v_(n,this._bufferService.cols)}};$f=It([pe(3,Cn),pe(4,bs),pe(5,Lm),pe(6,En),pe(7,ti),pe(8,ei)],$f);var __=class{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={}}},b_=class{constructor(){this._color=new __,this._css=new __}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ut=Object.freeze((()=>{let e=[Rt.toColor("#2e3436"),Rt.toColor("#cc0000"),Rt.toColor("#4e9a06"),Rt.toColor("#c4a000"),Rt.toColor("#3465a4"),Rt.toColor("#75507b"),Rt.toColor("#06989a"),Rt.toColor("#d3d7cf"),Rt.toColor("#555753"),Rt.toColor("#ef2929"),Rt.toColor("#8ae234"),Rt.toColor("#fce94f"),Rt.toColor("#729fcf"),Rt.toColor("#ad7fa8"),Rt.toColor("#34e2e2"),Rt.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],s=t[n%6];e.push({css:$t.toCss(r,i,s),rgba:$t.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:$t.toCss(r,r,r),rgba:$t.toRgba(r,r,r)})}return e})()),Gi=Rt.toColor("#ffffff"),Go=Rt.toColor("#000000"),w_=Rt.toColor("#ffffff"),x_=Go,Oo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},AB=Gi,Ff=class extends $e{constructor(e){super(),this._optionsService=e,this._contrastCache=new b_,this._halfContrastCache=new b_,this._onChangeColors=this._register(new ae),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Gi,background:Go,cursor:w_,cursorAccent:x_,selectionForeground:void 0,selectionBackgroundTransparent:Oo,selectionBackgroundOpaque:xt.blend(Go,Oo),selectionInactiveBackgroundTransparent:Oo,selectionInactiveBackgroundOpaque:xt.blend(Go,Oo),scrollbarSliderBackground:xt.opacity(Gi,.2),scrollbarSliderHoverBackground:xt.opacity(Gi,.4),scrollbarSliderActiveBackground:xt.opacity(Gi,.5),overviewRulerBorder:Gi,ansi:Ut.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ct(e.foreground,Gi),t.background=ct(e.background,Go),t.cursor=xt.blend(t.background,ct(e.cursor,w_)),t.cursorAccent=xt.blend(t.background,ct(e.cursorAccent,x_)),t.selectionBackgroundTransparent=ct(e.selectionBackground,Oo),t.selectionBackgroundOpaque=xt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ct(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=xt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ct(e.selectionForeground,m_):void 0,t.selectionForeground===m_&&(t.selectionForeground=void 0),xt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=xt.opacity(t.selectionBackgroundTransparent,.3)),xt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=xt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ct(e.scrollbarSliderBackground,xt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ct(e.scrollbarSliderHoverBackground,xt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ct(e.scrollbarSliderActiveBackground,xt.opacity(t.foreground,.5)),t.overviewRulerBorder=ct(e.overviewRulerBorder,AB),t.ansi=Ut.slice(),t.ansi[0]=ct(e.black,Ut[0]),t.ansi[1]=ct(e.red,Ut[1]),t.ansi[2]=ct(e.green,Ut[2]),t.ansi[3]=ct(e.yellow,Ut[3]),t.ansi[4]=ct(e.blue,Ut[4]),t.ansi[5]=ct(e.magenta,Ut[5]),t.ansi[6]=ct(e.cyan,Ut[6]),t.ansi[7]=ct(e.white,Ut[7]),t.ansi[8]=ct(e.brightBlack,Ut[8]),t.ansi[9]=ct(e.brightRed,Ut[9]),t.ansi[10]=ct(e.brightGreen,Ut[10]),t.ansi[11]=ct(e.brightYellow,Ut[11]),t.ansi[12]=ct(e.brightBlue,Ut[12]),t.ansi[13]=ct(e.brightMagenta,Ut[13]),t.ansi[14]=ct(e.brightCyan,Ut[14]),t.ansi[15]=ct(e.brightWhite,Ut[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=ct(e.extendedAnsi[r],Ut[r+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){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}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]}}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()}}};Ff=It([pe(0,En)],Ff);function ct(e,t){if(e!==void 0)try{return Rt.toColor(e)}catch{}return t}var IB=class{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)}},MB=class{constructor(){this._services=new IB,this._services.set(Dm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=RO(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},OB={trace:0,debug:1,info:2,warn:3,error:4,off:5},zB="xterm.js: ",Hf=class extends $e{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=OB[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?"":zB)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Hf=It([pe(0,En)],Hf);var S_=class extends $e{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ae),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ae),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ae),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new 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 new 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 r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}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 new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));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}},Be=3,Bt=Object.freeze(new Ga),Ll=0,Wh=2,Xo=class rk{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Be);let i=n||sr.fromCharData([0,x0,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*Be+0],r=n&2097151;return[this._data[t*Be+1],n&2097152?this._combined[t]:r?gi(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Be+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Be+0]=t|2097152|n[2]<<22):this._data[t*Be+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Be+0]>>22}hasWidth(t){return this._data[t*Be+0]&12582912}getFg(t){return this._data[t*Be+1]}getBg(t){return this._data[t*Be+2]}hasContent(t){return this._data[t*Be+0]&4194303}getCodePoint(t){let n=this._data[t*Be+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Be+0]&2097152}getString(t){let n=this._data[t*Be+0];return n&2097152?this._combined[t]:n&2097151?gi(n&2097151):""}isProtected(t){return this._data[t*Be+2]&536870912}loadCell(t,n){return Ll=t*Be,n.content=this._data[Ll+0],n.fg=this._data[Ll+1],n.bg=this._data[Ll+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Be+0]=n.content,this._data[t*Be+1]=n.fg,this._data[t*Be+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Be+0]=n|r<<22,this._data[t*Be+1]=i.fg,this._data[t*Be+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*Be+0];i&2097152?this._combined[t]+=gi(n):i&2097151?(this._combined[t]=gi(i&2097151)+gi(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*Be+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new sr;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new sr;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Wh<this._data.buffer.byteLength;let r=t*Be;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._combined[a]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,r*4*Wh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Wh<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new rk(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Be+0]&4194303)return t+(this._data[t*Be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Be+0]&4194303||this._data[t*Be+2]&50331648)return t+(this._data[t*Be+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let c=i-1;c>=0;c--){for(let u=0;u<Be;u++)this._data[(r+c)*Be+u]=o[(n+c)*Be+u];o[(n+c)*Be+2]&268435456&&(this._extendedAttrs[r+c]=t._extendedAttrs[n+c])}else for(let c=0;c<i;c++){for(let u=0;u<Be;u++)this._data[(r+c)*Be+u]=o[(n+c)*Be+u];o[(n+c)*Be+2]&268435456&&(this._extendedAttrs[r+c]=t._extendedAttrs[n+c])}let a=Object.keys(t._combined);for(let c=0;c<a.length;c++){let u=parseInt(a[c],10);u>=n&&(this._combined[u-n+r]=t._combined[u])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*Be+0],a=o&2097151,c=o&2097152?this._combined[n]:a?gi(a):wi;if(s+=c,i)for(let u=0;u<c.length;++u)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function BB(e,t,n,r,i,s){let o=[];for(let a=0;a<e.length-1;a++){let c=a,u=e.get(++c);if(!u.isWrapped)continue;let d=[e.get(a)];for(;c<e.length&&u.isWrapped;)d.push(u),u=e.get(++c);if(!s&&r>=a&&r<c){a+=d.length-1;continue}let h=0,f=Oa(d,h,t),p=1,m=0;for(;p<d.length;){let w=Oa(d,p,t),v=w-m,_=n-f,y=Math.min(v,_);d[h].copyCellsFrom(d[p],m,f,y,!1),f+=y,f===n&&(h++,f=0),m+=y,m===w&&(p++,m=0),f===0&&h!==0&&d[h-1].getWidth(n-1)===2&&(d[h].copyCellsFrom(d[h-1],n-1,f++,1,!1),d[h-1].setCell(n-1,i))}d[h].replaceCells(f,n,i);let g=0;for(let w=d.length-1;w>0&&(w>h||d[w].getTrimmedLength()===0);w--)g++;g>0&&(o.push(a+d.length-g),o.push(g)),a+=d.length-1}return o}function $B(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let a=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function FB(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function HB(e,t,n){let r=[],i=e.map((c,u)=>Oa(e,u,t)).reduce((c,u)=>c+u),s=0,o=0,a=0;for(;a<i;){if(i-a<n){r.push(i-a);break}s+=n;let c=Oa(e,o,t);s>c&&(s-=c,o++);let u=e[o].getWidth(s-1)===2;u&&s--;let d=u?n-1:n;r.push(d),a+=d}return r}function Oa(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}var ik=class sk{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=sk._nextId++,this._onDispose=this.register(new ae),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ms(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};ik._nextId=1;var WB=ik,Yt={},Xi=Yt.B;Yt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Yt.A={"#":"£"};Yt.B=void 0;Yt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Yt.C=Yt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Yt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Yt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Yt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Yt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Yt.E=Yt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Yt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Yt.H=Yt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Yt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var k_=4294967295,C_=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=Bt.clone(),this.savedCharset=Xi,this.markers=[],this._nullCell=sr.fromCharData([0,x0,1,0]),this._whitespaceCell=sr.fromCharData([0,wi,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Kc,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new S_(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 Wc),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 Wc),this._whitespaceCell}getBlankLine(e,t){return new Xo(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 t=e+this._optionsService.rawOptions.scrollback;return t>k_?k_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Bt);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 S_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Bt),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 o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)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 Xo(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Xo(e,n)));else for(let o=this._rows;o>t;o--)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 o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),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 s=0;s<this.lines.length;s++)r+=+this.lines.get(s).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=this._optionsService.rawOptions.reflowCursorLine,r=BB(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Bt),n);if(r.length>0){let i=$B(this.lines,r);FB(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Bt),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Xo(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Bt),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let c=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),c.unshift(a);if(!n){let y=this.ybase+this.y;if(y>=o&&y<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),d=HB(c,this._cols,e),h=d.length-c.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+h):f=Math.max(0,this.lines.length-this.lines.maxLength+h);let p=[];for(let y=0;y<h;y++){let S=this.getBlankLine(Bt,!0);p.push(S)}p.length>0&&(i.push({start:o+c.length+s,newLines:p}),s+=p.length),c.push(...p);let m=d.length-1,g=d[m];g===0&&(m--,g=d[m]);let w=c.length-h-1,v=u;for(;w>=0;){let y=Math.min(v,g);if(c[m]===void 0)break;if(c[m].copyCellsFrom(c[w],v-y,g-y,y,!0),g-=y,g===0&&(m--,g=d[m]),v-=y,v===0){w--;let S=Math.max(w,0);v=Oa(c,S,this._cols)}}for(let y=0;y<c.length;y++)d[y]<e&&c[y].setCell(d[y],r);let _=h-f;for(;_-- >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+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(i.length>0){let o=[],a=[];for(let g=0;g<this.lines.length;g++)a.push(this.lines.get(g));let c=this.lines.length,u=c-1,d=0,h=i[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let g=Math.min(this.lines.maxLength-1,c+s-1);g>=0;g--)if(h&&h.start>u+f){for(let w=h.newLines.length-1;w>=0;w--)this.lines.set(g--,h.newLines[w]);g++,o.push({index:u+1,amount:h.newLines.length}),f+=h.newLines.length,h=i[++d]}else this.lines.set(g,a[u--]);let p=0;for(let g=o.length-1;g>=0;g--)o[g].index+=p,this.lines.onInsertEmitter.fire(o[g]),p+=o[g].amount;let m=Math.max(0,c+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}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]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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.length=0,this._isClearing=!1}addMarker(e){let t=new WB(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},UB=class extends $e{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ae),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 C_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new C_(!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)}},ok=2,ak=1,Wf=class extends $e{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ok),this.rows=Math.max(e.rawOptions.rows||0,ak),this.buffers=this._register(new UB(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}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,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Wf=It([pe(0,En)],Wf);var Ps={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:qc,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},VB=["normal","bold","100","200","300","400","500","600","700","800","900"],qB=class extends $e{constructor(e){super(),this._onOptionChange=this._register(new ae),this.onOptionChange=this._onOptionChange.event;let t={...Ps};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Et(()=>{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=n=>{if(!(n in Ps))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Ps))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ps[e]),!KB(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ps[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=VB.includes(t)?t:Ps[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function KB(e){return e==="block"||e==="underline"||e==="bar"}function Jo(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Jo(e[r],t-1);return n}var E_=Object.freeze({insertMode:!1}),N_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Uf=class extends $e{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 ae),this.onData=this._onData.event,this._onUserInput=this._register(new ae),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ae),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Jo(E_),this.decPrivateModes=Jo(N_)}reset(){this.modes=Jo(E_),this.decPrivateModes=Jo(N_)}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}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Uf=It([pe(0,Cn),pe(1,N0),pe(2,En)],Uf);var j_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!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 Uh(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|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Vh=String.fromCharCode,R_={DEFAULT:e=>{let t=[Uh(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Vh(t[0])}${Vh(t[1])}${Vh(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Uh(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Uh(e,!0)};${e.x};${e.y}${t}`}},Vf=class extends $e{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ae),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(j_))this.addProtocol(r,j_[r]);for(let r of Object.keys(R_))this.addEncoding(r,R_[r]);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 new 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 new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}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:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_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)}};Vf=It([pe(0,Cn),pe(1,bs),pe(2,En)],Vf);var qh=[[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]],YB=[[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]],Vt;function GB(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var XB=class{constructor(){if(this.version="6",!Vt){Vt=new Uint8Array(65536),Vt.fill(1),Vt[0]=0,Vt.fill(0,1,32),Vt.fill(0,127,160),Vt.fill(2,4352,4448),Vt[9001]=2,Vt[9002]=2,Vt.fill(2,11904,42192),Vt[12351]=1,Vt.fill(2,44032,55204),Vt.fill(2,63744,64256),Vt.fill(2,65040,65050),Vt.fill(2,65072,65136),Vt.fill(2,65280,65377),Vt.fill(2,65504,65511);for(let e=0;e<qh.length;++e)Vt.fill(0,qh[e][0],qh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Vt[e]:GB(e,YB)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=ns.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return ns.createPropertyValue(0,n,r)}},ns=class sc{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ae,this.onChange=this._onChange.event;let t=new XB;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return n+this.wcwidth(o);let u=t.charCodeAt(s);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:n+=this.wcwidth(u)}let a=this.charProperties(o,r),c=sc.extractWidth(a);sc.extractShouldJoin(a)&&(c-=sc.extractWidth(r)),n+=c,r=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},JB=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)}};function T_(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var zo=2147483647,ZB=256,lk=class qf{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>ZB)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new qf;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new qf(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>zo?zo:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>zo?zo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,zo):t}},Bo=[],QB=class{constructor(){this._state=0,this._active=Bo,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 r=n.indexOf(t);r!==-1&&n.splice(r,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=Bo}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=Bo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Bo,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Tu(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(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 r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-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)this._handlerFb(this._id,"END",e);else{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&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);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}this._active=Bo,this._id=-1,this._state=0}}},$n=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+=Tu(e,t,n),this._data.length>1e7&&(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(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},$o=[],e3=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 r=n.indexOf(t);r!==-1&&n.splice(r,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)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Tu(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{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&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);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}this._active=$o,this._ident=0}},Zo=new lk;Zo.addParam(0);var P_=class{constructor(e){this._handler=e,this._data="",this._params=Zo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Zo,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Tu(e,t,n),this._data.length>1e7&&(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(n=>(this._params=Zo,this._data="",this._hitLimit=!1,n));return this._params=Zo,this._data="",this._hitLimit=!1,t}},t3=class{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}},Qn=160,n3=function(){let e=new t3(4095),t=Array.apply(null,Array(256)).map((a,c)=>c),n=(a,c)=>t.slice(a,c),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)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(Qn,0,2,0),e.add(Qn,8,5,8),e.add(Qn,6,0,6),e.add(Qn,11,0,11),e.add(Qn,13,13,13),e}(),r3=class extends $e{constructor(e=n3){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 lk,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Et(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new QB),this._dcsParser=this._register(new e3),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 new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new 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(e&255)),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 i=r.indexOf(t);i!==-1&&r.splice(i,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 i=r.indexOf(t);i!==-1&&r.splice(i,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=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&c>-1){for(;c>=0&&(o=a[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&c>-1){for(;c>=0&&(o=a[c](),o!==!0);c--)if(o instanceof Promise)return this._parseStack.handlerPos=c,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=s;a<t;++a){switch(r=e[a],i=this._transitions.table[this.currentState<<8|(r<160?r:Qn)],i>>4){case 2:for(let f=a+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r<Qn){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Qn){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Qn){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Qn){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|r],u=c?c.length-1:-1;for(;u>=0&&(o=c[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(3,c,u,i,a),o;u<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let d=this._escHandlers[this._collect<<8|r],h=d?d.length-1:-1;for(;h>=0&&(o=d[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,d,h,i,a),o;h<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(r=e[f])===24||r===26||r===27||r>127&&r<Qn){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,a),o;r===27&&(i|=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 f=a+1;;f++)if(f>=t||(r=e[f])<32||r>127&&r<Qn){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},i3=/^([\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})$/,s3=/^[\da-f]+$/;function D_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=i3.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),s3.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function Kh(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}}function o3(e,t=16){let[n,r,i]=e;return`rgb:${Kh(n,t)}/${Kh(r,t)}/${Kh(i,t)}`}var a3={"(":0,")":1,"*":2,"+":3,"-":1,".":2},di=131072,L_=10;function A_(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 I_=5e3,M_=0,l3=class extends $e{constructor(e,t,n,r,i,s,o,a,c=new r3){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=a,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new NO,this._utf8Decoder=new jO,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Bt.clone(),this._eraseAttrDataInternal=Bt.clone(),this._onRequestBell=this._register(new ae),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ae),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ae),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ae),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ae),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ae),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ae),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ae),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ae),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 Kf(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:d.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,d,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:d,data:h})}),this._parser.setDcsHandlerFallback((u,d,h)=>{d==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:d,payload:h})}),this._parser.setPrintHandler((u,d,h)=>this.print(u,d,h)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(q.BEL,()=>this.bell()),this._parser.setExecuteHandler(q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(q.BS,()=>this.backspace()),this._parser.setExecuteHandler(q.HT,()=>this.tab()),this._parser.setExecuteHandler(q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(rc.IND,()=>this.index()),this._parser.setExecuteHandler(rc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(rc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new $n(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new $n(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new $n(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new $n(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new $n(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new $n(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new $n(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new $n(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new $n(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new $n(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new $n(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new $n(u=>this.restoreCursorColor(u))),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 u in Yt)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new P_((u,d)=>this.requestStatusString(u,d)))}getAttrData(){return this._curAttrData}_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<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),I_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${I_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=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>di&&(s=this._parseStack.position+di)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(u=>u.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<di&&(this._parseBuffer=new Uint32Array(Math.min(e.length,di))),o||this._dirtyRowTracker.clearRange(),e.length>di)for(let u=s;u<e.length;u+=di){let d=u+di<e.length?u+di:e.length,h=typeof e=="string"?this._stringDecoder.decode(e.substring(u,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(u,d),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(r,i,h,u),this._logSlowResolvingAsync(n),n}else if(!o){let u=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,i,u,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let a=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({start:Math.min(c,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let r,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&s){let v=s[String.fromCharCode(r)];v&&(r=v.charCodeAt(0))}let m=this._unicodeService.charProperties(r,f);i=ns.extractWidth(m);let g=ns.extractShouldJoin(m),w=g?ns.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(gi(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-w>a){if(c){let v=h,_=this._activeBuffer.x-w;for(this._activeBuffer.x=w,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),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&h instanceof Xo&&h.copyCellsFrom(v,_,0,w,!1);_<a;)v.setCellFromCodepoint(_++,0,1,d)}else if(this._activeBuffer.x=a-1,i===2)continue}if(g&&this._activeBuffer.x){let v=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-v,r,i);for(let _=i-w;--_>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(u&&(h.insertCells(this._activeBuffer.x,i-w,this._activeBuffer.getNullCell(d)),h.getWidth(a-1)===2&&h.setCellFromCodepoint(a-1,0,1,d)),h.setCellFromCodepoint(this._activeBuffer.x++,r,i,d),i>0)for(;--i;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&n-t>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>A_(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new P_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new $n(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(){var e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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 s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.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){var r;this._restrictCursor(this._bufferService.cols);let n;switch(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:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}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);break}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(Bt));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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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=ns.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),a=0;for(let u=0;u<s.length;){let d=s.codePointAt(u)||0;o[a++]=d,u+=d>65535?2:1}let c=a;for(let u=1;u<n;++u)o.copyWithin(c,0,a),c+=a;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(q.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(q.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(q.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(q.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(q.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;break}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,Xi),this._charsetService.setgCharset(1,Xi),this._charsetService.setgCharset(2,Xi),this._charsetService.setgCharset(3,Xi);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}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;break}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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(g=>(g[g.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",g[g.SET=1]="SET",g[g.RESET=2]="RESET",g[g.PERMANENTLY_SET=3]="PERMANENTLY_SET",g[g.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:a,cols:c}=this._bufferService,{active:u,alt:d}=a,h=this._optionsService.rawOptions,f=(g,w)=>(o.triggerDataEvent(`${q.ESC}[${t?"":"?"}${g};${w}$y`),!0),p=g=>g?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(h.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,h.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i==="X10")):m===12?f(m,p(h.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i==="VT200")):m===1002?f(m,p(i==="DRAG")):m===1003?f(m,p(i==="ANY")):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(u===d)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Ga.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),a=0;do r[1]===5&&(i=1),r[s+a+1+i]=o[a];while(++a<o.length&&a+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=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 s}_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=Bt.fg,e.bg=Bt.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|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):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|=Bt.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Bt.bg&16777215):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|=Bt.fg&16777215,r.bg&=-67108864,r.bg|=Bt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${q.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[?${t};${n}R`);break}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=Bt.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.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!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(!A_(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(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>L_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>L_&&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());break}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 r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(O_(s))if(i==="?")t.push({type:0,index:s});else{let o=D_(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.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 r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=D_(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}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 r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);O_(i)&&t.push({type:2,index:i})}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,Xi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(a3[e[0]],Yt[e[1]]||Xi),!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=Bt.clone(),this._eraseAttrDataInternal=Bt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new sr;e.content=1<<22|69,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=o=>(this._coreService.triggerDataEvent(`${q.ESC}${o}${q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Kf=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&&(M_=e,e=t,t=M_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Kf=It([pe(0,Cn)],Kf);function O_(e){return 0<=e&&e<256}var c3=5e7,z_=12,u3=50,h3=class extends $e{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 ae),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>c3)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let o=a=>performance.now()-n>=z_?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(n,a);i.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=z_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>u3&&(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()}},Yf=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 a=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._dataByLinkId.set(c.id,c),c.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 s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),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(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.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)))}};Yf=It([pe(0,Cn)],Yf);var B_=!1,d3=class extends $e{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fo),this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onData=this._register(new ae),this.onData=this._onData.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ae),this._instantiationService=new MB,this.optionsService=this._register(new qB(e)),this._instantiationService.setService(En,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Wf)),this._instantiationService.setService(Cn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Hf)),this._instantiationService.setService(N0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Uf)),this._instantiationService.setService(bs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Vf)),this._instantiationService.setService(E0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ns)),this._instantiationService.setService(DO,this.unicodeService),this._charsetService=this._instantiationService.createInstance(JB),this._instantiationService.setService(PO,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Yf),this._instantiationService.setService(j0,this._oscLinkService),this._inputHandler=this._register(new l3(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(on.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(on.forward(this._bufferService.onResize,this._onResize)),this._register(on.forward(this.coreService.onData,this._onData)),this._register(on.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new h3((t,n)=>this._inputHandler.parse(t,n))),this._register(on.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ae),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!B_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),B_=!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,ok),t=Math.max(t,ak),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){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(T_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(T_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Et(()=>{for(let t of e)t.dispose()})}}},f3={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:["'",'"']};function p3(e,t,n,r){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=q.ESC+"OA":i.key=q.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=q.ESC+"OD":i.key=q.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=q.ESC+"OC":i.key=q.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=q.ESC+"OB":i.key=q.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":q.DEL,e.altKey&&(i.key=q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=q.ESC+"[Z";break}i.key=q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?q.ESC+q.CR:q.CR,i.cancel=!0;break;case 27:i.key=q.ESC,e.altKey&&(i.key=q.ESC+q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"D":t?i.key=q.ESC+"OD":i.key=q.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"C":t?i.key=q.ESC+"OC":i.key=q.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"A":t?i.key=q.ESC+"OA":i.key=q.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=q.ESC+"[1;"+(s+1)+"B":t?i.key=q.ESC+"OB":i.key=q.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=q.ESC+"[2~");break;case 46:s?i.key=q.ESC+"[3;"+(s+1)+"~":i.key=q.ESC+"[3~";break;case 36:s?i.key=q.ESC+"[1;"+(s+1)+"H":t?i.key=q.ESC+"OH":i.key=q.ESC+"[H";break;case 35:s?i.key=q.ESC+"[1;"+(s+1)+"F":t?i.key=q.ESC+"OF":i.key=q.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=q.ESC+"[5;"+(s+1)+"~":i.key=q.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=q.ESC+"[6;"+(s+1)+"~":i.key=q.ESC+"[6~";break;case 112:s?i.key=q.ESC+"[1;"+(s+1)+"P":i.key=q.ESC+"OP";break;case 113:s?i.key=q.ESC+"[1;"+(s+1)+"Q":i.key=q.ESC+"OQ";break;case 114:s?i.key=q.ESC+"[1;"+(s+1)+"R":i.key=q.ESC+"OR";break;case 115:s?i.key=q.ESC+"[1;"+(s+1)+"S":i.key=q.ESC+"OS";break;case 116:s?i.key=q.ESC+"[15;"+(s+1)+"~":i.key=q.ESC+"[15~";break;case 117:s?i.key=q.ESC+"[17;"+(s+1)+"~":i.key=q.ESC+"[17~";break;case 118:s?i.key=q.ESC+"[18;"+(s+1)+"~":i.key=q.ESC+"[18~";break;case 119:s?i.key=q.ESC+"[19;"+(s+1)+"~":i.key=q.ESC+"[19~";break;case 120:s?i.key=q.ESC+"[20;"+(s+1)+"~":i.key=q.ESC+"[20~";break;case 121:s?i.key=q.ESC+"[21;"+(s+1)+"~":i.key=q.ESC+"[21~";break;case 122:s?i.key=q.ESC+"[23;"+(s+1)+"~":i.key=q.ESC+"[23~";break;case 123:s?i.key=q.ESC+"[24;"+(s+1)+"~":i.key=q.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=q.DEL:e.keyCode===219?i.key=q.ESC:e.keyCode===220?i.key=q.FS:e.keyCode===221&&(i.key=q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let a=(o=f3[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)i.key=q.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let c=e.ctrlKey?e.keyCode-64:e.keyCode+32,u=String.fromCharCode(c);e.shiftKey&&(u=u.toUpperCase()),i.key=q.ESC+u}else if(e.keyCode===32)i.key=q.ESC+(e.ctrlKey?q.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let c=e.code.slice(3,4);e.shiftKey||(c=c.toLowerCase()),i.key=q.ESC+c,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=q.US),e.key==="@"&&(i.key=q.NUL));break}return i}var Mt=0,m3=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Kc,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Kc,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Mt=this._search(t),Mt===-1)||this._getKey(this._array[Mt])!==t)return!1;do if(this._array[Mt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Mt),!0;while(++Mt<this._array.length&&this._getKey(this._array[Mt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Mt=this._search(e),!(Mt<0||Mt>=this._array.length)&&this._getKey(this._array[Mt])===e))do yield this._array[Mt];while(++Mt<this._array.length&&this._getKey(this._array[Mt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Mt=this._search(e),!(Mt<0||Mt>=this._array.length)&&this._getKey(this._array[Mt])===e))do t(this._array[Mt]);while(++Mt<this._array.length&&this._getKey(this._array[Mt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...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)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Yh=0,$_=0,g3=class extends $e{constructor(){super(),this._decorations=new m3(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ae),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ae),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Et(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new y3(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.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 s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{Yh=i.options.x??0,$_=Yh+(i.options.width??1),e>=Yh&&e<$_&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},y3=class extends Ti{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ae),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ae),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")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Rt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Rt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},v3=1e3,_3=class{constructor(e,t=v3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},F_=20,Yc=class extends $e{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new _3(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
116
|
+
`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(je(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Et(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<F_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
117
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===F_+1&&(this._liveRegion.textContent+=pf.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],a=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",c=(n.ydisp+i+1).toString(),u=this._rowElements[i];u&&(a.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=a,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",r),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:c,offset:u})=>{let d=c instanceof Text?c.parentNode:c,h=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(d);if(!f)return console.warn("columns is null. Race condition?"),null;let p=u<f.length?f[u]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++h,p=0),{row:h,column:p}},s=i(t),o=i(n);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Yc=It([pe(1,Dm),pe(2,ei),pe(3,ti)],Yc);var Gf=class extends $e{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ae),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ae),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Et(()=>{var s;ms(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(je(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(je(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(je(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(je(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):o.provideLinks(e.y,a=>{var u,d;if(this._isMouseOut)return;let c=a==null?void 0:a.map(h=>({link:h}));(u=this._activeProviderReplies)==null||u.set(s,c),n=this._checkLinkProviderResult(s,e,n),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let s=0;s<i.length;s++){let o=i[s],a=o.link.range.start.y<e?0:o.link.range.start.x,c=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let u=a;u<=c;u++){if(n.has(u)){i.splice(s--,1);break}n.add(u)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&r){let o=r.find(a=>this._linkAtPosition(a.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(c=>this._linkAtPosition(c.link,t));if(a){n=!0,this._handleNewLink(a);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&b3(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ms(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Gf=It([pe(1,Lm),pe(2,ti),pe(3,Cn),pe(4,T0)],Gf);function b3(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var w3=class extends d3{constructor(e={}){super(e),this._linkifier=this._register(new fo),this.browser=G0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fo),this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ae),this.onKey=this._onKey.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ae),this.onBell=this._onBell.event,this._onFocus=this._register(new ae),this._onBlur=this._register(new ae),this._onA11yCharEmitter=this._register(new ae),this._onA11yTabEmitter=this._register(new ae),this._onWillOpen=this._register(new ae),this._setup(),this._decorationService=this._instantiationService.createInstance(g3),this._instantiationService.setService(Xa,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(uB),this._instantiationService.setService(T0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(gf)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(on.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(on.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(on.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(on.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Et(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=xt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${q.ESC}]${r};${o3(i)}${K0.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=$t.toColor(...t.color));else{let s=n;this._themeService.modifyColors(o=>o[s]=$t.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Yc,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(je(this.element,"copy",t=>{this.hasSelection()&&CO(t,this._selectionService)}));let e=t=>EO(t,this.textarea,this.coreService,this.optionsService);this._register(je(this.textarea,"paste",e)),this._register(je(this.element,"paste",e)),X0?this._register(je(this.element,"mousedown",t=>{t.button===2&&Jv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(je(this.element,"contextmenu",t=>{Jv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Fm&&this._register(je(this.element,"auxclick",t=>{t.button===1&&w0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(je(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(je(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(je(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(je(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(je(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(je(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(je(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(je(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ff.get()),Q0||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(lB,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ei,this._coreBrowserService),this._register(je(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(je(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Of,this._document,this._helperContainer),this._instantiationService.setService(Pu,this._charSizeService),this._themeService=this._instantiationService.createInstance(Ff),this._instantiationService.setService(bo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Vc),this._instantiationService.setService(R0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Bf,this.rows,this.screenElement)),this._instantiationService.setService(ti,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Af,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(zf),this._instantiationService.setService(Lm,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Gf,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Df,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance($f,this.element,this.screenElement,r)),this._instantiationService.setService(AO,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(on.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(Lf,this.screenElement)),this._register(je(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Yc,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uc,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Uc,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Mf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var u,d,h,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let a,c;switch(s.overrideType||s.type){case"mousemove":c=32,s.buttons===void 0?(a=3,s.button!==void 0&&(a=s.button<3?s.button:3)):a=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":c=0,a=s.button<3?s.button:3;break;case"mousedown":c=1,a=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(h=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:h.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;c=m<0?0:1,a=4;break;default:return!1}return c===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:c,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(je(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(je(t,"wheel",s=>{var o,a,c,u,d;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(u=(c=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:c.cell)==null?void 0:u.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return this.cancel(s,!0);let h=q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){b0(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=p3(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===q.ETX||n.key===q.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(x3(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Bt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(q.ESC+"[I"):this.coreService.triggerDataEvent(q.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${q.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function x3(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var S3=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 new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},k3=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 sr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},H_=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 k3(t)}getNullCell(){return new sr}},C3=class extends $e{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ae),this.onBufferChange=this._onBufferChange.event,this._normal=new H_(this._core.buffers.normal,"normal"),this._alternate=new H_(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 new 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)}},E3=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.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)}},N3=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}},j3=["cols","rows"],xr=0,R3=class extends $e{constructor(e){super(),this._core=this._register(new w3(e)),this._addonManager=this._register(new S3),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(j3.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new 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||(this._parser=new E3(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new N3(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._buffer=this._register(new C3(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";break}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,synchronizedOutputMode:e.synchronizedOutput,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
|
|
118
|
+
`,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{get promptLabel(){return ff.get()},set promptLabel(e){ff.set(e)},get tooMuchOutput(){return pf.get()},set tooMuchOutput(e){pf.set(e)}}}_verifyIntegers(...e){for(xr of e)if(xr===1/0||isNaN(xr)||xr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(xr of e)if(xr&&(xr===1/0||isNaN(xr)||xr%1!==0||xr<0))throw new Error("This API only accepts positive integers")}};/**
|
|
119
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
120
|
+
* @license MIT
|
|
121
|
+
*
|
|
122
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
123
|
+
* @license MIT
|
|
124
|
+
*
|
|
125
|
+
* Originally forked from (with the author's permission):
|
|
126
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
127
|
+
* http://bellard.org/jslinux/
|
|
128
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
129
|
+
*/var T3=2,P3=1,D3=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(){var h;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((h=this._terminal.options.overviewRuler)==null?void 0:h.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},a=o.top+o.bottom,c=o.right+o.left,u=r-a,d=i-c-t;return{cols:Math.max(T3,Math.floor(d/e.css.cell.width)),rows:Math.max(P3,Math.floor(u/e.css.cell.height))}}};function L3({token:e}){const t=b.useRef(null),[n,r]=b.useState("connecting"),[i,s]=b.useState(null);return b.useEffect(()=>{const o=t.current;if(!o)return;const a=new R3({fontSize:13,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",cursorBlink:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4"}}),c=new D3;a.loadAddon(c),a.open(o);try{c.fit()}catch{}const u=window.location.protocol==="https:"?"wss":"ws",d=new URL(`${u}://${window.location.host}/ws/pty`);e&&d.searchParams.set("t",e);const h=new WebSocket(d.toString()),f=()=>{h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"resize",cols:a.cols,rows:a.rows}))};h.onopen=()=>{r("open");try{c.fit()}catch{}f(),a.focus()},h.onmessage=g=>{let w;try{w=JSON.parse(g.data)}catch{return}w.type==="data"?a.write(w.data):w.type==="error"?(r("error"),s(w.message||"terminal not available")):w.type==="exit"&&(r("closed"),a.write(`\r
|
|
130
|
+
[session ended${w.code!=null?` (exit ${w.code})`:""}]\r
|
|
131
|
+
`))},h.onclose=()=>r(g=>g==="error"?g:"closed"),h.onerror=()=>{r("error"),s("connection failed")};const p=a.onData(g=>{h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"data",data:g}))});let m;try{m=new ResizeObserver(()=>{try{c.fit(),f()}catch{}}),m.observe(o)}catch{}return()=>{try{m==null||m.disconnect()}catch{}try{p.dispose()}catch{}try{h.close()}catch{}try{a.dispose()}catch{}}},[e]),l.jsxs("div",{className:"terminal-block","data-testid":"terminal-block",children:[n==="error"&&l.jsx("div",{className:"terminal-msg err","data-testid":"terminal-error",children:i||"terminal not available"}),l.jsx("div",{className:"terminal-host",ref:t,"data-testid":"terminal-host"})]})}function A3({spec:e}){if(!e||!e.kind)return l.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"This block has nothing to show yet."});const{kind:t,note:n,data:r={}}=e;return l.jsxs("div",{className:"cb-block","data-testid":"custom-block","data-kind":t,children:[n&&l.jsx("p",{className:"cb-note",children:n}),t==="metric"&&l.jsx(I3,{data:r}),t==="list"&&l.jsx(M3,{data:r}),t==="table"&&l.jsx(O3,{data:r}),t==="markdown"&&l.jsx(z3,{data:r})]})}function I3({data:e}){const t=["up","down","flat"].includes(e.trend)?e.trend:null;return l.jsxs("div",{className:"cb-metric","data-testid":"custom-metric",children:[l.jsx("div",{className:"cb-metric-value",children:e.value??"—"}),e.label&&l.jsx("div",{className:"cb-metric-label",children:e.label}),e.delta&&l.jsxs("div",{className:`cb-metric-delta ${t?`is-${t}`:""}`,"data-testid":"custom-delta",children:[t==="up"?"▲ ":t==="down"?"▼ ":"",e.delta]}),Array.isArray(e.spark)&&e.spark.length>0&&l.jsx(B3,{values:e.spark})]})}function M3({data:e}){const t=Array.isArray(e.items)?e.items:[];return t.length?l.jsx("ul",{className:"cb-list","data-testid":"custom-list",children:t.map((n,r)=>l.jsxs("li",{className:"cb-list-row",children:[l.jsx("span",{className:"cb-list-label",children:n.label}),n.value!==void 0&&n.value!==""&&l.jsx("span",{className:"cb-list-value",children:n.value})]},r))}):l.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"Empty list."})}function O3({data:e}){const t=Array.isArray(e.columns)?e.columns:[],n=Array.isArray(e.rows)?e.rows:[];return n.length?l.jsx("div",{className:"cb-table-wrap",children:l.jsxs("table",{className:"cb-table","data-testid":"custom-table",children:[t.length>0&&l.jsx("thead",{children:l.jsx("tr",{children:t.map((r,i)=>l.jsx("th",{children:r},i))})}),l.jsx("tbody",{children:n.map((r,i)=>l.jsx("tr",{children:(Array.isArray(r)?r:[r]).map((s,o)=>l.jsx("td",{children:s},o))},i))})]})}):l.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"No rows."})}function z3({data:e}){const t=typeof e.text=="string"?e.text:"";return t?l.jsx("div",{className:"cb-markdown","data-testid":"custom-markdown",children:l.jsx(CS,{text:t})}):l.jsx("div",{className:"cb-empty","data-testid":"custom-empty",children:"Empty note."})}function B3({values:e}){const t=Math.max(...e,1);return l.jsx("div",{className:"cb-spark","data-testid":"custom-spark","aria-hidden":"true",children:e.map((n,r)=>l.jsx("span",{className:"cb-spark-bar",style:{height:`${8+Math.round(Math.max(0,n)/t*92)}%`}},r))})}function $3({onClose:e}){Bi(e);const[t,n]=b.useState("viewer"),[r,i]=b.useState(24),[s,o]=b.useState(""),[a,c]=b.useState(null),[u,d]=b.useState([]),[h,f]=b.useState(null),[p,m]=b.useState(!1);b.useEffect(()=>{g()},[]);async function g(){const y=await fetch("/api/share").catch(()=>null);if(!y||!y.ok)return;const S=await y.json();d(S.tokens||[])}async function w(){f(null),m(!0);try{const y=await fetch("/api/share",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({role:t,ttlSeconds:Math.max(60,Number(r)*3600),label:s})}),S=await y.json();if(!y.ok)throw new Error(S.error||`HTTP ${y.status}`);c(S),g()}catch(y){f(y.message||String(y))}finally{m(!1)}}async function v(y){await fetch(`/api/share/${encodeURIComponent(y)}`,{method:"DELETE"}),g()}async function _(y){try{await navigator.clipboard.writeText(y)}catch{}}return l.jsx("div",{className:"modal-backdrop",onClick:e,children:l.jsxs("div",{className:"modal",onClick:y=>y.stopPropagation(),"data-testid":"share-dialog",children:[l.jsx("h2",{children:"Share workspace"}),l.jsx("p",{className:"muted",children:"Issue a token-protected URL. Anyone with the link opens this workspace in their browser with the role you choose."}),l.jsx("label",{children:"Role"}),l.jsx("div",{className:"row",children:l.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text)"},children:[l.jsx("input",{type:"radio",name:"role",value:"viewer",checked:t==="viewer",onChange:()=>n("viewer"),"data-testid":"share-role-viewer"}),l.jsx("span",{children:"Viewer — read-only chat + preview"})]})}),l.jsx("div",{className:"row",children:l.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text)"},children:[l.jsx("input",{type:"radio",name:"role",value:"client",checked:t==="client",onChange:()=>n("client"),"data-testid":"share-role-client"}),l.jsx("span",{children:"Client — can chat and request changes"})]})}),l.jsxs("div",{className:"row",children:[l.jsxs("div",{children:[l.jsx("label",{children:"Expires in"}),l.jsx("input",{type:"number",min:"1",value:r,onChange:y=>i(y.target.value),style:{width:80,background:"var(--bg)",color:"var(--text)",border:"1px solid var(--border)",padding:"4px 8px",borderRadius:6},"data-testid":"share-ttl"}),l.jsx("span",{style:{marginLeft:6,color:"var(--text-muted)",fontSize:12},children:"hours"})]}),l.jsxs("div",{style:{flex:1},children:[l.jsx("label",{children:"Label (optional)"}),l.jsx("input",{value:s,onChange:y=>o(y.target.value),placeholder:"e.g. Mel preview",style:{width:"100%",background:"var(--bg)",color:"var(--text)",border:"1px solid var(--border)",padding:"4px 8px",borderRadius:6},"data-testid":"share-label"})]})]}),h&&l.jsx("div",{style:{color:"var(--error)",fontSize:12,marginBottom:8},"data-testid":"share-error",children:h}),a&&l.jsxs(l.Fragment,{children:[l.jsx("label",{children:"Share URL"}),l.jsx("div",{className:"url-output","data-testid":"share-url",children:a.shareUrl}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{onClick:()=>_(a.shareUrl),"data-testid":"share-copy",children:"Copy"}),l.jsx("a",{href:a.shareUrl,target:"_blank",rel:"noreferrer",children:l.jsx("button",{children:"Open"})})]})]}),u.length>0&&l.jsxs("div",{style:{marginTop:16},children:[l.jsx("label",{children:"Active share tokens"}),l.jsx("div",{style:{maxHeight:140,overflow:"auto",border:"1px solid var(--border)",borderRadius:6},children:u.map(y=>l.jsxs("div",{style:{padding:"6px 10px",borderBottom:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12},"data-testid":`active-token-${y.sub}`,children:[l.jsxs("div",{children:[l.jsx("strong",{children:y.label||y.role})," ",l.jsxs("span",{style:{color:"var(--text-muted)"},children:["(",y.role,", expires ",new Date(y.exp*1e3).toLocaleString(),")"]})]}),l.jsx("button",{onClick:()=>v(y.sub),style:{fontSize:11},"data-testid":`revoke-${y.sub}`,children:"Revoke"})]},y.sub))})]}),l.jsxs("div",{className:"actions",children:[l.jsx("button",{onClick:e,"data-testid":"share-close",children:"Close"}),l.jsx("button",{className:"primary",onClick:w,disabled:p,"data-testid":"share-issue",children:p?l.jsx("span",{className:"spinner"}):"Issue URL"})]})]})})}function F3({onClose:e,token:t}){var $,L;Bi(e);const[n,r]=b.useState(null),[i,s]=b.useState(!1),[o,a]=b.useState(null),[c,u]=b.useState(!1),[d,h]=b.useState(""),[f,p]=b.useState(""),[m,g]=b.useState(168),[w,v]=b.useState(null);b.useEffect(()=>{y()},[]);function _(P,A={}){const D={...A.headers||{}};return t&&(D.Authorization=`Bearer ${t}`),fetch(P,{...A,headers:D})}async function y(){a(null),s(!1);const P=await _("/api/sync/status").catch(()=>null);if(!P||!P.ok){s(!0);return}r(await P.json())}async function S(P){a(null),u(!0);try{await P()}catch(A){a(A.message||String(A))}finally{u(!1)}}const E=()=>S(async()=>{const P=await _("/api/sync/pair",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({inviteCode:d})}),A=await P.json();if(!P.ok)throw new Error(A.error||`HTTP ${P.status}`);h(""),await y()}),k=()=>S(async()=>{var D,M;const P=await _("/api/sync/invite",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectCode:(M=(D=n==null?void 0:n.workspaces)==null?void 0:D[0])==null?void 0:M.projectId,displayName:f,expiresHours:Math.max(1,Number(m)||168)})}),A=await P.json();if(!P.ok)throw new Error(A.error||`HTTP ${P.status}`);v(A.invite)}),T=()=>S(async()=>{var D,M;const P=await _("/api/sync/detach",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({workspaceId:(M=(D=n==null?void 0:n.workspaces)==null?void 0:D[0])==null?void 0:M.workspaceId})}),A=await P.json();if(!P.ok)throw new Error(A.error||`HTTP ${P.status}`);v(null),await y()});async function R(P){try{await navigator.clipboard.writeText(P)}catch{}}const O=(($=n==null?void 0:n.workspaces)==null?void 0:$[0])||null,j=!!n&&!((L=n.daemon)!=null&&L.running);return l.jsx("div",{className:"modal-backdrop",onClick:e,children:l.jsxs("div",{className:"modal",onClick:P=>P.stopPropagation(),"data-testid":"sync-dialog",children:[l.jsx("h2",{children:"Collaborate on this folder"}),l.jsx("p",{className:"muted",children:"bmo-sync keeps this workspace folder identical across machines — yours and a collaborator's. Both of you edit; changes flow both ways. Like a shared drive, but built for workspaces."}),!n&&!i&&l.jsxs("div",{className:"muted",children:[l.jsx("span",{className:"spinner"})," Checking sync status…"]}),i&&l.jsxs("div",{className:"sync-state warn","data-testid":"sync-load-failed",children:[l.jsx("strong",{children:"Couldn't load sync status."}),l.jsx("span",{className:"muted",children:"The workspace server didn't answer. Try again."})]}),j&&l.jsxs("div",{className:"sync-state warn","data-testid":"sync-daemon-down",children:[l.jsx("strong",{children:"The bmo-sync daemon isn't running."}),l.jsx("span",{className:"muted",children:"Folder sharing needs the background sync service running on this machine. Start it, then recheck."})]}),n&&!j&&!O&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"sync-state","data-testid":"sync-unpaired",children:[l.jsxs("strong",{children:[n.workspaceName," isn't shared yet."]}),l.jsx("span",{className:"muted",children:"Got an invite code from a collaborator? Paste it to sync this folder with theirs."})]}),l.jsx("label",{children:"Invite code"}),l.jsxs("div",{className:"row",children:[l.jsx("input",{className:"sync-input",style:{flex:1},value:d,onChange:P=>h(P.target.value),placeholder:"e.g. CAFE-MILANO-A8X3","data-testid":"sync-invite-input"}),l.jsx("button",{className:"primary",onClick:E,disabled:c||!d.trim(),"data-testid":"sync-join",children:c?l.jsx("span",{className:"spinner"}):"Connect folder"})]})]}),n&&!j&&O&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"sync-state ok","data-testid":"sync-paired",children:[l.jsxs("strong",{children:["✓ Synced — ",O.projectName||O.projectId]}),l.jsxs("span",{className:"muted",children:["This folder is shared. Edits sync both ways automatically",O.conflictCount?` · ${O.conflictCount} conflict${O.conflictCount>1?"s":""} resolved`:"","."]})]}),n.canInvite?l.jsxs(l.Fragment,{children:[l.jsx("label",{children:"Invite a collaborator"}),l.jsxs("div",{className:"row",children:[l.jsx("input",{className:"sync-input",style:{flex:1},value:f,onChange:P=>p(P.target.value),placeholder:"Their name — e.g. Mel","data-testid":"sync-invite-name"}),l.jsx("input",{className:"sync-input",style:{width:64},type:"number",min:"1",value:m,onChange:P=>g(P.target.value),title:"Invite expires in (hours)"}),l.jsx("button",{onClick:k,disabled:c,"data-testid":"sync-create-invite",children:c?l.jsx("span",{className:"spinner"}):"Create invite"})]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("label",{children:"Send this code to your collaborator"}),l.jsx("div",{className:"url-output","data-testid":"sync-invite-code",children:w.code}),l.jsxs("div",{className:"row",style:{marginBottom:0},children:[l.jsx("button",{onClick:()=>R(w.code),"data-testid":"sync-copy-code",children:"Copy code"}),w.expiresAt&&l.jsxs("span",{className:"muted",style:{margin:0},children:["expires ",new Date(w.expiresAt*1e3).toLocaleDateString()]})]})]})]}):l.jsxs("p",{className:"muted","data-testid":"sync-no-invite",children:["Inviting from here needs a bmo-sync admin key (set"," ",l.jsx("span",{className:"md-code-inline",children:"BMO_SYNC_ADMIN_KEY"}),"). Without it, anyone you've already invited can still join with their own code."]})]}),o&&l.jsx("div",{style:{color:"var(--error)",fontSize:12,marginTop:8},"data-testid":"sync-error",children:o}),l.jsxs("div",{className:"actions",children:[(j||i)&&l.jsx("button",{onClick:y,disabled:c,"data-testid":"sync-recheck",children:"Recheck"}),O&&!j&&l.jsx("button",{onClick:T,disabled:c,"data-testid":"sync-disconnect",children:"Disconnect"}),l.jsx("button",{onClick:e,"data-testid":"sync-close",children:"Close"})]})]})})}const Al=[{tier:1,label:"Read-only (diagnostics + logs)"},{tier:2,label:"Diagnostics & fixes (recommended)"},{tier:3,label:"Operate my agent",operate:!0},{tier:4,label:"Run shell commands",operate:!0}],H3=[{minutes:30,label:"30 minutes"},{minutes:120,label:"2 hours"},{minutes:480,label:"8 hours"}];function W3(e){const t=Math.round(e/6e4);return t<=0?"expiring":t<60?`${t} min`:`${Math.floor(t/60)}h ${t%60}m`}function U3({token:e}){var _;const[t,n]=b.useState(null),[r,i]=b.useState(2),[s,o]=b.useState(30),[a,c]=b.useState(!1),[u,d]=b.useState(!1),h=b.useCallback(()=>e?{Authorization:`Bearer ${e}`}:{},[e]),f=b.useCallback(async()=>{try{const y=await fetch("/api/support/status",{headers:h()});if(!y.ok)return;n(await y.json())}catch{}},[h]);b.useEffect(()=>{f();const y=setInterval(f,1e4);return()=>clearInterval(y)},[f]);const p=b.useCallback(async()=>{var y;c(!0);try{const S=(y=Al.find(E=>E.tier===r))==null?void 0:y.operate;await fetch("/api/support/grant",{method:"POST",headers:{"content-type":"application/json",...h()},body:JSON.stringify({tier:r,minutes:s,confirmOperate:!!S})})}catch{}c(!1),f()},[h,f,r,s]),m=b.useCallback(async()=>{d(!0);try{await fetch("/api/support/revoke",{method:"POST",headers:h()})}catch{}d(!1),f()},[h,f]);if(!t||typeof t.enabled!="boolean")return null;const g=t.enabled||t.active||!!t.operate;if(!g&&!t.canGrant)return null;const w=Al.find(y=>y.tier===r),v=t.maxTier||4;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"set-section",children:"Support access"}),g?l.jsxs("div",{className:"set-support","data-testid":"support-access",children:[l.jsxs("span",{children:["🛟 ",l.jsx("strong",{children:"Allowed"})," —"," ",((_=Al.find(y=>y.tier===t.tier))==null?void 0:_.label)||`tier ${t.tier}`,t.remainingMs>0&&l.jsxs(l.Fragment,{children:[" · auto-expires in ",W3(t.remainingMs)]})]}),l.jsx("button",{type:"button",onClick:m,disabled:u,"data-testid":"support-revoke",children:u?"Revoking…":"Revoke"})]}):l.jsxs("div",{className:"set-support","data-testid":"support-access",children:[l.jsxs("label",{children:["Let support",l.jsx("select",{"aria-label":"support level",value:r,onChange:y=>i(Number(y.target.value)),children:Al.filter(y=>y.tier<=v).map(y=>l.jsx("option",{value:y.tier,children:y.label},y.tier))})]}),l.jsxs("label",{children:["for",l.jsx("select",{"aria-label":"duration",value:s,onChange:y=>o(Number(y.target.value)),children:H3.map(y=>l.jsx("option",{value:y.minutes,children:y.label},y.minutes))})]}),(w==null?void 0:w.operate)&&l.jsxs("span",{className:"set-support-warn","data-testid":"support-operate-warn",children:["⚠ lets support ",r>=4?"run shell commands on":"operate the agent on"," your machine"]}),l.jsx("button",{type:"button",onClick:p,disabled:a,"data-testid":"support-allow",children:a?"Allowing…":"Allow"})]}),l.jsx("p",{className:"muted small",children:"Off by default and time-boxed. While it’s allowed, a banner stays on screen with a one-tap Stop/Revoke."})]})}function V3({token:e,onClose:t}){return Bi(t),l.jsx("div",{className:"modal-backdrop",onClick:t,"data-testid":"support-backdrop",children:l.jsxs("div",{className:"modal support-dialog",onClick:n=>n.stopPropagation(),"data-testid":"support-dialog",children:[l.jsx("h2",{children:"🛟 VentureWild support"}),l.jsx("p",{className:"muted",children:"Let our team look at — and, if you ask, fix — your workspace. Off by default, time-boxed, and you can revoke it any time."}),l.jsx(U3,{token:e}),l.jsx("div",{className:"actions",children:l.jsx("button",{onClick:t,"data-testid":"support-done",children:"Done"})})]})})}function q3({alert:e,onDismiss:t}){if(!e)return null;const n=e.kind==="fatal";return l.jsxs("div",{className:"conflict-banner","data-testid":"conflict-banner",role:"status",children:[l.jsx("span",{className:"ico",children:n?"⛔":"⚠️"}),n?l.jsxs("span",{children:[l.jsx("strong",{children:"Sync stopped."})," ",e.message||"The sync engine hit a fatal error."," Reconnect from the Collaborate dialog."]}):l.jsxs("span",{children:[l.jsx("strong",{children:"Sync conflict"})," on ",l.jsx("code",{children:e.path||"a file"})," — bmo-sync kept ",l.jsx("strong",{children:e.resolution||"the latest edit"}),e.user?` (also edited by ${e.user})`:"","."]}),l.jsx("span",{className:"spacer"}),l.jsx("button",{onClick:t,"data-testid":"conflict-dismiss",children:"Dismiss"})]})}function K3({urlToken:e,onClose:t}){const[n,r]=b.useState([]),[i,s]=b.useState(!0),[o,a]=b.useState(null),[c,u]=b.useState(null),[d,h]=b.useState({}),[f,p]=b.useState(null),m=e?{Authorization:`Bearer ${e}`}:{};function g(){s(!0),fetch("/api/conflicts",{headers:m}).then(y=>y.ok?y.json():{conflicts:[]}).then(y=>{r(Array.isArray(y==null?void 0:y.conflicts)?y.conflicts:[]),a(null)}).catch(y=>a(String((y==null?void 0:y.message)||y))).finally(()=>s(!1))}b.useEffect(g,[]);function w(y){return`${y.workspaceId}:${y.path}`}async function v(y){const S=w(y);if(d[S])return;const E=new URL("/api/conflicts/view",window.location.origin);E.searchParams.set("workspaceId",y.workspaceId),E.searchParams.set("path",y.path);const k=await fetch(E.toString(),{headers:m});if(!k.ok){a(`Could not load ${y.path} (HTTP ${k.status})`);return}const T=await k.json().catch(()=>null);T&&h(R=>({...R,[S]:{mine:W_(T.mine),theirs:W_(T.theirs),conflict:T.conflict}}))}async function _(y,S){const E=w(y);p(E);try{const k=await fetch("/api/conflicts/resolve",{method:"POST",headers:{"content-type":"application/json",...m},body:JSON.stringify({workspaceId:y.workspaceId,path:y.path,action:S})});if(!k.ok){const T=await k.json().catch(()=>({}));a((T==null?void 0:T.error)||`Resolve failed (HTTP ${k.status}).`);return}g(),u(null)}finally{p(null)}}return l.jsxs("div",{className:"conflict-panel","data-testid":"conflict-panel",role:"dialog","aria-label":"Open conflicts",children:[l.jsxs("header",{className:"conflict-panel-header",children:[l.jsx("strong",{children:"Open conflicts"})," ",l.jsxs("span",{className:"muted",children:["(",n.length,") · changes saved to the daemon back-office until you resolve"]}),l.jsx("span",{className:"spacer"}),l.jsx("button",{onClick:g,children:"Refresh"}),l.jsx("button",{onClick:t,children:"Close"})]}),i&&l.jsx("div",{className:"muted",children:"Loading…"}),o&&l.jsx("div",{className:"conflict-panel-error",children:o}),!i&&n.length===0&&l.jsx("div",{className:"muted",children:"No open conflicts."}),l.jsx("ul",{className:"conflict-list",children:n.map(y=>{const S=w(y),E=c===S,k=d[S];return l.jsxs("li",{className:"conflict-row",children:[l.jsxs("div",{className:"conflict-row-head",onClick:()=>{E?u(null):(u(S),y.resolution!=="remote_announced"&&v(y))},children:[l.jsx("code",{children:y.path}),l.jsxs("span",{className:"muted",children:["·"," ",y.resolution==="remote_announced"?`${y.conflictingUser||"peer"} flagged`:y.conflictingUser||"peer"," ","·"," ",new Date((y.detectedAt||0)*1e3).toLocaleTimeString()]}),l.jsx("span",{className:"spacer"}),l.jsx("span",{className:"muted",children:E?"▲":"▼"})]}),E&&y.resolution==="remote_announced"&&l.jsxs("div",{className:"conflict-row-body",children:[l.jsxs("div",{className:"muted",children:[y.conflictingUser||"A peer"," reported a conflict on this file. Your local copy is unchanged here — open it, decide whether to keep your version or pull theirs, save, and the next sync will reconcile."]}),l.jsx("div",{className:"conflict-actions",children:l.jsx("button",{disabled:f===S,onClick:()=>_(y,"keep_mine"),"data-testid":"conflict-acknowledge",children:"Acknowledge"})})]}),E&&y.resolution!=="remote_announced"&&l.jsxs("div",{className:"conflict-row-body",children:[!k&&l.jsx("div",{className:"muted",children:"Loading diff…"}),k&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"conflict-meta",children:[l.jsxs("span",{children:["mine: ",l.jsx("code",{children:Gh(y.mineSha256)})]}),l.jsxs("span",{children:["theirs: ",l.jsx("code",{children:Gh(y.theirsSha256)})]}),y.baseSha256&&l.jsxs("span",{children:["base: ",l.jsx("code",{children:Gh(y.baseSha256)})]})]}),l.jsx(Y3,{mine:k.mine,theirs:k.theirs}),l.jsxs("div",{className:"conflict-actions",children:[l.jsx("button",{disabled:f===S,onClick:()=>_(y,"keep_mine"),"data-testid":"conflict-keep-mine",children:"Keep mine"}),l.jsx("button",{disabled:f===S,onClick:()=>_(y,"take_theirs"),"data-testid":"conflict-take-theirs",children:"Take theirs"})]})]})]})]},S)})})]})}function W_(e){if(typeof e!="string")return null;try{const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new TextDecoder().decode(n)}catch{return null}}function Gh(e){return typeof e!="string"?"∅":e.length>12?`${e.slice(0,12)}…`:e}function Y3({mine:e,theirs:t}){return e==null&&t==null?l.jsx("div",{className:"muted",children:"Both versions unavailable on disk."}):e==null||t==null?l.jsx("div",{className:"muted",children:"Only one side is available — the other was deleted before resolution."}):l.jsx(Gl,{oldText:t,newText:e})}function G3({role:e,urlToken:t,onSyncAlert:n,onOpenConflicts:r}){const[i,s]=b.useState([]),[o,a]=b.useState({tokensIn:0,tokensOut:0,costUsd:0}),[c,u]=b.useState([]),[d,h]=b.useState(!1),[f,p]=b.useState(null),[m,g]=b.useState(0);b.useEffect(()=>{if(e!=="partner")return;const S=t?{Authorization:`Bearer ${t}`}:{};fetch("/api/sync/status",{headers:S}).then(E=>E.ok?E.json():null).then(E=>{var k;E&&p({paired:!!E.paired,daemonRunning:!!((k=E.daemon)!=null&&k.running),peer:null})}).catch(()=>{}),fetch("/api/conflicts",{headers:S}).then(E=>E.ok?E.json():{conflicts:[]}).then(E=>g(Array.isArray(E==null?void 0:E.conflicts)?E.conflicts.length:0)).catch(()=>{})},[e,t]),b.useEffect(()=>{const S=window.location.protocol==="https:"?"wss":"ws",E=new URL(`${S}://${window.location.host}/ws/activity`);t&&E.searchParams.set("t",t);const k=new WebSocket(E.toString());return k.onopen=()=>h(!0),k.onclose=()=>h(!1),k.onmessage=T=>{let R;try{R=JSON.parse(T.data)}catch{return}R.type==="snapshot"?(s(R.snapshot.presence||[]),a(R.snapshot.usage||{tokensIn:0,tokensOut:0,costUsd:0}),u(R.snapshot.recent||[])):(u(O=>[...O.slice(-49),R]),w(R))},()=>{try{k.close()}catch{}}},[t]);function w(S){S.type==="daemon-status"?p(E=>({...E||{paired:!1},daemonRunning:!!S.connected})):S.type==="sync-paired"?p(E=>({...E||{},paired:!0,daemonRunning:!0})):S.type==="sync-detached"?p(E=>({...E||{},paired:!1,peer:null})):S.type==="remote-presence"?p(E=>({...E||{paired:!0},peer:S.user||null})):S.type==="sync-conflict"?(n==null||n({kind:"conflict",path:S.path,resolution:S.resolution,user:S.conflictingUser}),(S.resolution==="local_pre_write_guard"||S.resolution==="remote_announced")&&g(E=>E+1)):S.type==="sync-conflict-resolved"?g(E=>Math.max(0,E-1)):S.type==="sync-fatal"&&(n==null||n({kind:"fatal",message:S.message}))}const v=[...c].reverse().find(S=>S.type==="chat-stream"||S.type==="chat-user"||S.type==="chat-end"),_=c.find(S=>S.type==="inbox-change");let y=null;return f!=null&&f.paired&&(y=f.daemonRunning?l.jsxs("span",{className:"pill synced","data-testid":"activity-sync",children:["⇄ Synced",f.peer?` · with ${f.peer}`:""]}):l.jsx("span",{className:"pill sync-off","data-testid":"activity-sync",children:"⇄ Sync paused"})),l.jsxs("footer",{className:"bottombar","data-testid":"activity-bar",children:[l.jsx("span",{className:`pill ${d?"live":""}`,"data-testid":"activity-connected",children:d?"live":"reconnecting…"}),l.jsxs("span",{className:"pill","data-testid":"activity-presence",children:["👥 ",i.length," viewing"]}),y,e==="partner"&&m>0&&l.jsxs("button",{type:"button",className:"pill conflict-badge","data-testid":"activity-conflicts",onClick:()=>r==null?void 0:r(),title:"Resolve open sync conflicts",children:["🛑 ",m," conflict",m===1?"":"s"]}),l.jsxs("span",{className:"pill","data-testid":"activity-usage",children:["↓",o.tokensIn," ↑",o.tokensOut," · $",(o.costUsd||0).toFixed(3)]}),v&&l.jsx("span",{className:"pill",style:{maxWidth:380,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"data-testid":"activity-last",children:v.type==="chat-end"?"✓ agent finished":"… agent streaming"}),_&&l.jsx("span",{className:"pill","data-testid":"activity-inbox",children:"📦 inbox updated"}),l.jsx("span",{style:{flex:1}}),l.jsxs("span",{style:{fontSize:11},children:["v0.1.0 · ",e]})]})}function X3(){var r;const[e,t]=b.useState(null);if(b.useEffect(()=>{let i=!1;async function s(){try{const c=await(await fetch("/api/inbox")).json();i||t(c)}catch{}}s();const o=setInterval(s,5e3);return()=>{i=!0,clearInterval(o)}},[]),!e||!e.hasInbox||!((r=e.imports)!=null&&r.length))return null;const n=e.imports.filter(i=>{var o;const s=Object.keys(e.installed||{}).find(a=>a.startsWith(i.replace(/-v[\d.]+$/,"")));return s?((o=e.installed[s])==null?void 0:o.integrated)!==!0:!0});return n.length===0?null:l.jsxs("div",{className:"inbox-card","data-testid":"inbox-card",children:["📦 ",l.jsx("strong",{children:"Component inbox"}),": ",n.length," pending integration",n.length!==1?"s":"",": ",n.join(", "),".",l.jsxs("span",{className:"muted",children:["Ask the agent: ",l.jsxs("em",{children:["“walk me through integrating ",n[0],"”"]})]})]})}function J3(e){return`${Math.round((Number(e)||0)*100)}%`}function Z3(e){return`$${(Number(e)||0).toFixed(2)}`}function Q3(e){const t=Math.max(0,Math.min(5,Math.round(Number(e)||0)));return"★★★★★".slice(0,t)+"☆☆☆☆☆".slice(0,5-t)}function U_(e){var t,n;return((t=e.producer)==null?void 0:t.handle)==="you"||((n=e.producer)==null?void 0:n.kind)==="me"}const ck=[{key:"hiring",glyph:"🎯",label:"Hiring",re:/match|candidate|recruit|\bhir|screen|talent/},{key:"docs",glyph:"📄",label:"Docs",re:/\bcv\b|resume|parse|extract|document/},{key:"boards",glyph:"🗂️",label:"Boards",re:/kanban|board|pipeline|stage|drag/},{key:"deploy",glyph:"🚀",label:"Deploy",re:/deploy|cloudflare|worker|\bhost|ship|edge|serverless/},{key:"launch",glyph:"🌱",label:"Launch",re:/landing|waitlist|subscription|launch|checkout/},{key:"portfolio",glyph:"🖼️",label:"Portfolio",re:/portfolio|personal site/},{key:"finance",glyph:"🧾",label:"Finance",re:/receipt|expense|invoice|account/},{key:"forms",glyph:"💬",label:"Forms",re:/feedback|survey|\bform\b/},{key:"scheduling",glyph:"📅",label:"Scheduling",re:/book|slot|appointment|schedul|calendar/}],uk={key:"other",glyph:"🧩",label:"Other"};function Xh(e){const t=`${e.title} ${(e.tags||[]).join(" ")} ${e.pitch||""}`.toLowerCase();for(const n of ck)if(n.re.test(t))return n;return uk}function V_(e){var n,r,i,s;const t=(((n=e.reward)==null?void 0:n.unit)||"").toLowerCase();return e.hasService||((r=e.reward)==null?void 0:r.model)==="recurring"||/match|use/.test(t)?"earns per use":((i=e.reward)==null?void 0:i.model)==="one-time"?"one-time reward":(s=e.reward)!=null&&s.model?`${e.reward.model} reward`:null}function Jh(e){var t;return(((t=e.outcomeStats)==null?void 0:t.builds)||0)===0||e.safetyBadge==="new"}function e4(e,t){var n;return t?`I want to build "${e.title}" from my own recipe.`:`I want to build "${e.title}". Use ${((n=e.producer)==null?void 0:n.name)||"the producer"}'s recipe.`}function t4({onClose:e,onBuild:t,token:n}){var W;Bi(e);const[r,i]=b.useState([]),[s,o]=b.useState(null),[a,c]=b.useState(!0),[u,d]=b.useState(null),[h,f]=b.useState(null),[p,m]=b.useState({}),[g,w]=b.useState(""),[v,_]=b.useState(null);async function y(N){if(!p[N.id]){m(H=>({...H,[N.id]:!0}));try{const H={"content-type":"application/json",...n?{Authorization:`Bearer ${n}`}:{}};await fetch(`/api/bazaar/themes/${encodeURIComponent(N.id)}/report`,{method:"POST",headers:H,body:JSON.stringify({reason:""})})}catch{}}}b.useEffect(()=>{let N=!1;async function H(){try{const[C,re]=await Promise.all([fetch("/api/bazaar/shelf"),fetch("/api/bazaar/state")]);if(N)return;const Q=await C.json(),x=await re.json();if(N)return;const Y=(Q.recipes||[]).filter(Z=>Z.kind!=="theme").sort((Z,oe)=>(oe.outcomeScore||0)-(Z.outcomeScore||0));i(Y),o(x)}catch(C){N||d(String(C.message||C))}finally{N||c(!1)}}return H(),()=>{N=!0}},[]);const S=((s==null?void 0:s.earnings)||[]).filter(N=>N.total>0),E=r.filter(U_),k=S.find(N=>N.handle==="you"),T=new Set(r.map(N=>{var H,C;return((H=N.producer)==null?void 0:H.handle)||((C=N.producer)==null?void 0:C.name)||"?"})).size,R=b.useMemo(()=>{const N=new Set(r.map(H=>Xh(H).key));return[...ck,uk].filter(H=>N.has(H.key))},[r]),O=b.useMemo(()=>{const N=g.trim().toLowerCase();return r.filter(H=>{var re;return v&&Xh(H).key!==v?!1:N?`${H.title} ${H.pitch||""} ${(H.tags||[]).join(" ")} ${((re=H.producer)==null?void 0:re.name)||""}`.toLowerCase().includes(N):!0})},[r,g,v]),j=!!(g.trim()||v),$=r.filter(N=>!Jh(N)).slice(0,6),L=r.filter(Jh).slice(0,6),P=new Set([...$,...L].map(N=>N.id)),A=r.filter(N=>!P.has(N.id)),D=N=>{var Y,Z,oe,me,Ee,U;const H=U_(N),C=h===N.id,re=Jh(N),Q=ES(N),x=Q.label==="Verified"||Q.label==="Flagged";return l.jsxs("div",{className:`bz-card${H?" mine":""}${C?" open":""}`,"data-testid":`shelf-recipe-${N.id}`,onClick:()=>f(C?null:N.id),children:[l.jsxs("div",{className:"bz-card-head",children:[l.jsx("span",{className:"bz-card-glyph","aria-hidden":!0,children:Xh(N).glyph}),l.jsxs("div",{className:"bz-card-titles",children:[l.jsx("span",{className:"bz-card-title",children:N.title}),l.jsxs("span",{className:"bz-card-by",children:["by ",((Y=N.producer)==null?void 0:Y.name)||"a producer",H&&" (you)"]})]}),l.jsx("div",{className:"bz-card-score",children:re?l.jsx("span",{className:"bz-new",title:"Just listed — earns its rank by working",children:"NEW"}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"bz-score-pct",children:J3(N.outcomeScore)}),l.jsx("span",{className:"bz-score-label",children:"works"})]})})]}),N.pitch&&l.jsx("p",{className:"bz-card-pitch",children:N.pitch}),l.jsxs("div",{className:"bz-card-foot",children:[x&&l.jsx("span",{className:`bz-badge bz-trust-${Q.tone}`,"data-testid":`shelf-trust-${N.id}`,title:Q.note||void 0,children:Q.label}),V_(N)&&l.jsx("span",{className:"bz-reward-pill",children:V_(N)}),l.jsx("span",{className:"bz-card-expand",children:C?"▾":"▸"})]}),C&&l.jsxs("div",{className:"bz-card-detail","data-testid":`shelf-detail-${N.id}`,onClick:ye=>ye.stopPropagation(),children:[l.jsxs("div",{className:"bz-detail-badges",children:[l.jsx("span",{className:`bz-kind bz-kind-${H?"you":((Z=N.producer)==null?void 0:Z.kind)||"maker"}`,children:H?"you":((oe=N.producer)==null?void 0:oe.kind)==="vendor"?"vendor":"maker"}),N.hasService&&l.jsx("span",{className:"bz-kind bz-kind-tool",children:"tool"}),((me=N.rating)==null?void 0:me.count)>0&&l.jsxs("span",{className:"bz-card-rating",title:`${N.rating.stars} from ${N.rating.count}`,children:[Q3(N.rating.stars)," ",l.jsxs("span",{className:"muted",children:["(",N.rating.count,")"]})]})]}),N.summary&&l.jsx("p",{className:"bz-detail-summary",children:N.summary}),!re&&(((Ee=N.outcomeStats)==null?void 0:Ee.builds)||0)>0&&l.jsxs("p",{className:"muted bz-detail-stat",children:[N.outcomeStats.working," of ",N.outcomeStats.builds," builds reached a working result."]}),Mc(N)&&l.jsxs("p",{className:"muted bz-detail-stat","data-testid":`shelf-lineage-${N.id}`,children:["remixed from ",Mc(N)]}),l.jsxs("p",{className:"bz-detail-hint",children:["Your agent builds this for you and credits"," ",H?"you":((U=N.producer)==null?void 0:U.name)||"the producer"," when it does."]}),t&&l.jsx("button",{type:"button",className:"bz-build-btn","data-testid":`shelf-build-${N.id}`,onClick:ye=>{ye.stopPropagation(),t(e4(N,H))},children:"Build this →"}),N.source==="rails"&&!H&&l.jsx("button",{type:"button",className:"bz-theme-report","data-testid":`shelf-report-recipe-${N.id}`,disabled:!!p[N.id],title:"Report this recipe to VentureWild",onClick:ye=>{ye.stopPropagation(),y(N)},children:p[N.id]?"Reported ✓":"⚐ Report"})]})]},N.id)},M=(N,H,C)=>C.length?l.jsxs("div",{className:"bz-rail","data-testid":`bazaar-rail-${H.toLowerCase().replace(/\s+/g,"-")}`,children:[l.jsxs("div",{className:"bz-rail-head",children:[N," ",H]}),l.jsx("div",{className:"bz-rail-track",children:C.map(D)})]}):null;return l.jsx("div",{className:"modal-backdrop",onClick:e,children:l.jsxs("div",{className:"modal bazaar-modal",onClick:N=>N.stopPropagation(),"data-testid":"bazaar-shelf",children:[l.jsxs("div",{className:"bz-store-head",children:[l.jsxs("div",{className:"bz-store-headings",children:[l.jsx("h2",{children:"🛍️ The bazaar"}),l.jsx("p",{className:"muted bz-store-sub",children:"Proven recipes from a network of producers. Your agent reaches onto this shelf for you — ranked by how often each actually gets a working result, not by marketing."})]}),l.jsxs("div",{className:"bz-store-stats","data-testid":"bazaar-store-stats",children:[l.jsxs("span",{className:"bz-stat",children:[l.jsx("strong",{children:r.length}),"recipes"]}),l.jsxs("span",{className:"bz-stat",children:[l.jsx("strong",{children:T}),"producers"]})]})]}),u&&l.jsx("div",{className:"bz-err",children:u}),a&&r.length===0&&l.jsx("div",{className:"muted bz-loading","data-testid":"bazaar-loading",children:"Loading the shelf…"}),E.length>0&&l.jsxs("div",{className:"bz-you-banner","data-testid":"bazaar-you-banner",children:[l.jsx("span",{className:"bz-you-spark",children:"✦"}),l.jsxs("span",{children:["You're a producer here — ",l.jsx("strong",{children:E.length})," ",E.length===1?"of your recipes is":"of your recipes are"," on the shelf",k&&l.jsxs(l.Fragment,{children:[" · earning ",l.jsx("strong",{children:Z3(k.total)}),l.jsx("span",{className:"bz-represented",children:" represented"})]})]})]}),r.length>0&&l.jsxs("div",{className:"bz-browse","data-testid":"bazaar-browse",children:[l.jsx("input",{className:"bz-search",type:"search",value:g,onChange:N=>w(N.target.value),placeholder:"Search recipes…","data-testid":"bazaar-search","aria-label":"Search recipes"}),l.jsx("div",{className:"bz-chips",role:"group","aria-label":"Filter by category",children:R.map(N=>l.jsxs("button",{className:`bz-chip${v===N.key?" active":""}`,onClick:()=>_(v===N.key?null:N.key),"data-testid":`bazaar-chip-${N.key}`,"aria-pressed":v===N.key,children:[N.glyph," ",N.label]},N.key))})]}),j?l.jsx("div",{className:"bz-shelf-grid","data-testid":"bazaar-shelf-grid",children:O.length===0?l.jsxs("p",{className:"muted bz-no-results","data-testid":"bazaar-no-results",children:["No recipes match “",g.trim()||((W=R.find(N=>N.key===v))==null?void 0:W.label),"”. Clear the filter to see all."]}):O.map(D)}):l.jsxs(l.Fragment,{children:[M("✦","Proven",$),M("🆕","New",L),A.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"bz-all-head",children:"More recipes"}),l.jsx("div",{className:"bz-shelf-grid","data-testid":"bazaar-shelf-grid",children:A.map(D)})]})]}),l.jsx("div",{className:"actions",children:l.jsx("button",{onClick:e,"data-testid":"bazaar-shelf-close",children:"Close"})})]})})}const Qo=new Set(["login","missing","subscribe"]),hk=new Set(["login","missing"]),ma={missing:{title:"Almost there — I need Claude installed before I can think.",subtitle:"That's the brain I run on. Install it once, then come back here.",cmdLabel:"Run this in your terminal",cmd:"curl -fsSL https://claude.ai/install.sh | bash",after:"Then come back and press the button below.",retry:"Still don't see Claude on this machine. Make sure the install finished, then try again."},login:{title:"One quick thing before we dig in — sign me in to Claude.",subtitle:"It's a one-time sign-in to your own Claude account — it runs on your machine, on your plan. After this you won't be asked again.",cmdLabel:"Run this once in your terminal",cmd:"claude auth login",after:"A browser window opens — sign in with your Claude account, then come back and press the button.",retry:"Hmm — still not signed in. Finish the sign-in in your browser, then press it again."},subscribe:{title:"You're in — I just need an active Claude plan to start thinking.",subtitle:"Claude Code runs on a Claude Pro plan (or higher). Grab one on your own account, then come back — you won’t be asked again.",cmdLabel:"Get a plan, then come back",link:"https://claude.ai/upgrade",linkLabel:"Open claude.ai →",after:"Subscribe at claude.ai, then come back and press the button.",retry:"Still no active plan showing. Give it a moment after subscribing, then try again."}};function n4(e){var n;const t=(n=e==null?void 0:e.session)==null?void 0:n.source;return t==="loopback"||t==="localhost"}function dk({headers:e,onSuccess:t}){const[n,r]=b.useState(null),[i,s]=b.useState(""),o=b.useRef(t);b.useEffect(()=>{o.current=t});const a=b.useCallback(()=>{r(null),s("")},[]),c=b.useCallback(async()=>{var d;r({status:"starting",url:null,error:null});try{const f=await(await fetch("/api/agent/login/start",{method:"POST",headers:e})).json();r(f),f.status==="success"&&((d=o.current)==null||d.call(o))}catch{r({status:"error",url:null,error:"Could not start sign-in."})}},[e]),u=b.useCallback(async()=>{const d=i.trim();if(d){s("");try{const h=await fetch("/api/agent/login/code",{method:"POST",headers:{...e,"content-type":"application/json"},body:JSON.stringify({code:d})});r(await h.json())}catch{}}},[e,i]);return b.useEffect(()=>{if(!(n&&["starting","awaiting-browser","awaiting-code"].includes(n.status)))return;let h=!0;const f=setInterval(async()=>{var p;try{const g=await(await fetch("/api/agent/login/status",{headers:e})).json();if(!h)return;r(g),g.status==="success"&&(clearInterval(f),(p=o.current)==null||p.call(o))}catch{}},2e3);return()=>{h=!1,clearInterval(f)}},[n==null?void 0:n.status,e]),{loginFlow:n,setLoginFlow:r,signinCode:i,setSigninCode:s,start:c,submitCode:u,reset:a}}const r4=[{id:"concise",label:"Concise",sample:"Got it. Done."},{id:"playful",label:"Playful",sample:"Oh nice — let's go!"},{id:"formal",label:"Formal",sample:"Understood. Proceeding now."},{id:"dry",label:"Dry",sample:"Sure. If we must."}],q_=["#22d3ee","#a78bfa","#f472b6","#facc15","#34d399","#fb7185"],i4=[{id:"drive",label:"Google Drive",note:"Files & docs"},{id:"notion",label:"Notion",note:"Wiki & notes"},{id:"gmail",label:"Gmail",note:"Inbox & threads"},{id:"calendar",label:"Calendar",note:"Schedule"},{id:"canva",label:"Canva",note:"Designs"},{id:"github",label:"GitHub",note:"Code & PRs"}],s4=new Set(["md","txt","json","yml","yaml","toml","js","mjs","cjs","ts","tsx","jsx","py","rb","go","rs","java","kt","swift","c","h","cpp","cc","hpp","css","scss","html","sh","env","sql","xml","svg","csv"]);function o4(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}function a4(e){if(!e)return null;try{const t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"?null:t.protocol==="http:"&&(t.port===""||t.port==="80")||t.protocol==="https:"&&(t.port===""||t.port==="443")?t.hostname:`${t.hostname}:${t.port}`}catch{return null}}async function l4(e){const t=Array.from(e||[]).slice(0,200);if(t.length===0)return{folderName:null,files:[]};const n=(t[0].webkitRelativePath||t[0].name).split("/")[0]||"folder",r=40,i=600,s=[];for(const a of t){if(s.length>=r)break;const c=a.webkitRelativePath||a.name,u=o4(a.name);if(!s4.has(u)){s.push({path:c,head:""});continue}if(a.size>100*1024){s.push({path:c,head:""});continue}try{const f=await a.slice(0,i).text();s.push({path:c,head:f})}catch{s.push({path:c,head:""})}}const o=Math.max(t.length-s.length,0);return{folderName:n,files:s,totalFiles:t.length,untouched:o}}function c4({peekSummary:e,services:t,agentName:n}){const r=[],i=e!=null&&e.folderName?` (you just glanced at "${e.folderName}")`:"";return r.push({kind:"survey",title:"Tell me what's in my workspace",sub:e!=null&&e.folderName?"I'll read the workspace I'm running in and summarize.":"I'll read what's here and summarize the project."}),(t==null?void 0:t.size)>0?r.push({kind:"startup",title:"Help me start something new",sub:`${n} will ask one question to figure out what to build.`}):r.push({kind:"startup",title:"Help me start a project",sub:"Tell me the rough idea — I'll scaffold it."}),r.push({kind:"chat",title:"Just chat — find me work",sub:"No agenda yet. Get me into the workspace."}),r}function K_(e,t=55,n=380){const[r,i]=b.useState(""),[s,o]=b.useState(!1),[a,c]=b.useState(!1);return b.useEffect(()=>{if(!e){i(""),o(!1),c(!1);return}i(""),o(!1),c(!1);let u=0,d=null;const h=setTimeout(()=>{c(!0),d=setInterval(()=>{u+=1,i(e.slice(0,u)),u>=e.length&&(clearInterval(d),o(!0))},t)},n);return()=>{clearTimeout(h),d&&clearInterval(d)}},[e,t,n]),[r,s,a]}function fi({children:e,from:t="agent",accent:n,streaming:r=!1}){return l.jsx("div",{className:`ob-bubble ob-bubble-${t}${r?" ob-bubble-streaming":""}`,style:t==="user"?{borderColor:n}:void 0,children:e})}function Ds(){return l.jsx("span",{className:"ob-caret","aria-hidden":"true",children:"▍"})}function Y_(e){const t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}-${t}`}function u4({session:e,token:t,onComplete:n}){var Nn,_e,Te,xe;const[r,i]=b.useState(1),s=b.useMemo(()=>a4(e==null?void 0:e.shareBaseUrl),[e==null?void 0:e.shareBaseUrl]),[o,a]=b.useState(((Nn=e==null?void 0:e.identity)==null?void 0:Nn.name)||""),[c,u]=b.useState(((_e=e==null?void 0:e.identity)==null?void 0:_e.tone)||"concise"),[d,h]=b.useState(((Te=e==null?void 0:e.identity)==null?void 0:Te.color)||q_[0]),[f,p]=b.useState(!1),[m,g]=b.useState(null),[w,v]=b.useState(null),[_,y]=b.useState(!1),[S,E]=b.useState(!1),[k,T]=b.useState(new Set(((xe=e==null?void 0:e.identity)==null?void 0:xe.connectedServices)||[])),[R,O]=b.useState(!1),[j,$]=b.useState(null),[L,P]=b.useState(null),[A,D]=b.useState(!1),M=b.useRef(null),W=e==null?void 0:e.existingSetup,[N,H]=b.useState(!1),[C,re]=b.useState(!1);async function Q(){if(!C){re(!0);try{const B={"content-type":"application/json"};t&&(B.Authorization=`Bearer ${t}`),await fetch("/api/agent/adopt",{method:"POST",headers:B})}catch{}re(!1),n==null||n({})}}const x=b.useRef(null),Y=b.useRef({}),[Z,oe]=b.useState({}),me=b.useCallback((B,ce,he)=>{B&&oe(be=>{const ze=be[B]||{text:"",done:!1,error:null},Ye=ce==="text"?ze.text+(he||""):ze.text,Ge={...be,[B]:{...ze,text:Ye}};return Y.current[B]=Ye,Ge})},[]),Ee=b.useCallback((B,ce)=>{B&&oe(he=>{const be=he[B]||{text:"",done:!1,error:null};return{...he,[B]:{...be,done:!0,error:ce||be.error}}})},[]);b.useEffect(()=>{let B=!1,ce=0,he=null,be=null;const ze=()=>{if(B)return;const Ye=window.location.protocol==="https:"?"wss":"ws",Ge=new URL(`${Ye}://${window.location.host}/ws/chat`);t&&Ge.searchParams.set("t",t),be=new WebSocket(Ge.toString()),x.current=be,be.onmessage=cn=>{var nn;let ft;try{ft=JSON.parse(cn.data)}catch{return}ft.type==="chunk"&&((nn=ft.chunk)==null?void 0:nn.type)==="text"?me(ft.messageId,"text",ft.chunk.text):ft.type==="end"?Ee(ft.messageId,null):ft.type==="error"&&Ee(ft.messageId,ft.message||"agent error")},be.onopen=()=>{ce=0},be.onclose=()=>{if(x.current=null,B)return;const cn=Math.min(1e3*2**ce,8e3);ce+=1,he=setTimeout(ze,cn)},be.onerror=()=>{}};return ze(),()=>{B=!0,clearTimeout(he);try{be==null||be.close()}catch{}}},[t,me,Ee]),b.useEffect(()=>{document.documentElement.style.setProperty("--accent",d),document.documentElement.style.setProperty("--accent-hot",d)},[d]);const U=b.useMemo(()=>{const B={"content-type":"application/json"};return t&&(B.Authorization=`Bearer ${t}`),B},[t]),{loginFlow:ye,signinCode:we,setSigninCode:Se,start:fe,submitCode:it,reset:qe}=dk({headers:U,onSuccess:ge});async function Oe(B){const ce=await fetch("/api/agent/identity",{method:"POST",headers:U,body:JSON.stringify({name:o,tone:c,color:d,...B})});if(!ce.ok){const he=await ce.json().catch(()=>({}));throw new Error(he.error||`save failed (${ce.status})`)}return ce.json()}const I=b.useCallback(async(B=!1)=>{y(!0);try{const ce=await fetch(`/api/agent/readiness${B?"?fresh=1":""}`,{headers:U});return ce.ok?await ce.json():{status:"unknown"}}catch{return{status:"unknown"}}finally{y(!1)}},[U]);async function ie(){if(g(null),!o.trim()){g("Pick a name — even just one syllable.");return}p(!0);try{await Oe({});const B=await I(!1);if(Qo.has(B.status)){v(B);return}i(2)}catch(B){g(String(B.message||B))}finally{p(!1)}}async function le(){const B=await I(!0);if(E(!0),B.status==="login"||B.status==="missing"){v(B);return}v(null),i(2)}async function ge(){const B=await I(!0);if(B.status==="ready"||B.status==="unknown"){qe(),v(null),i(2);return}qe(),v(B)}function He(){E(!1),fe()}const[Pe,Ve]=b.useState(null),Ze=Pe?Z[Pe]:null;async function ut(B){if(P(null),!(!B||B.length===0)){O(!0);try{const ce=await l4(B);if(ce.files.length===0){P("That folder looks empty — try another?"),O(!1);return}$(ce);const he=Y_("peek");Ve(he),oe(ze=>({...ze,[he]:{text:"",done:!1,error:null}}));const be=await fetch("/api/onboarding/peek",{method:"POST",headers:U,body:JSON.stringify({folderName:ce.folderName,files:ce.files,totalFiles:ce.totalFiles,messageId:he})});if(!be.ok){const ze=await be.json().catch(()=>({}));throw new Error(ze.error||`peek failed (${be.status})`)}}catch(ce){P(String(ce.message||ce))}finally{O(!1)}}}function F(B){T(ce=>{const he=new Set(ce);return he.has(B)?he.delete(B):he.add(B),he})}const[G,ue]=b.useState(null),[ke,X]=b.useState(null),[De,st]=b.useState(null),Re=G?Z[G]:null,[Qe,vt]=b.useState(null),[ht,Ke]=b.useState(!1);async function _t(){st(null),X("remix"),Ke(!0);try{const he=((await(await fetch("/api/bazaar/shelf",{headers:U})).json()).recipes||[]).filter(be=>be.kind!=="theme"&&be.source!=="theme").slice().sort((be,ze)=>(ze.outcomeScore||0)-(be.outcomeScore||0)).slice(0,3);vt(he)}catch{vt([])}finally{Ke(!1)}}async function ni(B){var he;const ce=`Build me “${B.title}”. Use ${((he=B.producer)==null?void 0:he.name)||"the producer"}'s recipe.`;try{await Oe({connectedServices:[...k]}),await fetch("/api/agent/onboarded",{method:"POST",headers:U}),n==null||n({build:ce})}catch(be){st(String(be.message||be))}}async function Gn(B){st(null),X(B);const ce=Y_("job");ue(ce),oe(he=>({...he,[ce]:{text:"",done:!1,error:null}}));try{await Oe({connectedServices:[...k]});const he=await fetch("/api/onboarding/start-job",{method:"POST",headers:U,body:JSON.stringify({kind:B,messageId:ce,peekFolderName:(j==null?void 0:j.folderName)||null})});if(!he.ok){const be=await he.json().catch(()=>({}));throw new Error(be.error||`start-job failed (${he.status})`)}}catch(he){st(String(he.message||he)),ue(null),X(null)}}async function Mn(){var B;try{await Oe({connectedServices:[...k]});const ce=await fetch("/api/agent/onboarded",{method:"POST",headers:U});if(!ce.ok){const be=await ce.json().catch(()=>({}));throw new Error(be.error||`mark-onboarded failed (${ce.status})`)}let he=null;if(G&&(Re!=null&&Re.done)&&Re.text&&!Re.error){const be=((B=Ht.find(ze=>ze.kind===ke))==null?void 0:B.title)||"Let’s get started";he={messageId:G,userText:be,agentText:Re.text}}n==null||n(he?{seedChat:he}:void 0)}catch(ce){g(String(ce.message||ce))}}const Ae=o.trim()||"your agent",te="Hey. I'm new here.",dt="Before we start — what should I call myself?",[et,tt]=K_(r===1?te:"",42,340),[lt,kt]=K_(r===1&&tt?dt:"",30,360),bt=r===1?kt:!0,Ht=b.useMemo(()=>c4({peekSummary:j,services:k,agentName:Ae}),[j,k,Ae]),ot=w?ma[w.status]||ma.login:null,On=w?hk.has(w.status):!1;return W!=null&&W.hasConfig&&!N?l.jsx("div",{className:"ob-root",children:l.jsx("div",{className:"ob-layout",children:l.jsxs("div",{className:"ob-stage",children:[l.jsxs("div",{className:"fd-brand ob-brand",children:[l.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]}),l.jsx("section",{className:"ob-step","data-testid":"ob-adopt",children:l.jsxs("div",{className:"ob-card ob-reveal",children:[l.jsx("h2",{style:{margin:"0 0 6px"},children:"We found your existing setup"}),l.jsxs("p",{className:"ob-bubble-subtle",style:{margin:"0 0 10px"},children:["This folder already has"," ",l.jsx("strong",{children:W.signals.join(", ")}),". Your agent will use it as-is — we never change your files. Keep it, or set up a fresh agent instead."]}),l.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:[l.jsx("button",{className:"primary","data-testid":"ob-adopt-keep",onClick:Q,disabled:C,children:C?"Setting up…":"Keep my setup (recommended)"}),l.jsx("button",{"data-testid":"ob-adopt-customise",onClick:()=>H(!0),disabled:C,children:"Customise instead"})]})]})})]})})}):l.jsx("div",{className:"ob-root",children:l.jsxs("div",{className:"ob-layout",children:[l.jsxs("div",{className:"ob-stage",children:[l.jsxs("div",{className:"fd-brand ob-brand",children:[l.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]}),l.jsxs("header",{className:"ob-header",children:[l.jsx("div",{className:"ob-step-dots","aria-label":`Step ${r} of 4`,children:[1,2,3,4].map(B=>l.jsx("span",{className:`ob-dot ${B===r?"active":""} ${B<r?"done":""}`},B))}),r>1&&!w&&l.jsx("button",{className:"ob-back",onClick:()=>i(r-1),children:"← Back"})]}),w&&ot&&l.jsxs("section",{className:"ob-step",children:[l.jsxs(fi,{children:[l.jsx("p",{className:"ob-bubble-text",children:ot.title}),l.jsx("p",{className:"ob-bubble-subtle",children:ot.subtitle})]}),l.jsxs("div",{className:"ob-card ob-reveal",children:[w.status==="login"?l.jsxs("div",{className:"ob-login-inapp",children:[(!ye||ye.status==="idle")&&l.jsx("button",{className:"ob-next primary",onClick:He,children:"Sign in to Claude →"}),ye&&(ye.status==="starting"||ye.status==="awaiting-browser")&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"ob-bubble-text",children:"Opening Claude in your browser…"}),l.jsx("p",{className:"ob-bubble-subtle",children:"Sign in there with your Claude account — I'll detect it automatically, nothing to come back and click."}),ye.url&&l.jsx("a",{className:"ob-login-link",href:ye.url,target:"_blank",rel:"noreferrer",children:"If the browser didn't open, click here →"})]}),ye&&ye.status==="awaiting-code"&&l.jsxs("div",{className:"ob-login-code",children:[l.jsx("label",{className:"ob-label",children:"Paste the code from your browser"}),l.jsxs("div",{className:"ob-actions",children:[l.jsx("input",{className:"ob-input",value:we,onChange:B=>Se(B.target.value),placeholder:"code from claude.ai"}),l.jsx("button",{className:"ob-next primary",onClick:it,children:"Submit"})]})]}),ye&&(ye.status==="error"||ye.status==="unsupported")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ob-error",children:[ye.error||"I couldn't run the in-app sign-in."," You can sign in from a terminal instead:"]}),l.jsx("div",{className:"ob-login-cmd",children:l.jsx("code",{children:ot.cmd})}),l.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:10},children:ot.after})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("label",{className:"ob-label",children:ot.cmdLabel}),ot.cmd?l.jsx("div",{className:"ob-login-cmd",children:l.jsx("code",{children:ot.cmd})}):l.jsx("a",{className:"ob-login-link",href:ot.link,target:"_blank",rel:"noreferrer",children:ot.linkLabel}),l.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:10},children:ot.after})]}),S&&l.jsx("div",{className:"ob-error",style:{marginTop:12},children:ot.retry}),l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-next primary",onClick:le,disabled:_,children:_?"Checking…":"I've done it — continue →"})}),!On&&l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-skip",onClick:()=>{v(null),i(2)},children:"I already have a plan — continue"})})]})]}),r===1&&!w&&l.jsxs("section",{className:"ob-step",children:[l.jsxs(fi,{streaming:!tt||!kt,children:[l.jsxs("p",{className:"ob-bubble-text",children:[et,!tt&&l.jsx(Ds,{})]}),tt&&l.jsxs("p",{className:"ob-bubble-text",children:[lt,!kt&&l.jsx(Ds,{})]})]}),bt&&l.jsxs("div",{className:"ob-card ob-reveal",children:[l.jsx("label",{className:"ob-label",children:"Name"}),l.jsx("input",{autoFocus:!0,className:"ob-input",placeholder:"Echo, Pip, Atlas, Sage…",value:o,onChange:B=>a(B.target.value),onKeyDown:B=>{B.key==="Enter"&&ie()},maxLength:40}),l.jsx("label",{className:"ob-label",children:"Voice"}),l.jsx("div",{className:"ob-tone-grid",children:r4.map(B=>l.jsxs("button",{className:`ob-tone ${c===B.id?"selected":""}`,onClick:()=>u(B.id),children:[l.jsx("span",{className:"ob-tone-label",children:B.label}),l.jsx("span",{className:"ob-tone-sample",children:B.sample})]},B.id))}),l.jsx("label",{className:"ob-label",children:"Color"}),l.jsx("div",{className:"ob-color-row",children:q_.map(B=>l.jsx("button",{className:`ob-color-swatch ${d===B?"selected":""}`,style:{background:B},onClick:()=>h(B),"aria-label":`Pick ${B}`},B))}),m&&l.jsx("div",{className:"ob-error",children:m}),l.jsx("div",{className:"ob-actions ob-actions-block",children:l.jsx("button",{className:"ob-next primary ob-next-full",onClick:ie,disabled:f||!o.trim(),children:f?"Saving…":`I'm ${Ae}. Let's go →`})})]})]}),r===2&&l.jsxs("section",{className:"ob-step",children:[l.jsxs(fi,{children:[l.jsx("p",{className:"ob-bubble-text",children:"Cool. Now — show me something you're working on. Drag a folder onto me."}),l.jsx("p",{className:"ob-bubble-subtle",children:"I'll glance at what's inside so I can react — your files stay on your machine."}),l.jsxs("details",{className:"ob-disclose",children:[l.jsx("summary",{children:"What gets shared?"}),"Just to react, I read filenames plus a short sample of each text file (≤40 files, ≤600 bytes each). That sample goes to Anthropic the same way every chat message does — nothing is uploaded to VentureWild. Pick something you'd be comfortable talking about in chat."]})]}),l.jsxs("div",{className:`ob-dropzone ${A?"over":""} ${R?"peeking":""}`,onDragOver:B=>{B.preventDefault(),D(!0)},onDragLeave:()=>D(!1),onDrop:async B=>{var he,be;B.preventDefault(),D(!1);const ce=(he=B.dataTransfer)==null?void 0:he.items;if(ce&&ce.length>0&&ce[0].webkitGetAsEntry){const ze=[],Ye=async(Ge,cn="")=>{if(Ge.isFile)await new Promise(ft=>Ge.file(nn=>{try{Object.defineProperty(nn,"webkitRelativePath",{value:`${cn}${nn.name}`})}catch{}ze.push(nn),ft()},ft));else if(Ge.isDirectory){const ft=Ge.createReader();await new Promise(nn=>ft.readEntries(async ri=>{for(const pt of ri)await Ye(pt,`${cn}${Ge.name}/`);nn()},nn))}};for(const Ge of ce){const cn=Ge.webkitGetAsEntry();cn&&await Ye(cn)}if(ze.length>0){await ut(ze);return}}await ut((be=B.dataTransfer)==null?void 0:be.files)},onClick:()=>{var B;return(B=M.current)==null?void 0:B.click()},children:[l.jsx("input",{ref:M,type:"file",webkitdirectory:"",directory:"",multiple:!0,style:{display:"none"},onChange:B=>ut(B.target.files)}),R?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ob-drop-icon",children:"👀"}),l.jsx("div",{className:"ob-drop-title",children:"Looking…"})]}):j?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ob-drop-icon",children:"📁"}),l.jsx("div",{className:"ob-drop-title",children:j.folderName}),l.jsxs("div",{className:"ob-drop-sub",children:[j.totalFiles," file",j.totalFiles===1?"":"s"," · sampled ",j.files.length]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"ob-drop-icon",children:"📂"}),l.jsx("div",{className:"ob-drop-title",children:"Drop a folder here"}),l.jsx("div",{className:"ob-drop-sub",children:"or click to pick one"})]})]}),Ze&&l.jsxs(fi,{streaming:!Ze.done,children:[Ze.text?l.jsxs("p",{className:"ob-bubble-text ob-bubble-wow",children:[Ze.text,!Ze.done&&l.jsx(Ds,{})]}):l.jsxs("p",{className:"ob-bubble-subtle",children:["👀 ",Ae," is reading…",!Ze.done&&l.jsx(Ds,{})]}),Ze.error&&l.jsx("p",{className:"ob-bubble-subtle ob-bubble-error",children:Ze.error})]}),L&&l.jsx("div",{className:"ob-error",children:L}),l.jsxs("div",{className:"ob-actions",children:[l.jsx("button",{className:"ob-skip",onClick:()=>i(3),children:"Skip — I'd rather just chat"}),l.jsx("button",{className:"ob-next primary",onClick:()=>i(3),disabled:!j&&!L,children:"Next →"})]})]}),r===3&&l.jsxs("section",{className:"ob-step",children:[l.jsxs(fi,{children:[l.jsx("p",{className:"ob-bubble-text",children:"Anything I should keep an eye on?"}),l.jsx("p",{className:"ob-bubble-subtle",children:"Totally optional. Flag what lives in your world and I'll wire it up when these land — you can always add more later."})]}),l.jsx("div",{className:"ob-tile-grid",children:i4.map(B=>l.jsxs("button",{className:`ob-tile ${k.has(B.id)?"selected":""}`,onClick:()=>F(B.id),children:[l.jsx("span",{className:"ob-tile-label",children:B.label}),l.jsx("span",{className:"ob-tile-note",children:B.note}),k.has(B.id)&&l.jsx("span",{className:"ob-tile-check",children:"✓"})]},B.id))}),l.jsxs("div",{className:"ob-soon",children:["I'll wire these up as they come online — your picks are saved. And I'm not stuck on one device:",s?l.jsxs(l.Fragment,{children:[" open ",l.jsx("code",{children:s})," on your phone with the same login"]}):l.jsx(l.Fragment,{children:" sign in on any device with the same login"})," ","and I'm right there — same memory, same conversation."]}),l.jsxs("div",{className:"ob-actions",children:[l.jsx("button",{className:"ob-skip",onClick:()=>i(4),children:"Skip →"}),l.jsx("button",{className:"ob-next primary",onClick:()=>i(4),children:"Next: first job →"})]})]}),r===4&&l.jsxs("section",{className:"ob-step",children:[l.jsxs(fi,{children:[l.jsx("p",{className:"ob-bubble-text",children:"Right — what should I actually do for you first?"}),l.jsx("p",{className:"ob-bubble-subtle",children:"Pick one and I'll start now. Or close this and just talk to me."})]}),Qe?l.jsxs("div",{className:"ob-remix",children:[l.jsx(fi,{children:l.jsx("p",{className:"ob-bubble-text",children:j!=null&&j.folderName?`I had a peek at “${j.folderName}.” Here's what other builders made from starts like yours — pick one and I'll build your version.`:"Here's what other builders already got working. Pick one — I'll build your version the moment you land in your workspace."})}),Qe.length===0?l.jsx("div",{className:"ob-error",children:"The shelf is empty right now — start from scratch instead."}):Qe.map(B=>{var ce,he;return l.jsxs("button",{className:"ob-remix-card",onClick:()=>ni(B),children:[l.jsxs("div",{className:"ob-remix-main",children:[l.jsx("span",{className:"ob-remix-title",children:B.title}),l.jsxs("span",{className:"ob-remix-by",children:["by ",((ce=B.producer)==null?void 0:ce.name)||"a builder"]}),B.pitch&&l.jsx("span",{className:"ob-remix-pitch",children:B.pitch}),((he=B.outcomeStats)==null?void 0:he.builds)>0&&l.jsxs("span",{className:"ob-remix-worked",children:["✓ worked for ",B.outcomeStats.working," of ",B.outcomeStats.builds," builds"]})]}),l.jsx("span",{className:"ob-remix-go",children:"Build mine →"})]},B.id)}),l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-skip",onClick:()=>{vt(null),X(null)},children:"← Pick a different job"})})]}):G?l.jsxs(l.Fragment,{children:[l.jsxs(fi,{streaming:!Re||!Re.done,children:[Re!=null&&Re.text?l.jsxs("p",{className:"ob-bubble-text",children:[Re.text,!Re.done&&l.jsx(Ds,{})]}):l.jsxs("p",{className:"ob-bubble-subtle",children:[Ae," is on it…",(!Re||!Re.done)&&l.jsx(Ds,{})]}),(Re==null?void 0:Re.error)&&l.jsx("p",{className:"ob-bubble-subtle ob-bubble-error",children:Re.error})]}),l.jsxs("div",{className:"ob-actions",children:[l.jsx("button",{className:"ob-skip",onClick:()=>{ue(null),X(null)},children:"← Pick a different job"}),l.jsx("button",{className:"ob-next primary",onClick:Mn,disabled:!Re||!Re.done&&!Re.error,children:Re!=null&&Re.done?"Open my workspace →":"Streaming…"})]})]}):l.jsxs("div",{className:"ob-jobs",children:[l.jsxs("button",{className:"ob-job ob-job-remix",onClick:_t,disabled:ht,children:[l.jsx("div",{className:"ob-job-title",children:"✦ Remix a proven build"}),l.jsx("div",{className:"ob-job-sub",children:ht?"Pulling up what others have made…":"Start from something other builders already got working — I'll build one for you now."})]}),Ht.map(B=>l.jsxs("button",{className:"ob-job",onClick:()=>Gn(B.kind),children:[l.jsx("div",{className:"ob-job-title",children:B.title}),l.jsx("div",{className:"ob-job-sub",children:B.sub})]},B.kind))]}),(m||De)&&l.jsx("div",{className:"ob-error",children:m||De}),!G&&!Qe&&l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-skip",onClick:Mn,children:"Skip to chat →"})}),l.jsxs("details",{className:"ob-consent-note",children:[l.jsx("summary",{children:"What I share with VentureWild — and how to turn it off"}),"I quietly share how I'm doing — what's working, what breaks, my setup health — with the VentureWild team so they can help if you ever get stuck. Never your words or files. You can turn this off anytime in Settings."]})]})]}),l.jsx("aside",{className:"ob-aside","aria-label":"Builders like you",children:l.jsxs("div",{className:"ob-aside-inner",children:[l.jsx("div",{className:"ob-aside-label",children:"✦ Builders like you"}),l.jsx(bu,{variant:"ambient"})]})})]})})}function h4({token:e,session:t,verdict:n,onResolved:r,onDismiss:i}){const s=b.useMemo(()=>{const D={};return e&&(D.Authorization=`Bearer ${e}`),D},[e]),[o,a]=b.useState(n||{status:"login"}),[c,u]=b.useState(!1),[d,h]=b.useState(!1),[f,p]=b.useState(!1),m=n4(t),g=(o==null?void 0:o.status)||"login",w=ma[g]||ma.login;hk.has(g);const v=b.useCallback(async()=>{u(!0);try{const D=await fetch("/api/agent/readiness?fresh=1",{headers:s});return D.ok?await D.json():{status:"unknown"}}catch{return{status:"unknown"}}finally{u(!1)}},[s]),_=b.useCallback(async()=>{const D=await v();if(D.status==="ready"||D.status==="unknown"){r==null||r();return}a(D)},[v,r]),{loginFlow:y,signinCode:S,setSigninCode:E,start:k,submitCode:T,reset:R}=dk({headers:s,onSuccess:_}),O=b.useCallback(()=>{h(!1),k()},[k]);async function j(){const D=await v();if(h(!0),!Qo.has(D.status)){r==null||r();return}R(),a(D)}b.useEffect(()=>{let D=!0;if(Qo.has(g))return v().then(M=>{D&&(Qo.has(M.status)?a(M):r==null||r())}),()=>{D=!1}},[]);const $=l.jsxs("div",{className:"ob-login-inapp",children:[(!y||y.status==="idle")&&l.jsx("button",{className:"ob-next primary",onClick:O,"data-testid":"claude-gate-signin",children:"Sign in to Claude →"}),y&&(y.status==="starting"||y.status==="awaiting-browser")&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"ob-bubble-text",children:"Opening Claude in your browser…"}),l.jsx("p",{className:"ob-bubble-subtle",children:"Sign in there with your Claude account — I'll detect it automatically."}),y.url&&l.jsx("a",{className:"ob-login-link",href:y.url,target:"_blank",rel:"noreferrer",children:"If the browser didn't open, click here →"})]}),y&&y.status==="awaiting-code"&&l.jsxs("div",{className:"ob-login-code",children:[l.jsx("label",{className:"ob-label",children:"Paste the code from your browser"}),l.jsxs("div",{className:"ob-actions",children:[l.jsx("input",{className:"ob-input",value:S,onChange:D=>E(D.target.value),placeholder:"code from claude.ai","data-testid":"claude-gate-code"}),l.jsx("button",{className:"ob-next primary",onClick:T,children:"Submit"})]})]}),y&&(y.status==="error"||y.status==="unsupported")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ob-error",children:[y.error||"I couldn't run the in-app sign-in."," You can sign in from a terminal instead:"]}),l.jsx("div",{className:"ob-login-cmd",children:l.jsx("code",{children:ma.login.cmd})})]})]});let L=w.title,P=w.subtitle,A;return g==="login"&&m?A=$:g==="login"&&!m?(L="You're signed out of Claude.",P="Your Claude account lives on the computer that runs this workspace, so the sign-in has to finish there. Open wild-workspace on that machine — you’ll get a one-click “Sign in to Claude” prompt.",A=l.jsx("div",{className:"ob-login-remote","data-testid":"claude-gate-remote",children:l.jsxs("details",{className:"ob-login-advanced",open:f,onToggle:D=>p(D.currentTarget.open),children:[l.jsx("summary",{children:"Advanced: try signing in from here"}),l.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:8},children:"This starts the sign-in on the host and shows a link. It only completes if you can reach that machine’s browser."}),$]})})):g==="missing"?A=l.jsxs(l.Fragment,{children:[l.jsx("label",{className:"ob-label",children:m?w.cmdLabel:"Install Claude on the computer that runs this workspace"}),l.jsx("div",{className:"ob-login-cmd",children:l.jsx("code",{children:w.cmd})}),l.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:10},children:w.after})]}):A=l.jsxs(l.Fragment,{children:[l.jsx("label",{className:"ob-label",children:w.cmdLabel}),w.link&&l.jsx("a",{className:"ob-login-link",href:w.link,target:"_blank",rel:"noreferrer",children:w.linkLabel}),l.jsx("p",{className:"ob-bubble-subtle",style:{marginTop:10},children:w.after})]}),l.jsx("div",{className:"ob-root","data-testid":"claude-login-gate",children:l.jsx("div",{className:"ob-layout",children:l.jsxs("div",{className:"ob-stage",children:[l.jsxs("div",{className:"fd-brand ob-brand",children:[l.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]}),l.jsxs("section",{className:"ob-step",children:[l.jsxs("div",{className:"ob-bubble ob-bubble-agent",children:[l.jsx("p",{className:"ob-bubble-text",children:L}),l.jsx("p",{className:"ob-bubble-subtle",children:P})]}),l.jsxs("div",{className:"ob-card ob-reveal",children:[A,d&&Qo.has(g)&&l.jsx("div",{className:"ob-error",style:{marginTop:12},children:w.retry}),l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-next primary",onClick:j,disabled:c,"data-testid":"claude-gate-recheck",children:c?"Checking…":"I've signed in — check again →"})}),g==="subscribe"&&l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-skip",onClick:()=>r==null?void 0:r(),"data-testid":"claude-gate-haveplan",children:"I already have a plan — continue"})}),l.jsx("div",{className:"ob-actions",children:l.jsx("button",{className:"ob-skip",onClick:()=>i==null?void 0:i(),"data-testid":"claude-gate-dismiss",children:"Not now"})})]})]})]})})})}function d4(e=typeof window<"u"?window.location:null){const t=String((e==null?void 0:e.hostname)||"");if(t.endsWith(".venturewild.llc")){const n=t.split(".")[0];if(n)return`This is ${n.charAt(0).toUpperCase()+n.slice(1)}'s workspace on VentureWild.`}return"Welcome to VentureWild."}const f4={gridTemplateRows:"1fr"},p4={display:"grid",placeItems:"center",minHeight:"100vh",padding:24,textAlign:"center"},m4={maxWidth:440,padding:32,display:"grid",gap:16,justifyItems:"center",textAlign:"center"},g4={margin:0,fontSize:"var(--fs-h2)",fontWeight:700,color:"var(--text)"},y4={margin:0,color:"var(--text-muted)",fontSize:"var(--fs-body)",lineHeight:1.5},v4={margin:0,color:"var(--text-muted)",fontSize:"var(--fs-sm)"},_4={fontSize:36,letterSpacing:"0.16em",fontWeight:700,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:"var(--accent, #22d3ee)"};function b4(e){return e&&e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e}function Zh(e=typeof window<"u"?window.location:null){if(!e)return null;const t=String(e.hostname||"");if(!t.endsWith(".venturewild.llc"))return null;const n=t.split(".")[0];return n?`https://sync.venturewild.llc/auth/google/start?slug=${encodeURIComponent(n)}`:null}const w4={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,width:"100%",padding:"13px 18px",borderRadius:"var(--r-lg)",background:"#fff",color:"#1f2937",fontSize:"var(--fs-body)",fontWeight:600,textDecoration:"none",border:"1px solid #dadce0",boxShadow:"0 1px 2px rgba(0,0,0,0.08)"};function x4(){const[e,t]=b.useState("starting"),[n,r]=b.useState(null),[i,s]=b.useState(null),[o,a]=b.useState(0),[c,u]=b.useState(0),d=b.useRef({requestId:null,pollAfterMs:2500}),h=b.useCallback(async()=>{t("starting"),r(null);try{const f=await fetch("/api/auth/pair/start",{method:"POST",headers:{"content-type":"application/json"},body:"{}"});if(f.status===429){t("error"),r("Too many sign-in attempts right now. Wait a minute, then try again.");return}if(!f.ok){t("error"),r("Could not start sign-in. Please try again.");return}const p=await f.json();d.current={requestId:p.requestId,pollAfterMs:p.pollAfterMs||2500},s(p.code),a(p.expiresAt||0),t("waiting")}catch{t("error"),r("Network error. Check your connection and try again.")}},[]);return b.useEffect(()=>{h()},[h]),b.useEffect(()=>{if(e!=="waiting")return;let f=!1,p=null;const{requestId:m,pollAfterMs:g}=d.current;async function w(){try{const v=await fetch("/api/auth/pair/status",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({requestId:m})});if(f)return;const _=await v.json().catch(()=>({}));if(_.status==="approved"&&_.token){if((await fetch("/api/auth/exchange",{method:"POST",headers:{Authorization:`Bearer ${_.token}`}})).ok){window.location.reload();return}t("error"),r("Almost there — sign-in completed but the session could not be saved. Try again.");return}if(_.status==="denied"){t("error"),r("This device was denied.");return}if(_.status==="expired"){t("error"),r("The code expired before it was approved.");return}p=setTimeout(w,g)}catch{f||(p=setTimeout(w,g))}}return p=setTimeout(w,g),()=>{f=!0,clearTimeout(p)}},[e]),b.useEffect(()=>{if(e!=="waiting"||!o)return;const f=()=>u(Math.max(0,Math.round((o-Date.now())/1e3)));f();const p=setInterval(f,1e3);return()=>clearInterval(p)},[e,o]),l.jsx("div",{className:"app fd-wallpaper",style:f4,children:l.jsx("div",{style:p4,children:l.jsxs("div",{className:"fd-card",style:m4,children:[l.jsxs("span",{className:"fd-brand",children:[l.jsx("span",{className:"fd-brand-mark",children:"✦"})," VentureWild"]}),l.jsx("h2",{style:g4,children:"Sign in to look around"}),l.jsx("p",{style:y4,children:d4()}),Zh()&&l.jsxs("a",{href:Zh(),style:w4,"data-testid":"google-signin",children:[l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[l.jsx("path",{fill:"#4285F4",d:"M17.64 9.2c0-.64-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.92c1.71-1.57 2.68-3.89 2.68-6.62z"}),l.jsx("path",{fill:"#34A853",d:"M9 18c2.43 0 4.47-.8 5.96-2.18l-2.92-2.26c-.81.54-1.84.86-3.04.86-2.34 0-4.32-1.58-5.03-3.7H.96v2.33A9 9 0 0 0 9 18z"}),l.jsx("path",{fill:"#FBBC05",d:"M3.97 10.72A5.41 5.41 0 0 1 3.68 9c0-.6.1-1.18.29-1.72V4.95H.96A9 9 0 0 0 0 9c0 1.45.35 2.82.96 4.05l3.01-2.33z"}),l.jsx("path",{fill:"#EA4335",d:"M9 3.58c1.32 0 2.5.45 3.44 1.35l2.58-2.59C13.46.89 11.43 0 9 0A9 9 0 0 0 .96 4.95l3.01 2.33C4.68 5.16 6.66 3.58 9 3.58z"})]}),"Continue with Google"]}),Zh()&&l.jsx("p",{style:v4,children:"or approve from another device you’re signed in on:"}),e==="starting"&&l.jsxs("p",{style:{color:"var(--text-muted)"},children:[l.jsx("span",{className:"spinner"})," Preparing…"]}),e==="waiting"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{color:"var(--text-muted)",margin:0},children:"On a device where you’re already signed in, open this workspace and approve this code:"}),l.jsx("div",{style:_4,"data-testid":"pair-code",children:b4(i)}),l.jsxs("p",{style:{color:"var(--text-muted)",fontSize:13,margin:0},children:["Waiting for approval",c?` · expires in ${c}s`:"","…"]})]}),e==="error"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{style:{color:"var(--error)"},children:n}),l.jsx("button",{onClick:h,children:"Try again"})]})]})})})}const S4={position:"fixed",top:12,left:"50%",transform:"translateX(-50%)",zIndex:1e3,background:"var(--surface, #1e293b)",border:"1px solid var(--accent, #22d3ee)",borderRadius:10,padding:"12px 16px",boxShadow:"0 8px 24px rgba(0,0,0,0.35)",display:"grid",gap:10,maxWidth:460},k4={display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},C4={fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:"0.12em",fontWeight:700,color:"var(--accent, #22d3ee)"};function E4(e){return e&&e.length===6?`${e.slice(0,3)} ${e.slice(3)}`:e}function N4({token:e}){const[t,n]=b.useState([]),[r,i]=b.useState(null),[s,o]=b.useState(null),a=b.useRef(!0),c=b.useCallback((h={})=>e?{Authorization:`Bearer ${e}`,...h}:h,[e]),u=b.useCallback(async()=>{try{const h=await fetch("/api/auth/pair/requests",{headers:c()});if(!h.ok)return;const f=await h.json();a.current&&n(Array.isArray(f.requests)?f.requests:[])}catch{}},[c]);b.useEffect(()=>{a.current=!0,u();const h=setInterval(u,5e3);return()=>{a.current=!1,clearInterval(h)}},[u]);async function d(h,f,p){if(!r){i(h),o(null);try{const m=await fetch(`/api/auth/pair/${f}`,{method:"POST",headers:c({"content-type":"application/json"}),body:JSON.stringify({requestId:h})});m.ok&&f==="approve"?o({ok:!0,text:`Approved ${p}.`}):m.ok||o({ok:!1,text:"That request is no longer waiting."})}catch{o({ok:!1,text:"Network error."})}finally{i(null),u()}}}return t.length===0?null:l.jsxs("div",{style:S4,"data-testid":"pair-approvals",children:[l.jsx("strong",{style:{fontSize:13},children:t.length===1?"A device wants to sign in":`${t.length} devices want to sign in`}),l.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Check that the code matches the one on that device, then approve."}),t.map(h=>l.jsxs("div",{style:k4,children:[l.jsx("span",{style:{fontSize:13},children:h.label}),l.jsx("span",{style:C4,"data-testid":"pair-request-code",children:E4(h.code)}),l.jsx("span",{className:"spacer",style:{flex:1}}),l.jsx("button",{onClick:()=>d(h.requestId,"approve",h.label),disabled:r===h.requestId,"data-testid":"pair-approve-btn",children:r===h.requestId?"Approving…":"Approve"}),l.jsx("button",{onClick:()=>d(h.requestId,"deny",h.label),disabled:r===h.requestId,style:{background:"transparent",color:"var(--text-muted)"},children:"Deny"})]},h.requestId)),s&&l.jsx("span",{style:{fontSize:12,color:s.ok?"var(--accent, #22d3ee)":"var(--error)"},children:s.text})]})}const j4=15e3,R4=2500;function T4(e){const t=Math.round(e/6e4);return t<=0?"expiring":t<60?`${t} min`:`${Math.floor(t/60)}h ${t%60}m`}function P4({token:e}){var y;const[t,n]=b.useState(null),[r,i]=b.useState(!1),[s,o]=b.useState(!1),a=b.useRef(null),c=b.useRef(null),u=b.useCallback(()=>e?{Authorization:`Bearer ${e}`}:{},[e]),d=b.useCallback(async()=>{try{const S=await fetch("/api/support/status",{headers:u()});if(!S.ok)return;n(await S.json())}catch{}},[u]),h=!!((y=t==null?void 0:t.operate)!=null&&y.active);b.useEffect(()=>{d();const S=h?R4:j4;return a.current=setInterval(d,S),()=>clearInterval(a.current)},[d,h]),b.useLayoutEffect(()=>{const S=()=>{const E=c.current?c.current.offsetHeight:0;document.documentElement.style.setProperty("--support-banner-h",`${E}px`)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)}),b.useEffect(()=>()=>document.documentElement.style.setProperty("--support-banner-h","0px"),[]);const f=b.useCallback(async()=>{i(!0);try{await fetch("/api/support/revoke",{method:"POST",headers:u()})}catch{}i(!1),d()},[u,d]),p=b.useCallback(async()=>{o(!0);try{await fetch("/api/support/operate/cancel",{method:"POST",headers:u()})}catch{}o(!1),d()},[u,d]);if(!t)return null;const m=t.operate||null;if(!t.enabled&&!t.active&&!m)return null;if(m){const S=(m.lines||[]).slice(-6);return l.jsxs("div",{ref:c,role:"status","aria-live":"polite",style:G_(!0),children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,width:"100%"},children:[l.jsx("span",{"aria-hidden":"true",children:"⚙️"}),l.jsx("span",{style:{fontWeight:600},children:m.active?"VentureWild support is operating your agent":"VentureWild support finished helping"}),m.active&&l.jsx("button",{type:"button",onClick:p,disabled:s,style:Qh,children:s?"Stopping…":"Stop"}),l.jsx("button",{type:"button",onClick:f,disabled:r,style:{...Qh,marginLeft:m.active?0:"auto"},children:r?"Revoking…":"Revoke access"})]}),S.length>0&&l.jsx("div",{"data-testid":"operate-transcript",style:{width:"100%",marginTop:4,maxHeight:96,overflowY:"auto",font:"12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace",opacity:.92,whiteSpace:"pre-wrap"},children:S.map((E,k)=>l.jsx("div",{children:E.text},`${E.ts}-${k}`))})]})}const w=t.active,v=w?"VentureWild support is connected":`Support access allowed (tier ${t.tier})`,_=w?t.lastAction?`last action: ${t.lastAction.action}`:"a support session is live":`auto-expires in ${T4(t.remainingMs)}`;return l.jsxs("div",{ref:c,role:"status","aria-live":"polite",style:G_(w),children:[l.jsx("span",{"aria-hidden":"true",children:w?"🟢":"🛟"}),l.jsx("span",{style:{fontWeight:600},children:v}),l.jsxs("span",{style:{opacity:.8},children:["· ",_]}),l.jsx("button",{type:"button",onClick:f,disabled:r,style:{...Qh,marginLeft:"auto"},children:r?"Revoking…":"Revoke"})]})}function G_(e){return{position:"fixed",top:0,left:0,right:0,zIndex:9999,display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"6px 14px",background:e?"var(--accent, #0891b2)":"var(--surface-2, #f4f4f5)",color:e?"var(--accent-ink, #fff)":"var(--text, #222)",borderBottom:"1px solid var(--border, #e4e4e7)",boxShadow:"0 1px 6px rgba(0,0,0,0.12)",font:"13px/1.4 -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"}}const Qh={padding:"3px 12px",borderRadius:6,border:"1px solid currentColor",background:"transparent",color:"inherit",cursor:"pointer",fontWeight:600},D4={partner:"Partner",viewer:"Viewer",client:"Client"},As=12,Vi=[{id:"chat-1",type:"chat"}],L4={lg:[{i:"chat-1",x:0,y:0,w:12,h:As,minW:3,minH:4}]},A4={chat:{w:5,h:12},liveview:{w:4,h:12},notes:{w:3,h:6},earnings:{w:3,h:5},analytics:{w:4,h:7},usage:{w:3,h:6},powers:{w:3,h:7},files:{w:3,h:12},code:{w:5,h:12},todo:{w:3,h:7},logs:{w:4,h:8},tasks:{w:4,h:7},datatable:{w:6,h:8},deploy:{w:4,h:7},peers:{w:3,h:6}},I4=[{type:"liveview",title:"Live view",icon:"👁️",desc:"See what your agent builds, live."},{type:"files",title:"Files",icon:"📁",desc:"Browse your workspace files.",cap:"fileTree"},{type:"code",title:"Code",icon:"💻",desc:"View a file, with highlighting.",cap:"fileTree"},{type:"notes",title:"Notes",icon:"📝",desc:"A place to jot anything."},{type:"todo",title:"To-do",icon:"✅",desc:"A simple checklist."},{type:"logs",title:"Logs",icon:"📋",desc:"Tail your workspace logs, live.",cap:"fileTree"},{type:"tasks",title:"Tasks",icon:"🌀",desc:"Watch your agent's background jobs, live.",cap:"fileTree"},{type:"datatable",title:"Data table",icon:"🗂️",desc:"View a CSV or JSON file as a sortable table.",cap:"fileTree"},{type:"deploy",title:"Deploy",icon:"🚀",desc:"Put your build online (agent-driven)."},{type:"usage",title:"Usage",icon:"🔋",desc:"Your plan usage + working memory, live."},{type:"powers",title:"Powers",icon:"🧰",desc:"Your skills — one tap to run."},{type:"peers",title:"Builders like you",icon:"🌱",desc:"Real things real people built here."},{type:"sessions",title:"Chats",icon:"💬",desc:"All your chat sessions — jump between them.",cap:"chat"},{type:"requests",title:"Requests",icon:"🎫",desc:"Feature requests & bugs — you or your agent.",cap:"chatWrite"},{type:"chat",title:"Another chat",icon:"🗨️",desc:"A second, independent conversation."}],M4=[{type:"earnings",title:"Producer earnings",icon:"💸",desc:"Watch represented earnings tick in, live."},{type:"analytics",title:"Shelf analytics",icon:"📊",desc:"Who's earning across the marketplace."}],O4=[{id:"just-chat",name:"Just chat",icon:"💬",desc:"Only the conversation — clean and focused.",blocks:[{type:"chat",l:{x:0,y:0,w:12,h:12,minW:3,minH:4}}]},{id:"build",name:"Build",icon:"🔨",desc:"Chat, a live view, and your powers.",blocks:[{type:"chat",l:{x:0,y:0,w:6,h:12,minW:3,minH:4}},{type:"liveview",l:{x:6,y:0,w:6,h:8,minW:3,minH:3}},{type:"powers",l:{x:6,y:8,w:6,h:4,minW:3,minH:3}}]},{id:"producer",name:"Producer",icon:"💸",desc:"Chat + your earnings, usage, and the shelf.",blocks:[{type:"chat",l:{x:0,y:0,w:6,h:12,minW:3,minH:4}},{type:"earnings",l:{x:6,y:0,w:6,h:4,minW:3,minH:3}},{type:"usage",l:{x:6,y:4,w:6,h:4,minW:3,minH:3}},{type:"analytics",l:{x:6,y:8,w:6,h:4,minW:3,minH:3}}]},{id:"workspace",name:"Workspace",icon:"📝",desc:"Chat, a live view, your usage, and notes.",blocks:[{type:"chat",l:{x:0,y:0,w:6,h:12,minW:3,minH:4}},{type:"liveview",l:{x:6,y:0,w:6,h:6,minW:3,minH:3}},{type:"usage",l:{x:6,y:6,w:6,h:3,minW:3,minH:3}},{type:"notes",l:{x:6,y:9,w:6,h:3,minW:3,minH:3}}]},{id:"code",name:"Code",icon:"💻",desc:"Chat with a file browser and a code view.",cap:"fileTree",blocks:[{type:"chat",l:{x:0,y:0,w:4,h:12,minW:3,minH:4}},{type:"files",l:{x:4,y:0,w:3,h:12,minW:2,minH:4}},{type:"code",l:{x:7,y:0,w:5,h:12,minW:3,minH:4}}]}];let X_=0;function Fo(e){return X_+=1,`${e}-${Date.now().toString(36)}-${X_}`}function z4(e=640){const[t,n]=b.useState(()=>typeof window<"u"&&window.innerWidth<=e);return b.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(`(max-width: ${e}px)`),i=()=>n(r.matches);return i(),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[e]),t}function B4(){var Vm,qm,Km,Ym,Gm,Xm,Jm;const[e,t]=b.useState(null),[n,r]=b.useState(null),[i,s]=b.useState(!1),[o,a]=b.useState(null),[c,u]=b.useState(()=>!da()),[d,h]=b.useState(()=>da()),[f,p]=b.useState(!1),[m,g]=b.useState(!1),[w,v]=b.useState(!1),[_,y]=b.useState(null),[S,E]=b.useState(!1),[k,T]=b.useState(!1),[R,O]=b.useState(!1);b.useEffect(()=>{if(!R)return;const z=K=>{var se,de;(de=(se=K.target)==null?void 0:se.closest)!=null&&de.call(se,".topbar-more")||O(!1)},J=K=>{K.key==="Escape"&&O(!1)};return document.addEventListener("pointerdown",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("pointerdown",z),document.removeEventListener("keydown",J)}},[R]);const[j,$]=b.useState({}),[L,P]=b.useState(null),[A,D]=b.useState(null),[M,W]=b.useState(null),[N,H]=b.useState(()=>{try{return!window.matchMedia("(max-width: 640px)").matches}catch{return!0}}),[C,re]=b.useState(0),[Q,x]=b.useState(null),[Y,Z]=b.useState("idle"),[oe,me]=b.useState(!1),[Ee,U]=b.useState(null),[ye,we]=b.useState(!1),[Se,fe]=b.useState(null),[it,qe]=b.useState("use"),[Oe,I]=b.useState(!1),[ie,le]=b.useState(!1),[ge,He]=b.useState(!1),[Pe,Ve]=b.useState(!1),[Ze,ut]=b.useState(!1),[F,G]=b.useState(()=>typeof window<"u"?BM():{font:"system",size:"m",spacing:"cozy"}),[ue,ke]=b.useState(()=>typeof window<"u"?DM():{mode:"light",accent:"#0891b2",hot:"#0e7490",accentManual:!1}),[X,De]=b.useState(null),[st,Re]=b.useState(()=>{try{const z=JSON.parse(localStorage.getItem("wild:templates")||"[]");return Array.isArray(z)?z:[]}catch{return[]}}),[Qe,vt]=b.useState(Vi),[ht,Ke]=b.useState(L4),[_t,ni]=b.useState(!1),[Gn,Mn]=b.useState("chat-1"),Ae=z4(),te=b.useMemo(()=>typeof window>"u"?null:new URLSearchParams(window.location.search).get("t"),[]),[dt,et]=gO(te,d);b.useEffect(()=>{async function z(){try{const J={};te&&(J.Authorization=`Bearer ${te}`);const K=await fetch("/api/session",{headers:J});if(K.status===401){s(!0);return}if(!K.ok)throw new Error(`session fetch failed: ${K.status}`);const se=await K.json();t(se)}catch(J){r(J.message||String(J))}}z()},[te,d]);const tt=b.useRef({ws:null,dismissed:!1});b.useEffect(()=>{var K,se,de;const z=((K=e==null?void 0:e.currentWorkspace)==null?void 0:K.id)??d??null;if(c||!(e!=null&&e.onboarded)||!((se=e.capabilities)!=null&&se.chatWrite)||((de=e.agent)==null?void 0:de.id)!=="claude"||(tt.current.ws!==z&&(tt.current={ws:z,dismissed:!1}),o||tt.current.dismissed))return;let J=!0;return(async()=>{try{const Fe={};te&&(Fe.Authorization=`Bearer ${te}`);const Ne=await fetch("/api/agent/readiness",{headers:Fe});if(!Ne.ok||!J)return;const rt=await Ne.json();J&&(rt.status==="login"||rt.status==="missing")&&a(rt)}catch{}})(),()=>{J=!1}},[e,c,d,te,o]),b.useEffect(()=>{AM(ue),LM(ue)},[ue]),b.useEffect(()=>{FM(F),$M(F)},[F]),b.useEffect(()=>{var J;const z=(J=e==null?void 0:e.identity)==null?void 0:J.color;z&&!ue.accentManual&&ke(K=>K.accentManual?K:{...K,accent:z,hot:z})},[(Vm=e==null?void 0:e.identity)==null?void 0:Vm.color,ue.accentManual]);const lt=e!=null&&e.workspaceId?`wild:canvas:v2:${e.workspaceId}:${e.personKey||"local"}`:null,kt=b.useRef(null);function bt(z){clearTimeout(kt.current),kt.current=setTimeout(()=>{const J={"Content-Type":"application/json"};te&&(J.Authorization=`Bearer ${te}`),fetch("/api/canvas/state",{method:"POST",headers:J,body:JSON.stringify(z)}).catch(()=>{})},800)}b.useEffect(()=>{if(!lt||_t)return;let z=!1;const J=te?{Authorization:`Bearer ${te}`}:{};return(async()=>{var K,se,de,Fe,Ne,rt,_r,Fi;try{const Xn=await fetch("/api/canvas/state",{headers:J});if(!Xn.ok)throw new Error(Xn.status);const Nt=await Xn.json();if(z)return;let vn=null;try{vn=JSON.parse(localStorage.getItem(lt))}catch{}if((se=(K=Nt.layout)==null?void 0:K.blocks)!=null&&se.length||(Ne=(Fe=(de=Nt.layout)==null?void 0:de.layouts)==null?void 0:Fe.lg)!=null&&Ne.length){let Wt=Array.isArray(Nt.layout.blocks)&&Nt.layout.blocks.length?Nt.layout.blocks:Vi;Wt.some(oi=>oi.type==="chat")||(Wt=[...Vi,...Wt]),vt(Wt),(rt=Nt.layout.layouts)!=null&&rt.lg&&Ke(Nt.layout.layouts);try{localStorage.setItem(lt,JSON.stringify({blocks:Wt,layouts:Nt.layout.layouts}))}catch{}}else if((_r=vn==null?void 0:vn.blocks)!=null&&_r.length){let Wt=Array.isArray(vn.blocks)&&vn.blocks.length?vn.blocks:Vi;Wt.some(oi=>oi.type==="chat")||(Wt=[...Vi,...Wt]),vt(Wt),(Fi=vn.layouts)!=null&&Fi.lg&&Ke(vn.layouts),bt({layout:{blocks:Wt,layouts:vn.layouts||{lg:[]}}})}if(Array.isArray(Nt.templates)&&Nt.templates.length){Re(Nt.templates);try{localStorage.setItem("wild:templates",JSON.stringify(Nt.templates))}catch{}}if(Nt.userTheme){const Wt=Nt.userTheme;ke(oi=>({...oi,mode:Wt.mode==="dark"?"dark":"light",accent:Wt.accent||oi.accent,hot:Wt.hot||oi.hot,accentManual:Wt.accentManual??oi.accentManual,tokens:Wt.tokens||{}}))}Nt.userReading&&G(Ru(Nt.userReading))}catch{if(z)return;try{const Xn=localStorage.getItem(lt);if(Xn){const Nt=JSON.parse(Xn);let vn=Array.isArray(Nt.blocks)&&Nt.blocks.length?Nt.blocks:Vi;vn.some(Wt=>Wt.type==="chat")||(vn=[...Vi,...vn]),vt(vn),Nt.layouts&&Nt.layouts.lg&&Ke(Nt.layouts)}}catch{}}z||ni(!0)})(),()=>{z=!0,clearTimeout(kt.current)}},[lt]),b.useEffect(()=>{if(!(!lt||!_t)){try{localStorage.setItem(lt,JSON.stringify({blocks:Qe,layouts:ht}))}catch{}bt({layout:{blocks:Qe,layouts:ht}})}},[lt,_t,Qe,ht]);const Ht=b.useRef(null);b.useEffect(()=>{if(_t)return clearTimeout(Ht.current),Ht.current=setTimeout(()=>{bt({userTheme:ue})},800),()=>clearTimeout(Ht.current)},[_t,ue]);const ot=b.useRef(null);b.useEffect(()=>{if(_t)return clearTimeout(ot.current),ot.current=setTimeout(()=>{bt({userReading:F})},800),()=>clearTimeout(ot.current)},[_t,F]),b.useEffect(()=>{var K;if(!_t||!((K=e==null?void 0:e.capabilities)!=null&&K.chat))return;let z=!1;const J=te?{Authorization:`Bearer ${te}`}:{};return fetch("/api/canvas/blocks",{headers:J}).then(se=>se.ok?se.json():null).then(se=>{z||!Array.isArray(se==null?void 0:se.blocks)||!se.blocks.length||(vt(de=>{const Fe=new Set(de.map(rt=>rt.id)),Ne=se.blocks.filter(rt=>rt.id&&!Fe.has(rt.id));return Ne.length?[...de,...Ne.map(rt=>({id:rt.id,type:"custom",spec:rt}))]:de}),Ke(de=>{const Fe=de.lg||[],Ne=new Set(Fe.map(_r=>_r.i)),rt=se.blocks.filter(_r=>_r.id&&!Ne.has(_r.id));return rt.length?{lg:[...Fe,...rt.map((_r,Fi)=>({i:_r.id,x:8,y:Fi*6,w:4,h:6,minW:3,minH:3}))]}:de}))}).catch(()=>{}),()=>{z=!0}},[_t,(qm=e==null?void 0:e.capabilities)==null?void 0:qm.chat,te]),b.useEffect(()=>{var K;if(!((K=e==null?void 0:e.capabilities)!=null&&K.chat)||ue.accentManual)return;let z=!1;const J=te?{Authorization:`Bearer ${te}`}:{};return fetch("/api/canvas/theme",{headers:J}).then(se=>se.ok?se.json():null).then(se=>{z||!(se!=null&&se.theme)||ke(de=>de.accentManual?de:{...de,mode:se.theme.mode==="dark"?"dark":"light",accent:se.theme.accent||de.accent,hot:se.theme.hot||se.theme.accent||de.hot,tokens:se.theme.tokens||{}})}).catch(()=>{}),()=>{z=!0}},[(Km=e==null?void 0:e.capabilities)==null?void 0:Km.chat,te]);function On(z){const J=Fo(z),K=A4[z]||{w:4,h:12};if(vt(se=>[...se,{id:J,type:z}]),Ke(se=>{const de=se.lg||[],Fe=de.reduce((Ne,rt)=>Math.max(Ne,(rt.y||0)+(rt.h||0)),0);return{lg:[...de,{i:J,x:Math.max(0,12-K.w),y:Fe,w:K.w,h:K.h,minW:3,minH:3}]}}),Mn(J),I(!1),typeof window<"u"){const se=de=>{var Fe;return(Fe=document.querySelector(`[data-rgl-id="${J}"]`))==null?void 0:Fe.scrollIntoView({behavior:de,block:"nearest"})};setTimeout(()=>se("smooth"),300),setTimeout(()=>se("auto"),750)}}function Nn(z){const J=Qe.find(K=>K.id===z);if(vt(K=>K.filter(se=>se.id!==z)),Ke(K=>({lg:(K.lg||[]).filter(se=>se.i!==z)})),Mn(K=>{var se;return K===z?((se=Qe.find(de=>de.type==="chat"))==null?void 0:se.id)||"chat-1":K}),(J==null?void 0:J.type)==="custom"){const K=te?{Authorization:`Bearer ${te}`}:{};fetch(`/api/canvas/blocks/${encodeURIComponent(z)}`,{method:"DELETE",headers:K}).catch(()=>{})}}function _e(z){const J=Qe.find(K=>K.id===z);J&&On(J.type)}const Te=b.useRef(Qe);Te.current=Qe;const xe=b.useRef(null),B=b.useRef(null),ce=b.useRef(!1);b.useEffect(()=>{var de;if(!((de=e==null?void 0:e.capabilities)!=null&&de.chat)||Ae)return;let z=!1,J=null;const K=te?{Authorization:`Bearer ${te}`}:{},se=async()=>{var Fi;if(z||ce.current||document.hidden)return;const Fe=await fetch("/api/preview/ports",{headers:K}).catch(()=>null);if(!Fe||z)return;const rt=((await Fe.json().catch(()=>({}))).ports||[]).map(Xn=>Xn.port);if(B.current===null){B.current=new Set(rt);return}rt.some(Xn=>!B.current.has(Xn))&&!Te.current.some(Xn=>Xn.type==="liveview")&&(ce.current=!0,clearInterval(J),(Fi=xe.current)==null||Fi.call(xe))};return se(),J=setInterval(se,5e3),()=>{z=!0,clearInterval(J)}},[(Ym=e==null?void 0:e.capabilities)==null?void 0:Ym.chat,te,Ae]);function he(){if(Qe.some(J=>J.type==="liveview"))return;const z=Fo("liveview");vt(J=>J.some(K=>K.type==="liveview")?J:[...J,{id:z,type:"liveview"}]),Ke(J=>{const K=(J.lg||[]).map(se=>se.i.startsWith("chat")?{...se,w:6,x:0,h:As}:se);return K.push({i:z,x:6,y:0,w:6,h:As,minW:3,minH:4}),{lg:K}})}xe.current=he;function be(z){if(U(z),Qe.some(K=>K.type==="code"))return;const J=Fo("code");vt(K=>K.some(se=>se.type==="code")?K:[...K,{id:J,type:"code"}]),Ke(K=>({lg:[...K.lg||[],{i:J,x:6,y:0,w:6,h:As,minW:3,minH:4}]}))}function ze(z,J){if(z!=null&&z.id&&(vt(K=>{const se=K.findIndex(de=>de.id===z.id);if(se>=0){const de=K.slice();return de[se]={...de[se],type:"custom",spec:z},de}return[...K,{id:z.id,type:"custom",spec:z}]}),Ke(K=>{const se=K.lg||[];return se.some(de=>de.i===z.id)?K:{lg:[...se,{i:z.id,x:8,y:0,w:4,h:6,minW:3,minH:3}]}}),J!=="update"&&(Mn(z.id),typeof window<"u"))){const K=se=>{var de;return(de=document.querySelector(`[data-rgl-id="${z.id}"]`))==null?void 0:de.scrollIntoView({behavior:se,block:"nearest"})};setTimeout(()=>K("smooth"),300),setTimeout(()=>K("auto"),750)}}function Ye(z){!z||typeof z!="object"||ke(J=>{var K;return PM(J,z,J.accentManual||!!((K=e==null?void 0:e.identity)!=null&&K.color))})}const Ge=b.useCallback(async(z=!1)=>{try{const J=te?{Authorization:`Bearer ${te}`}:{},K=await fetch(`/api/update/status${z?"?fresh=1":""}`,{headers:J});if(!K.ok)return null;const se=await K.json();return x(se),se}catch{return null}},[te]);b.useEffect(()=>{var J;if(!((J=e==null?void 0:e.capabilities)!=null&&J.chat))return;Ge();const z=()=>Ge();return window.addEventListener("focus",z),()=>window.removeEventListener("focus",z)},[(Gm=e==null?void 0:e.capabilities)==null?void 0:Gm.chat,Ge]);async function cn(){if(Y==="applying"||!Q)return;const z=Q.current;me(!1),Z("applying");try{const J={"Content-Type":"application/json",...te?{Authorization:`Bearer ${te}`}:{}},K=await fetch("/api/update/apply",{method:"POST",headers:J}).then(de=>de.json()).catch(()=>null);if(K&&K.updated===!1){x(de=>({...de||{},available:!1,current:K.current,latest:K.latest})),Z("uptodate"),setTimeout(()=>Z(de=>de==="uptodate"?"idle":de),4e3);return}if(!K||!K.ok&&!K.requested){Z("error");return}const se=Date.now();for(;Date.now()-se<15e4;){await new Promise(Fe=>setTimeout(Fe,2500));const de=await fetch("/api/health").then(Fe=>Fe.ok?Fe.json():null).catch(()=>null);if(de&&de.version&&de.version!==z){Z("done"),setTimeout(()=>window.location.reload(),800);return}}Z("error")}catch{Z("error")}}async function ft(){me(!1),Z("idle");const z=await Ge(!0);z&&!z.available&&(Z("uptodate"),setTimeout(()=>Z(J=>J==="uptodate"?"idle":J),4e3))}async function nn({title:z,pitch:J}){const K={"content-type":"application/json",...te?{Authorization:`Bearer ${te}`}:{}},se={title:z,pitch:J,theme:{mode:ue.mode,accent:ue.accent,hot:ue.hot,tokens:ue.tokens||{},structure:ue.structure||{}},builtFrom:X?{id:X.id,title:X.title}:null};return(await fetch("/api/bazaar/themes/publish",{method:"POST",headers:K,body:JSON.stringify(se)})).json().catch(()=>({ok:!1,error:"bad-response"}))}function ri(z){const J=z&&z.theme||{};ke(K=>({...K,mode:J.mode==="dark"?"dark":"light",accent:J.accent||K.accent,hot:J.hot||J.accent||K.hot,tokens:J.tokens||{},structure:J.structure||{},accentManual:!0})),De({id:z.id,title:z.title}),He(!0)}function pt(z){var se;const J=[],K=z.blocks.map(de=>{const Fe=Fo(de.type);return J.push({i:Fe,...de.l||{x:0,y:0,w:4,h:As,minW:3,minH:3}}),{id:Fe,type:de.type}});if(!K.some(de=>de.type==="chat")){const de=Fo("chat");K.unshift({id:de,type:"chat"}),J.unshift({i:de,x:0,y:0,w:8,h:As,minW:3,minH:4})}vt(K),Ke({lg:J}),Mn(((se=K[0])==null?void 0:se.id)||"chat-1"),le(!1),typeof window<"u"&&setTimeout(()=>{var de;return(de=document.querySelector(".block-canvas"))==null?void 0:de.scrollTo({top:0,behavior:"smooth"})},60)}function ws(z){try{localStorage.setItem("wild:templates",JSON.stringify(z))}catch{}return bt({templates:z}),z}function xs(z){const J=ht.lg||[],K=Qe.map(de=>{const Fe=J.find(Ne=>Ne.i===de.id);return{type:de.type,l:Fe?{x:Fe.x,y:Fe.y,w:Fe.w,h:Fe.h,minW:Fe.minW??3,minH:Fe.minH??4}:{x:0,y:0,w:4,h:10,minW:3,minH:4}}}),se={id:`saved-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,name:z,icon:"⭐",desc:"Your saved layout",blocks:K,custom:!0};Re(de=>ws([...de,se]))}function Ss(z){Re(J=>ws(J.filter(K=>K.id!==z)))}if(i)return l.jsx(x4,{});if(n)return l.jsx("div",{className:"app",style:{gridTemplateRows:"1fr",alignItems:"center",justifyItems:"center"},children:l.jsxs("div",{style:{padding:24},children:[l.jsx("h2",{children:"wild-workspace"}),l.jsxs("p",{style:{color:"var(--error)"},children:["Could not load session: ",n]}),l.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:"Verify the server is running and the share URL token is valid."})]})});if(!e)return l.jsx("div",{className:"app",style:{gridTemplateRows:"1fr",alignItems:"center",justifyItems:"center"},children:l.jsxs("div",{style:{padding:24,color:"var(--text-muted)"},children:[l.jsx("span",{className:"spinner"})," Loading workspace…"]})});if((Xm=e.capabilities)!=null&&Xm.chatWrite&&!e.onboarded)return l.jsx(u4,{session:e,token:te,onComplete:async z=>{z!=null&&z.seedChat&&mL(z.seedChat,void 0,xh(e.currentWorkspace));try{const J={};te&&(J.Authorization=`Bearer ${te}`);const K=await fetch("/api/session",{headers:J});K.ok?t(await K.json()):t({...e,onboarded:!0})}catch{t({...e,onboarded:!0})}z!=null&&z.build&&fe({text:z.build,ts:Date.now()})}});if(c)return l.jsx(sA,{session:e,onEnter:z=>{z!==d&&(gL(z),h(z),U(null),fe(null),$({})),u(!1)},onClose:da()?()=>u(!1):null});if(o)return l.jsx(h4,{token:te,session:e,verdict:o,onResolved:()=>{tt.current.dismissed=!1,a(null),(async()=>{try{const z={};te&&(z.Authorization=`Bearer ${te}`);const J=await fetch("/api/session",{headers:z});J.ok&&t(await J.json())}catch{}})()},onDismiss:()=>{tt.current.dismissed=!0,a(null)}});const{role:ii,capabilities:nt,workspace:si,workspaceId:xo,agent:ks,identity:Or}=e,Hm=(Or==null?void 0:Or.name)||(ks==null?void 0:ks.label)||"Chat",So=e.currentWorkspace||{},Au=(d?So.id===d:!!So.isDefault)?So:{id:d,isDefault:!d},Cs=Au.id||"default";xh(Au);const $i=(Jm=Qe.find(z=>z.type==="chat"))==null?void 0:Jm.id;function Wm(z){var J,K;switch(z.type){case"chat":return{title:Hm,icon:"🗨️"};case"liveview":return{title:"Live view",icon:"👁️"};case"notes":return{title:"Notes",icon:"📝"};case"usage":return{title:"Usage",icon:"🔋"};case"powers":return{title:"Powers",icon:"🧰"};case"earnings":return{title:"Producer earnings",icon:"💸"};case"analytics":return{title:"Shelf analytics",icon:"📊"};case"files":return{title:"Files",icon:"📁"};case"code":return{title:"Code",icon:"💻"};case"todo":return{title:"To-do",icon:"✅"};case"logs":return{title:"Logs",icon:"📋"};case"tasks":return{title:"Tasks",icon:"🌀"};case"sessions":return{title:"Chats",icon:"💬"};case"requests":return{title:"Requests",icon:"🎫"};case"datatable":return{title:"Data table",icon:"🗂️"};case"deploy":return{title:"Deploy",icon:"🚀"};case"peers":return{title:"Builders like you",icon:"🌱"};case"custom":return{title:((J=z.spec)==null?void 0:J.title)||"Block",icon:((K=z.spec)==null?void 0:K.icon)||"🧩"};default:return{title:z.type,icon:"▫️"}}}function Um(z){var J;switch(z.type){case"chat":{const K=z.id===$i,se=j[z.id]||(K?"main":z.id),de=se==="main"?void 0:se,Fe=xh(Au,de);return l.jsxs(l.Fragment,{children:[nt.chatWrite&&l.jsx("div",{className:"chat-block-bar",children:l.jsx(PL,{workspaceKey:Cs,activeSessionId:se,canWrite:nt.chatWrite,onSelect:Ne=>$(rt=>({...rt,[z.id]:Ne}))})}),K&&nt.inbox&&l.jsx(X3,{}),l.jsx(_L,{storageKey:Fe,threadId:de,sessionId:se,role:ii,capabilities:nt,token:te,inject:K?Se:void 0,onInjectConsumed:K?()=>fe(null):void 0,agentName:Hm,onOpenReading:()=>ut(!0),contextPct:K?((J=M==null?void 0:M.context)==null?void 0:J.pct)??0:0,onBazaarEvent:Ne=>{(Ne==null?void 0:Ne.type)==="preview"?(P({url:Ne.url,ts:Ne.ts}),he()):(Ne==null?void 0:Ne.type)==="meter"?D(Ne.state):(Ne==null?void 0:Ne.type)==="usage"?(W(Ne.state),re(rt=>rt+1)):(Ne==null?void 0:Ne.type)==="block"?ze(Ne.block,Ne.op):(Ne==null?void 0:Ne.type)==="theme"?Ye(Ne.theme):(Ne==null?void 0:Ne.type)==="task"&&et(Ne.task)}},`chat-${Cs}-${se}`)]})}case"liveview":return l.jsx(KM,{bazaarPreview:L});case"notes":return l.jsx(YM,{id:z.id});case"usage":return l.jsx(QM,{live:M,token:te});case"powers":return l.jsx(tO,{token:te,onRun:K=>fe({text:`/${K}`,ts:Date.now()})});case"earnings":return l.jsx(JM,{live:A,token:te});case"analytics":return l.jsx(nO,{live:A,token:te});case"files":return l.jsx(rO,{token:te,selectedFile:Ee,onOpenFile:be},`files-${Cs}`);case"code":return l.jsx(oO,{path:Ee,token:te,onPickFile:U},`code-${Cs}`);case"todo":return l.jsx(aO,{id:z.id});case"logs":return l.jsx(uO,{token:te});case"tasks":return l.jsx(hO,{tasks:dt,token:te});case"sessions":return l.jsx(OL,{workspaceKey:Cs,token:te,canWrite:nt.chatWrite,refreshKey:C,activeSessionId:j[$i]||"main",onSelect:K=>$(se=>({...se,[$i]:K}))});case"requests":return l.jsx(FL,{token:te,canWrite:nt.chatWrite});case"datatable":return l.jsx(_O,{token:te});case"deploy":return l.jsx(bO,{canDeploy:nt.chatWrite,onSetup:()=>fe({text:"Help me deploy this project — set up a deploy target and ship it.",ts:Date.now()})});case"peers":return l.jsx(bu,{variant:"block"});case"custom":return l.jsx(A3,{spec:z.spec});default:return null}}return l.jsxs("div",{className:"app",children:[l.jsx(P4,{token:te}),nt.chatWrite&&l.jsx(eO,{info:Q,phase:Y,dismissed:oe,onApply:cn,onDismiss:()=>me(!0)}),nt.share&&l.jsx(N4,{token:te}),l.jsxs("header",{className:"topbar","data-testid":"topbar",children:[l.jsx("span",{className:"brand",children:"wild-workspace"}),l.jsx("span",{className:`badge ${ii}`,"data-testid":"role-badge",children:D4[ii]||ii}),l.jsxs("button",{className:"badge","data-testid":"workspace-switcher",onClick:()=>u(!0),title:"Switch workspace",style:{cursor:"pointer"},children:[So.name||(si==null?void 0:si.name)||xo," ▾"]}),nt.chat&&l.jsx("button",{className:`badge sidebar-toggle${N?" active":""}`,onClick:()=>H(z=>!z),"data-testid":"sidebar-toggle",title:N?"Hide chats":"Show chats","aria-pressed":N,children:"💬 Chats"}),Or!=null&&Or.name?l.jsx("span",{className:"badge","data-testid":"agent-name",style:{borderColor:Or.color,color:Or.color},children:Or.name}):ks&&l.jsx("span",{className:"badge","data-testid":"agent-name",children:ks.label||ks.id}),l.jsx("span",{className:"spacer"}),nt.fileTree&&l.jsx(fO,{tasks:dt,token:te}),l.jsx("button",{onClick:()=>He(!0),"data-testid":"theme-btn",title:"Theme — make it yours (light/dark + accent)",children:"🎨 Theme"}),nt.chatWrite&&l.jsx("button",{onClick:()=>le(!0),"data-testid":"templates-btn",title:"Start from a template layout",children:"▾ Templates"}),nt.chatWrite&&l.jsx("button",{className:it==="layout"?"primary":"",onClick:()=>qe(z=>z==="layout"?"use":"layout"),"data-testid":"arrange-toggle",title:"Rearrange your blocks",children:it==="layout"?"✓ Done":"✥ Arrange"}),nt.chat&&l.jsx("button",{onClick:()=>we(!0),"data-testid":"bazaar-btn",title:"Browse the marketplace shelf",children:"🛍️ Bazaar"}),(()=>{const z=nt.chatWrite&&l.jsx("button",{onClick:()=>Ve(!0),"data-testid":"settings-btn",title:"Settings — agent autonomy, name, appearance",children:"⚙️ Settings"},"settings"),J=nt.chatWrite&&l.jsx("button",{onClick:()=>v(!0),"data-testid":"support-btn",title:"VentureWild support — let our team help, on your say-so",children:"🛟 Support"},"support"),K=nt.chatWrite&&l.jsx("button",{onClick:ft,"data-testid":"updates-btn",title:"Check for updates",children:Q!=null&&Q.available?`✨ Update to v${Q.latest}`:`🔄 Check for updates${Q!=null&&Q.current?` (v${Q.current})`:""}`},"updates"),se=nt.sync&&l.jsx("button",{onClick:()=>g(!0),"data-testid":"collaborate-btn",children:"🤝 Collaborate"},"collab"),de=nt.share&&l.jsx("button",{onClick:()=>p(!0),"data-testid":"share-btn",children:"🔗 Share"},"share"),Fe=nt.terminal&&l.jsx("button",{onClick:()=>T(rt=>!rt),"data-testid":"terminal-toggle",children:k?"⌨ Hide terminal":"⌨ Terminal"},"term"),Ne=[z,J,K,se,de,Fe].filter(Boolean);return Ne.length===0?null:l.jsxs("div",{className:"topbar-more","data-testid":"topbar-more",children:[l.jsx("button",{onClick:()=>O(rt=>!rt),"data-testid":"more-toggle","aria-haspopup":"menu","aria-expanded":R,title:"More — settings, sharing, advanced",children:"⋯ More"}),R&&l.jsx("div",{className:"more-menu","data-testid":"more-menu",onClick:()=>O(!1),children:Ne})]})})()]}),l.jsxs("div",{className:`workspace-body${N?" with-sidebar":""}`,"data-testid":"workspace-body",children:[N&&nt.chat&&l.jsx(IL,{workspaceName:So.name||(si==null?void 0:si.name)||xo,workspaceKey:Cs,token:te,canWrite:nt.chatWrite,activeSessionId:j[$i]||"main",onSelect:z=>$(J=>({...J,[$i]:z})),onClose:()=>H(!1),refreshKey:C}),l.jsxs("main",{className:"canvas-wrap","data-testid":"canvas-wrap",children:[it==="layout"&&l.jsxs("div",{className:"arrange-bar","data-testid":"arrange-bar",children:[l.jsx("span",{className:"arrange-hint",children:"✥ Arranging your space — drag a block's header, resize from its corner, or add a new one."}),l.jsx("span",{className:"spacer"}),l.jsx("button",{className:"primary",onClick:()=>I(!0),"data-testid":"add-block-btn",children:"+ Add block"}),l.jsx("button",{onClick:()=>qe("use"),children:"Done"})]}),Ae?l.jsx(_M,{blocks:Qe,activeId:Gn,setActiveId:Mn,mode:it,renderBlock:Um,blockMeta:Wm,onRemove:Nn,canRemove:z=>z.type!=="chat"||z.id!==$i}):l.jsx(vM,{blocks:Qe,layouts:ht,mode:it,onLayoutChange:Ke,renderBlock:Um,blockMeta:Wm,onRemove:Nn,onDuplicate:_e,canRemove:z=>z.type!=="chat"||z.id!==$i,canDuplicate:z=>z.type!=="custom"})]})]}),l.jsx(G3,{role:ii,capabilities:nt,session:e,urlToken:te,onSyncAlert:y,onOpenConflicts:()=>E(!0)}),l.jsx(q3,{alert:_,onDismiss:()=>y(null)}),S&&l.jsx(K3,{urlToken:te,onClose:()=>E(!1)}),Oe&&l.jsx(bM,{items:I4.filter(z=>!z.cap||nt[z.cap]),bazaarItems:M4,onAdd:On,onClose:()=>I(!1)}),ie&&l.jsx(xM,{builtins:O4.filter(z=>!z.cap||nt[z.cap]),saved:st,onApply:pt,onSaveCurrent:xs,onDelete:Ss,onClose:()=>le(!1)}),ge&&l.jsx(UM,{theme:ue,onChange:ke,reading:F,onChangeReading:G,onClose:()=>{He(!1),De(null)},onPublish:nt.chatWrite?nn:void 0,onApplyTheme:Ye,onRemixTheme:nt.chatWrite?ri:void 0,onClearRemix:()=>De(null),remixOf:X,token:te}),Ze&&l.jsx(qM,{reading:F,onChange:G,onClose:()=>ut(!1)}),Pe&&l.jsx(VM,{token:te,session:e,onClose:()=>Ve(!1),onOpenTheme:()=>He(!0),onOpenReading:()=>ut(!0),onClaudeSignedOut:()=>{Ve(!1),tt.current.dismissed=!1,a({status:"login"})}}),w&&l.jsx(V3,{token:te,onClose:()=>v(!1)}),ye&&l.jsx(t4,{token:te,onClose:()=>we(!1),onBuild:z=>{fe({text:z,ts:Date.now()}),we(!1)}}),f&&l.jsx($3,{onClose:()=>p(!1),workspaceId:xo}),m&&l.jsx(F3,{onClose:()=>g(!1),token:te}),k&&l.jsxs("div",{className:"terminal-overlay","data-testid":"terminal-overlay",children:[l.jsxs("header",{children:[l.jsx("strong",{children:"Terminal"}),l.jsx("button",{onClick:()=>T(!1),children:"close"})]}),l.jsx(L3,{token:te})]})]})}function $4(e){const t=window.fetch.bind(window);window.fetch=(n,r={})=>{const i=typeof n=="string"?n:(n==null?void 0:n.url)||"";if(!(i.startsWith("/api/")||i.includes("://")===!1&&i.startsWith("api/")))return t(n,r);const o=new Headers(r.headers||{});return o.has("Authorization")||o.set("Authorization",`Bearer ${e}`),t(n,{...r,headers:o})}}function F4(){const e=window.fetch.bind(window);window.fetch=(t,n={})=>{const r=typeof t=="string"?t:(t==null?void 0:t.url)||"",i=r.startsWith("/api/")||r.includes("://")===!1&&r.startsWith("api/"),s=da();if(!i||!s)return e(t,n);const o=new Headers(n.headers||{});return o.has("X-Workspace-Id")||o.set("X-Workspace-Id",s),e(t,{...n,headers:o})}}function H4(){ed.createRoot(document.getElementById("root")).render(l.jsx(yr.StrictMode,{children:l.jsx(B4,{})}))}async function W4(){const e=typeof window<"u"&&window.fetch,t=e?new URLSearchParams(window.location.search).get("t"):null;if(t){let r=!1;try{const i=await window.fetch("/api/auth/exchange",{method:"POST",headers:{Authorization:`Bearer ${t}`}});r=i.ok&&(await i.json().catch(()=>({}))).cookie===!0}catch{}if(r){const i=new URLSearchParams(window.location.search);i.delete("t");const s=i.toString(),o=window.location.pathname+(s?`?${s}`:"")+window.location.hash;window.history.replaceState(null,"",o)}else $4(t)}F4();const n=e?new URLSearchParams(window.location.search).get("gv"):null;if(n){try{await window.fetch("/api/auth/google",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({vouch:n})})}catch{}const r=new URLSearchParams(window.location.search);r.delete("gv");const i=r.toString(),s=window.location.pathname+(i?`?${i}`:"")+window.location.hash;window.history.replaceState(null,"",s)}H4()}W4();
|