lg-dev-manager-bridge 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +176 -18
  2. package/dist/cli.js +118 -16
  3. package/package.json +6 -4
  4. package/web/assets/{index-DmYG3adw.js → index-CWU_4o5k.js} +23 -23
  5. package/web/assets/{index-CTz5i-Zo.css → index-Cc--HRgL.css} +1 -1
  6. package/web/index.html +2 -2
  7. package/web/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
  8. package/web/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
  9. package/web/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
  10. package/web/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
  11. package/web/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
  12. package/web/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
  13. package/web/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
  14. package/web/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
  15. package/web/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
  16. package/web/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
  17. package/web/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
  18. package/web/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
  19. package/web/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
  20. package/web/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
  21. package/web/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
  22. package/web/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
  23. package/web/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
  24. package/web/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
  25. package/web/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
  26. package/web/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
  27. package/web/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
  28. package/web/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
  29. package/web/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
  30. package/web/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
  31. package/web/assets/inter-tight-cyrillic-500-normal-CRXauZSq.woff +0 -0
  32. package/web/assets/inter-tight-cyrillic-600-normal-BeTasGgk.woff +0 -0
  33. package/web/assets/inter-tight-cyrillic-700-normal-DDZiLR3d.woff +0 -0
  34. package/web/assets/inter-tight-cyrillic-ext-500-normal-Dy1ZB9JY.woff +0 -0
  35. package/web/assets/inter-tight-cyrillic-ext-600-normal-_3ga77Eo.woff +0 -0
  36. package/web/assets/inter-tight-cyrillic-ext-700-normal-BFcoPt71.woff +0 -0
  37. package/web/assets/inter-tight-greek-500-normal-Ca-cFdRH.woff +0 -0
  38. package/web/assets/inter-tight-greek-600-normal-67HAlfW-.woff +0 -0
  39. package/web/assets/inter-tight-greek-700-normal-DU8XoIeX.woff +0 -0
  40. package/web/assets/inter-tight-greek-ext-500-normal-BEGGcu3x.woff +0 -0
  41. package/web/assets/inter-tight-greek-ext-600-normal-5gKW7MDU.woff +0 -0
  42. package/web/assets/inter-tight-greek-ext-700-normal-mW3dmpoD.woff +0 -0
  43. package/web/assets/inter-tight-latin-500-normal-pobXraBK.woff +0 -0
  44. package/web/assets/inter-tight-latin-600-normal-D7bG6gX1.woff +0 -0
  45. package/web/assets/inter-tight-latin-700-normal-DvYAVZQd.woff +0 -0
  46. package/web/assets/inter-tight-latin-ext-500-normal-_hLDZz_3.woff +0 -0
  47. package/web/assets/inter-tight-latin-ext-600-normal-BvYdOF2O.woff +0 -0
  48. package/web/assets/inter-tight-latin-ext-700-normal-CrlzIQ10.woff +0 -0
  49. package/web/assets/inter-tight-vietnamese-500-normal-CO4EMNTO.woff +0 -0
  50. package/web/assets/inter-tight-vietnamese-600-normal-BCXZ1BbA.woff +0 -0
  51. package/web/assets/inter-tight-vietnamese-700-normal-DwHBAXeT.woff +0 -0
  52. package/web/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
  53. package/web/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
  54. package/web/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
  55. package/web/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
  56. package/web/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  57. package/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  58. package/web/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  59. package/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  60. package/web/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  61. package/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  62. package/web/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  63. package/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  64. package/web/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  65. package/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
@@ -1,48 +1,48 @@
1
- (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const _ of d)if(_.type==="childList")for(const w of _.addedNodes)w.tagName==="LINK"&&w.rel==="modulepreload"&&o(w)}).observe(document,{childList:!0,subtree:!0});function l(d){const _={};return d.integrity&&(_.integrity=d.integrity),d.referrerPolicy&&(_.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?_.credentials="include":d.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function o(d){if(d.ep)return;d.ep=!0;const _=l(d);fetch(d.href,_)}})();function la(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var yd={exports:{}},ll={};var V_;function sw(){if(V_)return ll;V_=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function l(o,d,_){var w=null;if(_!==void 0&&(w=""+_),d.key!==void 0&&(w=""+d.key),"key"in d){_={};for(var c in d)c!=="key"&&(_[c]=d[c])}else _=d;return d=_.ref,{$$typeof:s,type:o,key:w,ref:d!==void 0?d:null,props:_}}return ll.Fragment=n,ll.jsx=l,ll.jsxs=l,ll}var q_;function iw(){return q_||(q_=1,yd.exports=sw()),yd.exports}var r=iw(),bd={exports:{}},Me={};var K_;function nw(){if(K_)return Me;K_=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),w=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),C=Symbol.iterator;function j(z){return z===null||typeof z!="object"?null:(z=C&&z[C]||z["@@iterator"],typeof z=="function"?z:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,b={};function v(z,ee,de){this.props=z,this.context=ee,this.refs=b,this.updater=de||E}v.prototype.isReactComponent={},v.prototype.setState=function(z,ee){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,ee,"setState")},v.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function S(){}S.prototype=v.prototype;function N(z,ee,de){this.props=z,this.context=ee,this.refs=b,this.updater=de||E}var T=N.prototype=new S;T.constructor=N,g(T,v.prototype),T.isPureReactComponent=!0;var D=Array.isArray;function O(){}var k={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function V(z,ee,de){var Z=de.ref;return{$$typeof:s,type:z,key:ee,ref:Z!==void 0?Z:null,props:de}}function q(z,ee){return V(z.type,ee,z.props)}function Y(z){return typeof z=="object"&&z!==null&&z.$$typeof===s}function P(z){var ee={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(de){return ee[de]})}var Q=/\/+/g;function he(z,ee){return typeof z=="object"&&z!==null&&z.key!=null?P(""+z.key):ee.toString(36)}function ne(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(O,O):(z.status="pending",z.then(function(ee){z.status==="pending"&&(z.status="fulfilled",z.value=ee)},function(ee){z.status==="pending"&&(z.status="rejected",z.reason=ee)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function W(z,ee,de,Z,U){var ue=typeof z;(ue==="undefined"||ue==="boolean")&&(z=null);var pe=!1;if(z===null)pe=!0;else switch(ue){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(z.$$typeof){case s:case n:pe=!0;break;case p:return pe=z._init,W(pe(z._payload),ee,de,Z,U)}}if(pe)return U=U(z),pe=Z===""?"."+he(z,0):Z,D(U)?(de="",pe!=null&&(de=pe.replace(Q,"$&/")+"/"),W(U,ee,de,"",function(Re){return Re})):U!=null&&(Y(U)&&(U=q(U,de+(U.key==null||z&&z.key===U.key?"":(""+U.key).replace(Q,"$&/")+"/")+pe)),ee.push(U)),1;pe=0;var me=Z===""?".":Z+":";if(D(z))for(var ge=0;ge<z.length;ge++)Z=z[ge],ue=me+he(Z,ge),pe+=W(Z,ee,de,ue,U);else if(ge=j(z),typeof ge=="function")for(z=ge.call(z),ge=0;!(Z=z.next()).done;)Z=Z.value,ue=me+he(Z,ge++),pe+=W(Z,ee,de,ue,U);else if(ue==="object"){if(typeof z.then=="function")return W(ne(z),ee,de,Z,U);throw ee=String(z),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return pe}function I(z,ee,de){if(z==null)return z;var Z=[],U=0;return W(z,Z,"","",function(ue){return ee.call(de,ue,U++)}),Z}function A(z){if(z._status===-1){var ee=z._result,de=ee();de.then(function(Z){(z._status===0||z._status===-1)&&(z._status=1,z._result=Z,de.status===void 0&&(de.status="fulfilled",de.value=Z))},function(Z){(z._status===0||z._status===-1)&&(z._status=2,z._result=Z,de.status===void 0&&(de.status="rejected",de.reason=Z))}),z._status===-1&&(z._status=0,z._result=de)}if(z._status===1)return z._result.default;throw z._result}var B=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)};function F(z){var ee=k.T,de={};de.types=ee!==null?ee.types:null,k.T=de;try{var Z=z(),U=k.S;U!==null&&U(de,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(O,B)}catch(ue){B(ue)}finally{ee!==null&&de.types!==null&&(ee.types=de.types),k.T=ee}}function $(z){var ee=k.T;if(ee!==null){var de=ee.types;de===null?ee.types=[z]:de.indexOf(z)===-1&&de.push(z)}else F($.bind(null,z))}var J={map:I,forEach:function(z,ee,de){I(z,function(){ee.apply(this,arguments)},de)},count:function(z){var ee=0;return I(z,function(){ee++}),ee},toArray:function(z){return I(z,function(ee){return ee})||[]},only:function(z){if(!Y(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Me.Activity=f,Me.Children=J,Me.Component=v,Me.Fragment=l,Me.Profiler=d,Me.PureComponent=N,Me.StrictMode=o,Me.Suspense=h,Me.ViewTransition=x,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,Me.__COMPILER_RUNTIME={__proto__:null,c:function(z){return k.H.useMemoCache(z)}},Me.addTransitionType=$,Me.cache=function(z){return function(){return z.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(z,ee,de){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var Z=g({},z.props),U=z.key;if(ee!=null)for(ue in ee.key!==void 0&&(U=""+ee.key),ee)!L.call(ee,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&ee.ref===void 0||(Z[ue]=ee[ue]);var ue=arguments.length-2;if(ue===1)Z.children=de;else if(1<ue){for(var pe=Array(ue),me=0;me<ue;me++)pe[me]=arguments[me+2];Z.children=pe}return V(z.type,U,Z)},Me.createContext=function(z){return z={$$typeof:w,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:_,_context:z},z},Me.createElement=function(z,ee,de){var Z,U={},ue=null;if(ee!=null)for(Z in ee.key!==void 0&&(ue=""+ee.key),ee)L.call(ee,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(U[Z]=ee[Z]);var pe=arguments.length-2;if(pe===1)U.children=de;else if(1<pe){for(var me=Array(pe),ge=0;ge<pe;ge++)me[ge]=arguments[ge+2];U.children=me}if(z&&z.defaultProps)for(Z in pe=z.defaultProps,pe)U[Z]===void 0&&(U[Z]=pe[Z]);return V(z,ue,U)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(z){return{$$typeof:c,render:z}},Me.isValidElement=Y,Me.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:A}},Me.memo=function(z,ee){return{$$typeof:y,type:z,compare:ee===void 0?null:ee}},Me.startTransition=F,Me.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},Me.use=function(z){return k.H.use(z)},Me.useActionState=function(z,ee,de){return k.H.useActionState(z,ee,de)},Me.useCallback=function(z,ee){return k.H.useCallback(z,ee)},Me.useContext=function(z){return k.H.useContext(z)},Me.useDebugValue=function(){},Me.useDeferredValue=function(z,ee){return k.H.useDeferredValue(z,ee)},Me.useEffect=function(z,ee){return k.H.useEffect(z,ee)},Me.useEffectEvent=function(z){return k.H.useEffectEvent(z)},Me.useId=function(){return k.H.useId()},Me.useImperativeHandle=function(z,ee,de){return k.H.useImperativeHandle(z,ee,de)},Me.useInsertionEffect=function(z,ee){return k.H.useInsertionEffect(z,ee)},Me.useLayoutEffect=function(z,ee){return k.H.useLayoutEffect(z,ee)},Me.useMemo=function(z,ee){return k.H.useMemo(z,ee)},Me.useOptimistic=function(z,ee){return k.H.useOptimistic(z,ee)},Me.useReducer=function(z,ee,de){return k.H.useReducer(z,ee,de)},Me.useRef=function(z){return k.H.useRef(z)},Me.useState=function(z){return k.H.useState(z)},Me.useSyncExternalStore=function(z,ee,de){return k.H.useSyncExternalStore(z,ee,de)},Me.useTransition=function(){return k.H.useTransition()},Me.version="19.3.0",Me}var G_;function qf(){return G_||(G_=1,bd.exports=nw()),bd.exports}var M=qf(),Sd={exports:{}},ol={},xd={exports:{}},wd={};var Y_;function rw(){return Y_||(Y_=1,(function(s){function n(ne,W){var I=ne.length;ne.push(W);e:for(;0<I;){var A=I-1>>>1,B=ne[A];if(0<d(B,W))ne[A]=W,ne[I]=B,I=A;else break e}}function l(ne){return ne.length===0?null:ne[0]}function o(ne){if(ne.length===0)return null;var W=ne[0],I=ne.pop();if(I!==W){ne[0]=I;e:for(var A=0,B=ne.length,F=B>>>1;A<F;){var $=2*(A+1)-1,J=ne[$],z=$+1,ee=ne[z];if(0>d(J,I))z<B&&0>d(ee,J)?(ne[A]=ee,ne[z]=I,A=z):(ne[A]=J,ne[$]=I,A=$);else if(z<B&&0>d(ee,I))ne[A]=ee,ne[z]=I,A=z;else break e}}return W}function d(ne,W){var I=ne.sortIndex-W.sortIndex;return I!==0?I:ne.id-W.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var _=performance;s.unstable_now=function(){return _.now()}}else{var w=Date,c=w.now();s.unstable_now=function(){return w.now()-c}}var h=[],y=[],p=1,f=null,x=3,C=!1,j=!1,E=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function N(ne){for(var W=l(y);W!==null;){if(W.callback===null)o(y);else if(W.startTime<=ne)o(y),W.sortIndex=W.expirationTime,n(h,W);else break;W=l(y)}}function T(ne){if(E=!1,N(ne),!j)if(l(h)!==null)j=!0,D||(D=!0,Y());else{var W=l(y);W!==null&&he(T,W.startTime-ne)}}var D=!1,O=-1,k=5,L=-1;function V(){return g?!0:!(s.unstable_now()-L<k)}function q(){if(g=!1,D){var ne=s.unstable_now();L=ne;var W=!0;try{e:{j=!1,E&&(E=!1,v(O),O=-1),C=!0;var I=x;try{t:{for(N(ne),f=l(h);f!==null&&!(f.expirationTime>ne&&V());){var A=f.callback;if(typeof A=="function"){f.callback=null,x=f.priorityLevel;var B=A(f.expirationTime<=ne);if(ne=s.unstable_now(),typeof B=="function"){f.callback=B,N(ne),W=!0;break t}f===l(h)&&o(h),N(ne)}else o(h);f=l(h)}if(f!==null)W=!0;else{var F=l(y);F!==null&&he(T,F.startTime-ne),W=!1}}break e}finally{f=null,x=I,C=!1}W=void 0}}finally{W?Y():D=!1}}}var Y;if(typeof S=="function")Y=function(){S(q)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,Q=P.port2;P.port1.onmessage=q,Y=function(){Q.postMessage(null)}}else Y=function(){b(q,0)};function he(ne,W){O=b(function(){ne(s.unstable_now())},W)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(ne){ne.callback=null},s.unstable_forceFrameRate=function(ne){0>ne||125<ne?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<ne?Math.floor(1e3/ne):5},s.unstable_getCurrentPriorityLevel=function(){return x},s.unstable_next=function(ne){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var I=x;x=W;try{return ne()}finally{x=I}},s.unstable_requestPaint=function(){g=!0},s.unstable_runWithPriority=function(ne,W){switch(ne){case 1:case 2:case 3:case 4:case 5:break;default:ne=3}var I=x;x=ne;try{return W()}finally{x=I}},s.unstable_scheduleCallback=function(ne,W,I){var A=s.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?A+I:A):I=A,ne){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=I+B,ne={id:p++,callback:W,priorityLevel:ne,startTime:I,expirationTime:B,sortIndex:-1},I>A?(ne.sortIndex=I,n(y,ne),l(h)===null&&ne===l(y)&&(E?(v(O),O=-1):E=!0,he(T,I-A))):(ne.sortIndex=B,n(h,ne),j||C||(j=!0,D||(D=!0,Y()))),ne},s.unstable_shouldYield=V,s.unstable_wrapCallback=function(ne){var W=x;return function(){var I=x;x=W;try{return ne.apply(this,arguments)}finally{x=I}}}})(wd)),wd}var Z_;function aw(){return Z_||(Z_=1,xd.exports=rw()),xd.exports}var Cd={exports:{}},Xt={};var X_;function lw(){if(X_)return Xt;X_=1;var s=qf();function n(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)f+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var o={d:{f:l,r:function(){throw Error(n(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},d=Symbol.for("react.portal"),_=Symbol.for("react.recoverable"),w=Symbol.for("react.optimistic_key");function c(p,f,x){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:C==null?null:C===w?w:""+C,children:p,containerInfo:f,implementation:x}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Xt.browser=function(p){return{$$typeof:_,_reason:p}},Xt.createPortal=function(p,f){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(n(299));return c(p,f,null,x)},Xt.flushSync=function(p){var f=h.T,x=o.p;try{if(h.T=null,o.p=2,p)return p()}finally{h.T=f,o.p=x,o.d.f()}},Xt.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,o.d.C(p,f))},Xt.prefetchDNS=function(p){typeof p=="string"&&o.d.D(p)},Xt.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var x=f.as,C=y(x,f.crossOrigin),j=typeof f.integrity=="string"?f.integrity:void 0,E=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;x==="style"?o.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:C,integrity:j,fetchPriority:E}):x==="script"&&o.d.X(p,{crossOrigin:C,integrity:j,fetchPriority:E,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Xt.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var x=y(f.as,f.crossOrigin);o.d.M(p,{crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0})}}else f==null&&o.d.M(p)},Xt.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var x=f.as,C=y(x,f.crossOrigin);o.d.L(p,x,{crossOrigin:C,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Xt.preloadModule=function(p,f){if(typeof p=="string")if(f){var x=y(f.as,f.crossOrigin);o.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0})}else o.d.m(p)},Xt.requestFormReset=function(p){o.d.r(p)},Xt.unstable_batchedUpdates=function(p,f){return p(f)},Xt.useFormState=function(p,f,x){return h.H.useFormState(p,f,x)},Xt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Xt.version="19.3.0",Xt}var W_;function Hb(){if(W_)return Cd.exports;W_=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),Cd.exports=lw(),Cd.exports}var Q_;function ow(){if(Q_)return ol;Q_=1;var s=aw(),n=qf(),l=Hb();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _(e){for(var t=e,i=t;i&&!i.alternate;)t=i,(t.flags&4098)!==0&&(e=t.return),i=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function w(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(_(e)!==e)throw Error(o(188))}function y(e){var t=e.alternate;if(!t){if(t=_(e),t===null)throw Error(o(188));return t!==e?null:e}for(var i=e,a=t;;){var u=i.return;if(u===null)break;var m=u.alternate;if(m===null){if(a=u.return,a!==null){i=a;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===i)return h(u),e;if(m===a)return h(u),t;m=m.sibling}throw Error(o(188))}if(i.return!==a.return)i=u,a=m;else{for(var R=!1,H=u.child;H;){if(H===i){R=!0,i=u,a=m;break}if(H===a){R=!0,a=u,i=m;break}H=H.sibling}if(!R){for(H=m.child;H;){if(H===i){R=!0,i=m,a=u;break}if(H===a){R=!0,a=m,i=u;break}H=H.sibling}if(!R)throw Error(o(189))}}if(i.alternate!==a)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function f(e,t,i,a,u,m){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&i(e,a,u,m)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,i,a,u,m))return!0;e=e.sibling}return!1}function x(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function C(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function j(e){var t=[null,null],i=x(e);return i===null||E(t,e,i.child,{foundSelf:!1}),t}function E(e,t,i,a){for(;i!==null;){if(i===t)a.foundSelf=!0;else if(i.tag===5||i.tag===27||i.tag===6){if(a.foundSelf)return e[1]=i,!0;e[0]=i}else if((i.tag!==22||i.memoizedState===null)&&E(e,t,i.child,a))return!0;i=i.sibling}return!1}function g(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var b=null,v=null;function S(e,t,i){return e===i?!0:e===t?(b=e,!0):!1}function N(e,t,i){return e===i?(v=e,!1):e===t?(v!==null&&(b=e),!0):!1}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function D(e,t,i){for(var a=0,u=e;u;u=i(u))a++;u=0;for(var m=t;m;m=i(m))u++;for(;0<a-u;)e=i(e),a--;for(;0<u-a;)t=i(t),u--;for(;a--;){if(e===t||t!==null&&e===t.alternate)return e;e=i(e),t=i(t)}return null}var O=Object.assign,k=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),he=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),$=Symbol.for("react.legacy_hidden"),J=Symbol.for("react.memo_cache_sentinel"),z=Symbol.for("react.view_transition"),ee=Symbol.for("react.recoverable"),de=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=de&&e[de]||e["@@iterator"],typeof e=="function"?e:null)}var U=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===U?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case P:return"Profiler";case Y:return"StrictMode";case W:return"Suspense";case I:return"SuspenseList";case F:return"Activity";case z:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case V:return"Portal";case he:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var pe=Array.isArray,me=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re={pending:!1,data:null,method:null,action:null},tt=[],qe=-1;function at(e){return{current:e}}function we(e){0>qe||(e.current=tt[qe],tt[qe]=null,qe--)}function Ke(e,t){qe++,tt[qe]=e.current,e.current=t}var Bt=at(null),bs=at(null),is=at(null),es=at(null);function wt(e,t){switch(Ke(is,t),Ke(bs,e),Ke(Bt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jv(t),e=e_(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}we(Bt),Ke(Bt,e)}function It(){we(Bt),we(bs),we(is)}function G(e){var t=e.memoizedState;t!==null&&(Kr._currentValue=t.memoizedState,Ke(es,e)),t=Bt.current;var i=e_(t,e.type);t!==i&&(Ke(bs,e),Ke(Bt,i))}function Se(e){bs.current===e&&(we(Bt),we(bs)),es.current===e&&(we(es),Kr._currentValue=Re)}var Ie,Qe;function He(e){if(Ie===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",Qe=-1<i.stack.indexOf(`
1
+ (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const _ of d)if(_.type==="childList")for(const w of _.addedNodes)w.tagName==="LINK"&&w.rel==="modulepreload"&&o(w)}).observe(document,{childList:!0,subtree:!0});function l(d){const _={};return d.integrity&&(_.integrity=d.integrity),d.referrerPolicy&&(_.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?_.credentials="include":d.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function o(d){if(d.ep)return;d.ep=!0;const _=l(d);fetch(d.href,_)}})();function la(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var yd={exports:{}},ll={};var K_;function iw(){if(K_)return ll;K_=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function l(o,d,_){var w=null;if(_!==void 0&&(w=""+_),d.key!==void 0&&(w=""+d.key),"key"in d){_={};for(var c in d)c!=="key"&&(_[c]=d[c])}else _=d;return d=_.ref,{$$typeof:s,type:o,key:w,ref:d!==void 0?d:null,props:_}}return ll.Fragment=n,ll.jsx=l,ll.jsxs=l,ll}var G_;function nw(){return G_||(G_=1,yd.exports=iw()),yd.exports}var r=nw(),bd={exports:{}},Me={};var Y_;function rw(){if(Y_)return Me;Y_=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),w=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),C=Symbol.iterator;function j(z){return z===null||typeof z!="object"?null:(z=C&&z[C]||z["@@iterator"],typeof z=="function"?z:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,b={};function v(z,ee,de){this.props=z,this.context=ee,this.refs=b,this.updater=de||E}v.prototype.isReactComponent={},v.prototype.setState=function(z,ee){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,ee,"setState")},v.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function S(){}S.prototype=v.prototype;function N(z,ee,de){this.props=z,this.context=ee,this.refs=b,this.updater=de||E}var T=N.prototype=new S;T.constructor=N,g(T,v.prototype),T.isPureReactComponent=!0;var D=Array.isArray;function O(){}var k={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function V(z,ee,de){var Z=de.ref;return{$$typeof:s,type:z,key:ee,ref:Z!==void 0?Z:null,props:de}}function q(z,ee){return V(z.type,ee,z.props)}function Y(z){return typeof z=="object"&&z!==null&&z.$$typeof===s}function P(z){var ee={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(de){return ee[de]})}var Q=/\/+/g;function he(z,ee){return typeof z=="object"&&z!==null&&z.key!=null?P(""+z.key):ee.toString(36)}function ne(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(O,O):(z.status="pending",z.then(function(ee){z.status==="pending"&&(z.status="fulfilled",z.value=ee)},function(ee){z.status==="pending"&&(z.status="rejected",z.reason=ee)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function W(z,ee,de,Z,U){var ue=typeof z;(ue==="undefined"||ue==="boolean")&&(z=null);var pe=!1;if(z===null)pe=!0;else switch(ue){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(z.$$typeof){case s:case n:pe=!0;break;case p:return pe=z._init,W(pe(z._payload),ee,de,Z,U)}}if(pe)return U=U(z),pe=Z===""?"."+he(z,0):Z,D(U)?(de="",pe!=null&&(de=pe.replace(Q,"$&/")+"/"),W(U,ee,de,"",function(Re){return Re})):U!=null&&(Y(U)&&(U=q(U,de+(U.key==null||z&&z.key===U.key?"":(""+U.key).replace(Q,"$&/")+"/")+pe)),ee.push(U)),1;pe=0;var me=Z===""?".":Z+":";if(D(z))for(var ge=0;ge<z.length;ge++)Z=z[ge],ue=me+he(Z,ge),pe+=W(Z,ee,de,ue,U);else if(ge=j(z),typeof ge=="function")for(z=ge.call(z),ge=0;!(Z=z.next()).done;)Z=Z.value,ue=me+he(Z,ge++),pe+=W(Z,ee,de,ue,U);else if(ue==="object"){if(typeof z.then=="function")return W(ne(z),ee,de,Z,U);throw ee=String(z),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return pe}function I(z,ee,de){if(z==null)return z;var Z=[],U=0;return W(z,Z,"","",function(ue){return ee.call(de,ue,U++)}),Z}function A(z){if(z._status===-1){var ee=z._result,de=ee();de.then(function(Z){(z._status===0||z._status===-1)&&(z._status=1,z._result=Z,de.status===void 0&&(de.status="fulfilled",de.value=Z))},function(Z){(z._status===0||z._status===-1)&&(z._status=2,z._result=Z,de.status===void 0&&(de.status="rejected",de.reason=Z))}),z._status===-1&&(z._status=0,z._result=de)}if(z._status===1)return z._result.default;throw z._result}var B=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)};function F(z){var ee=k.T,de={};de.types=ee!==null?ee.types:null,k.T=de;try{var Z=z(),U=k.S;U!==null&&U(de,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(O,B)}catch(ue){B(ue)}finally{ee!==null&&de.types!==null&&(ee.types=de.types),k.T=ee}}function $(z){var ee=k.T;if(ee!==null){var de=ee.types;de===null?ee.types=[z]:de.indexOf(z)===-1&&de.push(z)}else F($.bind(null,z))}var J={map:I,forEach:function(z,ee,de){I(z,function(){ee.apply(this,arguments)},de)},count:function(z){var ee=0;return I(z,function(){ee++}),ee},toArray:function(z){return I(z,function(ee){return ee})||[]},only:function(z){if(!Y(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Me.Activity=f,Me.Children=J,Me.Component=v,Me.Fragment=l,Me.Profiler=d,Me.PureComponent=N,Me.StrictMode=o,Me.Suspense=h,Me.ViewTransition=x,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,Me.__COMPILER_RUNTIME={__proto__:null,c:function(z){return k.H.useMemoCache(z)}},Me.addTransitionType=$,Me.cache=function(z){return function(){return z.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(z,ee,de){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var Z=g({},z.props),U=z.key;if(ee!=null)for(ue in ee.key!==void 0&&(U=""+ee.key),ee)!L.call(ee,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&ee.ref===void 0||(Z[ue]=ee[ue]);var ue=arguments.length-2;if(ue===1)Z.children=de;else if(1<ue){for(var pe=Array(ue),me=0;me<ue;me++)pe[me]=arguments[me+2];Z.children=pe}return V(z.type,U,Z)},Me.createContext=function(z){return z={$$typeof:w,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:_,_context:z},z},Me.createElement=function(z,ee,de){var Z,U={},ue=null;if(ee!=null)for(Z in ee.key!==void 0&&(ue=""+ee.key),ee)L.call(ee,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(U[Z]=ee[Z]);var pe=arguments.length-2;if(pe===1)U.children=de;else if(1<pe){for(var me=Array(pe),ge=0;ge<pe;ge++)me[ge]=arguments[ge+2];U.children=me}if(z&&z.defaultProps)for(Z in pe=z.defaultProps,pe)U[Z]===void 0&&(U[Z]=pe[Z]);return V(z,ue,U)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(z){return{$$typeof:c,render:z}},Me.isValidElement=Y,Me.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:A}},Me.memo=function(z,ee){return{$$typeof:y,type:z,compare:ee===void 0?null:ee}},Me.startTransition=F,Me.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},Me.use=function(z){return k.H.use(z)},Me.useActionState=function(z,ee,de){return k.H.useActionState(z,ee,de)},Me.useCallback=function(z,ee){return k.H.useCallback(z,ee)},Me.useContext=function(z){return k.H.useContext(z)},Me.useDebugValue=function(){},Me.useDeferredValue=function(z,ee){return k.H.useDeferredValue(z,ee)},Me.useEffect=function(z,ee){return k.H.useEffect(z,ee)},Me.useEffectEvent=function(z){return k.H.useEffectEvent(z)},Me.useId=function(){return k.H.useId()},Me.useImperativeHandle=function(z,ee,de){return k.H.useImperativeHandle(z,ee,de)},Me.useInsertionEffect=function(z,ee){return k.H.useInsertionEffect(z,ee)},Me.useLayoutEffect=function(z,ee){return k.H.useLayoutEffect(z,ee)},Me.useMemo=function(z,ee){return k.H.useMemo(z,ee)},Me.useOptimistic=function(z,ee){return k.H.useOptimistic(z,ee)},Me.useReducer=function(z,ee,de){return k.H.useReducer(z,ee,de)},Me.useRef=function(z){return k.H.useRef(z)},Me.useState=function(z){return k.H.useState(z)},Me.useSyncExternalStore=function(z,ee,de){return k.H.useSyncExternalStore(z,ee,de)},Me.useTransition=function(){return k.H.useTransition()},Me.version="19.3.0",Me}var Z_;function Kf(){return Z_||(Z_=1,bd.exports=rw()),bd.exports}var M=Kf(),Sd={exports:{}},ol={},xd={exports:{}},wd={};var X_;function aw(){return X_||(X_=1,(function(s){function n(ne,W){var I=ne.length;ne.push(W);e:for(;0<I;){var A=I-1>>>1,B=ne[A];if(0<d(B,W))ne[A]=W,ne[I]=B,I=A;else break e}}function l(ne){return ne.length===0?null:ne[0]}function o(ne){if(ne.length===0)return null;var W=ne[0],I=ne.pop();if(I!==W){ne[0]=I;e:for(var A=0,B=ne.length,F=B>>>1;A<F;){var $=2*(A+1)-1,J=ne[$],z=$+1,ee=ne[z];if(0>d(J,I))z<B&&0>d(ee,J)?(ne[A]=ee,ne[z]=I,A=z):(ne[A]=J,ne[$]=I,A=$);else if(z<B&&0>d(ee,I))ne[A]=ee,ne[z]=I,A=z;else break e}}return W}function d(ne,W){var I=ne.sortIndex-W.sortIndex;return I!==0?I:ne.id-W.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var _=performance;s.unstable_now=function(){return _.now()}}else{var w=Date,c=w.now();s.unstable_now=function(){return w.now()-c}}var h=[],y=[],p=1,f=null,x=3,C=!1,j=!1,E=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function N(ne){for(var W=l(y);W!==null;){if(W.callback===null)o(y);else if(W.startTime<=ne)o(y),W.sortIndex=W.expirationTime,n(h,W);else break;W=l(y)}}function T(ne){if(E=!1,N(ne),!j)if(l(h)!==null)j=!0,D||(D=!0,Y());else{var W=l(y);W!==null&&he(T,W.startTime-ne)}}var D=!1,O=-1,k=5,L=-1;function V(){return g?!0:!(s.unstable_now()-L<k)}function q(){if(g=!1,D){var ne=s.unstable_now();L=ne;var W=!0;try{e:{j=!1,E&&(E=!1,v(O),O=-1),C=!0;var I=x;try{t:{for(N(ne),f=l(h);f!==null&&!(f.expirationTime>ne&&V());){var A=f.callback;if(typeof A=="function"){f.callback=null,x=f.priorityLevel;var B=A(f.expirationTime<=ne);if(ne=s.unstable_now(),typeof B=="function"){f.callback=B,N(ne),W=!0;break t}f===l(h)&&o(h),N(ne)}else o(h);f=l(h)}if(f!==null)W=!0;else{var F=l(y);F!==null&&he(T,F.startTime-ne),W=!1}}break e}finally{f=null,x=I,C=!1}W=void 0}}finally{W?Y():D=!1}}}var Y;if(typeof S=="function")Y=function(){S(q)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,Q=P.port2;P.port1.onmessage=q,Y=function(){Q.postMessage(null)}}else Y=function(){b(q,0)};function he(ne,W){O=b(function(){ne(s.unstable_now())},W)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(ne){ne.callback=null},s.unstable_forceFrameRate=function(ne){0>ne||125<ne?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<ne?Math.floor(1e3/ne):5},s.unstable_getCurrentPriorityLevel=function(){return x},s.unstable_next=function(ne){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var I=x;x=W;try{return ne()}finally{x=I}},s.unstable_requestPaint=function(){g=!0},s.unstable_runWithPriority=function(ne,W){switch(ne){case 1:case 2:case 3:case 4:case 5:break;default:ne=3}var I=x;x=ne;try{return W()}finally{x=I}},s.unstable_scheduleCallback=function(ne,W,I){var A=s.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?A+I:A):I=A,ne){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=I+B,ne={id:p++,callback:W,priorityLevel:ne,startTime:I,expirationTime:B,sortIndex:-1},I>A?(ne.sortIndex=I,n(y,ne),l(h)===null&&ne===l(y)&&(E?(v(O),O=-1):E=!0,he(T,I-A))):(ne.sortIndex=B,n(h,ne),j||C||(j=!0,D||(D=!0,Y()))),ne},s.unstable_shouldYield=V,s.unstable_wrapCallback=function(ne){var W=x;return function(){var I=x;x=W;try{return ne.apply(this,arguments)}finally{x=I}}}})(wd)),wd}var W_;function lw(){return W_||(W_=1,xd.exports=aw()),xd.exports}var Cd={exports:{}},Wt={};var Q_;function ow(){if(Q_)return Wt;Q_=1;var s=Kf();function n(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)f+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var o={d:{f:l,r:function(){throw Error(n(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},d=Symbol.for("react.portal"),_=Symbol.for("react.recoverable"),w=Symbol.for("react.optimistic_key");function c(p,f,x){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:C==null?null:C===w?w:""+C,children:p,containerInfo:f,implementation:x}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Wt.browser=function(p){return{$$typeof:_,_reason:p}},Wt.createPortal=function(p,f){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(n(299));return c(p,f,null,x)},Wt.flushSync=function(p){var f=h.T,x=o.p;try{if(h.T=null,o.p=2,p)return p()}finally{h.T=f,o.p=x,o.d.f()}},Wt.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,o.d.C(p,f))},Wt.prefetchDNS=function(p){typeof p=="string"&&o.d.D(p)},Wt.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var x=f.as,C=y(x,f.crossOrigin),j=typeof f.integrity=="string"?f.integrity:void 0,E=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;x==="style"?o.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:C,integrity:j,fetchPriority:E}):x==="script"&&o.d.X(p,{crossOrigin:C,integrity:j,fetchPriority:E,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Wt.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var x=y(f.as,f.crossOrigin);o.d.M(p,{crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0})}}else f==null&&o.d.M(p)},Wt.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var x=f.as,C=y(x,f.crossOrigin);o.d.L(p,x,{crossOrigin:C,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Wt.preloadModule=function(p,f){if(typeof p=="string")if(f){var x=y(f.as,f.crossOrigin);o.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0})}else o.d.m(p)},Wt.requestFormReset=function(p){o.d.r(p)},Wt.unstable_batchedUpdates=function(p,f){return p(f)},Wt.useFormState=function(p,f,x){return h.H.useFormState(p,f,x)},Wt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Wt.version="19.3.0",Wt}var J_;function zb(){if(J_)return Cd.exports;J_=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),Cd.exports=ow(),Cd.exports}var ey;function cw(){if(ey)return ol;ey=1;var s=lw(),n=Kf(),l=zb();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _(e){for(var t=e,i=t;i&&!i.alternate;)t=i,(t.flags&4098)!==0&&(e=t.return),i=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function w(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(_(e)!==e)throw Error(o(188))}function y(e){var t=e.alternate;if(!t){if(t=_(e),t===null)throw Error(o(188));return t!==e?null:e}for(var i=e,a=t;;){var u=i.return;if(u===null)break;var m=u.alternate;if(m===null){if(a=u.return,a!==null){i=a;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===i)return h(u),e;if(m===a)return h(u),t;m=m.sibling}throw Error(o(188))}if(i.return!==a.return)i=u,a=m;else{for(var R=!1,H=u.child;H;){if(H===i){R=!0,i=u,a=m;break}if(H===a){R=!0,a=u,i=m;break}H=H.sibling}if(!R){for(H=m.child;H;){if(H===i){R=!0,i=m,a=u;break}if(H===a){R=!0,a=m,i=u;break}H=H.sibling}if(!R)throw Error(o(189))}}if(i.alternate!==a)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function f(e,t,i,a,u,m){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&i(e,a,u,m)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,i,a,u,m))return!0;e=e.sibling}return!1}function x(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function C(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function j(e){var t=[null,null],i=x(e);return i===null||E(t,e,i.child,{foundSelf:!1}),t}function E(e,t,i,a){for(;i!==null;){if(i===t)a.foundSelf=!0;else if(i.tag===5||i.tag===27||i.tag===6){if(a.foundSelf)return e[1]=i,!0;e[0]=i}else if((i.tag!==22||i.memoizedState===null)&&E(e,t,i.child,a))return!0;i=i.sibling}return!1}function g(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var b=null,v=null;function S(e,t,i){return e===i?!0:e===t?(b=e,!0):!1}function N(e,t,i){return e===i?(v=e,!1):e===t?(v!==null&&(b=e),!0):!1}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function D(e,t,i){for(var a=0,u=e;u;u=i(u))a++;u=0;for(var m=t;m;m=i(m))u++;for(;0<a-u;)e=i(e),a--;for(;0<u-a;)t=i(t),u--;for(;a--;){if(e===t||t!==null&&e===t.alternate)return e;e=i(e),t=i(t)}return null}var O=Object.assign,k=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),he=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),$=Symbol.for("react.legacy_hidden"),J=Symbol.for("react.memo_cache_sentinel"),z=Symbol.for("react.view_transition"),ee=Symbol.for("react.recoverable"),de=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=de&&e[de]||e["@@iterator"],typeof e=="function"?e:null)}var U=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===U?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case P:return"Profiler";case Y:return"StrictMode";case W:return"Suspense";case I:return"SuspenseList";case F:return"Activity";case z:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case V:return"Portal";case he:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var pe=Array.isArray,me=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re={pending:!1,data:null,method:null,action:null},tt=[],qe=-1;function at(e){return{current:e}}function we(e){0>qe||(e.current=tt[qe],tt[qe]=null,qe--)}function Ke(e,t){qe++,tt[qe]=e.current,e.current=t}var Bt=at(null),bs=at(null),is=at(null),es=at(null);function wt(e,t){switch(Ke(is,t),Ke(bs,e),Ke(Bt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?t_(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=t_(t),e=s_(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}we(Bt),Ke(Bt,e)}function It(){we(Bt),we(bs),we(is)}function G(e){var t=e.memoizedState;t!==null&&(Kr._currentValue=t.memoizedState,Ke(es,e)),t=Bt.current;var i=s_(t,e.type);t!==i&&(Ke(bs,e),Ke(Bt,i))}function Se(e){bs.current===e&&(we(Bt),we(bs)),es.current===e&&(we(es),Kr._currentValue=Re)}var Ie,Qe;function He(e){if(Ie===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",Qe=-1<i.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+Ie+e+Qe}var Be=!1;function dt(e,t){if(!e||Be)return"";Be=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(be){var te=be}Reflect.construct(e,[],_e)}else{try{_e.call()}catch(be){te=be}_e=!1;try{var ae=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),_e=!0,new e}finally{_e&&(ae!==void 0?Object.defineProperty(e.prototype,"props",ae):delete e.prototype.props)}}}else{try{throw Error()}catch(be){te=be}(_e=e())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(be){if(be&&te&&typeof be.stack=="string")return[be.stack,te.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=a.DetermineComponentFrameRoot(),R=m[0],H=m[1];if(R&&H){var K=R.split(`
4
4
  `),ie=H.split(`
5
5
  `);for(u=a=0;a<K.length&&!K[a].includes("DetermineComponentFrameRoot");)a++;for(;u<ie.length&&!ie[u].includes("DetermineComponentFrameRoot");)u++;if(a===K.length||u===ie.length)for(a=K.length-1,u=ie.length-1;1<=a&&0<=u&&K[a]!==ie[u];)u--;for(;1<=a&&0<=u;a--,u--)if(K[a]!==ie[u]){if(a!==1||u!==1)do if(a--,u--,0>u||K[a]!==ie[u]){var oe=`
6
- `+K[a].replace(" at new "," at ");return e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=a&&0<=u);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?He(i):""}function De(e,t){switch(e.tag){case 26:case 27:case 5:return He(e.type);case 16:return He("Lazy");case 13:return e.child!==t&&t!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return dt(e.type,!1);case 11:return dt(e.type.render,!1);case 1:return dt(e.type,!0);case 31:return He("Activity");case 30:return He("ViewTransition");default:return""}}function Ft(e){try{var t="",i=null;do t+=De(e,i),i=e,e=e.return;while(e);return t}catch(a){return`
6
+ `+K[a].replace(" at new "," at ");return e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=a&&0<=u);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?He(i):""}function De(e,t){switch(e.tag){case 26:case 27:case 5:return He(e.type);case 16:return He("Lazy");case 13:return e.child!==t&&t!==null?He("Suspense Fallback"):He("Suspense");case 19:return He("SuspenseList");case 0:case 15:return dt(e.type,!1);case 11:return dt(e.type.render,!1);case 1:return dt(e.type,!0);case 31:return He("Activity");case 30:return He("ViewTransition");default:return""}}function Vt(e){try{var t="",i=null;do t+=De(e,i),i=e,e=e.return;while(e);return t}catch(a){return`
7
7
  Error generating stack: `+a.message+`
8
- `+a.stack}}var bi=Object.prototype.hasOwnProperty,Ss=s.unstable_scheduleCallback,Fi=s.unstable_cancelCallback,Tl=s.unstable_shouldYield,rr=s.unstable_requestPaint,ns=s.unstable_now,ai=s.unstable_getCurrentPriorityLevel,Vi=s.unstable_ImmediatePriority,fa=s.unstable_UserBlockingPriority,kl=s.unstable_NormalPriority,uS=s.unstable_LowPriority,Cm=s.unstable_IdlePriority,hS=s.log,dS=s.unstable_setDisableYieldValue,ma=null,xs=null;function qi(e){if(typeof hS=="function"&&dS(e),xs&&typeof xs.setStrictMode=="function")try{xs.setStrictMode(ma,e)}catch{}}var ws=Math.clz32?Math.clz32:pS,fS=Math.log,mS=Math.LN2;function pS(e){return e>>>=0,e===0?32:31-(fS(e)/mS|0)|0}var Rl=256,Dl=262144,Al=4194304;function jn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ol(e,t,i){var a=e.pendingLanes;if(a===0)return 0;var u=0,m=e.suspendedLanes,R=e.pingedLanes;e=e.warmLanes;var H=a&134217727;return H!==0?(a=H&~m,a!==0?u=jn(a):(R&=H,R!==0?u=jn(R):i||(i=H&~e,i!==0&&(u=jn(i))))):(H=a&~m,H!==0?u=jn(H):R!==0?u=jn(R):i||(i=a&~e,i!==0&&(u=jn(i)))),u===0?0:t!==0&&t!==u&&(t&m)===0&&(m=u&-u,i=t&-t,m>=i||m===32&&(i&4194048)!==0)?t:u}function pa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Em(e,t){(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var a=31-ws(i),u=1<<a;t|=e[a],i&=~u}return t}function gS(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nm(){var e=Al;return Al<<=1,(Al&62914560)===0&&(Al=4194304),e}function Kc(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function ga(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function vS(e,t,i,a,u,m){var R=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var H=e.entanglements,K=e.expirationTimes,ie=e.hiddenUpdates;for(i=R&~i;0<i;){var oe=31-ws(i),_e=1<<oe;H[oe]=0,K[oe]=-1;var te=ie[oe];if(te!==null)for(ie[oe]=null,oe=0;oe<te.length;oe++){var ae=te[oe];ae!==null&&(ae.lane&=-536870913)}i&=~_e}a!==0&&jm(e,a,0),m!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=m&~(R&~t))}function jm(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-ws(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|i&261930}function Tm(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var a=31-ws(i),u=1<<a;u&t|e[a]&t&&(e[a]|=t),i&=~u}}function km(e,t){var i=t&-t;return i=(i&42)!==0?1:Gc(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Yc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Rm(){var e=ge.p;return e!==0?e:(e=window.event,e===void 0?32:I_(e.type))}function Dm(e,t){var i=ge.p;try{return ge.p=e,t()}finally{ge.p=i}}var Si=Math.random().toString(36).slice(2),Vt="__reactFiber$"+Si,us="__reactProps$"+Si,ar="__reactContainer$"+Si,Am="__reactEvents$"+Si,_S="__reactListeners$"+Si,yS="__reactHandles$"+Si,Om="__reactResources$"+Si,va="__reactMarker$"+Si,Ll="__reactLoad$"+Si;function Ml(e){delete e[Vt],delete e[us],delete e[_S],delete e[yS]}function Tn(e){var t;if(t=e[Vt])return t;for(var i=e.parentNode;i;){if(t=i[ar]||i[Vt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=v_(e);e!==null;){if(i=e[Vt])return i;e=v_(e)}return t}e=i,i=e.parentNode}return null}function lr(e){if(e=e[Vt]||e[ar]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _a(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function or(e){var t=e[Om];return t||(t=e[Om]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[va]=!0}function Lm(e){e[Ll]=void 0}var Mm=new Set,Bm={};function kn(e,t){cr(e,t),cr(e+"Capture",t)}function cr(e,t){for(Bm[e]=t,e=0;e<t.length;e++)Mm.add(t[e])}var bS=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Im={},Hm={};function SS(e){return bi.call(Hm,e)?!0:bi.call(Im,e)?!1:bS.test(e)?Hm[e]=!0:(Im[e]=!0,!1)}var it=!1;function Um(){var e=it;return it=!1,e}function Bl(e,t,i){if(SS(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,i)}}function Il(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,i)}}function xi(e,t,i,a){if(a===null)e.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,a)}}function Cs(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xS(e,t,i){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var u=a.get,m=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(R){i=""+R,m.call(this,R)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return i},setValue:function(R){i=""+R},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zc(e){if(!e._valueTracker){var t=zm(e)?"checked":"value";e._valueTracker=xS(e,t,""+e[t])}}function $m(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),a="";return e&&(a=zm(e)?e.checked?"true":"false":e.value),e=a,e!==i?(t.setValue(e),!0):!1}var wS=/[\n"\\]/g;function Ls(e){return e.replace(wS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xc(e,t,i,a,u,m,R,H){e.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?e.type=R:e.removeAttribute("type"),t!=null?R==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cs(t)):e.value!==""+Cs(t)&&(e.value=""+Cs(t)):R!=="submit"&&R!=="reset"||e.removeAttribute("value"),t!=null?R==="number"&&e.value==t?Wc(e,Cs(e.value)):Wc(e,Cs(t)):i!=null?Wc(e,Cs(i)):a!=null&&e.removeAttribute("value"),u==null&&m!=null&&(e.defaultChecked=!!m),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?e.name=""+Cs(H):e.removeAttribute("name")}function Pm(e,t,i,a,u,m,R,H){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),t!=null||i!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){Zc(e);return}i=i!=null?""+Cs(i):"",t=t!=null?""+Cs(t):i,H||t===e.value||(e.value=t),e.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=H?e.checked:!!a,e.defaultChecked=!!a,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(e.name=R),Zc(e)}function Wc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function ur(e,t,i,a){if(e=e.options,t){t={};for(var u=0;u<i.length;u++)t["$"+i[u]]=!0;for(i=0;i<e.length;i++)u=t.hasOwnProperty("$"+e[i].value),e[i].selected!==u&&(e[i].selected=u),u&&a&&(e[i].defaultSelected=!0)}else{for(i=""+Cs(i),t=null,u=0;u<e.length;u++){if(e[u].value===i){e[u].selected=!0,a&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Fm(e,t,i){if(t!=null&&(t=""+Cs(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Cs(i):""}function Vm(e,t,i,a){if(t==null){if(a!=null){if(i!=null)throw Error(o(92));if(pe(a)){if(1<a.length)throw Error(o(93));a=a[0]}i=a}i==null&&(i=""),t=i}i=Cs(t),e.defaultValue=i,a=e.textContent,a===i&&a!==""&&a!==null&&(e.value=a),Zc(e)}function hr(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var CS=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function qm(e,t,i){var a=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,i):typeof i!="number"||i===0||CS.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Km(e,t,i){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,i!=null){for(var a in i)!i.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="",it=!0);for(var u in t)a=t[u],t.hasOwnProperty(u)&&i[u]!==a&&(qm(e,u,a),it=!0)}else for(var m in t)t.hasOwnProperty(m)&&qm(e,m,t[m])}function Qc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ES=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),NS=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hl(e){return NS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function li(){}var Jc=null;function eu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dr=null,fr=null;function Gm(e){var t=lr(e);if(t&&(e=t.stateNode)){var i=e[us]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Ls(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var a=i[t];if(a!==e&&a.form===e.form){var u=a[us]||null;if(!u)throw Error(o(90));Xc(a,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<i.length;t++)a=i[t],a.form===e.form&&$m(a)}break e;case"textarea":Fm(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&ur(e,!!i.multiple,t,!1)}}}var tu=!1;function Ym(e,t,i){if(tu)return e(t,i);tu=!0;try{var a=e(t);return a}finally{if(tu=!1,(dr!==null||fr!==null)&&(Uo(),dr&&(t=dr,e=fr,fr=dr=null,Gm(t),e)))for(t=0;t<e.length;t++)Gm(e[t])}}function ya(e,t){var i=e.stateNode;if(i===null)return null;var a=i[us]||null;if(a===null)return null;i=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(o(231,t,typeof i));return i}var wi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),su=!1;if(wi)try{var ba={};Object.defineProperty(ba,"passive",{get:function(){su=!0}}),window.addEventListener("test",ba,ba),window.removeEventListener("test",ba,ba)}catch{su=!1}var Ki=null,iu=null,Ul=null;function Zm(){if(Ul)return Ul;var e,t=iu,i=t.length,a,u="value"in Ki?Ki.value:Ki.textContent,m=u.length;for(e=0;e<i&&t[e]===u[e];e++);var R=i-e;for(a=1;a<=R&&t[i-a]===u[m-a];a++);return Ul=u.slice(e,1<a?1-a:void 0)}function zl(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 $l(){return!0}function Xm(){return!1}function rs(e){function t(i,a,u,m,R){this._reactName=i,this._targetInst=u,this.type=a,this.nativeEvent=m,this.target=R,this.currentTarget=null;for(var H in e)e.hasOwnProperty(H)&&(i=e[H],this[H]=i?i(m):m[H]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?$l:Xm,this.isPropagationStopped=Xm,this}return O(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=$l)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=$l)},persist:function(){},isPersistent:$l}),t}var Gi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pl=rs(Gi),Sa=O({},Gi,{view:0,detail:0}),jS=rs(Sa),nu,ru,xa,Fl=O({},Sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lu,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!==xa&&(xa&&e.type==="mousemove"?(nu=e.screenX-xa.screenX,ru=e.screenY-xa.screenY):ru=nu=0,xa=e),nu)},movementY:function(e){return"movementY"in e?e.movementY:ru}}),Wm=rs(Fl),TS=O({},Fl,{dataTransfer:0}),kS=rs(TS),RS=O({},Sa,{relatedTarget:0}),au=rs(RS),DS=O({},Gi,{animationName:0,elapsedTime:0,pseudoElement:0}),AS=rs(DS),OS=O({},Gi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),LS=rs(OS),MS=O({},Gi,{data:0}),Qm=rs(MS),BS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IS={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"},HS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function US(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=HS[e])?!!t[e]:!1}function lu(){return US}var zS=O({},Sa,{key:function(e){if(e.key){var t=BS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=zl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?IS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lu,charCode:function(e){return e.type==="keypress"?zl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$S=rs(zS),PS=O({},Fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jm=rs(PS),FS=O({},Gi,{submitter:0}),VS=rs(FS),qS=O({},Sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lu}),KS=rs(qS),GS=O({},Gi,{propertyName:0,elapsedTime:0,pseudoElement:0}),YS=rs(GS),ZS=O({},Fl,{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}),XS=rs(ZS),WS=O({},Gi,{newState:0,oldState:0,source:0}),QS=rs(WS),JS=[9,13,27,32],ou=wi&&"CompositionEvent"in window,wa=null;wi&&"documentMode"in document&&(wa=document.documentMode);var e1=wi&&"TextEvent"in window&&!wa,ep=wi&&(!ou||wa&&8<wa&&11>=wa),tp=" ",sp=!1;function ip(e,t){switch(e){case"keyup":return JS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function np(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mr=!1;function t1(e,t){switch(e){case"compositionend":return np(t);case"keypress":return t.which!==32?null:(sp=!0,tp);case"textInput":return e=t.data,e===tp&&sp?null:e;default:return null}}function s1(e,t){if(mr)return e==="compositionend"||!ou&&ip(e,t)?(e=Zm(),Ul=iu=Ki=null,mr=!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 ep&&t.locale!=="ko"?null:t.data;default:return null}}var i1={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 rp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!i1[e.type]:t==="textarea"}function ap(e,t,i,a){dr?fr?fr.push(a):fr=[a]:dr=a,t=qo(t,"onChange"),0<t.length&&(i=new Pl("onChange","change",null,i,a),e.push({event:i,listeners:t}))}var Ca=null,Ea=null;function n1(e){Gv(e,0)}function Vl(e){var t=_a(e);if($m(t))return e}function lp(e,t){if(e==="change")return t}var op=!1;if(wi){var cu;if(wi){var uu="oninput"in document;if(!uu){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),uu=typeof cp.oninput=="function"}cu=uu}else cu=!1;op=cu&&(!document.documentMode||9<document.documentMode)}function up(){Ca&&(Ca.detachEvent("onpropertychange",hp),Ea=Ca=null)}function hp(e){if(e.propertyName==="value"&&Vl(Ea)){var t=[];ap(t,Ea,e,eu(e)),Ym(n1,t)}}function r1(e,t,i){e==="focusin"?(up(),Ca=t,Ea=i,Ca.attachEvent("onpropertychange",hp)):e==="focusout"&&up()}function a1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vl(Ea)}function l1(e,t){if(e==="click")return Vl(t)}function o1(e,t){if(e==="input"||e==="change")return Vl(t)}function c1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Es=typeof Object.is=="function"?Object.is:c1;function Na(e,t){if(Es(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(a=0;a<i.length;a++){var u=i[a];if(!bi.call(t,u)||!Es(e[u],t[u]))return!1}return!0}function hu(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 dp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fp(e,t){var i=dp(e);e=0;for(var a;i;){if(i.nodeType===3){if(a=e+i.textContent.length,e<=t&&a>=t)return{node:i,offset:t-e};e=a}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=dp(i)}}function mp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?mp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function pp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hu(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=hu(e.document)}return t}function du(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var u1=wi&&"documentMode"in document&&11>=document.documentMode,pr=null,fu=null,ja=null,mu=!1;function gp(e,t,i){var a=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;mu||pr==null||pr!==hu(a)||(a=pr,"selectionStart"in a&&du(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),ja&&Na(ja,a)||(ja=a,a=qo(fu,"onSelect"),0<a.length&&(t=new Pl("onSelect","select",null,t,i),e.push({event:t,listeners:a}),t.target=pr)))}function Rn(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var gr={animationend:Rn("Animation","AnimationEnd"),animationiteration:Rn("Animation","AnimationIteration"),animationstart:Rn("Animation","AnimationStart"),transitionrun:Rn("Transition","TransitionRun"),transitionstart:Rn("Transition","TransitionStart"),transitioncancel:Rn("Transition","TransitionCancel"),transitionend:Rn("Transition","TransitionEnd")},pu={},vp={};wi&&(vp=document.createElement("div").style,"AnimationEvent"in window||(delete gr.animationend.animation,delete gr.animationiteration.animation,delete gr.animationstart.animation),"TransitionEvent"in window||delete gr.transitionend.transition);function Dn(e){if(pu[e])return pu[e];if(!gr[e])return e;var t=gr[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in vp)return pu[e]=t[i];return e}var _p=Dn("animationend"),yp=Dn("animationiteration"),bp=Dn("animationstart"),h1=Dn("transitionrun"),d1=Dn("transitionstart"),f1=Dn("transitioncancel"),Sp=Dn("transitionend"),xp=new Map,gu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");gu.push("scrollEnd");function Gs(e,t){xp.set(e,t),kn(t,[e])}var m1=0;function Ci(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Ws.identifierPrefix;var i=m1++;return e="_"+e+"t_"+i.toString(32)+"_",t.autoName=e}function wp(e){if(e==null||typeof e=="string")return e;var t=null,i=Br;if(i!==null)for(var a=0;a<i.length;a++){var u=e[i[a]];if(u!=null){if(u==="none")return"none";t=t==null?u:t+(" "+u)}}return t??e.default}function Ei(e,t){return e=wp(e),t=wp(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var ql=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ms=[],vr=0,vu=0;function Kl(){for(var e=vr,t=vu=vr=0;t<e;){var i=Ms[t];Ms[t++]=null;var a=Ms[t];Ms[t++]=null;var u=Ms[t];Ms[t++]=null;var m=Ms[t];if(Ms[t++]=null,a!==null&&u!==null){var R=a.pending;R===null?u.next=u:(u.next=R.next,R.next=u),a.pending=u}m!==0&&Cp(i,u,m)}}function Gl(e,t,i,a){Ms[vr++]=e,Ms[vr++]=t,Ms[vr++]=i,Ms[vr++]=a,vu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function _u(e,t,i,a){return Gl(e,t,i,a),Yl(e)}function An(e,t){return Gl(e,null,null,t),Yl(e)}function Cp(e,t,i){e.lanes|=i;var a=e.alternate;a!==null&&(a.lanes|=i);for(var u=!1,m=e.return;m!==null;)m.childLanes|=i,a=m.alternate,a!==null&&(a.childLanes|=i),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(u=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,u&&t!==null&&(u=31-ws(i),e=m.hiddenUpdates,a=e[u],a===null?e[u]=[t]:a.push(t),t.lane=i|536870912),m):null}function Yl(e){if(50<Za)throw Za=0,Ho=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var _r={};function p1(e,t,i,a){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hs(e,t,i,a){return new p1(e,t,i,a)}function yu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ni(e,t){var i=e.alternate;return i===null?(i=hs(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&1206910976,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Ep(e,t){e.flags&=1206910978;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Zl(e,t,i,a,u,m){var R=0;if(a=e,typeof a=="function")yu(a)&&(R=1);else if(typeof a=="string")R=Fx(e,i,Bt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(a){case F:return e=hs(31,i,t,u),e.elementType=F,e.lanes=m,e;case q:return On(i.children,u,m,t);case Y:R=8,u|=24;break;case P:return e=hs(12,i,t,u|2),e.elementType=P,e.lanes=m,e;case W:return e=hs(13,i,t,u),e.elementType=W,e.lanes=m,e;case I:return e=hs(19,i,t,u),e.elementType=I,e.lanes=m,e;case $:case z:return e=u|32,e=hs(30,i,t,e),e.elementType=z,e.lanes=m,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case he:R=10;break e;case Q:R=9;break e;case ne:R=11;break e;case A:R=14;break e;case B:R=16,a=null;break e}R=29,i=Error(o(130,e===null?"null":typeof e,"")),a=null}return t=hs(R,i,t,u),t.elementType=e,t.type=a,t.lanes=m,t}function On(e,t,i,a){return e=hs(7,e,a,t),e.lanes=i,e}function bu(e,t,i){return e=hs(6,e,null,t),e.lanes=i,e}function Np(e){var t=hs(18,null,null,0);return t.stateNode=e,t}function Su(e,t,i){return t=hs(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var jp=new WeakMap;function Bs(e,t){if(typeof e=="object"&&e!==null){var i=jp.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Ft(t)},jp.set(e,t),t)}return{value:e,source:t,stack:Ft(t)}}var yr=[],br=0,Xl=null,Ta=0,Is=[],Hs=0,Yi=null,oi=1,ci="";function ji(e,t){yr[br++]=Ta,yr[br++]=Xl,Xl=e,Ta=t}function Tp(e,t,i){Is[Hs++]=oi,Is[Hs++]=ci,Is[Hs++]=Yi,Yi=e;var a=oi;e=ci;var u=32-ws(a)-1;a&=~(1<<u),i+=1;var m=32-ws(t)+u;if(30<m){var R=u-u%5;m=(a&(1<<R)-1).toString(32),a>>=R,u-=R,oi=1<<32-ws(t)+u|i<<u|a,ci=m+e}else oi=1<<m|i<<u|a,ci=e}function Wl(e){e.return!==null&&(ji(e,1),Tp(e,1,0))}function xu(e){for(;e===Xl;)Xl=yr[--br],yr[br]=null,Ta=yr[--br],yr[br]=null;for(;e===Yi;)Yi=Is[--Hs],Is[Hs]=null,ci=Is[--Hs],Is[Hs]=null,oi=Is[--Hs],Is[Hs]=null}function kp(e,t){Is[Hs++]=oi,Is[Hs++]=ci,Is[Hs++]=Yi,oi=t.id,ci=t.overflow,Yi=e}var zt=null,mt=null,Fe=!1,Zi=null,Us=!1,wu=Error(o(519));function Xi(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ka(Bs(t,e)),wu}function Rp(e){var t=e.stateNode,i=e.type,a=e.memoizedProps;switch(t[Vt]=e,t[us]=a,i){case"dialog":Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":case"embed":Ye("load",t);break;case"video":case"audio":for(i=0;i<Wa.length;i++)Ye(Wa[i],t);break;case"source":Ye("error",t);break;case"img":case"image":case"link":Ye("error",t),Ye("load",t);break;case"details":Ye("toggle",t);break;case"input":Ye("invalid",t),Pm(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Ye("invalid",t);break;case"textarea":Ye("invalid",t),Vm(t,a.value,a.defaultValue,a.children)}i=a.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||a.suppressHydrationWarning===!0||Wv(t.textContent,i)?(a.popover!=null&&(Ye("beforetoggle",t),Ye("toggle",t)),a.onScroll!=null&&Ye("scroll",t),a.onScrollEnd!=null&&Ye("scrollend",t),a.onClick!=null&&(t.onclick=li),t=!0):t=!1,t||Xi(e,!0)}function Ql(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:Us=!1;return;case 27:case 3:Us=!0;return;default:zt=zt.return}}function Sr(e){if(e!==zt)return!1;if(!Fe)return Ql(e),Fe=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Jh(e.type,e.memoizedProps)),i=!i),i&&mt&&Xi(e),Ql(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=g_(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=g_(e)}else t===27?(t=mt,fn(e.type)?(e=od,od=null,mt=e):mt=t):mt=zt?$s(e.stateNode.nextSibling):null;return!0}function Ln(){mt=zt=null,Fe=!1}function Cu(){var e=Zi;return e!==null&&(ms===null?ms=e:ms.push.apply(ms,e),Zi=null),e}function ka(e){Zi===null?Zi=[e]:Zi.push(e)}var Eu=at(null),Mn=null,Ti=null;function Wi(e,t,i){Ke(Eu,t._currentValue),t._currentValue=i}function ki(e){e._currentValue=Eu.current,we(Eu)}function Jl(e,t,i){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===i)break;e=e.return}}function Nu(e,t,i,a){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var m=u.dependencies;if(m!==null){var R=u.child;m=m.firstContext;e:for(;m!==null;){var H=m;m=u;for(var K=0;K<t.length;K++)if(H.context===t[K]){m.lanes|=i,H=m.alternate,H!==null&&(H.lanes|=i),Jl(m.return,i,e),a||(R=null);break e}m=H.next}}else if(u.tag===18){if(R=u.return,R===null)throw Error(o(341));R.lanes|=i,m=R.alternate,m!==null&&(m.lanes|=i),Jl(R,i,e),R=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=i,R=u.alternate,R!==null&&(R.lanes|=i),Jl(u.return,i,e),R=u.child,R=R!==null?R.sibling:null):R=u.child;if(R!==null)R.return=u;else for(R=u;R!==null;){if(R===e){R=null;break}if(u=R.sibling,u!==null){u.return=R.return,R=u;break}R=R.return}u=R}}function Bn(e,t,i,a){e=null;for(var u=t,m=!1;u!==null;){if(!m){if((u.flags&524288)!==0)m=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var R=u.alternate;if(R===null)throw Error(o(387));if(R=R.memoizedProps,R!==null){var H=u.type;Es(u.pendingProps.value,R.value)||(e!==null?e.push(H):e=[H])}}else if(u===es.current){if(R=u.alternate,R===null)throw Error(o(387));R.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Kr):e=[Kr])}u=u.return}return e!==null&&Nu(t,e,i,a),t.flags|=262144,e!==null}function eo(e){for(e=e.firstContext;e!==null;){if(!Es(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function In(e){Mn=e,Ti=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Dp(Mn,e)}function to(e,t){return Mn===null&&In(e),Dp(e,t)}function Dp(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Ti===null){if(e===null)throw Error(o(308));Ti=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ti=Ti.next=t;return i}var g1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},v1=s.unstable_scheduleCallback,_1=s.unstable_NormalPriority,kt={$$typeof:he,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ju(){return{controller:new g1,data:new Map,refCount:0}}function Ra(e){e.refCount--,e.refCount===0&&v1(_1,function(){e.controller.abort()})}function Ap(e,t){if((e.pendingLanes&4194048)!==0){var i=e.transitionTypes;for(i===null&&(i=e.transitionTypes=[]),e=0;e<t.length;e++){var a=t[e];i.indexOf(a)===-1&&i.push(a)}}}var Da=null;function y1(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Aa=null,Tu=0,Hn=0,xr=null;function b1(e,t){if(Aa===null){var i=Aa=[];Tu=0,Hn=Vh(),xr={status:"pending",value:void 0,then:function(a){i.push(a)}}}return Tu++,t.then(Op,Op),t}function Op(){if(--Tu===0&&(Da=null,Aa!==null)){xr!==null&&(xr.status="fulfilled");var e=Aa;Aa=null,Hn=0,xr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function S1(e,t){var i=[],a={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var u=0;u<i.length;u++)(0,i[u])(t)},function(u){for(a.status="rejected",a.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),a}var Lp=me.S;me.S=function(e,t){if(Nv=ns(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&b1(e,t),Da!==null)for(var i=zr;i!==null;)Ap(i,Da),i=i.next;if(i=e.types,i!==null){for(var a=zr;a!==null;)Ap(a,i),a=a.next;if(Hn!==0){a=Da,a===null&&(a=Da=[]);for(var u=0;u<i.length;u++){var m=i[u];a.indexOf(m)===-1&&a.push(m)}}}Lp!==null&&Lp(e,t)};var Un=at(null);function ku(){var e=Un.current;return e!==null?e:ft.pooledCache}function so(e,t){t===null?Ke(Un,Un.current):Ke(Un,t.pool)}function Mp(){var e=ku();return e===null?null:{parent:kt._currentValue,pool:e}}var wr=Error(o(460)),Ru=Error(o(474)),io=Error(o(542)),no={then:function(){}};function Bp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ip(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(li,li),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Up(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(li,li);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=a}},function(a){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Up(e),e}throw $n=t,wr}}function zn(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?($n=i,wr):i}}var $n=null;function Hp(){if($n===null)throw Error(o(459));var e=$n;return $n=null,e}function Up(e){if(e===wr||e===io)throw Error(o(483))}var Cr=null,Oa=0;function ro(e){var t=Oa;return Oa+=1,Cr===null&&(Cr=[]),Ip(Cr,e,t)}function Qi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ao(e,t){throw t.$$typeof===k?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function zp(e){function t(se,X){if(e){var re=se.deletions;re===null?(se.deletions=[X],se.flags|=16):re.push(X)}}function i(se,X){if(!e)return null;for(;X!==null;)t(se,X),X=X.sibling;return null}function a(se){for(var X=new Map;se!==null;)se.key===null?X.set(se.index,se):X.set(se.key,se),se=se.sibling;return X}function u(se,X){return se=Ni(se,X),se.index=0,se.sibling=null,se}function m(se,X,re){return se.index=re,e?(re=se.alternate,re!==null?(re=re.index,re<X?(se.flags|=2,X):re):(se.flags|=134217730,X)):(se.flags|=1048576,X)}function R(se){return e&&se.alternate===null&&(se.flags|=134217730),se}function H(se,X,re,ve){return X===null||X.tag!==6?(X=bu(re,se.mode,ve),X.return=se,X):(X=u(X,re),X.return=se,X)}function K(se,X,re,ve){var Ce=re.type;return Ce===q?(se=oe(se,X,re.props.children,ve,re.key),Qi(se,re),se):X!==null&&(X.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&zn(Ce)===X.type)?(X=u(X,re.props),Qi(X,re),X.return=se,X):(X=Zl(re.type,re.key,re.props,null,se.mode,ve),Qi(X,re),X.return=se,X)}function ie(se,X,re,ve){return X===null||X.tag!==4||X.stateNode.containerInfo!==re.containerInfo||X.stateNode.implementation!==re.implementation?(X=Su(re,se.mode,ve),X.return=se,X):(X=u(X,re.children||[]),X.return=se,X)}function oe(se,X,re,ve,Ce){return X===null||X.tag!==7?(X=On(re,se.mode,ve,Ce),X.return=se,X):(X=u(X,re),X.return=se,X)}function _e(se,X,re){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=bu(""+X,se.mode,re),X.return=se,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case L:return re=Zl(X.type,X.key,X.props,null,se.mode,re),Qi(re,X),re.return=se,re;case V:return X=Su(X,se.mode,re),X.return=se,X;case B:return X=zn(X),_e(se,X,re)}if(pe(X)||Z(X))return X=On(X,se.mode,re,null),X.return=se,X;if(typeof X.then=="function")return _e(se,ro(X),re);if(X.$$typeof===he)return _e(se,to(se,X),re);ao(se,X)}return null}function te(se,X,re,ve){var Ce=X!==null?X.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Ce!==null?null:H(se,X,""+re,ve);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case L:return re.key===Ce?K(se,X,re,ve):null;case V:return re.key===Ce?ie(se,X,re,ve):null;case B:return re=zn(re),te(se,X,re,ve)}if(pe(re)||Z(re))return Ce!==null?null:oe(se,X,re,ve,null);if(typeof re.then=="function")return te(se,X,ro(re),ve);if(re.$$typeof===he)return te(se,X,to(se,re),ve);ao(se,re)}return null}function ae(se,X,re,ve,Ce){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return se=se.get(re)||null,H(X,se,""+ve,Ce);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case L:return se=se.get(ve.key===null?re:ve.key)||null,K(X,se,ve,Ce);case V:return se=se.get(ve.key===null?re:ve.key)||null,ie(X,se,ve,Ce);case B:return ve=zn(ve),ae(se,X,re,ve,Ce)}if(pe(ve)||Z(ve))return se=se.get(re)||null,oe(X,se,ve,Ce,null);if(typeof ve.then=="function")return ae(se,X,re,ro(ve),Ce);if(ve.$$typeof===he)return ae(se,X,re,to(X,ve),Ce);ao(X,ve)}return null}function be(se,X,re,ve){for(var Ce=null,Xe=null,Te=X,Ae=X=0,At=null;Te!==null&&Ae<re.length;Ae++){Te.index>Ae?(At=Te,Te=null):At=Te.sibling;var Je=te(se,Te,re[Ae],ve);if(Je===null){Te===null&&(Te=At);break}e&&Te&&Je.alternate===null&&t(se,Te),X=m(Je,X,Ae),Xe===null?Ce=Je:Xe.sibling=Je,Xe=Je,Te=At}if(Ae===re.length)return i(se,Te),Fe&&ji(se,Ae),Ce;if(Te===null){for(;Ae<re.length;Ae++)Te=_e(se,re[Ae],ve),Te!==null&&(X=m(Te,X,Ae),Xe===null?Ce=Te:Xe.sibling=Te,Xe=Te);return Fe&&ji(se,Ae),Ce}for(Te=a(Te);Ae<re.length;Ae++)At=ae(Te,se,Ae,re[Ae],ve),At!==null&&(e&&(Je=At.alternate,Je!==null&&Te.delete(Je.key===null?Ae:Je.key)),X=m(At,X,Ae),Xe===null?Ce=At:Xe.sibling=At,Xe=At);return e&&Te.forEach(function(_n){return t(se,_n)}),Fe&&ji(se,Ae),Ce}function Ne(se,X,re,ve){if(re==null)throw Error(o(151));for(var Ce=null,Xe=null,Te=X,Ae=X=0,At=null,Je=re.next();Te!==null&&!Je.done;Ae++,Je=re.next()){Te.index>Ae?(At=Te,Te=null):At=Te.sibling;var _n=te(se,Te,Je.value,ve);if(_n===null){Te===null&&(Te=At);break}e&&Te&&_n.alternate===null&&t(se,Te),X=m(_n,X,Ae),Xe===null?Ce=_n:Xe.sibling=_n,Xe=_n,Te=At}if(Je.done)return i(se,Te),Fe&&ji(se,Ae),Ce;if(Te===null){for(;!Je.done;Ae++,Je=re.next())Je=_e(se,Je.value,ve),Je!==null&&(X=m(Je,X,Ae),Xe===null?Ce=Je:Xe.sibling=Je,Xe=Je);return Fe&&ji(se,Ae),Ce}for(Te=a(Te);!Je.done;Ae++,Je=re.next())Je=ae(Te,se,Ae,Je.value,ve),Je!==null&&(e&&(At=Je.alternate,At!==null&&Te.delete(At.key===null?Ae:At.key)),X=m(Je,X,Ae),Xe===null?Ce=Je:Xe.sibling=Je,Xe=Je);return e&&Te.forEach(function(tw){return t(se,tw)}),Fe&&ji(se,Ae),Ce}function ze(se,X,re,ve){if(typeof re=="object"&&re!==null&&re.type===q&&re.key===null&&re.props.ref===void 0&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case L:e:{for(var Ce=re.key;X!==null;){if(X.key===Ce){if(Ce=re.type,Ce===q){if(X.tag===7){i(se,X.sibling),ve=u(X,re.props.children),Qi(ve,re),ve.return=se,se=ve;break e}}else if(X.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&zn(Ce)===X.type){i(se,X.sibling),ve=u(X,re.props),Qi(ve,re),ve.return=se,se=ve;break e}i(se,X);break}else t(se,X);X=X.sibling}re.type===q?(ve=On(re.props.children,se.mode,ve,re.key),Qi(ve,re),ve.return=se,se=ve):(ve=Zl(re.type,re.key,re.props,null,se.mode,ve),Qi(ve,re),ve.return=se,se=ve)}return R(se);case V:e:{for(Ce=re.key;X!==null;){if(X.key===Ce)if(X.tag===4&&X.stateNode.containerInfo===re.containerInfo&&X.stateNode.implementation===re.implementation){i(se,X.sibling),ve=u(X,re.children||[]),ve.return=se,se=ve;break e}else{i(se,X);break}else t(se,X);X=X.sibling}ve=Su(re,se.mode,ve),ve.return=se,se=ve}return R(se);case B:return re=zn(re),ze(se,X,re,ve)}if(pe(re))return be(se,X,re,ve);if(Z(re)){if(Ce=Z(re),typeof Ce!="function")throw Error(o(150));return re=Ce.call(re),Ne(se,X,re,ve)}if(typeof re.then=="function")return ze(se,X,ro(re),ve);if(re.$$typeof===he)return ze(se,X,to(se,re),ve);ao(se,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,X!==null&&X.tag===6?(i(se,X.sibling),ve=u(X,re),ve.return=se,se=ve):(i(se,X),ve=bu(re,se.mode,ve),ve.return=se,se=ve),R(se)):i(se,X)}return function(se,X,re,ve){try{Oa=0;var Ce=ze(se,X,re,ve);return Cr=null,Ce}catch(Te){if(Te===wr||Te===io)throw Te;var Xe=hs(29,Te,null,se.mode);return Xe.lanes=ve,Xe.return=se,Xe}}}var Pn=zp(!0),$p=zp(!1),Ji=!1;function Du(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Au(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function en(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function tn(e,t,i){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(nt&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=Yl(e),Cp(e,null,i),t}return Gl(e,a,t,i),Yl(e)}function La(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,i|=a,t.lanes=i,Tm(e,i)}}function Ou(e,t){var i=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,i===a)){var u=null,m=null;if(i=i.firstBaseUpdate,i!==null){do{var R={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};m===null?u=m=R:m=m.next=R,i=i.next}while(i!==null);m===null?u=m=t:m=m.next=t}else u=m=t;i={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:m,shared:a.shared,callbacks:a.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Lu=!1;function Ma(){if(Lu){var e=xr;if(e!==null)throw e}}function Ba(e,t,i,a){Lu=!1;var u=e.updateQueue;Ji=!1;var m=u.firstBaseUpdate,R=u.lastBaseUpdate,H=u.shared.pending;if(H!==null){u.shared.pending=null;var K=H,ie=K.next;K.next=null,R===null?m=ie:R.next=ie,R=K;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,H=oe.lastBaseUpdate,H!==R&&(H===null?oe.firstBaseUpdate=ie:H.next=ie,oe.lastBaseUpdate=K))}if(m!==null){var _e=u.baseState;R=0,oe=ie=K=null,H=m;do{var te=H.lane&-536870913,ae=te!==H.lane;if(ae?(Ze&te)===te:(a&te)===te){te!==0&&te===Hn&&(Lu=!0),oe!==null&&(oe=oe.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var be=e,Ne=H;te=t;var ze=i;switch(Ne.tag){case 1:if(be=Ne.payload,typeof be=="function"){_e=be.call(ze,_e,te);break e}_e=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ne.payload,te=typeof be=="function"?be.call(ze,_e,te):be,te==null)break e;_e=O({},_e,te);break e;case 2:Ji=!0}}te=H.callback,te!==null&&(e.flags|=64,ae&&(e.flags|=8192),ae=u.callbacks,ae===null?u.callbacks=[te]:ae.push(te))}else ae={lane:te,tag:H.tag,payload:H.payload,callback:H.callback,next:null},oe===null?(ie=oe=ae,K=_e):oe=oe.next=ae,R|=te;if(H=H.next,H===null){if(H=u.shared.pending,H===null)break;ae=H,H=ae.next,ae.next=null,u.lastBaseUpdate=ae,u.shared.pending=null}}while(!0);oe===null&&(K=_e),u.baseState=K,u.firstBaseUpdate=ie,u.lastBaseUpdate=oe,m===null&&(u.shared.lanes=0),cn|=R,e.lanes=R,e.memoizedState=_e}}function Pp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Fp(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Pp(i[e],t)}var sn=at(null),lo=at(0);function Vp(e,t){e=Li,Ke(lo,e),Ke(sn,t),Li=e|t.baseLanes}function Mu(){Ke(lo,Li),Ke(sn,sn.current)}function Bu(){Li=lo.current,we(sn),we(lo)}var Kt=at(null),ts=null;function nn(e){var t=e.alternate;Ke(Gt,Gt.current&1),Ke(Kt,e),ts===null&&(t===null||sn.current!==null||t.memoizedState!==null)&&(ts=e)}function Iu(e){Ke(Gt,Gt.current),Ke(Kt,e),ts===null&&(ts=e)}function qp(e){e.tag===22?(Ke(Gt,Gt.current),Ke(Kt,e),ts===null&&(ts=e)):rn()}function rn(){Ke(Gt,Gt.current),Ke(Kt,Kt.current)}function Ns(e){we(Kt),ts===e&&(ts=null),we(Gt)}var Gt=at(0);function Ia(e,t){Ke(Kt,Kt.current),Ke(Gt,t)}function Hu(e){we(Gt),we(Kt),ts===e&&(ts=null)}function oo(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||ad(i)||ld(i)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)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 Ri=0,Ue=null,ht=null,Rt=null,co=!1,Er=!1,Fn=!1,uo=0,Ha=0,Nr=null,x1=0;function Ct(){throw Error(o(321))}function Uu(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Es(e[i],t[i]))return!1;return!0}function zu(e,t,i,a,u,m){return Ri=m,Ue=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,me.H=e===null||e.memoizedState===null?Tg:kg,Fn=!1,m=i(a,u),Fn=!1,Er&&(m=Gp(t,i,a,u)),Kp(e),m}function Kp(e){me.H=_o;var t=ht!==null&&ht.next!==null;if(Ri=0,Rt=ht=Ue=null,co=!1,Ha=0,Nr=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&eo(e)&&(Dt=!0))}function Gp(e,t,i,a){Ue=e;var u=0;do{if(Er&&(Nr=null),Ha=0,Er=!1,25<=u)throw Error(o(301));if(u+=1,Rt=ht=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}me.H=R1,m=t(i,a)}while(Er);return m}function w1(){var e=me.H,t=e.useState()[0];return t=typeof t.then=="function"?Ua(t):t,e=e.useState()[0],(ht!==null?ht.memoizedState:null)!==e&&(Ue.flags|=1024),t}function $u(){var e=uo!==0;return uo=0,e}function Pu(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fu(e){if(co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}co=!1}Ri=0,Rt=ht=Ue=null,Er=!1,Ha=uo=0,Nr=null}function as(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Ue.memoizedState=Rt=e:Rt=Rt.next=e,Rt}function Tt(){if(ht===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var t=Rt===null?Ue.memoizedState:Rt.next;if(t!==null)Rt=t,ht=e;else{if(e===null)throw Ue.alternate===null?Error(o(467)):Error(o(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},Rt===null?Ue.memoizedState=Rt=e:Rt=Rt.next=e}return Rt}function ho(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ua(e){var t=Ha;return Ha+=1,Nr===null&&(Nr=[]),e=Ip(Nr,e,t),t=Ue,(Rt===null?t.memoizedState:Rt.next)===null&&(t=t.alternate,me.H=t===null||t.memoizedState===null?Tg:kg),e}function fo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ua(e);if(e.$$typeof===ee)return;if(e.$$typeof===he)return qt(e)}throw Error(o(438,String(e)))}function Vu(e){var t=null,i=Ue.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var a=Ue.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=ho(),Ue.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),a=0;a<e;a++)i[a]=J;return t.index++,i}function Di(e,t){return typeof t=="function"?t(e):t}function mo(e){var t=Tt();return qu(t,ht,e)}function qu(e,t,i){var a=e.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=i;var u=e.baseQueue,m=a.pending;if(m!==null){if(u!==null){var R=u.next;u.next=m.next,m.next=R}t.baseQueue=u=m,a.pending=null}if(m=e.baseState,u===null)e.memoizedState=m;else{t=u.next;var H=R=null,K=null,ie=t,oe=!1;do{var _e=ie.lane&-536870913;if(_e!==ie.lane?(Ze&_e)===_e:(Ri&_e)===_e){var te=ie.revertLane;if(te===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),_e===Hn&&(oe=!0);else if((Ri&te)===te){ie=ie.next,te===Hn&&(oe=!0);continue}else _e={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(H=K=_e,R=m):K=K.next=_e,Ue.lanes|=te,cn|=te;_e=ie.action,Fn&&i(m,_e),m=ie.hasEagerState?ie.eagerState:i(m,_e)}else te={lane:_e,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(H=K=te,R=m):K=K.next=te,Ue.lanes|=_e,cn|=_e;ie=ie.next}while(ie!==null&&ie!==t);if(K===null?R=m:K.next=H,!Es(m,e.memoizedState)&&(Dt=!0,oe&&(i=xr,i!==null)))throw i;e.memoizedState=m,e.baseState=R,e.baseQueue=K,a.lastRenderedState=m}return u===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Ku(e){var t=Tt(),i=t.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=e;var a=i.dispatch,u=i.pending,m=t.memoizedState;if(u!==null){i.pending=null;var R=u=u.next;do m=e(m,R.action),R=R.next;while(R!==u);Es(m,t.memoizedState)||(Dt=!0),t.memoizedState=m,t.baseQueue===null&&(t.baseState=m),i.lastRenderedState=m}return[m,a]}function Yp(e,t,i){var a=Ue,u=Tt(),m=Fe;if(m){if(i===void 0)throw Error(o(407));i=i()}else i=t();var R=!Es((ht||u).memoizedState,i);if(R&&(u.memoizedState=i,Dt=!0),u=u.queue,Zu(Wp.bind(null,a,u,e),[e]),e=u.getSnapshot!==t||R||Rt!==null&&(Rt.memoizedState.tag&1)!==0,jr(e?9:8,{destroy:void 0},Xp.bind(null,a,u,i,t),null),e){if(a.flags|=2048,ft===null)throw Error(o(349));m||(Ri&127)!==0||Zp(a,t,i)}return i}function Zp(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ue.updateQueue,t===null?(t=ho(),Ue.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Xp(e,t,i,a){t.value=i,t.getSnapshot=a,Qp(t)&&Jp(e)}function Wp(e,t,i){return i(function(){Qp(t)&&Jp(e)})}function Qp(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Es(e,i)}catch{return!0}}function Jp(e){var t=An(e,2);t!==null&&ps(t,e,2)}function Gu(e){var t=as();if(typeof e=="function"){var i=e;if(e=i(),Fn){qi(!0);try{i()}finally{qi(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:e},t}function eg(e,t,i,a){return e.baseState=i,qu(e,ht,typeof a=="function"?a:Di)}function C1(e,t,i,a,u){if(vo(e))throw Error(o(485));if(e=t.action,e!==null){var m={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){m.listeners.push(R)}};me.T!==null?i(!0):m.isTransition=!1,a(m),i=t.pending,i===null?(m.next=t.pending=m,tg(t,m)):(m.next=i.next,t.pending=i.next=m)}}function tg(e,t){var i=t.action,a=t.payload,u=e.state;if(t.isTransition){var m=me.T,R={};R.types=m!==null?m.types:null,me.T=R;try{var H=i(u,a),K=me.S;K!==null&&K(R,H),sg(e,t,H)}catch(ie){Yu(e,t,ie)}finally{m!==null&&R.types!==null&&(m.types=R.types),me.T=m}}else try{m=i(u,a),sg(e,t,m)}catch(ie){Yu(e,t,ie)}}function sg(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(a){ig(e,t,a)},function(a){return Yu(e,t,a)}):ig(e,t,i)}function ig(e,t,i){t.status="fulfilled",t.value=i,ng(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,tg(e,i)))}function Yu(e,t,i){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=i,ng(t),t=t.next;while(t!==a)}e.action=null}function ng(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function rg(e,t){return t}function ag(e,t){if(Fe){var i=ft.formState;if(i!==null){e:{var a=Ue;if(Fe){if(mt){t:{for(var u=mt,m=Us;u.nodeType!==8;){if(!m){u=null;break t}if(u=$s(u.nextSibling),u===null){u=null;break t}}m=u.data,u=m==="F!"||m==="F"?u:null}if(u){mt=$s(u.nextSibling),a=u.data==="F!";break e}}Xi(a)}a=!1}a&&(t=i[0])}}return i=as(),i.memoizedState=i.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rg,lastRenderedState:t},i.queue=a,i=Eg.bind(null,Ue,a),a.dispatch=i,a=Gu(!1),m=eh.bind(null,Ue,!1,a.queue),a=as(),u={state:t,dispatch:null,action:e,pending:null},a.queue=u,i=C1.bind(null,Ue,u,m,i),u.dispatch=i,a.memoizedState=e,[t,i,!1]}function lg(e){var t=Tt();return og(t,ht,e)}function og(e,t,i){if(t=qu(e,t,rg)[0],e=mo(Di)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ua(t)}catch(R){throw R===wr?io:R}else a=t;t=Tt();var u=t.queue,m=u.dispatch;return i!==t.memoizedState&&(Ue.flags|=2048,jr(9,{destroy:void 0},E1.bind(null,u,i),null)),[a,m,e]}function E1(e,t){e.action=t}function cg(e){var t=Tt(),i=ht;if(i!==null)return og(t,i,e);Tt(),t=t.memoizedState,i=Tt();var a=i.queue.dispatch;return i.memoizedState=e,[t,a,!1]}function jr(e,t,i,a){return e={tag:e,create:i,deps:a,inst:t,next:null},t=Ue.updateQueue,t===null&&(t=ho(),Ue.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(a=i.next,i.next=e,e.next=a,t.lastEffect=e),e}function ug(){return Tt().memoizedState}function po(e,t,i,a){var u=as();Ue.flags|=e,u.memoizedState=jr(1|t,{destroy:void 0},i,a===void 0?null:a)}function go(e,t,i,a){var u=Tt();a=a===void 0?null:a;var m=u.memoizedState.inst;ht!==null&&a!==null&&Uu(a,ht.memoizedState.deps)?u.memoizedState=jr(t,m,i,a):(Ue.flags|=e,u.memoizedState=jr(1|t,m,i,a))}function hg(e,t){po(8390656,8,e,t)}function Zu(e,t){go(2048,8,e,t)}function N1(e){Ue.flags|=4;var t=Ue.updateQueue;if(t===null)t=ho(),Ue.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function dg(e){var t=Tt().memoizedState;return N1({ref:t,nextImpl:e}),function(){if((nt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function fg(e,t){return go(4,2,e,t)}function mg(e,t){return go(4,4,e,t)}function pg(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function gg(e,t,i){i=i!=null?i.concat([e]):null,go(4,4,pg.bind(null,t,e),i)}function Xu(){}function vg(e,t){var i=Tt();t=t===void 0?null:t;var a=i.memoizedState;return t!==null&&Uu(t,a[1])?a[0]:(i.memoizedState=[e,t],e)}function _g(e,t){var i=Tt();t=t===void 0?null:t;var a=i.memoizedState;if(t!==null&&Uu(t,a[1]))return a[0];if(a=e(),Fn){qi(!0);try{e()}finally{qi(!1)}}return i.memoizedState=[a,t],a}function Wu(e,t,i){return i===void 0||(Ri&1073741824)!==0&&(Ze&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Tv(),Ue.lanes|=e,cn|=e,i)}function yg(e,t,i,a){return Es(i,t)?i:sn.current!==null?(e=Wu(e,i,a),Es(e,t)||(Dt=!0),e):(Ri&106)===0||(Ri&1073741824)!==0&&(Ze&261930)===0?(Dt=!0,e.memoizedState=i):(e=Tv(),Ue.lanes|=e,cn|=e,t)}function bg(e,t,i,a,u){var m=ge.p;ge.p=m!==0&&8>m?m:8;var R=me.T,H={};H.types=R!==null?R.types:null,me.T=H,eh(e,!1,t,i);try{var K=u(),ie=me.S;if(ie!==null&&ie(H,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var oe=S1(K,a);za(e,t,oe,Rs(e))}else za(e,t,a,Rs(e))}catch(_e){za(e,t,{then:function(){},status:"rejected",reason:_e},Rs())}finally{ge.p=m,R!==null&&H.types!==null&&(R.types=H.types),me.T=R}}function j1(){}function Qu(e,t,i,a){if(e.tag!==5)throw Error(o(476));var u=Sg(e).queue;bg(e,u,t,Re,i===null?j1:function(){return xg(e),i(a)})}function Sg(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Re,baseState:Re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:Re},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xg(e){var t=Sg(e);t.next===null&&(t=e.alternate.memoizedState),za(e,t.next.queue,{},Rs())}function Ju(){return qt(Kr)}function wg(){return Tt().memoizedState}function Cg(){return Tt().memoizedState}function T1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Rs();e=en(i);var a=tn(t,e,i);a!==null&&(ps(a,t,i),La(a,t,i)),t={cache:ju()},e.payload=t;return}t=t.return}}function k1(e,t,i){var a=Rs();i={lane:a,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},vo(e)?Ng(t,i):(i=_u(e,t,i,a),i!==null&&(ps(i,e,a),jg(i,t,a)))}function Eg(e,t,i){var a=Rs();za(e,t,i,a)}function za(e,t,i,a){var u={lane:a,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(vo(e))Ng(t,u);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var R=t.lastRenderedState,H=m(R,i);if(u.hasEagerState=!0,u.eagerState=H,Es(H,R))return Gl(e,t,u,0),ft===null&&Kl(),!1}catch{}if(i=_u(e,t,u,a),i!==null)return ps(i,e,a),jg(i,t,a),!0}return!1}function eh(e,t,i,a){if(a={lane:2,revertLane:Vh(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},vo(e)){if(t)throw Error(o(479))}else t=_u(e,i,a,2),t!==null&&ps(t,e,2)}function vo(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function Ng(e,t){Er=co=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function jg(e,t,i){if((i&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,i|=a,t.lanes=i,Tm(e,i)}}var _o={readContext:qt,use:fo,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct,useEffectEvent:Ct},Tg={readContext:qt,use:fo,useCallback:function(e,t){return as().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:hg,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,po(4194308,4,pg.bind(null,t,e),i)},useLayoutEffect:function(e,t){return po(4194308,4,e,t)},useInsertionEffect:function(e,t){po(4,2,e,t)},useMemo:function(e,t){var i=as();t=t===void 0?null:t;var a=e();if(Fn){qi(!0);try{e()}finally{qi(!1)}}return i.memoizedState=[a,t],a},useReducer:function(e,t,i){var a=as();if(i!==void 0){var u=i(t);if(Fn){qi(!0);try{i(t)}finally{qi(!1)}}}else u=t;return a.memoizedState=a.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},a.queue=e,e=e.dispatch=k1.bind(null,Ue,e),[a.memoizedState,e]},useRef:function(e){var t=as();return e={current:e},t.memoizedState=e},useState:function(e){e=Gu(e);var t=e.queue,i=Eg.bind(null,Ue,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Xu,useDeferredValue:function(e,t){var i=as();return Wu(i,e,t)},useTransition:function(){var e=Gu(!1);return e=bg.bind(null,Ue,e.queue,!0,!1),as().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var a=Ue,u=as();if(Fe){if(i===void 0)throw Error(o(407));i=i()}else{if(i=t(),ft===null)throw Error(o(349));(Ze&127)!==0||Zp(a,t,i)}u.memoizedState=i;var m={value:i,getSnapshot:t};return u.queue=m,hg(Wp.bind(null,a,m,e),[e]),a.flags|=2048,jr(9,{destroy:void 0},Xp.bind(null,a,m,i,t),null),i},useId:function(){var e=as(),t=ft.identifierPrefix;if(Fe){var i=ci,a=oi;i=(a&~(1<<32-ws(a)-1)).toString(32)+i,t="_"+t+"R_"+i,i=uo++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=x1++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ju,useFormState:ag,useActionState:ag,useOptimistic:function(e){var t=as();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=eh.bind(null,Ue,!0,i),i.dispatch=t,[e,t]},useMemoCache:Vu,useCacheRefresh:function(){return as().memoizedState=T1.bind(null,Ue)},useEffectEvent:function(e){var t=as(),i={impl:e};return t.memoizedState=i,function(){if((nt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},kg={readContext:qt,use:fo,useCallback:vg,useContext:qt,useEffect:Zu,useImperativeHandle:gg,useInsertionEffect:fg,useLayoutEffect:mg,useMemo:_g,useReducer:mo,useRef:ug,useState:function(){return mo(Di)},useDebugValue:Xu,useDeferredValue:function(e,t){var i=Tt();return yg(i,ht.memoizedState,e,t)},useTransition:function(){var e=mo(Di)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ua(e),t]},useSyncExternalStore:Yp,useId:wg,useHostTransitionStatus:Ju,useFormState:lg,useActionState:lg,useOptimistic:function(e,t){var i=Tt();return eg(i,ht,e,t)},useMemoCache:Vu,useCacheRefresh:Cg,useEffectEvent:dg},R1={readContext:qt,use:fo,useCallback:vg,useContext:qt,useEffect:Zu,useImperativeHandle:gg,useInsertionEffect:fg,useLayoutEffect:mg,useMemo:_g,useReducer:Ku,useRef:ug,useState:function(){return Ku(Di)},useDebugValue:Xu,useDeferredValue:function(e,t){var i=Tt();return ht===null?Wu(i,e,t):yg(i,ht.memoizedState,e,t)},useTransition:function(){var e=Ku(Di)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ua(e),t]},useSyncExternalStore:Yp,useId:wg,useHostTransitionStatus:Ju,useFormState:cg,useActionState:cg,useOptimistic:function(e,t){var i=Tt();return ht!==null?eg(i,ht,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Vu,useCacheRefresh:Cg,useEffectEvent:dg};function th(e,t,i,a){t=e.memoizedState,i=i(a,t),i=i==null?t:O({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var sh={enqueueSetState:function(e,t,i){e=e._reactInternals;var a=Rs(),u=en(a);u.payload=t,i!=null&&(u.callback=i),t=tn(e,u,a),t!==null&&(ps(t,e,a),La(t,e,a))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var a=Rs(),u=en(a);u.tag=1,u.payload=t,i!=null&&(u.callback=i),t=tn(e,u,a),t!==null&&(ps(t,e,a),La(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Rs(),a=en(i);a.tag=2,t!=null&&(a.callback=t),t=tn(e,a,i),t!==null&&(ps(t,e,i),La(t,e,i))}};function Rg(e,t,i,a,u,m,R){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,m,R):t.prototype&&t.prototype.isPureReactComponent?!Na(i,a)||!Na(u,m):!0}function Dg(e,t,i,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,a),t.state!==e&&sh.enqueueReplaceState(t,t.state,null)}function Vn(e,t){var i=t;if("ref"in t){i={};for(var a in t)a!=="ref"&&(i[a]=t[a])}if(e=e.defaultProps){i===t&&(i=O({},i));for(var u in e)i[u]===void 0&&(i[u]=e[u])}return i}function Ag(e){ql(e)}function Og(e){console.error(e)}function Lg(e){ql(e)}function yo(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Mg(e,t,i){try{var a=e.onCaughtError;a(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function ih(e,t,i){return i=en(i),i.tag=3,i.payload={element:null},i.callback=function(){yo(e,t)},i}function Bg(e){return e=en(e),e.tag=3,e}function Ig(e,t,i,a){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var m=a.value;e.payload=function(){return u(m)},e.callback=function(){Mg(t,i,a)}}var R=i.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(e.callback=function(){Mg(t,i,a),typeof u!="function"&&(un===null?un=new Set([this]):un.add(this));var H=a.stack;this.componentDidCatch(a.value,{componentStack:H!==null?H:""})})}function D1(e,t,i,a,u){if(i.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=i.alternate,t!==null&&Bn(t,i,u,!0),i=Kt.current,i!==null){switch(i.tag){case 31:case 13:case 19:return ts===null?zo():i.alternate===null&&Et===0&&(Et=3),i.flags&=-257,i.flags|=65536,i.lanes=u,a===no?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([a]):t.add(a),$h(e,a,u)),!1;case 22:return i.flags|=65536,a===no?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([a]):i.add(a)),$h(e,a,u)),!1}throw Error(o(435,i.tag))}return $h(e,a,u),zo(),!1}if(Fe)return t=Kt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,a!==wu&&(e=Error(o(422),{cause:a}),ka(Bs(e,i)))):(a!==wu&&(t=Error(o(423),{cause:a}),ka(Bs(t,i))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,a=Bs(a,i),u=ih(e.stateNode,a,u),Ou(e,u),Et!==4&&(Et=2)),!1;var m=Error(o(520),{cause:a});if(m=Bs(m,i),Ya===null?Ya=[m]:Ya.push(m),Et!==4&&(Et=2),t===null)return!0;a=Bs(a,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=u&-u,i.lanes|=e,e=ih(i.stateNode,a,e),Ou(i,e),!1;case 1:if(t=i.type,m=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(un===null||!un.has(m))))return i.flags|=65536,u&=-u,i.lanes|=u,u=Bg(u),Ig(u,e,i,a),Ou(i,u),!1;break;case 22:if(i.memoizedState!==null)return i.flags|=65536,!1}i=i.return}while(i!==null);return!1}var nh=Error(o(461)),Dt=!1;function Ht(e,t,i,a){t.child=e===null?$p(t,null,i,a):Pn(t,e.child,i,a)}function Hg(e,t,i,a,u){i=i.render;var m=t.ref;if("ref"in a){var R={};for(var H in a)H!=="ref"&&(R[H]=a[H])}else R=a;return In(t),a=zu(e,t,i,R,m,u),H=$u(),e!==null&&!Dt?(Pu(e,t,u),Ai(e,t,u)):(Fe&&H&&Wl(t),t.flags|=1,Ht(e,t,a,u),t.child)}function Ug(e,t,i,a,u){if(e===null){var m=i.type;return typeof m=="function"&&!yu(m)&&m.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=m,zg(e,t,m,a,u)):(e=Zl(i.type,null,a,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(m=e.child,!dh(e,u)){var R=m.memoizedProps;if(i=i.compare,i=i!==null?i:Na,i(R,a)&&e.ref===t.ref)return Ai(e,t,u)}return t.flags|=1,e=Ni(m,a),e.ref=t.ref,e.return=t,t.child=e}function zg(e,t,i,a,u){if(e!==null){var m=e.memoizedProps;if(Na(m,a)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=a=m,dh(e,u))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,Ai(e,t,u)}return rh(e,t,i,a,u)}function $g(e,t,i,a){var u=a.children,m=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(m=m!==null?m.baseLanes|i:i,e!==null){for(a=t.child=e.child,u=0;a!==null;)u=u|a.lanes|a.childLanes,a=a.sibling;a=u&~m}else a=0,t.child=null;return Pg(e,t,m,i,a)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&so(t,m!==null?m.cachePool:null),m!==null?Vp(t,m):Mu(),qp(t);else return a=t.lanes=536870912,Pg(e,t,m!==null?m.baseLanes|i:i,i,a)}else m!==null?(so(t,m.cachePool),Vp(t,m),rn(),t.memoizedState=null):(e!==null&&so(t,null),Mu(),rn());return Ht(e,t,u,i),t.child}function $a(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Pg(e,t,i,a,u){var m=ku();return m=m===null?null:{parent:kt._currentValue,pool:m},t.memoizedState={baseLanes:i,cachePool:m},e!==null&&so(t,null),Mu(),qp(t),e!==null&&Bn(e,t,a,!0),t.childLanes=u,null}function bo(e,t){return t=So({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Fg(e,t,i){return Pn(t,e.child,null,i),e=bo(t,t.pendingProps),e.flags|=2,Ns(t),t.memoizedState=null,e}function A1(e,t,i){var a=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Fe){if(a.mode==="hidden")return e=bo(t,a),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},$a(null,e);if(Iu(t),(e=mt)?(e=p_(e,Us),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi!==null?{id:oi,overflow:ci}:null,retryLane:536870912,hydrationErrors:null},i=Np(e),i.return=t,t.child=i,zt=t,mt=null)):e=null,e===null)throw Xi(t);return t.lanes=536870912,null}return bo(t,a)}var m=e.memoizedState;if(m!==null){var R=m.dehydrated;if(Iu(t),u)if(t.flags&256)t.flags&=-257,t=Fg(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Dt||Bn(e,t,i,!1),u=(i&e.childLanes)!==0,Dt||u){if(sn.current===null){if(a=ft,a!==null&&(R=km(a,i),R!==0&&R!==m.retryLane))throw m.retryLane=R,An(e,R),ps(a,e,R),nh;zo()}t=Fg(e,t,i)}else e=m.treeContext,mt=$s(R.nextSibling),zt=t,Fe=!0,Zi=null,Us=!1,e!==null&&kp(t,e),t=bo(t,a),t.flags|=134221824;return t}return e=Ni(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Tr(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function rh(e,t,i,a,u){return In(t),i=zu(e,t,i,a,void 0,u),a=$u(),e!==null&&!Dt?(Pu(e,t,u),Ai(e,t,u)):(Fe&&a&&Wl(t),t.flags|=1,Ht(e,t,i,u),t.child)}function Vg(e,t,i,a,u,m){return In(t),t.updateQueue=null,i=Gp(t,a,i,u),Kp(e),a=$u(),e!==null&&!Dt?(Pu(e,t,m),Ai(e,t,m)):(Fe&&a&&Wl(t),t.flags|=1,Ht(e,t,i,m),t.child)}function qg(e,t,i,a,u){if(In(t),t.stateNode===null){var m=_r,R=i.contextType;typeof R=="object"&&R!==null&&(m=qt(R)),m=new i(a,m),t.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=sh,t.stateNode=m,m._reactInternals=t,m=t.stateNode,m.props=a,m.state=t.memoizedState,m.refs={},Du(t),R=i.contextType,m.context=typeof R=="object"&&R!==null?qt(R):_r,m.state=t.memoizedState,R=i.getDerivedStateFromProps,typeof R=="function"&&(th(t,i,R,a),m.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(R=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),R!==m.state&&sh.enqueueReplaceState(m,m.state,null),Ba(t,a,m,u),Ma(),m.state=t.memoizedState),typeof m.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){m=t.stateNode;var H=t.memoizedProps,K=Vn(i,H);m.props=K;var ie=m.context,oe=i.contextType;R=_r,typeof oe=="object"&&oe!==null&&(R=qt(oe));var _e=i.getDerivedStateFromProps;oe=typeof _e=="function"||typeof m.getSnapshotBeforeUpdate=="function",H=t.pendingProps!==H,oe||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(H||ie!==R)&&Dg(t,m,a,R),Ji=!1;var te=t.memoizedState;m.state=te,Ba(t,a,m,u),Ma(),ie=t.memoizedState,H||te!==ie||Ji?(typeof _e=="function"&&(th(t,i,_e,a),ie=t.memoizedState),(K=Ji||Rg(t,i,K,a,te,ie,R))?(oe||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(t.flags|=4194308)):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=ie),m.props=a,m.state=ie,m.context=R,a=K):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{m=t.stateNode,Au(e,t),R=t.memoizedProps,oe=Vn(i,R),m.props=oe,_e=t.pendingProps,te=m.context,ie=i.contextType,K=_r,typeof ie=="object"&&ie!==null&&(K=qt(ie)),H=i.getDerivedStateFromProps,(ie=typeof H=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(R!==_e||te!==K)&&Dg(t,m,a,K),Ji=!1,te=t.memoizedState,m.state=te,Ba(t,a,m,u),Ma();var ae=t.memoizedState;R!==_e||te!==ae||Ji||e!==null&&e.dependencies!==null&&eo(e.dependencies)?(typeof H=="function"&&(th(t,i,H,a),ae=t.memoizedState),(oe=Ji||Rg(t,i,oe,a,te,ae,K)||e!==null&&e.dependencies!==null&&eo(e.dependencies))?(ie||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(a,ae,K),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(a,ae,K)),typeof m.componentDidUpdate=="function"&&(t.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof m.componentDidUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=ae),m.props=a,m.state=ae,m.context=K,a=oe):(typeof m.componentDidUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=1024),a=!1)}return m=a,Tr(e,t),a=(t.flags&128)!==0,m||a?(m=t.stateNode,i=a&&typeof i.getDerivedStateFromError!="function"?null:m.render(),t.flags|=1,e!==null&&a?(t.child=Pn(t,e.child,null,u),t.child=Pn(t,null,i,u)):Ht(e,t,i,u),t.memoizedState=m.state,e=t.child):e=Ai(e,t,u),e}function Kg(e,t,i,a){return Ln(),t.flags|=256,Ht(e,t,i,a),t.child}var ah={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lh(e){return{baseLanes:e,cachePool:Mp()}}function oh(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=ks),e}function Gg(e,t,i){var a=t.pendingProps,u=!1,m=(t.flags&128)!==0,R;if((R=m)||(R=e!==null&&e.memoizedState===null?!1:(Gt.current&2)!==0),R&&(u=!0,t.flags&=-129),R=(t.flags&32)!==0,t.flags&=-33,e===null){if(Fe){if(u?nn(t):rn(),(e=mt)?(e=p_(e,Us),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi!==null?{id:oi,overflow:ci}:null,retryLane:536870912,hydrationErrors:null},i=Np(e),i.return=t,t.child=i,zt=t,mt=null)):e=null,e===null)throw Xi(t);return ld(e)?t.lanes=32:t.lanes=536870912,null}return m=a.children,a=a.fallback,u?(rn(),u=t.mode,m=So({mode:"hidden",children:m},u),a=On(a,u,i,null),m.return=t,a.return=t,m.sibling=a,t.child=m,a=t.child,a.memoizedState=lh(i),a.childLanes=oh(e,R,i),t.memoizedState=ah,$a(null,a)):(nn(t),ch(t,m))}var H=e.memoizedState;if(H!==null){var K=H.dehydrated;if(K!==null)return O1(e,t,m,R,a,K,H,i)}return u?(rn(),u=a.fallback,m=t.mode,H=e.child,K=H.sibling,a=Ni(H,{mode:"hidden",children:a.children}),a.subtreeFlags=H.subtreeFlags&1206910976,K!==null?u=Ni(K,u):(u=On(u,m,i,null),u.flags|=2),u.return=t,a.return=t,a.sibling=u,t.child=a,$a(null,a),a=t.child,u=e.child.memoizedState,u===null?u=lh(i):(m=u.cachePool,m!==null?(H=kt._currentValue,m=m.parent!==H?{parent:H,pool:H}:m):m=Mp(),u={baseLanes:u.baseLanes|i,cachePool:m}),a.memoizedState=u,a.childLanes=oh(e,R,i),t.memoizedState=ah,$a(e.child,a)):(nn(t),i=e.child,e=i.sibling,i=Ni(i,{mode:"visible",children:a.children}),i.return=t,i.sibling=null,e!==null&&(R=t.deletions,R===null?(t.deletions=[e],t.flags|=16):R.push(e)),t.child=i,t.memoizedState=null,i)}function ch(e,t){return t=So({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function So(e,t){return e=hs(22,e,null,t),e.lanes=0,e}function xo(e,t,i){return Pn(t,e.child,null,i),e=ch(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function O1(e,t,i,a,u,m,R,H){if(i)return t.flags&256?(nn(t),t.flags&=-257,xo(e,t,H)):t.memoizedState!==null?(rn(),t.child=e.child,t.flags|=128,null):(rn(),m=u.fallback,R=t.mode,u=So({mode:"visible",children:u.children},R),m=On(m,R,H,null),m.flags|=2,u.return=t,m.return=t,u.sibling=m,t.child=u,Pn(t,e.child,null,H),u=t.child,u.memoizedState=lh(H),u.childLanes=oh(e,a,H),t.memoizedState=ah,$a(null,u));if(nn(t),ld(m)){if(a=m.nextSibling&&m.nextSibling.dataset,a)var K=a.dgst;return a=K,a!==""&&(u=Error(o(419)),u.stack="",u.digest=a,ka({value:u,source:null,stack:null})),xo(e,t,H)}if(Dt||Bn(e,t,H,!1),a=(H&e.childLanes)!==0,Dt||a){if(sn.current!==null)return xo(e,t,H);if(a=ft,a!==null&&(u=km(a,H),u!==0&&u!==R.retryLane))throw R.retryLane=u,An(e,u),ps(a,e,u),nh;return ad(m)||zo(),xo(e,t,H)}return ad(m)?(t.flags|=192,t.child=e.child,null):(e=R.treeContext,mt=$s(m.nextSibling),zt=t,Fe=!0,Zi=null,Us=!1,e!==null&&kp(t,e),t=ch(t,u.children),t.flags|=134221824,t)}function Yg(e,t,i){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Jl(e.return,t,i)}function Zg(e){for(var t=null;e!==null;){var i=e.alternate;i!==null&&oo(i)===null&&(t=e),e=e.sibling}return t}function wo(e,t,i,a,u,m){var R=e.memoizedState;R===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:i,tailMode:u,treeForkCount:m}:(R.isBackwards=t,R.rendering=null,R.renderingStartTime=0,R.last=a,R.tail=i,R.tailMode=u,R.treeForkCount=m)}function uh(e){var t=e.child;for(e.child=null;t!==null;){var i=t.sibling;t.sibling=e.child,e.child=t,t=i}}function hh(e,t,i){var a=t.pendingProps,u=a.revealOrder,m=a.tail;a=a.children;var R=Gt.current;if(t.flags&128)return Ia(t,R),null;var H=(R&2)!==0;if(H?(R=R&1|2,t.flags|=128):R&=1,Ia(t,R),u==="backwards"&&e!==null?(uh(e),Ht(e,t,a,i),uh(e)):Ht(e,t,a,i),a=Fe?Ta:0,!H&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Yg(e,i,t);else if(e.tag===19)Yg(e,i,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}switch(u){case"backwards":i=Zg(t.child),i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null,uh(t)),wo(t,!0,u,null,m,a);break;case"unstable_legacy-backwards":for(i=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&oo(e)===null){t.child=u;break}e=u.sibling,u.sibling=i,i=u,u=e}wo(t,!0,i,null,m,a);break;case"together":wo(t,!1,null,null,void 0,a);break;case"independent":t.memoizedState=null;break;default:i=Zg(t.child),i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null),wo(t,!1,u,i,m,a)}return t.child}function Xg(e,t,i){var a=t.pendingProps;return Wi(t,t.type,a.value),Ht(e,t,a.children,i),t.child}function Ai(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),cn|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Bn(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,i=Ni(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ni(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function dh(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&eo(e)))}function L1(e,t,i){switch(t.tag){case 3:wt(t,t.stateNode.containerInfo),Wi(t,kt,e.memoizedState.cache),Ln();break;case 27:case 5:G(t);break;case 4:wt(t,t.stateNode.containerInfo);break;case 10:Wi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Iu(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return nn(t),t.flags|=128,null;a=Bn(e,t,i,!1);var u=t.child.childLanes;return a||(i&u)!==0?Gg(e,t,i):(nn(t),e=Ai(e,t,i),e!==null?e.sibling:null)}nn(t);break;case 19:if(t.flags&128)return hh(e,t,i);if(u=(e.flags&128)!==0,a=(i&t.childLanes)!==0,a||(Bn(e,t,i,!1),a=(i&t.childLanes)!==0),u){if(a)return hh(e,t,i);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Ia(t,Gt.current),a)break;return null;case 22:return t.lanes=0,$g(e,t,i,t.pendingProps);case 24:Wi(t,kt,e.memoizedState.cache)}return Ai(e,t,i)}function Wg(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!dh(e,i)&&(t.flags&128)===0)return Dt=!1,L1(e,t,i);Dt=(e.flags&131072)!==0}else Dt=!1,Fe&&(t.flags&1048576)!==0&&Tp(t,Ta,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=zn(t.elementType),t.type=e,typeof e=="function")yu(e)?(a=Vn(e,a),t.tag=1,t=qg(null,t,e,a,i)):(t.tag=0,t=rh(null,t,e,a,i));else{if(e!=null){var u=e.$$typeof;if(u===ne){t.tag=11,t=Hg(null,t,e,a,i);break e}else if(u===A){t.tag=14,t=Ug(null,t,e,a,i);break e}else if(u===he){t.tag=10,t.type=e,t=Xg(null,t,i);break e}}throw t=ue(e)||e,Error(o(306,t,""))}}return t;case 0:return rh(e,t,t.type,t.pendingProps,i);case 1:return a=t.type,u=Vn(a,t.pendingProps),qg(e,t,a,u,i);case 3:e:{if(wt(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var m=t.memoizedState;u=m.element,Au(e,t),Ba(t,a,null,i);var R=t.memoizedState;if(a=R.cache,Wi(t,kt,a),a!==m.cache&&Nu(t,[kt],i,!0),Ma(),a=R.element,m.isDehydrated)if(m={element:a,isDehydrated:!1,cache:R.cache},t.updateQueue.baseState=m,t.memoizedState=m,t.flags&256){t=Kg(e,t,a,i);break e}else if(a!==u){u=Bs(Error(o(424)),t),ka(u),t=Kg(e,t,a,i);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,mt=$s(e.firstChild),zt=t,Fe=!0,Zi=null,Us=!0,i=$p(t,null,a,i),t.child=i;i;)i.flags=i.flags&-3|134221824,i=i.sibling;else{if(Ln(),a===u){t=Ai(e,t,i);break e}Ht(e,t,a,i)}t=t.child}return t;case 26:return Tr(e,t),e===null?(i=x_(t.type,null,t.pendingProps,null))?t.memoizedState=i:Fe||(t.stateNode=t_(t.type,t.pendingProps,is.current,t)):t.memoizedState=x_(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return G(t),e===null&&Fe&&(a=t.stateNode=__(t.type,t.pendingProps,is.current),zt=t,Us=!0,u=mt,fn(t.type)?(od=u,mt=$s(a.firstChild)):mt=u),Ht(e,t,t.pendingProps.children,i),Tr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fe&&((u=a=mt)&&(a=Tx(a,t.type,t.pendingProps,Us),a!==null?(t.stateNode=a,zt=t,mt=$s(a.firstChild),Us=!1,u=!0):u=!1),u||Xi(t)),G(t),u=t.type,m=t.pendingProps,R=e!==null?e.memoizedProps:null,a=m.children,Jh(u,m)?a=null:R!==null&&Jh(u,R)&&(t.flags|=32),t.memoizedState!==null&&(u=zu(e,t,w1,null,null,i),Kr._currentValue=u),Tr(e,t),Ht(e,t,a,i),t.child;case 6:return e===null&&Fe&&((e=i=mt)&&(i=kx(i,t.pendingProps,Us),i!==null?(t.stateNode=i,zt=t,mt=null,e=!0):e=!1),e||Xi(t)),null;case 13:return Gg(e,t,i);case 4:return wt(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Pn(t,null,a,i):Ht(e,t,a,i),t.child;case 11:return Hg(e,t,t.type,t.pendingProps,i);case 7:return a=t.pendingProps,Tr(e,t),Ht(e,t,a,i),t.child;case 8:return Ht(e,t,t.pendingProps.children,i),t.child;case 12:return Ht(e,t,t.pendingProps.children,i),t.child;case 10:return Xg(e,t,i);case 9:return u=t.type._context,a=t.pendingProps.children,In(t),u=qt(u),a=a(u),t.flags|=1,Ht(e,t,a,i),t.child;case 14:return Ug(e,t,t.type,t.pendingProps,i);case 15:return zg(e,t,t.type,t.pendingProps,i);case 19:return hh(e,t,i);case 31:return A1(e,t,i);case 22:return $g(e,t,i,t.pendingProps);case 24:return In(t),a=qt(kt),e===null?(u=ku(),u===null&&(u=ft,m=ju(),u.pooledCache=m,m.refCount++,m!==null&&(u.pooledCacheLanes|=i),u=m),t.memoizedState={parent:a,cache:u},Du(t),Wi(t,kt,u)):((e.lanes&i)!==0&&(Au(e,t),Ba(t,null,null,i),Ma()),u=e.memoizedState,m=t.memoizedState,u.parent!==a?(u={parent:a,cache:a},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Wi(t,kt,a)):(a=m.cache,Wi(t,kt,a),a!==u.cache&&Nu(t,[kt],i,!0))),Ht(e,t,t.pendingProps.children,i),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),a=t.pendingProps,a.name!=null&&a.name!=="auto"?t.flags|=e===null?18882560:18874368:Fe&&Wl(t),e!==null&&e.memoizedProps.name!==a.name?t.flags|=4194816:Tr(e,t),Ht(e,t,a.children,i),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Oi(e){e.flags|=4}function fh(e,t,i,a,u){var m;if((m=(e.mode&32)!==0)&&(m=i===null?N_(t,a):N_(t,a)&&(a.src!==i.src||a.srcSet!==i.srcSet)),m){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Av())e.flags|=8192;else throw $n=no,Ru}else e.flags&=-16777217}function Qg(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!j_(t))if(Av())e.flags|=8192;else throw $n=no,Ru}function Co(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Nm():536870912,e.lanes|=t,Or|=t)}function Pa(e,t){if(!Fe)switch(e.tailMode){case"visible":break;case"collapsed":for(var i=e.tail,a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null;break;default:for(t=e.tail,i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,a=0;if(t)for(var u=e.child;u!==null;)i|=u.lanes|u.childLanes,a|=u.subtreeFlags&1206910976,a|=u.flags&1206910976,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)i|=u.lanes|u.childLanes,a|=u.subtreeFlags,a|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=a,e.childLanes=i,t}function M1(e,t,i){var a=t.pendingProps;switch(xu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return i=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ki(kt),It(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Sr(t)?Oi(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cu())),pt(t),null;case 26:var u=t.type,m=t.memoizedState;return e===null?(Oi(t),m!==null?(pt(t),Qg(t,m)):(pt(t),fh(t,u,null,a,i))):m?m!==e.memoizedState?(Oi(t),pt(t),Qg(t,m)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Oi(t),pt(t),fh(t,u,e,a,i)),null;case 27:if(Se(t),i=is.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Oi(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return pt(t),t.subtreeFlags&=-33554433,null}e=Bt.current,Sr(t)?Rp(t):(e=__(u,a,i),t.stateNode=e,Oi(t))}return pt(t),t.subtreeFlags&=-33554433,null;case 5:if(Se(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Oi(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return pt(t),t.subtreeFlags&=-33554433,null}if(m=Bt.current,Sr(t))Rp(t);else{var R=Ja(is.current);switch(m){case 1:m=R.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:m=R.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":m=R.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":m=R.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":m=R.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof a.is=="string"?R.createElement("select",{is:a.is}):R.createElement("select"),a.multiple?m.multiple=!0:a.size&&(m.size=a.size);break;default:m=typeof a.is=="string"?R.createElement(u,{is:a.is}):R.createElement(u)}}m[Vt]=t,m[us]=a;e:for(R=t.child;R!==null;){if(R.tag===5||R.tag===6)m.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===t)break e;for(;R.sibling===null;){if(R.return===null||R.return===t)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}t.stateNode=m;e:switch(Zt(m,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Oi(t)}}return pt(t),t.subtreeFlags&=-33554433,fh(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Oi(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=is.current,Sr(t)){if(e=t.stateNode,i=t.memoizedProps,a=null,u=zt,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}e[Vt]=t,e=!!(e.nodeValue===i||a!==null&&a.suppressHydrationWarning===!0||Wv(e.nodeValue,i)),e||Xi(t,!0)}else e=Ja(e).createTextNode(a),e[Vt]=t,t.stateNode=e}return pt(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(a=Sr(t),i!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Vt]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else i=Cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Ns(t),t):(Ns(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Sr(t),a!==null&&a.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Vt]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),u=!1}else u=Cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Ns(t),t):(Ns(t),null)}return Ns(t),(t.flags&128)!==0?(t.lanes=i,t):(i=a!==null,e=e!==null&&e.memoizedState!==null,i&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==u&&(a.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Co(t,t.updateQueue),pt(t),null);case 4:return It(),e===null&&Yh(t.stateNode.containerInfo),t.flags|=67108864,pt(t),null;case 10:return ki(t.type),pt(t),null;case 19:if(Hu(t),a=t.memoizedState,a===null)return pt(t),null;if(u=(t.flags&128)!==0,m=a.rendering,m===null)if(u)Pa(a,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(m=oo(e),m!==null){for(t.flags|=128,Pa(a,!1),e=m.updateQueue,t.updateQueue=e,Co(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)Ep(i,e),i=i.sibling;return Ia(t,Gt.current&1|2),Fe&&ji(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ns()>Bo&&(t.flags|=128,u=!0,Pa(a,!1),t.lanes=4194304)}else{if(!u)if(e=oo(m),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Co(t,e),Pa(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!m.alternate&&!Fe)return pt(t),null}else 2*ns()-a.renderingStartTime>Bo&&i!==536870912&&(t.flags|=128,u=!0,Pa(a,!1),t.lanes=4194304);a.isBackwards?(m.sibling=t.child,t.child=m):(e=a.last,e!==null?e.sibling=m:t.child=m,a.last=m)}if(a.tail!==null){e=a.tail;e:{for(i=e;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ns(),e.sibling=null,m=Gt.current,m=u?m&1|2:m&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!i||Fe?Ia(t,m):(i=m,Ke(Kt,t),Ke(Gt,i),ts===null&&(ts=t)),Fe&&ji(t,a.treeForkCount),e}return pt(t),null;case 22:case 23:return Ns(t),Bu(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(i&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),i=t.updateQueue,i!==null&&Co(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==i&&(t.flags|=2048),e!==null&&we(Un),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ki(kt),pt(t),null;case 25:return null;case 30:return t.flags|=33554432,pt(t),null}throw Error(o(156,t.tag))}function B1(e,t){switch(xu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ki(kt),It(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Se(t),null;case 31:if(t.memoizedState!==null){if(Ns(t),t.alternate===null)throw Error(o(340));Ln()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ns(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ln()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return It(),null;case 10:return ki(t.type),null;case 22:case 23:return Ns(t),Bu(),e!==null&&we(Un),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ki(kt),null;case 25:return null;default:return null}}function Jg(e,t){switch(xu(t),t.tag){case 3:ki(kt),It();break;case 26:case 27:case 5:Se(t);break;case 4:It();break;case 31:t.memoizedState!==null&&Ns(t);break;case 13:Ns(t);break;case 19:Hu(t);break;case 10:ki(t.type);break;case 22:case 23:Ns(t),Bu(),e!==null&&we(Un);break;case 24:ki(kt)}}function Fa(e,t){try{var i=t.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var u=a.next;i=u;do{if((i.tag&e)===e){a=void 0;var m=i.create,R=i.inst;a=m(),R.destroy=a}i=i.next}while(i!==u)}}catch(H){ot(t,t.return,H)}}function an(e,t,i){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var m=u.next;a=m;do{if((a.tag&e)===e){var R=a.inst,H=R.destroy;if(H!==void 0){R.destroy=void 0,u=t;var K=i,ie=H;try{ie()}catch(oe){ot(u,K,oe)}}}a=a.next}while(a!==m)}}catch(oe){ot(t,t.return,oe)}}function ev(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{Fp(t,i)}catch(a){ot(e,e.return,a)}}}function tv(e,t,i){i.props=Vn(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(a){ot(e,t,a)}}function ui(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:var u=e.stateNode,m=Ci(e.memoizedProps,u);(u.ref===null||u.ref.name!==m)&&(u.ref=o_(m)),a=u.ref;break;case 7:if(e.stateNode===null){var R=new Ds(e);f(e.child,!1,Nx,R,void 0,void 0),e.stateNode=R}a=e.stateNode;break;default:a=e.stateNode}typeof i=="function"?e.refCleanup=i(a):i.current=a}}catch(H){ot(e,t,H)}}function Yt(e,t){var i=e.ref,a=e.refCleanup;if(i!==null)if(typeof a=="function")try{a()}catch(u){ot(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){ot(e,t,u)}else i.current=null}function Eo(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var i=0;i<t.length;i++)m_(e.stateNode,t[i])}function sv(e){for(var t=e.return;t!==null&&(ph(t)&&m_(e.stateNode,t.stateNode),!mh(t));)t=t.return}function Va(e){for(var t=e.return;t!==null&&(ph(t)&&jx(e.stateNode,t.stateNode),!mh(t));)t=t.return}function mh(e){return e.tag===5||e.tag===3||e.tag===27}function ph(e){return e&&e.tag===7&&e.stateNode!==null}function gh(e){var t=e.type,i=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&a.focus();break e;case"img":i.src?a.src=i.src:i.srcSet&&(a.srcset=i.srcSet)}}catch(u){ot(e,e.return,u)}}function vh(e,t,i){try{var a=e.stateNode;ox(a,e.type,i,t),a[us]=t}catch(u){ot(e,e.return,u)}}function iv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&fn(e.type)||e.tag===4}function _h(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&fn(e.type)||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 yh(e,t,i,a){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(u,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(u),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=li)),Eo(e,a),it=!0;else if(u!==4&&(u===27&&(Eo(e,a),a=null,fn(e.type)&&(i=e.stateNode,t=null)),e=e.child,e!==null))for(yh(e,t,i,a),e=e.sibling;e!==null;)yh(e,t,i,a),e=e.sibling}function No(e,t,i,a){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?i.insertBefore(u,t):i.appendChild(u),Eo(e,a),it=!0;else if(u!==4&&(u===27&&(Eo(e,a),a=null,fn(e.type)&&(i=e.stateNode)),e=e.child,e!==null))for(No(e,t,i,a),e=e.sibling;e!==null;)No(e,t,i,a),e=e.sibling}function nv(e){var t=e.stateNode,i=e.memoizedProps;try{for(var a=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Zt(t,a,i),t[Vt]=e,t[us]=i}catch(m){ot(e,e.return,m)}}var jo=!1,js=null;function rv(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(jo=!0)}var hi=null;function av(){var e=hi;return hi=null,e}var ds=0;function kr(e,t,i,a,u){return ds=0,lv(e.child,t,i,a,u)}function lv(e,t,i,a,u){for(var m=!1;e!==null;){if(e.tag===5){var R=e.stateNode;if(a!==null){var H=sd(R);a.push(H),H.view&&(m=!0)}else m||sd(R).view&&(m=!0);jo=!0,a_(R,ds===0?t:t+"_"+ds,i),ds++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||lv(e.child,t,i,a,u)&&(m=!0));e=e.sibling}return m}function di(e,t){for(;e!==null;)e.tag===5?l_(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||di(e.child,t)),e=e.sibling}function To(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(To(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(o(544));var i=t.name;t=Ei(t.default,t.share),t!=="none"&&(kr(e,i,t,null,!1)||di(e.child,!1))}e=e.sibling}}function bh(e,t){if(e.tag===30){var i=e.stateNode,a=e.memoizedProps,u=Ci(a,i),m=Ei(a.default,i.paired?a.share:a.enter);m!=="none"?kr(e,u,m,null,!1)?(To(e),i.paired||t||Ir(e,a.onEnter)):di(e.child,!1):To(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)bh(e,t),e=e.sibling;else To(e)}function Sh(e){if(js!==null&&js.size!==0){var t=js;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var i=e.memoizedProps,a=i.name;if(a!=null&&a!=="auto"){var u=t.get(a);if(u!==void 0){var m=Ei(i.default,i.share);if(m!=="none"&&(kr(e,a,m,null,!1)?(m=e.stateNode,u.paired=m,m.paired=u,Ir(e,i.onShare)):di(e.child,!1)),t.delete(a),t.size===0)break}}}Sh(e)}e=e.sibling}}}function xh(e){if(e.tag===30){var t=e.memoizedProps,i=Ci(t,e.stateNode),a=js!==null?js.get(i):void 0,u=Ei(t.default,a!==void 0?t.share:t.exit);u!=="none"&&(kr(e,i,u,null,!1)?a!==void 0?(u=e.stateNode,a.paired=u,u.paired=a,js.delete(i),Ir(e,t.onShare)):Ir(e,t.onExit):di(e.child,!1)),js!==null&&Sh(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)xh(e),e=e.sibling;else js!==null&&Sh(e)}function ov(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,i=Ci(t,e.stateNode);t=Ei(t.default,t.update),e.flags&=-5,t!=="none"&&kr(e,i,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&ov(e);e=e.sibling}}function wh(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,di(e.child,!1))}wh(e)}e=e.sibling}}function ko(e){if(e.tag===30)e.stateNode.paired=null,di(e.child,!1),wh(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)ko(e),e=e.sibling;else wh(e)}function cv(e){for(e=e.child;e!==null;)e.tag===30?di(e.child,!1):(e.subtreeFlags&33554432)!==0&&cv(e),e=e.sibling}function Ch(e,t,i,a,u,m,R){for(var H=!1;t!==null;){if(t.tag===5){var K=t.stateNode;if(m!==null&&ds<m.length){var ie=m[ds],oe=sd(K);(ie.view||oe.view)&&(H=!0);var _e;if(_e=(e.flags&4)===0)if(oe.clip)_e=!0;else{_e=ie.rect;var te=oe.rect;_e=_e.y!==te.y||_e.x!==te.x||_e.height!==te.height||_e.width!==te.width}_e&&(e.flags|=4),oe.abs?oe=!ie.abs:(ie=ie.rect,oe=oe.rect,oe=ie.height!==oe.height||ie.width!==oe.width),oe&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&a_(K,ds===0?i:i+"_"+ds,u),H&&(e.flags&4)!==0||(hi===null&&(hi=[]),hi.push(K,ds===0?a:a+"_"+ds,t.memoizedProps)),ds++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&R?e.flags|=t.flags&32:Ch(e,t.child,i,a,u,m,R)&&(H=!0));t=t.sibling}return H}function uv(e,t){for(e=e.child;e!==null;){if(e.tag===30){var i=e.memoizedProps,a=e.stateNode,u=Ci(i,a),m=Ei(i.default,i.update),R;R=e.memoizedState,e.memoizedState=null,a=e;var H=e.child;ds=0,u=Ch(a,H,u,u,m,R,!1),(e.flags&4)!==0&&u&&Ir(e,i.onUpdate)}else(e.subtreeFlags&33554432)!==0&&uv(e);e=e.sibling}}var $t=!1,rt=!1,fi=!1,Eh=!1,hv=typeof WeakSet=="function"?WeakSet:Set,Pt=null,mi=!1,qa=!1,Ro=!1,Nh=!1;function I1(e,t,i){if(e=e.containerInfo,Wh=Gr,e=pp(e),du(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var m=u.anchorOffset,R=u.focusNode;u=u.focusOffset;try{a.nodeType,R.nodeType}catch{a=null;break e}var H=0,K=-1,ie=-1,oe=0,_e=0,te=e,ae=null;t:for(;;){for(var be;te!==a||m!==0&&te.nodeType!==3||(K=H+m),te!==R||u!==0&&te.nodeType!==3||(ie=H+u),te.nodeType===3&&(H+=te.nodeValue.length),(be=te.firstChild)!==null;)ae=te,te=be;for(;;){if(te===e)break t;if(ae===a&&++oe===m&&(K=H),ae===R&&++_e===u&&(ie=H),(be=te.nextSibling)!==null)break;te=ae,ae=te.parentNode}te=be}a=K===-1||ie===-1?null:{start:K,end:ie}}else a=null}a=a||{start:0,end:0}}else a=null;for(Qh={focusedElem:e,selectionRange:a},Gr=!1,i=(i&335544064)===i,Pt=t,t=i?9270:1024;Pt!==null;){if(e=Pt,i&&(a=e.deletions,a!==null))for(m=0;m<a.length;m++)i&&xh(a[m]);if(e.alternate===null&&(e.flags&2)!==0)i&&rv(e),Do(i);else{if(e.tag===22){if(a=e.alternate,e.memoizedState!==null){a!==null&&a.memoizedState===null&&i&&xh(a),Do(i);continue}else if(a!==null&&a.memoizedState!==null){i&&rv(e),Do(i);continue}}a=e.child,(e.subtreeFlags&t)!==0&&a!==null?(a.return=e,Pt=a):(i&&ov(e),Do(i))}}js=null}function Do(e){for(;Pt!==null;){var t=Pt,i=e,a=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&a!==null){i=void 0,u=a.memoizedProps,a=a.memoizedState;var m=t.stateNode;try{var R=Vn(t.type,u);i=m.getSnapshotBeforeUpdate(R,a),m.__reactInternalSnapshotBeforeUpdate=i}catch(H){ot(t,t.return,H)}}break;case 3:if((u&1024)!==0){if(a=t.stateNode.containerInfo,i=a.nodeType,i===9)rd(a);else if(i===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":rd(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:i&&a!==null&&(i=Ci(a.memoizedProps,a.stateNode),u=t.memoizedProps,u=Ei(u.default,u.update),u!=="none"&&kr(a,i,u,a.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(o(163))}if(a=t.sibling,a!==null){a.return=t.return,Pt=a;break}Pt=t.return}}function dv(e,t,i){var a=i.flags;switch(i.tag){case 0:case 11:case 15:pi(e,i),a&4&&Fa(5,i);break;case 1:if(pi(e,i),a&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(R){ot(i,i.return,R)}else{var u=Vn(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(R){ot(i,i.return,R)}}a&64&&ev(i),a&512&&ui(i,i.return);break;case 3:if(pi(e,i),a&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{Fp(e,t)}catch(R){ot(i,i.return,R)}}break;case 27:t===null&&a&4&&nv(i);case 26:case 5:pi(e,i),t===null&&a&4&&gh(i),a&512&&ui(i,i.return);break;case 12:pi(e,i);break;case 31:pi(e,i),a&4&&gv(e,i);break;case 13:pi(e,i),a&4&&vv(e,i),a&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Z1.bind(null,i),Rx(e,i))));break;case 22:if(a=i.memoizedState!==null||$t,!a){var m=t!==null&&t.memoizedState!==null||rt;t=$t,u=rt,$t=a,(rt=m)&&!u?(a=2,(i.subtreeFlags&8772)!==0&&(a|=1),Xs(e,i,a)):pi(e,i),$t=t,rt=u}break;case 30:pi(e,i),a&512&&ui(i,i.return);break;case 7:a&512&&ui(i,i.return);default:pi(e,i)}}function jh(e,t){for(e=e.child;e!==null;)fv(e,t),e=e.sibling}function fv(e,t){switch(e.tag){case 5:case 26:try{var i=e.stateNode;if(t){var a=i.style;typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"}else{var u=e.stateNode,m=e.memoizedProps.style,R=m!=null&&m.hasOwnProperty("display")?m.display:null;u.style.display=R==null||typeof R=="boolean"?"":(""+R).trim()}}catch(K){ot(e,e.return,K)}Th(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,it=!0}catch(K){ot(e,e.return,K)}break;case 18:try{var H=e.stateNode;t?r_(H,!0):r_(e.stateNode,!1)}catch(K){ot(e,e.return,K)}break;case 22:case 23:e.memoizedState===null&&jh(e,t);break;default:jh(e,t)}}function Th(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var i=e,a=t;switch(i.tag){case 4:fv(i,a);break e;case 22:i.memoizedState===null&&Th(i,a);break e;default:Th(i,a)}}e=e.sibling}}function mv(e){var t=e.alternate;t!==null&&(e.alternate=null,mv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ml(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,fs=!1;function Ys(e,t,i){for(i=i.child;i!==null;)pv(e,t,i),i=i.sibling}function pv(e,t,i){if(xs&&typeof xs.onCommitFiberUnmount=="function")try{xs.onCommitFiberUnmount(ma,i)}catch{}switch(i.tag){case 26:rt||Yt(i,t),Ys(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&!rt&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:rt||Yt(i,t),Va(i);var a=vt,u=fs;fn(i.type)&&(vt=i.stateNode,fs=!1),Ys(e,t,i),y_(i.stateNode,i.type,i.memoizedProps),vt=a,fs=u;break;case 5:rt||Yt(i,t),Va(i);case 6:if(i.tag===6&&Va(i),a=vt,u=fs,vt=null,Ys(e,t,i),vt=a,fs=u,vt!==null)if(fs)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(i.stateNode),it=!0}catch(m){ot(i,t,m)}else try{vt.removeChild(i.stateNode),it=!0}catch(m){ot(i,t,m)}break;case 18:vt!==null&&(fs?(e=vt,n_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Yr(e)):n_(vt,i.stateNode));break;case 4:a=vt,u=fs,vt=i.stateNode.containerInfo,fs=!0,Ys(e,t,i),vt=a,fs=u;break;case 0:case 11:case 14:case 15:an(2,i,t),rt||an(4,i,t),Ys(e,t,i);break;case 1:rt||(Yt(i,t),a=i.stateNode,typeof a.componentWillUnmount=="function"&&tv(i,t,a)),Ys(e,t,i);break;case 21:Ys(e,t,i);break;case 22:rt=(a=rt)||i.memoizedState!==null,Ys(e,t,i),rt=a;break;case 30:Yt(i,t),Ys(e,t,i);break;case 7:rt||Yt(i,t),Ys(e,t,i);break;default:Ys(e,t,i)}}function gv(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Yr(e)}catch(i){ot(t,t.return,i)}}}function vv(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Yr(e)}catch(i){ot(t,t.return,i)}}function H1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new hv),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new hv),t;default:throw Error(o(435,e.tag))}}function Ao(e,t){var i=H1(e);t.forEach(function(a){if(!i.has(a)){i.add(a);var u=X1.bind(null,e,a);a.then(u,u)}})}function ls(e,t,i){var a=t.deletions;if(a!==null)for(var u=0;u<a.length;u++){var m=a[u],R=e,H=t,K=H;e:for(;K!==null;){switch(K.tag){case 27:if(fn(K.type)){vt=K.stateNode,fs=!1;break e}break;case 5:vt=K.stateNode,fs=!1;break e;case 3:case 4:vt=K.stateNode.containerInfo,fs=!0;break e}K=K.return}if(vt===null)throw Error(o(160));pv(R,H,m),vt=null,fs=!1,R=m.alternate,R!==null&&(R.return=null),m.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_v(t,e,i),t=t.sibling}var Zs=null;function _v(e,t,i){var a=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(u&4&&(a=e.updateQueue,a=a!==null?a.events:null,a!==null))for(var m=0;m<a.length;m++){var R=a[m];R.ref.impl=R.nextImpl}ls(t,e,i),os(e),u&4&&(an(3,e,e.return),Fa(3,e),an(5,e,e.return));break;case 1:ls(t,e,i),os(e),u&512&&(rt||a===null||Yt(a,a.return)),u&64&&$t&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?t:i.concat(t))));break;case 26:if(m=Zs,ls(t,e,i),os(e),u&512&&(rt||a===null||Yt(a,a.return)),u&4)if(u=a!==null?a.memoizedState:null,i=e.memoizedState,a===null)if(i===null)if(e.stateNode===null)if($t)e.stateNode=t_(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,i=e.memoizedProps,u=m.ownerDocument||m;t:switch(t){case"title":a=u.getElementsByTagName("title")[0],(!a||a[va]||a[Vt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=u.createElement(t),u.head.insertBefore(a,u.querySelector("head > title"))),Zt(a,t,i),a[Vt]=e,Ut(a),t=a;break e;case"link":if(m=E_("link","href",u).get(t+(i.href||""))){for(R=0;R<m.length;R++)if(a=m[R],a.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&a.getAttribute("rel")===(i.rel==null?null:i.rel)&&a.getAttribute("title")===(i.title==null?null:i.title)&&a.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){m.splice(R,1);break t}}a=u.createElement(t),Zt(a,t,i),u.head.appendChild(a);break;case"meta":if(m=E_("meta","content",u).get(t+(i.content||""))){for(R=0;R<m.length;R++)if(a=m[R],a.getAttribute("content")===(i.content==null?null:""+i.content)&&a.getAttribute("name")===(i.name==null?null:i.name)&&a.getAttribute("property")===(i.property==null?null:i.property)&&a.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&a.getAttribute("charset")===(i.charSet==null?null:i.charSet)){m.splice(R,1);break t}}a=u.createElement(t),Zt(a,t,i),u.head.appendChild(a);break;default:throw Error(o(468,t))}a[Vt]=e,Ut(a),t=a}e.stateNode=t}else $t||dd(m,e.type,e.stateNode);else e.stateNode=C_(m,i,e.memoizedProps);else u!==i?(u===null?(t=a.stateNode,t===null||rt||t.parentNode.removeChild(t)):u.count--,i===null?$t||dd(m,e.type,e.stateNode):C_(m,i,e.memoizedProps)):i===null&&e.stateNode!==null&&vh(e,e.memoizedProps,a.memoizedProps);break;case 27:ls(t,e,i),os(e),u&512&&(rt||a===null||Yt(a,a.return)),a!==null&&u&4&&vh(e,e.memoizedProps,a.memoizedProps);break;case 5:if(m=fi,fi=!1,ls(t,e,i),fi=m,os(e),u&512&&(rt||a===null||Yt(a,a.return)),e.flags&32){t=e.stateNode;try{hr(t,""),it=!0}catch(oe){ot(e,e.return,oe)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,vh(e,t,a!==null?a.memoizedProps:t)),u&1024&&(Eh=!0);break;case 6:if(ls(t,e,i),os(e),u&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,i=e.stateNode;try{i.nodeValue=t,it=!0}catch(oe){ot(e,e.return,oe)}}break;case 3:if(it=!1,Go=null,m=Zs,Zs=el(t.containerInfo),ls(t,e,i),Zs=m,os(e),u&4&&a!==null&&a.memoizedState.isDehydrated)try{Yr(t.containerInfo)}catch(oe){ot(e,e.return,oe)}Eh&&(Eh=!1,yv(e)),it=!1;break;case 4:u=fi,fi=$t,a=Um(),m=Zs,Zs=el(e.stateNode.containerInfo),ls(t,e,i),os(e),Zs=m,it&&qa&&(Ro=!0),it=a,fi=u;break;case 12:ls(t,e,i),os(e);break;case 31:ls(t,e,i),os(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ao(e,t)));break;case 13:ls(t,e,i),os(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Mo=ns()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ao(e,t)));break;case 22:m=e.memoizedState!==null,R=a!==null&&a.memoizedState!==null;var H=$t,K=rt,ie=fi;$t=H||m,fi=ie||m,rt=K||R,ls(t,e,i),rt=K,fi=ie,$t=H,os(e),u&8192&&(t=e.stateNode,t._visibility=m?t._visibility&-2:t._visibility|1,!m||a===null||R||$t||rt||(t=R||rt,i=$t,a=rt,$t=m||$t,rt=t,ln(e,2),$t=i,rt=a),!m&&fi||jh(e,m)),u&4&&(t=e.updateQueue,t!==null&&(i=t.retryQueue,i!==null&&(t.retryQueue=null,Ao(e,i))));break;case 19:ls(t,e,i),os(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ao(e,t)));break;case 30:u&512&&(rt||a===null||Yt(a,a.return)),u=Um(),m=qa,R=(i&335544064)===i,H=e.memoizedProps,qa=R&&Ei(H.default,H.update)!=="none",ls(t,e,i),os(e),R&&a!==null&&it&&(e.flags|=4),qa=m,it=u;break;case 21:break;case 7:u&512&&(rt||a===null||Yt(a,a.return)),a&&a.stateNode!==null&&(a.stateNode._fragmentFiber=e);default:ls(t,e,i),os(e)}}function os(e){var t=e.flags;if(t&2){try{for(var i,a=e.return;a!==null;){if(iv(a)){i=a;break}a=a.return}a=null;for(var u=e.return;u!==null;){if(ph(u)){var m=u.stateNode;a===null?a=[m]:a.push(m)}if(mh(u))break;u=u.return}var R=a;if(i==null)throw Error(o(160));switch(i.tag){case 27:var H=i.stateNode,K=_h(e);No(e,K,H,R);break;case 5:var ie=i.stateNode;i.flags&32&&(hr(ie,""),i.flags&=-33);var oe=_h(e);No(e,oe,ie,R);break;case 3:case 4:var _e=i.stateNode.containerInfo,te=_h(e);yh(e,te,_e,R);break;default:throw Error(o(161))}}catch(ae){ot(e,e.return,ae)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yv(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Gr=!0,t.reset(),Gr=!1),e=e.sibling}}function Rr(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)bv(t,e),t=t.sibling;else uv(t)}function bv(e,t){var i=e.alternate;if(i===null)bh(e,!1);else switch(e.tag){case 3:if(Nh=mi=!1,av(),Rr(t,e),!mi&&!Ro){if(e=hi,e!==null)for(var a=0;a<e.length;a+=3){i=e[a];var u=e[a+1];l_(i,e[a+2]),i=i.ownerDocument.documentElement,i!==null&&i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Nh=!0}hi=null;break;case 5:Rr(t,e);break;case 4:a=mi,mi=!1,Rr(t,e),mi&&(Ro=!0),mi=a;break;case 22:e.memoizedState===null&&(i.memoizedState!==null?bh(e,!1):Rr(t,e));break;case 30:a=mi,u=av(),mi=!1,Rr(t,e),mi&&(e.flags|=4);var m=e.memoizedProps,R=e.stateNode;t=Ci(m,R),R=Ci(i.memoizedProps,R);var H=Ei(m.default,m.update);H==="none"?t=!1:(m=i.memoizedState,i.memoizedState=null,i=e.child,ds=0,t=Ch(e,i,t,R,H,m,!0),ds!==(m===null?0:m.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Ir(e,e.memoizedProps.onUpdate),hi=u):u!==null&&(u.push.apply(u,hi),hi=u),mi=(e.flags&32)!==0?!0:a;break;default:Rr(t,e)}}function pi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)dv(e,t.alternate,t),t=t.sibling}function ln(e,t){for(e=e.child;e!==null;){var i=e,a=t;switch(i.tag){case 0:case 11:case 14:case 15:an(4,i,i.return),ln(i,a);break;case 1:Yt(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&tv(i,i.return,u),ln(i,a);break;case 27:(a&2)!==0&&y_(i.stateNode,i.type,i.memoizedProps);case 5:Yt(i,i.return),i.tag!==5&&i.tag!==27||Va(i),ln(i,a);break;case 6:Va(i);break;case 26:Yt(i,i.return),u=i.stateNode,i.memoizedState!==null||u===null||rt||u.parentNode.removeChild(u),ln(i,a);break;case 22:i.memoizedState===null&&ln(i,a);break;case 30:Yt(i,i.return),ln(i,a);break;case 7:Yt(i,i.return);default:ln(i,a)}e=e.sibling}}function Xs(e,t,i){for(i=(t.subtreeFlags&8772)!==0?i:i&-2,t=t.child;t!==null;){var a=t.alternate,u=e,m=t,R=m.flags,H=(i&1)!==0;switch(m.tag){case 0:case 11:case 15:Xs(u,m,i),Fa(4,m);break;case 1:if(Xs(u,m,i),a=m,u=a.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(oe){ot(a,a.return,oe)}if(a=m,u=a.updateQueue,u!==null){var K=a.stateNode;try{var ie=u.shared.hiddenCallbacks;if(ie!==null)for(u.shared.hiddenCallbacks=null,u=0;u<ie.length;u++)Pp(ie[u],K)}catch(oe){ot(a,a.return,oe)}}H&&R&64&&ev(m),ui(m,m.return);break;case 27:(i&2)!==0&&nv(m);case 5:m.tag!==5&&m.tag!==27||sv(m),Xs(u,m,i),H&&a===null&&R&4&&gh(m),ui(m,m.return);break;case 6:sv(m);break;case 26:K=m.stateNode,m.memoizedState!==null||K===null||$t||dd(el(K.ownerDocument),m.type,K),Xs(u,m,i),H&&a===null&&R&4&&gh(m),ui(m,m.return);break;case 12:Xs(u,m,i);break;case 31:Xs(u,m,i),H&&R&4&&gv(u,m);break;case 13:Xs(u,m,i),H&&R&4&&vv(u,m);break;case 22:m.memoizedState===null&&Xs(u,m,i),ui(m,m.return);break;case 30:Xs(u,m,i),ui(m,m.return);break;case 7:ui(m,m.return);default:Xs(u,m,i)}t=t.sibling}}function kh(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Ra(i))}function Rh(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ra(e))}function zs(e,t,i,a){var u=(i&335544064)===i;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)Sv(e,t,i,a),t=t.sibling;else u&&cv(t)}function Sv(e,t,i,a){var u=(i&335544064)===i;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ko(t);var m=t.flags;switch(t.tag){case 0:case 11:case 15:zs(e,t,i,a),m&2048&&Fa(9,t);break;case 1:zs(e,t,i,a);break;case 3:zs(e,t,i,a),u&&Nh&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),m&2048&&(m=null,t.alternate!==null&&(m=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==m&&(t.refCount++,m!=null&&Ra(m)));break;case 12:if(m&2048){zs(e,t,i,a),m=t.stateNode;try{var R=t.memoizedProps,H=R.id,K=R.onPostCommit;typeof K=="function"&&K(H,t.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(ie){ot(t,t.return,ie)}}else zs(e,t,i,a);break;case 31:zs(e,t,i,a);break;case 13:zs(e,t,i,a);break;case 23:break;case 22:R=t.stateNode,H=t.alternate,t.memoizedState!==null?(u&&H!==null&&H.memoizedState===null&&ko(H),R._visibility&2?zs(e,t,i,a):Ka(e,t)):(u&&H!==null&&H.memoizedState!==null&&ko(t),R._visibility&2?zs(e,t,i,a):(R._visibility|=2,Dr(e,t,i,a,(t.subtreeFlags&10256)!==0||!1))),m&2048&&kh(H,t);break;case 24:zs(e,t,i,a),m&2048&&Rh(t.alternate,t);break;case 30:u&&(m=t.alternate,m!==null&&(di(m.child,!0),di(t.child,!0))),zs(e,t,i,a);break;default:zs(e,t,i,a)}}function Dr(e,t,i,a,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var m=e,R=t,H=i,K=a,ie=R.flags;switch(R.tag){case 0:case 11:case 15:Dr(m,R,H,K,u),Fa(8,R);break;case 23:break;case 22:var oe=R.stateNode;R.memoizedState!==null?oe._visibility&2?Dr(m,R,H,K,u):Ka(m,R):(oe._visibility|=2,Dr(m,R,H,K,u)),u&&ie&2048&&kh(R.alternate,R);break;case 24:Dr(m,R,H,K,u),u&&ie&2048&&Rh(R.alternate,R);break;default:Dr(m,R,H,K,u)}t=t.sibling}}function Ka(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,a=t,u=a.flags;switch(a.tag){case 22:Ka(i,a),u&2048&&kh(a.alternate,a);break;case 24:Ka(i,a),u&2048&&Rh(a.alternate,a);break;default:Ka(i,a)}t=t.sibling}}var qn=8192;function Kn(e,t,i){if(e.subtreeFlags&qn)for(e=e.child;e!==null;)xv(e,t,i),e=e.sibling}function xv(e,t,i){switch(e.tag){case 26:Kn(e,t,i),e.flags&qn&&(e.memoizedState!==null?Vx(i,Zs,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&k_(i,e)));break;case 5:Kn(e,t,i),e.flags&qn&&(e=e.stateNode,(t&335544128)===t&&k_(i,e));break;case 3:case 4:var a=Zs;Zs=el(e.stateNode.containerInfo),Kn(e,t,i),Zs=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=qn,qn=16777216,Kn(e,t,i),qn=a):Kn(e,t,i));break;case 30:if((e.flags&qn)!==0&&(a=e.memoizedProps.name,a!=null&&a!=="auto")){var u=e.stateNode;u.paired=null,js===null&&(js=new Map),js.set(a,u)}Kn(e,t,i);break;default:Kn(e,t,i)}}function wv(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ga(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var a=t[i];Pt=a,Ev(a,e)}wv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Cv(e),e=e.sibling}function Cv(e){switch(e.tag){case 0:case 11:case 15:Ga(e),e.flags&2048&&an(9,e,e.return);break;case 3:Ga(e);break;case 12:Ga(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Oo(e)):Ga(e);break;default:Ga(e)}}function Oo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var a=t[i];Pt=a,Ev(a,e)}wv(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:an(8,t,t.return),Oo(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Oo(t));break;default:Oo(t)}e=e.sibling}}function Ev(e,t){for(;Pt!==null;){var i=Pt;switch(i.tag){case 0:case 11:case 15:an(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var a=i.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Ra(i.memoizedState.cache)}if(a=i.child,a!==null)a.return=i,Pt=a;else e:for(i=e;Pt!==null;){a=Pt;var u=a.sibling,m=a.return;if(mv(a),a===i){Pt=null;break e}if(u!==null){u.return=m,Pt=u;break e}Pt=m}}}var U1={getCacheForType:function(e){var t=qt(kt),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return qt(kt).controller.signal}},z1=typeof WeakMap=="function"?WeakMap:Map,nt=0,ft=null,Ge=null,Ze=0,lt=0,Ts=null,on=!1,Ar=!1,Dh=!1,Li=0,Et=0,cn=0,Gn=0,Lo=0,ks=0,Or=0,Ya=null,ms=null,Ah=!1,Mo=0,Nv=0,Bo=1/0,Io=null,un=null,St=0,Ws=null,Yn=null,gi=0,Oh=0,Lh=null,jv=null,Lr=null,Mr=null,Br=null,Za=0,Ho=null;function Rs(){return(nt&2)!==0&&Ze!==0?Ze&-Ze:me.T!==null?Vh():Rm()}function Tv(){if(ks===0)if((Ze&536870912)===0||Fe){var e=Dl;Dl<<=1,(Dl&3932160)===0&&(Dl=262144),ks=e}else ks=536870912;return e=Kt.current,e!==null&&(e.flags|=32),ks}function Ir(e,t){if(t!=null){var i=e.stateNode,a=i.ref;a===null&&(a=i.ref=o_(Ci(e.memoizedProps,i))),Mr===null&&(Mr=[]),Mr.push(t.bind(null,a))}}function ps(e,t,i){(e===ft&&(lt===2||lt===9)||e.cancelPendingCommit!==null)&&(Hr(e,0),hn(e,Ze,ks,!1)),ga(e,i),((nt&2)===0||e!==ft)&&(e===ft&&((nt&2)===0&&(Gn|=i),Et===4&&hn(e,Ze,ks,!1)),vi(e))}function kv(e,t,i){if((nt&6)!==0)throw Error(o(327));var a=!i&&(t&127)===0&&(t&e.expiredLanes)===0||pa(e,t),u=a?F1(e,t):Bh(e,t,!0),m=a;do{if(u===0){Ar&&!a&&hn(e,t,0,!1);break}else{if(i=e.current.alternate,m&&!$1(i)){u=Bh(e,t,!1),m=!1;continue}if(u===2){if(m=t,e.errorRecoveryDisabledLanes&m)var R=0;else R=e.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){t=R;e:{var H=e;u=Ya;var K=H.current.memoizedState.isDehydrated;if(K&&(Hr(H,R).flags|=256),R=Bh(H,R,!1),R!==2&&R!==6){if(Dh&&!K){H.errorRecoveryDisabledLanes|=m,Gn|=m,u=4;break e}m=ms,ms=u,m!==null&&(ms===null?ms=m:ms.push.apply(ms,m))}u=R}if(m=!1,u!==2)continue}}if(u===1){Hr(e,0),hn(e,t,0,!0);break}e:{switch(a=e,m=u,m){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:hn(a,t,ks,!on);break e;case 2:ms=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Mo+300-ns(),10<u)){if(hn(a,t,ks,!on),Ol(a,0,!0)!==0)break e;gi=t,a.timeoutHandle=td(Rv.bind(null,a,i,ms,Io,Ah,t,ks,Gn,Or,on,m,"Throttled",-0,0),u);break e}Rv(a,i,ms,Io,Ah,t,ks,Gn,Or,on,m,null,-0,0)}}break}while(!0);vi(e)}function Rv(e,t,i,a,u,m,R,H,K,ie,oe,_e,te,ae){e.timeoutHandle=-1;var be=t.subtreeFlags,Ne=(m&335544064)===m;if(_e=null,(Ne||be&8192||(be&16785408)===16785408)&&(_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:li},js=null,xv(t,m,_e),Ne&&(be=_e,Ne=e.containerInfo,Ne=(Ne.nodeType===9?Ne:Ne.ownerDocument).__reactViewTransition,Ne!=null&&(be.count++,be.waitingForViewTransition=!0,be=il.bind(be),Ne.finished.then(be,be))),be=(m&62914560)===m?Mo-ns():(m&4194048)===m?Nv-ns():0,be=qx(_e,be),be!==null)){gi=m,e.cancelPendingCommit=be(Hv.bind(null,e,t,m,i,a,u,R,H,K,ie,oe,_e,null,te,ae)),hn(e,m,R,!ie);return}Hv(e,t,m,i,a,u,R,H,K,ie,oe,_e)}function $1(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var a=0;a<i.length;a++){var u=i[a],m=u.getSnapshot;u=u.value;try{if(!Es(m(),u))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 hn(e,t,i,a){t=Em(e,t),t&=~Lo,t&=~Gn,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var u=t;0<u;){var m=31-ws(u),R=1<<m;a[m]=-1,u&=~R}i!==0&&jm(e,i,t)}function Uo(){return(nt&6)===0?(Xa(0),!1):!0}function Mh(){if(Ge!==null){if(lt===0)var e=Ge.return;else e=Ge,Ti=Mn=null,Fu(e),Cr=null,Oa=0,e=Ge;for(;e!==null;)Jg(e.alternate,e),e=e.return;Ge=null}}function Hr(e,t){var i=e.timeoutHandle;return i!==-1&&(e.timeoutHandle=-1,hx(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),gi=0,Mh(),ft=e,Ge=i=Ni(e.current,null),Ze=t,lt=0,Ts=null,on=!1,Ar=pa(e,t),Dh=!1,Or=ks=Lo=Gn=cn=Et=0,ms=Ya=null,Ah=!1,Li=Em(e,t),Kl(),i}function Dv(e,t){Ue=null,me.H=_o,t===wr||t===io?(t=Hp(),lt=3):t===Ru?(t=Hp(),lt=4):lt=t===nh?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ts=t,Ge===null&&(Et=1,yo(e,Bs(t,e.current)))}function Av(){var e=Kt.current;return e===null?!0:(Ze&4194048)===Ze?ts===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?e===ts:!1}function Ov(){var e=me.H;return me.H=_o,e===null?_o:e}function Lv(){var e=me.A;return me.A=U1,e}function zo(){Et=4,on||(Ze&4194048)!==Ze&&Kt.current!==null||(Ar=!0),(cn&134217727)===0&&(Gn&134217727)===0||ft===null||hn(ft,Ze,ks,!1)}function Bh(e,t,i){var a=nt;nt|=2;var u=Ov(),m=Lv();(ft!==e||Ze!==t)&&(Io=null,Hr(e,t)),t=!1;var R=Et;e:do try{if(lt!==0&&Ge!==null){var H=Ge,K=Ts;switch(lt){case 8:Mh(),R=6;break e;case 3:case 2:case 9:case 6:Kt.current===null&&(t=!0);var ie=lt;if(lt=0,Ts=null,Ur(e,H,K,ie),i&&Ar){R=0;break e}break;default:ie=lt,lt=0,Ts=null,Ur(e,H,K,ie)}}P1(),R=Et;break}catch(oe){Dv(e,oe)}while(!0);return t&&e.shellSuspendCounter++,Ti=Mn=null,nt=a,me.H=u,me.A=m,Ge===null&&(ft=null,Ze=0,Kl()),R}function P1(){for(;Ge!==null;)Mv(Ge)}function F1(e,t){var i=nt;nt|=2;var a=Ov(),u=Lv();ft!==e||Ze!==t?(Io=null,Bo=ns()+500,Hr(e,t)):Ar=pa(e,t);e:do try{if(lt!==0&&Ge!==null){t=Ge;var m=Ts;t:switch(lt){case 1:lt=0,Ts=null,Ur(e,t,m,1);break;case 2:case 9:if(Bp(m)){lt=0,Ts=null,Bv(t);break}t=function(){lt!==2&&lt!==9||ft!==e||(lt=7),vi(e)},m.then(t,t);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:Bp(m)?(lt=0,Ts=null,Bv(t)):(lt=0,Ts=null,Ur(e,t,m,7));break;case 5:var R=null;switch(Ge.tag){case 26:R=Ge.memoizedState;case 5:case 27:var H=Ge;if(R?j_(R):H.stateNode.complete){lt=0,Ts=null;var K=H.sibling;if(K!==null)Ge=K;else{var ie=H.return;ie!==null?(Ge=ie,$o(ie)):Ge=null}break t}}lt=0,Ts=null,Ur(e,t,m,5);break;case 6:lt=0,Ts=null,Ur(e,t,m,6);break;case 8:Mh(),Et=6;break e;default:throw Error(o(462))}}V1();break}catch(oe){Dv(e,oe)}while(!0);return Ti=Mn=null,me.H=a,me.A=u,nt=i,Ge!==null?0:(ft=null,Ze=0,Kl(),Et)}function V1(){for(;Ge!==null&&!Tl();)Mv(Ge)}function Mv(e){var t=Wg(e.alternate,e,Li);e.memoizedProps=e.pendingProps,t===null?$o(e):Ge=t}function Bv(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=Vg(i,t,t.pendingProps,t.type,void 0,Ze);break;case 11:t=Vg(i,t,t.pendingProps,t.type.render,t.ref,Ze);break;case 5:Fu(t);var a=t;a===zt&&(Fe?(Ql(a),a.tag===5&&a.stateNode!=null&&(mt=a.stateNode)):(Ql(a),Fe=!0));default:Jg(i,t),t=Ge=Ep(t,Li),t=Wg(i,t,Li)}e.memoizedProps=e.pendingProps,t===null?$o(e):Ge=t}function Ur(e,t,i,a){Ti=Mn=null,Fu(t),Cr=null,Oa=0;var u=t.return;try{if(D1(e,u,t,i,Ze)){Et=1,yo(e,Bs(i,e.current)),Ge=null;return}}catch(m){if(u!==null)throw Ge=u,m;Et=1,yo(e,Bs(i,e.current)),Ge=null;return}t.flags&32768?(Fe||a===1?e=!0:Ar||(Ze&536870912)!==0?e=!1:(on=e=!0,(a===2||a===9||a===3||a===6)&&(a=Kt.current,a!==null&&a.tag===13&&(a.flags|=16384))),Iv(t,e)):$o(t)}function $o(e){var t=e;do{if((t.flags&32768)!==0){Iv(t,on);return}e=t.return;var i=M1(t.alternate,t,Li);if(i!==null){Ge=i;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);Et===0&&(Et=5)}function Iv(e,t){do{var i=B1(e.alternate,e);if(i!==null){i.flags&=32767,Ge=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=i}while(e!==null);Et=6,Ge=null}function Hv(e,t,i,a,u,m,R,H,K,ie,oe,_e){e.cancelPendingCommit=null;do Po();while(St!==0);if((nt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===ft&&(Ge=ft=null,Ze=0),Yn=t,Ws=e,gi=i,Lh=u,jv=a,q1(e,t,i,R,H,K,_e)}}function q1(e,t,i,a,u,m,R){var H=t.lanes|t.childLanes;if(Oh=H,H|=vu,vS(e,i,H,a,u,m),Mr=null,(i&335544064)===i?(Br=y1(e),a=10262):(Br=null,a=10256),(t.subtreeFlags&a)!==0||(t.flags&a)!==0?(e.callbackNode=null,e.callbackPriority=0,W1(kl,function(){return zh(),null})):(e.callbackNode=null,e.callbackPriority=0),jo=!1,a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null,u=ge.p,ge.p=2,m=nt,nt|=4;try{I1(e,t,i)}finally{nt=m,ge.p=u,me.T=a}}St=1,jo?Lr=vx(R,e.containerInfo,Br,Ih,Hh,G1,Uh,zh,K1):(Ih(),Hh(),Uh())}function K1(e){if(St!==0){var t=Ws.onRecoverableError;t(e,{componentStack:null})}}function G1(){St===3&&(St=0,bv(Yn,Ws),St=4)}function Ih(){if(St===1){St=0;var e=Ws,t=Yn,i=gi,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null;var u=ge.p;ge.p=2;var m=nt;nt|=4;try{qa=Ro=!1,_v(t,e,i),i=Qh;var R=pp(e.containerInfo),H=i.focusedElem,K=i.selectionRange;if(R!==H&&H&&H.ownerDocument&&mp(H.ownerDocument.documentElement,H)){if(K!==null&&du(H)){var ie=K.start,oe=K.end;if(oe===void 0&&(oe=ie),"selectionStart"in H)H.selectionStart=ie,H.selectionEnd=Math.min(oe,H.value.length);else{var _e=H.ownerDocument||document,te=_e&&_e.defaultView||window;if(te.getSelection){var ae=te.getSelection(),be=H.textContent.length,Ne=Math.min(K.start,be),ze=K.end===void 0?Ne:Math.min(K.end,be);!ae.extend&&Ne>ze&&(R=ze,ze=Ne,Ne=R);var se=fp(H,Ne),X=fp(H,ze);if(se&&X&&(ae.rangeCount!==1||ae.anchorNode!==se.node||ae.anchorOffset!==se.offset||ae.focusNode!==X.node||ae.focusOffset!==X.offset)){var re=_e.createRange();re.setStart(se.node,se.offset),ae.removeAllRanges(),Ne>ze?(ae.addRange(re),ae.extend(X.node,X.offset)):(re.setEnd(X.node,X.offset),ae.addRange(re))}}}}for(_e=[],ae=H;ae=ae.parentNode;)ae.nodeType===1&&_e.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<_e.length;H++){var ve=_e[H];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Gr=!!Wh,Qh=Wh=null}finally{nt=m,ge.p=u,me.T=a}}e.current=t,St=2}}function Hh(){if(St===2){St=0;var e=Ws,t=Yn,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=me.T,me.T=null;var a=ge.p;ge.p=2;var u=nt;nt|=4;try{dv(e,t.alternate,t)}finally{nt=u,ge.p=a,me.T=i}}St=3}}function Uh(){if(St===4||St===3){St=0;var e=Lr;Lr=null,rr();var t=Ws,i=Yn,a=gi,u=jv,m=(a&335544064)===a?10262:10256;if((i.subtreeFlags&m)!==0||(i.flags&m)!==0?St=5:(St=0,Yn=Ws=null,Uv(t,t.pendingLanes)),m=t.pendingLanes,m===0&&(un=null),Yc(a),i=i.stateNode,xs&&typeof xs.onCommitFiberRoot=="function")try{xs.onCommitFiberRoot(ma,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=me.T,m=ge.p,ge.p=2,me.T=null;try{for(var R=t.onRecoverableError,H=0;H<u.length;H++){var K=u[H];R(K.value,{componentStack:K.stack})}}finally{me.T=i,ge.p=m}}if(u=Mr,R=Br,Br=null,u!==null&&(Mr=null,R===null&&(R=[]),e!==null))for(K=0;K<u.length;K++)i=(0,u[K])(R),i!==void 0&&e.finished.finally(i);(gi&3)!==0&&Po(),vi(t),m=t.pendingLanes,(a&261930)!==0&&(m&42)!==0?t===Ho?Za++:(Za=0,Ho=t):(Za=0,Ho=null),Xa(0)}}function Uv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ra(t)))}function Po(){return Lr!==null&&(Lr.skipTransition(),Lr=null),Ih(),Hh(),Uh(),zh()}function zh(){if(St!==5)return!1;var e=Ws,t=Oh;Oh=0;var i=Yc(gi),a=me.T,u=ge.p;try{ge.p=32>i?32:i,me.T=null,i=Lh,Lh=null;var m=Ws,R=gi;if(St=0,Yn=Ws=null,gi=0,(nt&6)!==0)throw Error(o(331));var H=nt;if(nt|=4,Cv(m.current),Sv(m,m.current,R,i),nt=H,Xa(0,!1),xs&&typeof xs.onPostCommitFiberRoot=="function")try{xs.onPostCommitFiberRoot(ma,m)}catch{}return!0}finally{ge.p=u,me.T=a,Uv(e,t)}}function zv(e,t,i){t=Bs(i,t),t=ih(e.stateNode,t,2),e=tn(e,t,2),e!==null&&(ga(e,2),vi(e))}function ot(e,t,i){if(e.tag===3)zv(e,e,i);else for(;t!==null;){if(t.tag===3){zv(t,e,i);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(un===null||!un.has(a))){e=Bs(i,e),i=Bg(2),a=tn(t,i,2),a!==null&&(Ig(i,a,t,e),ga(a,2),vi(a));break}}t=t.return}}function $h(e,t,i){var a=e.pingCache;if(a===null){a=e.pingCache=new z1;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(i)||(Dh=!0,u.add(i),e=Y1.bind(null,e,t,i),t.then(e,e))}function Y1(e,t,i){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,ft===e&&(Ze&i)===i&&((Et===4||Et===3&&(Ze&62914560)===Ze&&300>ns()-Mo)&&(nt&2)===0?Hr(e,0):Lo|=i,Or===Ze&&(Or=0)),vi(e)}function $v(e,t){t===0&&(t=Nm()),e=An(e,t),e!==null&&(ga(e,t),vi(e))}function Z1(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),$v(e,i)}function X1(e,t){var i=0;switch(e.tag){case 31:case 13:var a=e.stateNode,u=e.memoizedState;u!==null&&(i=u.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),$v(e,i)}function W1(e,t){return Ss(e,t)}var zr=null,$r=null,Ph=!1,Fo=!1,Fh=!1,dn=0;function vi(e){e!==$r&&e.next===null&&($r===null?zr=$r=e:$r=$r.next=e),Fo=!0,Ph||(Ph=!0,J1())}function Xa(e,t){if(!Fh&&Fo){Fh=!0;do for(var i=!1,a=zr;a!==null;){if(e!==0){var u=a.pendingLanes;if(u===0)var m=0;else{var R=a.suspendedLanes,H=a.pingedLanes;m=(1<<31-ws(42|e)+1)-1,m&=u&~(R&~H),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(i=!0,qv(a,m))}else m=Ze,m=Ol(a,a===ft?m:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(m&3)===0||pa(a,m)||(i=!0,qv(a,m));a=a.next}while(i);Fh=!1}}function Q1(){Pv()}function Pv(){Fo=Ph=!1;var e=0;dn!==0&&ux()&&(e=dn);for(var t=ns(),i=null,a=zr;a!==null;){var u=a.next,m=Fv(a,t);m===0?(a.next=null,i===null?zr=u:i.next=u,u===null&&($r=i)):(i=a,(e!==0||(m&3)!==0)&&(Fo=!0)),a=u}St!==0&&St!==5||Xa(e),dn!==0&&(dn=0)}function Fv(e,t){for(var i=e.suspendedLanes,a=e.pingedLanes,u=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var R=31-ws(m),H=1<<R,K=u[R];K===-1?((H&i)===0||(H&a)!==0)&&(u[R]=gS(H,t)):K<=t&&(e.expiredLanes|=H),m&=~H}if(t=ft,i=Ze,i=Ol(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,i===0||e===t&&(lt===2||lt===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Fi(a),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||pa(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(a!==null&&Fi(a),Yc(i)){case 2:case 8:i=fa;break;case 32:i=kl;break;case 268435456:i=Cm;break;default:i=kl}return a=Vv.bind(null,e),i=Ss(i,a),e.callbackPriority=t,e.callbackNode=i,t}return a!==null&&a!==null&&Fi(a),e.callbackPriority=2,e.callbackNode=null,2}function Vv(e,t){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Po()&&e.callbackNode!==i)return null;var a=Ze;return a=Ol(e,e===ft?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(kv(e,a,t),Fv(e,ns()),e.callbackNode!=null&&e.callbackNode===i?Vv.bind(null,e):null)}function qv(e,t){if(Po())return null;kv(e,t,!0)}function J1(){dx(function(){(nt&6)!==0?Ss(Vi,Q1):Pv()})}function Vh(){if(dn===0){var e=Hn;e===0&&(e=Rl,Rl<<=1,(Rl&261888)===0&&(Rl=256)),dn=e}return dn}function Kv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Hl(e)}function ex(e,t,i,a,u){if(t==="submit"&&i&&i.stateNode===u){var m=Kv((u[us]||null).action),R=a.submitter;R&&(t=(t=R[us]||null)?Kv(t.formAction):R.getAttribute("formAction"),t!==null&&(m=t,R=null));var H=new Pl("action","action",null,a,u);e.push({event:H,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(dn!==0){var K=new FormData(u,R);Qu(i,{pending:!0,data:K,method:u.method,action:m},null,K)}}else typeof m=="function"&&(H.preventDefault(),K=new FormData(u,R),Qu(i,{pending:!0,data:K,method:u.method,action:m},m,K))},currentTarget:u}]})}}for(var qh=0;qh<gu.length;qh++){var Kh=gu[qh],tx=Kh.toLowerCase(),sx=Kh[0].toUpperCase()+Kh.slice(1);Gs(tx,"on"+sx)}Gs(_p,"onAnimationEnd"),Gs(yp,"onAnimationIteration"),Gs(bp,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(h1,"onTransitionRun"),Gs(d1,"onTransitionStart"),Gs(f1,"onTransitionCancel"),Gs(Sp,"onTransitionEnd"),cr("onMouseEnter",["mouseout","mouseover"]),cr("onMouseLeave",["mouseout","mouseover"]),cr("onPointerEnter",["pointerout","pointerover"]),cr("onPointerLeave",["pointerout","pointerover"]),kn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),kn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),kn("onBeforeInput",["compositionend","keypress","textInput","paste"]),kn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),kn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),kn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wa="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(" "),ix=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Wa));function Gv(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var a=e[i],u=a.event;a=a.listeners;e:{var m=void 0;if(t)for(var R=a.length-1;0<=R;R--){var H=a[R],K=H.instance,ie=H.currentTarget;if(H=H.listener,K!==m&&u.isPropagationStopped())break e;m=H,u.currentTarget=ie;try{m(u)}catch(oe){ql(oe)}u.currentTarget=null,m=K}else for(R=0;R<a.length;R++){if(H=a[R],K=H.instance,ie=H.currentTarget,H=H.listener,K!==m&&u.isPropagationStopped())break e;m=H,u.currentTarget=ie;try{m(u)}catch(oe){ql(oe)}u.currentTarget=null,m=K}}}}function Ye(e,t){var i=t[Am];i===void 0&&(i=t[Am]=new Set);var a=e+"__bubble";i.has(a)||(Yv(t,e,2,!1),i.add(a))}function Gh(e,t,i){var a=0;t&&(a|=4),Yv(i,e,a,t)}var Vo="_reactListening"+Math.random().toString(36).slice(2);function Yh(e){if(!e[Vo]){e[Vo]=!0,Mm.forEach(function(i){i!=="selectionchange"&&(ix.has(i)||Gh(i,!1,e),Gh(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Vo]||(t[Vo]=!0,Gh("selectionchange",!1,t))}}function Yv(e,t,i,a){switch(I_(t)){case 2:var u=Zx;break;case 8:u=Xx;break;default:u=md}i=u.bind(null,t,i,e),u=void 0,!su||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),a?u!==void 0?e.addEventListener(t,i,{capture:!0,passive:u}):e.addEventListener(t,i,!0):u!==void 0?e.addEventListener(t,i,{passive:u}):e.addEventListener(t,i,!1)}function Zh(e,t,i,a,u){var m=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var R=a.tag;if(R===3||R===4){var H=a.stateNode.containerInfo;if(H===u)break;if(R===4)for(R=a.return;R!==null;){var K=R.tag;if((K===3||K===4)&&R.stateNode.containerInfo===u)return;R=R.return}for(;H!==null;){if(R=Tn(H),R===null)return;if(K=R.tag,K===5||K===6||K===26||K===27){a=m=R;continue e}H=H.parentNode}}a=a.return}Ym(function(){var ie=m,oe=eu(i),_e=[];e:{var te=xp.get(e);if(te!==void 0){var ae=Pl,be=e;switch(e){case"keypress":if(zl(i)===0)break e;case"keydown":case"keyup":ae=$S;break;case"focusin":be="focus",ae=au;break;case"focusout":be="blur",ae=au;break;case"beforeblur":case"afterblur":ae=au;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Wm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=kS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=KS;break;case _p:case yp:case bp:ae=AS;break;case Sp:ae=YS;break;case"scroll":case"scrollend":ae=jS;break;case"wheel":ae=XS;break;case"copy":case"cut":case"paste":ae=LS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Jm;break;case"submit":ae=VS;break;case"toggle":case"beforetoggle":ae=QS}var Ne=(t&4)!==0,ze=!Ne&&(e==="scroll"||e==="scrollend"),se=Ne?te!==null?te+"Capture":null:te;Ne=[];for(var X=ie,re;X!==null;){var ve=X;if(re=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||re===null||se===null||(ve=ya(X,se),ve!=null&&Ne.push(Qa(X,ve,re))),ze)break;X=X.return}0<Ne.length&&(te=new ae(te,be,null,i,oe),_e.push({event:te,listeners:Ne}))}}if((t&7)===0){e:{if(ae=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",ae&&i!==Jc&&(be=i.relatedTarget||i.fromElement)&&(Tn(be)||be[ar]))break e;(te||ae)&&(be=oe.window===oe?oe:(ae=oe.ownerDocument)?ae.defaultView||ae.parentWindow:window,te?(ae=i.relatedTarget||i.toElement,te=ie,ae=ae?Tn(ae):null,ae!==null&&(ze=_(ae),Ne=ae.tag,ae!==ze||Ne!==5&&Ne!==27&&Ne!==6)&&(ae=null)):(te=null,ae=ie),te!==ae&&(Ne=Wm,ve="onMouseLeave",se="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=Jm,ve="onPointerLeave",se="onPointerEnter",X="pointer"),ze=te==null?be:_a(te),re=ae==null?be:_a(ae),be=new Ne(ve,X+"leave",te,i,oe),be.target=ze,be.relatedTarget=re,ve=null,Tn(oe)===ie&&(Ne=new Ne(se,X+"enter",ae,i,oe),Ne.target=re,Ne.relatedTarget=ze,ve=Ne),ze=ve,Ne=te&&ae?D(te,ae,nx):null,te!==null&&Zv(_e,be,te,Ne,!1),ae!==null&&ze!==null&&Zv(_e,ze,ae,Ne,!0)))}e:{if(te=ie?_a(ie):window,ae=te.nodeName&&te.nodeName.toLowerCase(),ae==="select"||ae==="input"&&te.type==="file")var Ce=lp;else if(rp(te))if(op)Ce=o1;else{Ce=a1;var Xe=r1}else ae=te.nodeName,!ae||ae.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ie&&Qc(ie.elementType)&&(Ce=lp):Ce=l1;if(Ce&&(Ce=Ce(e,ie))){ap(_e,Ce,i,oe);break e}Xe&&Xe(e,te,ie)}switch(Xe=ie?_a(ie):window,e){case"focusin":(rp(Xe)||Xe.contentEditable==="true")&&(pr=Xe,fu=ie,ja=null);break;case"focusout":ja=fu=pr=null;break;case"mousedown":mu=!0;break;case"contextmenu":case"mouseup":case"dragend":mu=!1,gp(_e,i,oe);break;case"selectionchange":if(u1)break;case"keydown":case"keyup":gp(_e,i,oe)}var Te;if(ou)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else mr?ip(e,i)&&(Ae="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ae="onCompositionStart");Ae&&(ep&&i.locale!=="ko"&&(mr||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&mr&&(Te=Zm()):(Ki=oe,iu="value"in Ki?Ki.value:Ki.textContent,mr=!0)),Xe=qo(ie,Ae),0<Xe.length&&(Ae=new Qm(Ae,e,null,i,oe),_e.push({event:Ae,listeners:Xe}),Te?Ae.data=Te:(Te=np(i),Te!==null&&(Ae.data=Te)))),(Te=e1?t1(e,i):s1(e,i))&&(Ae=qo(ie,"onBeforeInput"),0<Ae.length&&(Xe=new Qm("onBeforeInput","beforeinput",null,i,oe),_e.push({event:Xe,listeners:Ae}),Xe.data=Te)),ex(_e,e,ie,i,oe)}Gv(_e,t)})}function Qa(e,t,i){return{instance:e,listener:t,currentTarget:i}}function qo(e,t){for(var i=t+"Capture",a=[];e!==null;){var u=e,m=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||m===null||(u=ya(e,i),u!=null&&a.unshift(Qa(e,u,m)),u=ya(e,t),u!=null&&a.push(Qa(e,u,m))),e.tag===3)return a;e=e.return}return[]}function nx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Zv(e,t,i,a,u){for(var m=t._reactName,R=[];i!==null&&i!==a;){var H=i,K=H.alternate,ie=H.stateNode;if(H=H.tag,K!==null&&K===a)break;H!==5&&H!==26&&H!==27||ie===null||(K=ie,u?(ie=ya(i,m),ie!=null&&R.unshift(Qa(i,ie,K))):u||(ie=ya(i,m),ie!=null&&R.push(Qa(i,ie,K)))),i=i.return}R.length!==0&&e.push({event:t,listeners:R})}var rx=/\r\n?/g,ax=/\u0000|\uFFFD/g;function Xv(e){return(typeof e=="string"?e:""+e).replace(rx,`
9
- `).replace(ax,"")}function Wv(e,t){return t=Xv(t),Xv(e)===t}function ct(e,t,i,a,u,m){switch(i){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||hr(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&hr(e,""+a);else return;break;case"className":Il(e,"class",a);break;case"tabIndex":Il(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Il(e,i,a);break;case"style":Km(e,a,m);return;case"data":if(t!=="object"){Il(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(i);break}a=Hl(a),e.setAttribute(i,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(i==="formAction"?(t!=="input"&&ct(e,t,"name",u.name,u,null),ct(e,t,"formEncType",u.formEncType,u,null),ct(e,t,"formMethod",u.formMethod,u,null),ct(e,t,"formTarget",u.formTarget,u,null)):(ct(e,t,"encType",u.encType,u,null),ct(e,t,"method",u.method,u,null),ct(e,t,"target",u.target,u,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(i);break}a=Hl(a),e.setAttribute(i,a);break;case"onClick":a!=null&&(e.onclick=li);return;case"onScroll":a!=null&&Ye("scroll",e);return;case"onScrollEnd":a!=null&&Ye("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(i=a.__html,i!=null){if(u.children!=null)throw Error(o(60));m?.__html!==i&&(e.innerHTML=i)}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}i=Hl(a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(i,a):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":a===!0?e.setAttribute(i,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(i,a):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(i,a):e.removeAttribute(i);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(i):e.setAttribute(i,a);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),Bl(e,"popover",a);break;case"xlinkActuate":xi(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":xi(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":xi(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":xi(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":xi(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":xi(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":xi(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":xi(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":xi(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Bl(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")i=ES.get(i)||i,Bl(e,i,a);else return}it=!0}function Xh(e,t,i,a,u,m){switch(i){case"style":Km(e,a,m);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(i=a.__html,i!=null){if(u.children!=null)throw Error(o(60));m?.__html!==i&&(e.innerHTML=i)}}break;case"children":if(typeof a=="string")hr(e,a);else if(typeof a=="number"||typeof a=="bigint")hr(e,""+a);else return;break;case"onScroll":a!=null&&Ye("scroll",e);return;case"onScrollEnd":a!=null&&Ye("scrollend",e);return;case"onClick":a!=null&&(e.onclick=li);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Bm.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),m=i.slice(2,u?i.length-7:void 0),t=e[us]||null,t=t!=null?t[i]:null,typeof t=="function"&&e.removeEventListener(m,t,u),typeof a=="function")){typeof t!="function"&&t!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(m,a,u);break e}it=!0,i in e?e[i]=a:a===!0?e.setAttribute(i,""):Bl(e,i,a)}return}it=!0}function Zt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var a=!1,u=!1,m;for(m in i)if(i.hasOwnProperty(m)){var R=i[m];if(R!=null)switch(m){case"src":a=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,m,R,i,null)}}u&&ct(e,t,"srcSet",i.srcSet,i,null),a&&ct(e,t,"src",i.src,i,null);return;case"input":Ye("invalid",e);var H=m=R=u=null,K=null,ie=null;for(a in i)if(i.hasOwnProperty(a)){var oe=i[a];if(oe!=null)switch(a){case"name":u=oe;break;case"type":R=oe;break;case"checked":K=oe;break;case"defaultChecked":ie=oe;break;case"value":m=oe;break;case"defaultValue":H=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(o(137,t));break;default:ct(e,t,a,oe,i,null)}}Pm(e,m,H,K,ie,R,u,!1);return;case"select":Ye("invalid",e),a=R=m=null;for(u in i)if(i.hasOwnProperty(u)&&(H=i[u],H!=null))switch(u){case"value":m=H;break;case"defaultValue":R=H;break;case"multiple":a=H;default:ct(e,t,u,H,i,null)}t=m,i=R,e.multiple=!!a,t!=null?ur(e,!!a,t,!1):i!=null&&ur(e,!!a,i,!0);return;case"textarea":Ye("invalid",e),m=u=a=null;for(R in i)if(i.hasOwnProperty(R)&&(H=i[R],H!=null))switch(R){case"value":a=H;break;case"defaultValue":u=H;break;case"children":m=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(91));break;default:ct(e,t,R,H,i,null)}Vm(e,a,u,m);return;case"option":for(K in i)i.hasOwnProperty(K)&&(a=i[K],a!=null)&&(K==="selected"?e.selected=a&&typeof a!="function"&&typeof a!="symbol":ct(e,t,K,a,i,null));return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(a=0;a<Wa.length;a++)Ye(Wa[a],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in i)if(i.hasOwnProperty(ie)&&(a=i[ie],a!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,ie,a,i,null)}return;default:if(Qc(t)){for(oe in i)i.hasOwnProperty(oe)&&(a=i[oe],a!==void 0&&Xh(e,t,oe,a,i,void 0));return}}for(H in i)i.hasOwnProperty(H)&&(a=i[H],a!=null&&ct(e,t,H,a,i,null))}var lx={};function ox(e,t,i,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,m=null,R=null,H=null,K=null,ie=null,oe=null;for(ae in i){var _e=i[ae];if(i.hasOwnProperty(ae)&&_e!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":K=_e;default:a.hasOwnProperty(ae)||ct(e,t,ae,null,a,_e)}}for(var te in a){var ae=a[te];if(_e=i[te],a.hasOwnProperty(te)&&(ae!=null||_e!=null))switch(te){case"type":ae!==_e&&(it=!0),m=ae;break;case"name":ae!==_e&&(it=!0),u=ae;break;case"checked":ae!==_e&&(it=!0),ie=ae;break;case"defaultChecked":ae!==_e&&(it=!0),oe=ae;break;case"value":ae!==_e&&(it=!0),R=ae;break;case"defaultValue":ae!==_e&&(it=!0),H=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(o(137,t));break;default:ae!==_e&&ct(e,t,te,ae,a,_e)}}Xc(e,R,H,K,ie,oe,m,u);return;case"select":ae=R=H=te=null;for(m in i)if(K=i[m],i.hasOwnProperty(m)&&K!=null)switch(m){case"value":break;case"multiple":ae=K;default:a.hasOwnProperty(m)||ct(e,t,m,null,a,K)}for(u in a)if(m=a[u],K=i[u],a.hasOwnProperty(u)&&(m!=null||K!=null))switch(u){case"value":m!==K&&(it=!0),te=m;break;case"defaultValue":m!==K&&(it=!0),H=m;break;case"multiple":m!==K&&(it=!0),R=m;default:m!==K&&ct(e,t,u,m,a,K)}t=H,i=R,a=ae,te!=null?ur(e,!!i,te,!1):!!a!=!!i&&(t!=null?ur(e,!!i,t,!0):ur(e,!!i,i?[]:"",!1));return;case"textarea":ae=te=null;for(H in i)if(u=i[H],i.hasOwnProperty(H)&&u!=null&&!a.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:ct(e,t,H,null,a,u)}for(R in a)if(u=a[R],m=i[R],a.hasOwnProperty(R)&&(u!=null||m!=null))switch(R){case"value":u!==m&&(it=!0),te=u;break;case"defaultValue":u!==m&&(it=!0),ae=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==m&&ct(e,t,R,u,a,m)}Fm(e,te,ae);return;case"option":for(var be in i)te=i[be],i.hasOwnProperty(be)&&te!=null&&!a.hasOwnProperty(be)&&(be==="selected"?e.selected=!1:ct(e,t,be,null,a,te));for(K in a)te=a[K],ae=i[K],a.hasOwnProperty(K)&&te!==ae&&(te!=null||ae!=null)&&(K==="selected"?(te!==ae&&(it=!0),e.selected=te&&typeof te!="function"&&typeof te!="symbol"):ct(e,t,K,te,a,ae));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in i)te=i[Ne],i.hasOwnProperty(Ne)&&te!=null&&!a.hasOwnProperty(Ne)&&ct(e,t,Ne,null,a,te);for(ie in a)if(te=a[ie],ae=i[ie],a.hasOwnProperty(ie)&&te!==ae&&(te!=null||ae!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(o(137,t));break;default:ct(e,t,ie,te,a,ae)}return;default:if(Qc(t)){for(var ze in i)te=i[ze],i.hasOwnProperty(ze)&&te!==void 0&&!a.hasOwnProperty(ze)&&Xh(e,t,ze,void 0,a,te);for(oe in a)te=a[oe],ae=i[oe],!a.hasOwnProperty(oe)||te===ae||te===void 0&&ae===void 0||Xh(e,t,oe,te,a,ae);return}}for(var se in i)te=i[se],i.hasOwnProperty(se)&&te!=null&&!a.hasOwnProperty(se)&&ct(e,t,se,null,a,te);for(_e in a)te=a[_e],ae=i[_e],!a.hasOwnProperty(_e)||te===ae||te==null&&ae==null||ct(e,t,_e,te,a,ae)}function Qv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function cx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),a=0;a<i.length;a++){var u=i[a],m=u.transferSize,R=u.initiatorType,H=u.duration;if(m&&H&&Qv(R)){for(R=0,H=u.responseEnd,a+=1;a<i.length;a++){var K=i[a],ie=K.startTime;if(ie>H)break;var oe=K.transferSize,_e=K.initiatorType;oe&&Qv(_e)&&(K=K.responseEnd,R+=oe*(K<H?1:(H-ie)/(K-ie)))}if(--a,t+=8*(m+R)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Wh=null,Qh=null;function Ja(e){return e.nodeType===9?e:e.ownerDocument}function Jv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function e_(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function t_(e,t,i,a){return i=Ja(i).createElement(e),i[Vt]=a,i[us]=t,Zt(i,e,t),Ut(i),i}function Jh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ed=null;function ux(){var e=window.event;return e&&e.type==="popstate"?e===ed?!1:(ed=e,!0):(ed=null,!1)}var td=typeof setTimeout=="function"?setTimeout:void 0,hx=typeof clearTimeout=="function"?clearTimeout:void 0,s_=typeof Promise=="function"?Promise:void 0,i_=typeof requestAnimationFrame=="function"?requestAnimationFrame:td,dx=typeof queueMicrotask=="function"?queueMicrotask:typeof s_<"u"?function(e){return s_.resolve(null).then(e).catch(fx)}:td;function fx(e){setTimeout(function(){throw e})}function fn(e){return e==="head"}function n_(e,t){var i=t,a=0;do{var u=i.nextSibling;if(e.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(a===0){e.removeChild(u),Yr(t);return}a--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")a++;else if(i==="html")cd(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,cd(i);for(var m=i.firstChild;m;){var R=m.nextSibling,H=m.nodeName;m[va]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&m.rel.toLowerCase()==="stylesheet"||i.removeChild(m),m=R}}else i==="body"&&cd(e.ownerDocument.body);i=u}while(i);Yr(t)}function r_(e,t){var i=e;e=0;do{var a=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),a&&a.nodeType===8)if(i=a.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=a}while(i)}function a_(e,t,i){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,i!=null&&(e.style.viewTransitionClass=i),i=getComputedStyle(e),i.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var u=a=0;u<t.length;u++){var m=t[u];0<m.width&&0<m.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+i.paddingTop,e.marginBottom="-"+i.paddingBottom)}}function l_(e,t){e=e.style,t=t.style;var i=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=i==null||typeof i=="boolean"?"":(""+i).trim(),i=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=i==null||typeof i=="boolean"?"":(""+i).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(i=t.display,e.display=i==null||typeof i=="boolean"?"":i,i=t.margin,i!=null?e.margin=i:(i=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=i==null||typeof i=="boolean"?"":i,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function mx(e,t,i){return i=i.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=i.innerHeight&&e.left<=i.innerWidth}}function sd(e){var t=e.getBoundingClientRect(),i=getComputedStyle(e);return mx(t,i,e)}function px(e){return e.documentElement.clientHeight}function gx(e){this.addEventListener("load",e),this.addEventListener("error",e)}function vx(e,t,i,a,u,m,R,H,K){var ie=t.nodeType===9?t:t.ownerDocument;try{var oe=ie.startViewTransition({update:function(){var te=ie.defaultView,ae=te.navigation&&te.navigation.transition,be=ie.fonts.status;a();var Ne=[];if(be==="loaded"&&(px(ie),ie.fonts.status==="loading"&&Ne.push(ie.fonts.ready)),be=Ne.length,e!==null)for(var ze=e.suspenseyImages,se=0,X=0;X<ze.length;X++){var re=ze[X];if(!re.complete){var ve=re.getBoundingClientRect();if(0<ve.bottom&&0<ve.right&&ve.top<te.innerHeight&&ve.left<te.innerWidth){if(se+=T_(re),se>Yo){Ne.length=be;break}re=new Promise(gx.bind(re)),Ne.push(re)}}}if(0<Ne.length)return te=Promise.race([Promise.all(Ne),new Promise(function(Ce){return setTimeout(Ce,500)})]).then(u,u),(ae?Promise.allSettled([ae.finished,te]):te).then(m,m);if(u(),ae)return ae.finished.then(m,m);m()},types:i});ie.__reactViewTransition=oe;var _e=[];return oe.ready.then(function(){for(var te=ie.documentElement.getAnimations({subtree:!0}),ae=0;ae<te.length;ae++){var be=te[ae],Ne=be.effect,ze=Ne.pseudoElement;if(ze!=null&&ze.startsWith("::view-transition")){_e.push(be),be=Ne.getKeyframes();for(var se=ze=void 0,X=!0,re=0;re<be.length;re++){var ve=be[re],Ce=ve.width;if(ze===void 0)ze=Ce;else if(ze!==Ce){X=!1;break}if(Ce=ve.height,se===void 0)se=Ce;else if(se!==Ce){X=!1;break}delete ve.width,delete ve.height,ve.transform==="none"&&delete ve.transform}X&&ze!==void 0&&se!==void 0&&(Ne.setKeyframes(be),X=getComputedStyle(Ne.target,Ne.pseudoElement),X.width!==ze||X.height!==se)&&(X=be[0],X.width=ze,X.height=se,X=be[be.length-1],X.width=ze,X.height=se,Ne.setKeyframes(be))}}R()},function(te){ie.__reactViewTransition===oe&&(ie.__reactViewTransition=null);try{typeof te=="object"&&te!==null&&te.name==="InvalidStateError"&&(te.message==="View transition was skipped because document visibility state is hidden."||te.message==="Skipping view transition because document visibility state has become hidden."||te.message==="Skipping view transition because viewport size changed."||te.message==="Transition was aborted because of invalid state")&&(te=null),te!==null&&K(te)}finally{a(),u(),R()}}),oe.finished.finally(function(){for(var te=0;te<_e.length;te++)_e[te].cancel();ie.__reactViewTransition===oe&&(ie.__reactViewTransition=null),H()}),oe}catch{return a(),u(),R(),null}}function Zn(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}Zn.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:O({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Zn.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,i=e.getAnimations({subtree:!0}),a=[],u=0;u<i.length;u++){var m=i[u].effect;m!==null&&m.target===e&&m.pseudoElement===t&&a.push(i[u])}return a},Zn.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function o_(e){return{name:e,group:new Zn("group",e),imagePair:new Zn("image-pair",e),old:new Zn("old",e),new:new Zn("new",e)}}function Ds(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ds.prototype.addEventListener=function(e,t,i){var a=null,u=null;if(!(i!=null&&typeof i!="boolean"&&(a=i.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var m=this._eventListeners;if(u_(m,e,t,i)===-1){var R=this,H=t;i!=null&&typeof i!="boolean"&&i.once===!0&&(H=function(K){R.removeEventListener(e,t,i),typeof t=="function"?t.call(this,K):t.handleEvent(K)}),a!==null&&(u=R.removeEventListener.bind(R,e,t,i),a.addEventListener("abort",u,{once:!0}),u=a.removeEventListener.bind(a,"abort",u)),a=Pr(i),m.push({type:e,listener:t,optionsOrUseCapture:i,attachedListener:H,cleanup:u}),f(this._fragmentFiber.child,!1,_x,e,H,a)}this._eventListeners=m}};function _x(e,t,i,a){return g(e).addEventListener(t,i,a),!1}Ds.prototype.removeEventListener=function(e,t,i){var a=this._eventListeners;if(a!==null&&(t=u_(a,e,t,i),t!==-1)){var u=a[t];i=u.attachedListener;var m=u.cleanup;u=Pr(u.optionsOrUseCapture),f(this._fragmentFiber.child,!1,yx,e,i,u),a.splice(t,1),m!==null&&m()}};function yx(e,t,i,a){return g(e).removeEventListener(t,i,a),!1}function Pr(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function c_(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function u_(e,t,i,a){if(e.length===0)return-1;a=c_(a);for(var u=0;u<e.length;u++){var m=e[u];if(m.type===t&&m.listener===i&&c_(m.optionsOrUseCapture)===a)return u}return-1}Ds.prototype.dispatchEvent=function(e){var t=x(this._fragmentFiber);if(t===null)return!0;t=g(t);var i=this._eventListeners;if(i!==null&&0<i.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(i)for(var u=0;u<i.length;u++){var m=i[u];a.addEventListener(m.type,m.attachedListener,Pr(m.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),i)for(u=0;u<i.length;u++)m=i[u],a.removeEventListener(m.type,m.attachedListener,Pr(m.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},Ds.prototype.focus=function(e){f(this._fragmentFiber.child,!0,h_,e,void 0,void 0)};function h_(e,t){return e.tag===6?!1:(e=g(e),Dx(e,t))}Ds.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,id,t,void 0,void 0);for(var i=t.length-1;0<=i&&!h_(t[i],e);i--);};function id(e,t){return t.push(e),!1}Ds.prototype.blur=function(){var e=x(this._fragmentFiber);e!==null&&(e=g(e),e=Ja(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,bx,e,void 0,void 0))};function bx(e,t){return e.tag===6?!1:(e=g(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ds.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,Sx,e,void 0,void 0)};function Sx(e,t){return e.tag===6||(e=g(e),t.observe(e)),!1}Ds.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,xx,e,void 0,void 0);for(var i=t=0;i<Qs.length;i++){var a=Qs[i];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):Qs[t++]=a}Qs.length=t}};function xx(e,t){return e.tag===6||(e=g(e),t.unobserve(e)),!1}var Qs=[],nd=!1;function wx(e,t,i){Qs.push({fragmentInstance:e,observer:t,instance:i}),nd||(nd=!0,Ax(function(){nd=!1;var a=Qs;Qs=[];for(var u=0;u<a.length;u++){var m=a[u];m.observer.unobserve(m.instance)}}))}Ds.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Cx,e,void 0,void 0),e};function Cx(e,t){if(e.tag===6){e=e.stateNode;var i=e.ownerDocument.createRange();i.selectNodeContents(e),t.push.apply(t,i.getClientRects())}else e=g(e),t.push.apply(t,e.getClientRects());return!1}Ds.prototype.getRootNode=function(e){var t=x(this._fragmentFiber);return t===null?this:g(t).getRootNode(e)},Ds.prototype.compareDocumentPosition=function(e){var t=x(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var i=[];f(this._fragmentFiber.child,!1,id,i,void 0,void 0);var a=g(t);if(i.length===0){if(i=a,C(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(i=t)}t=this._fragmentFiber;var u=a=i.compareDocumentPosition(e);return i===e?u=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(i=j(t)[1],i===null?u=Node.DOCUMENT_POSITION_PRECEDING:(e=g(i).compareDocumentPosition(e),u=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=g(i[0]),u=g(i[i.length-1]);var m=C(this._fragmentFiber)?t.parentElement:a;if(m==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=m.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,m=m.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var R=t.compareDocumentPosition(e),H=u.compareDocumentPosition(e),K=R&Node.DOCUMENT_POSITION_CONTAINED_BY||H&Node.DOCUMENT_POSITION_CONTAINED_BY;return H=a&&m&&R&Node.DOCUMENT_POSITION_FOLLOWING&&H&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||m&&u===e||K||H?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!m&&u===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:R,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Ex(t,this._fragmentFiber,i[0],i[i.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Ex(e,t,i,a,u){var m=Tn(u);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(i=!!m)e:{for(;m!==null;){if(m.tag===7&&(m===t||m.alternate===t)){i=!0;break e}m=m.return}i=!1}return i}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(m===null)return m=u.ownerDocument,u===m||u===m.documentElement||u===m.body;e:{for(m=t,t=x(t);m!==null;){if(!(m.tag!==5&&m.tag!==3&&m.tag!==27||m!==t&&m.alternate!==t)){m=!0;break e}m=m.return}m=!1}return m}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!m)&&!(t=m===i)&&(t=D(i,m,T),t===null?t=!1:(f(t,!0,S,m,i),m=b,b=null,t=m!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!m)&&!(t=m===a)&&(t=D(a,m,T),t===null?t=!1:(f(t,!0,N,m,a),m=b,v=b=null,t=m!==null)),t):!1}function d_(e,t){var i=e.ownerDocument.createRange();i.selectNodeContents(e),e=i.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ds.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];f(this._fragmentFiber.child,!1,id,t,void 0,void 0);var i=e!==!1;if(t.length===0){var a=j(this._fragmentFiber);if(a=i?a[1]||a[0]||x(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=g(a),d_(e,i);return}if(a=g(a),a.nodeType!==9){if(a.nodeType===11){i="host"in a?a.host:null,i!==null&&i.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=i?t.length-1:0;a!==(i?-1:t.length);){var u=t[a];u.tag===6?(u=g(u),d_(u,i)):g(u).scrollIntoView(e),a+=i?-1:1}};function Nx(e,t){return e=g(e),f_(e,t),!1}function f_(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function m_(e,t){var i=t._eventListeners;if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];e.addEventListener(u.type,u.attachedListener,Pr(u.optionsOrUseCapture))}e.nodeType!==3&&(i=t._observers,i!==null&&i.forEach(function(m){for(var R=0,H=0;H<Qs.length;H++){var K=Qs[H];(K.fragmentInstance!==t||K.observer!==m||K.instance!==e)&&(Qs[R++]=K)}Qs.length=R,m.observe(e)}),f_(e,t))}function jx(e,t){var i=t._eventListeners;if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];e.removeEventListener(u.type,u.attachedListener,Pr(u.optionsOrUseCapture))}e.nodeType!==3&&(i=t._observers,i!==null&&i.forEach(function(m){typeof m.rootMargin=="string"?wx(t,m,e):m.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function rd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":rd(i),Ml(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Tx(e,t,i,a){for(;e.nodeType===1;){var u=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[va])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var m=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=$s(e.nextSibling),e===null)break}return null}function kx(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=$s(e.nextSibling),e===null))return null;return e}function p_(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=$s(e.nextSibling),e===null))return null;return e}function ad(e){return e.data==="$?"||e.data==="$~"}function ld(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Rx(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var a=function(){t(),i.removeEventListener("DOMContentLoaded",a)};i.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function $s(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var od=null;function g_(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return $s(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function v_(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Dx(e,t){function i(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",i,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",i,!0)}return a}function Ax(e){i_(function(){i_(function(t){return e(t)})})}function __(e,t,i){switch(t=Ja(i),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function y_(e,t,i){for(var a in i){var u=i[a];i.hasOwnProperty(a)&&u!=null&&ct(e,t,a,null,lx,u)}i.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===li&&(e.onclick=null),Ml(e)}function cd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ml(e)}var Ps=new Map,b_=new Set;function el(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Mi=ge.d;ge.d={f:Ox,r:Lx,D:Mx,C:Bx,L:Ix,m:Hx,X:zx,S:Ux,M:$x};function Ox(){var e=Mi.f(),t=Uo();return e||t}function Lx(e){var t=lr(e);t!==null&&t.tag===5&&t.type==="form"?xg(t):Mi.r(e)}var Fr=typeof document>"u"?null:document;function S_(e,t,i){var a=Fr;if(a&&typeof t=="string"&&t){var u=Ls(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),b_.has(u)||(b_.add(u),e={rel:e,crossOrigin:i,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),Zt(t,"link",e),Ut(t),a.head.appendChild(t)))}}function Mx(e){Mi.D(e),S_("dns-prefetch",e,null)}function Bx(e,t){Mi.C(e,t),S_("preconnect",e,t)}function Ix(e,t,i){Mi.L(e,t,i);var a=Fr;if(a&&e&&t){var u='link[rel="preload"][as="'+Ls(t)+'"]';t==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Ls(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Ls(i.imageSizes)+'"]')):u+='[href="'+Ls(e)+'"]';var m=u;switch(t){case"style":m=Vr(e);break;case"script":m=qr(e)}if(!(Ps.has(m)||(e=O({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),Ps.set(m,e),a.querySelector(u)!==null||t==="style"&&a.querySelector(tl(m))||t==="script"&&a.querySelector(sl(m))))){var R=a.createElement("link");Zt(R,"link",e),t==="style"&&(R[Ll]=!0,R.onload=R.onerror=function(){Lm(R)}),Ut(R),a.head.appendChild(R)}}}function Hx(e,t){Mi.m(e,t);var i=Fr;if(i&&e){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Ls(a)+'"][href="'+Ls(e)+'"]',m=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=qr(e)}if(!Ps.has(m)&&(e=O({rel:"modulepreload",href:e},t),Ps.set(m,e),i.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(sl(m)))return}a=i.createElement("link"),Zt(a,"link",e),Ut(a),i.head.appendChild(a)}}}function Ux(e,t,i){Mi.S(e,t,i);var a=Fr;if(a&&e){var u=or(a).hoistableStyles,m=Vr(e);t=t||"default";var R=u.get(m);if(!R){var H={loading:0,preload:null};if(R=a.querySelector(tl(m)))H.loading=5;else{e=O({rel:"stylesheet",href:e,"data-precedence":t},i),(i=Ps.get(m))&&ud(e,i);var K=R=a.createElement("link");Ut(K),Zt(K,"link",e),K._p=new Promise(function(ie,oe){K.onload=ie,K.onerror=oe}),K.addEventListener("load",function(){H.loading|=1}),K.addEventListener("error",function(){H.loading|=2}),H.loading|=4,Ko(R,t,a)}R={type:"stylesheet",instance:R,count:1,state:H},u.set(m,R)}}}function zx(e,t){Mi.X(e,t);var i=Fr;if(i&&e){var a=or(i).hoistableScripts,u=qr(e),m=a.get(u);m||(m=i.querySelector(sl(u)),m||(e=O({src:e,async:!0},t),(t=Ps.get(u))&&hd(e,t),m=i.createElement("script"),Ut(m),Zt(m,"link",e),i.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},a.set(u,m))}}function $x(e,t){Mi.M(e,t);var i=Fr;if(i&&e){var a=or(i).hoistableScripts,u=qr(e),m=a.get(u);m||(m=i.querySelector(sl(u)),m||(e=O({src:e,async:!0,type:"module"},t),(t=Ps.get(u))&&hd(e,t),m=i.createElement("script"),Ut(m),Zt(m,"link",e),i.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},a.set(u,m))}}function x_(e,t,i,a){var u=(u=is.current)?el(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=Vr(i.href),t=or(u).hoistableStyles,a=t.get(i),a||(a={type:"style",instance:null,count:0,state:null},t.set(i,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Vr(i.href);var m=or(u).hoistableStyles,R=m.get(e);if(R||(u=u.ownerDocument||u,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,R),(m=u.querySelector(tl(e)))?m._p||(R.instance=m,R.state.loading=5):(m=Ps.get(e),m||(m={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Ps.set(e,m)),Px(u,e,m,R.state))),t&&a===null)throw Error(o(528,""));return R}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(i=qr(i),t=or(u).hoistableScripts,a=t.get(i),a||(a={type:"script",instance:null,count:0,state:null},t.set(i,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Vr(e){return'href="'+Ls(e)+'"'}function tl(e){return'link[rel="stylesheet"]['+e+"]"}function w_(e){return O({},e,{"data-precedence":e.precedence,precedence:null})}function Px(e,t,i,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Ll]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Ll]=!0,t.onload=t.onerror=Lm.bind(null,t),Zt(t,"link",i),Ut(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function qr(e){return'[src="'+Ls(e)+'"]'}function sl(e){return"script[async]"+e}function C_(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ls(i.href)+'"]');if(a)return t.instance=a,Ut(a),a;var u=O({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ut(a),Zt(a,"style",u),Ko(a,i.precedence,e),t.instance=a;case"stylesheet":u=Vr(i.href);var m=e.querySelector(tl(u));if(m)return t.state.loading|=4,t.instance=m,Ut(m),m;a=w_(i),(u=Ps.get(u))&&ud(a,u),m=(e.ownerDocument||e).createElement("link"),Ut(m);var R=m;return R._p=new Promise(function(H,K){R.onload=H,R.onerror=K}),Zt(m,"link",a),t.state.loading|=4,Ko(m,i.precedence,e),t.instance=m;case"script":return m=qr(i.src),(u=e.querySelector(sl(m)))?(t.instance=u,Ut(u),u):(a=i,(u=Ps.get(m))&&(a=O({},i),hd(a,u)),e=e.ownerDocument||e,u=e.createElement("script"),Ut(u),Zt(u,"link",a),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ko(a,i.precedence,e));return t.instance}function Ko(e,t,i){for(var a=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,m=u,R=0;R<a.length;R++){var H=a[R];if(H.dataset.precedence===t)m=H;else if(m!==u)break}m?m.parentNode.insertBefore(e,m.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function ud(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function hd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Go=null;function E_(e,t,i){if(Go===null){var a=new Map,u=Go=new Map;u.set(i,a)}else u=Go,a=u.get(i),a||(a=new Map,u.set(i,a));if(a.has(e))return a;for(a.set(e,null),i=i.getElementsByTagName(e),u=0;u<i.length;u++){var m=i[u];if(!(m[va]||m[Vt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var R=m.getAttribute(t)||"";R=e+R;var H=a.get(R);H?H.push(m):a.set(R,[m])}}return a}function dd(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function Fx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function N_(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function j_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function T_(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function k_(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=T_(t),e.suspenseyImages.push(t)),e=Kx.bind(e),t.decode().then(e,e))}function Vx(e,t,i,a){if(i.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=Vr(a.href),m=t.querySelector(tl(u));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=il.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=m,Ut(m);return}m=t.ownerDocument||t,a=w_(a),(u=Ps.get(u))&&ud(a,u),m=m.createElement("link"),Ut(m);var R=m;R._p=new Promise(function(H,K){R.onload=H,R.onerror=K}),Zt(m,"link",a),i.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=il.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Yo=0;function qx(e,t){return e.stylesheets&&e.count===0&&Xo(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var a=setTimeout(function(){if(e.stylesheets&&Xo(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+t);0<e.imgBytes&&Yo===0&&(Yo=62500*cx());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xo(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>Yo?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function R_(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Xo(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function il(){this.count--,R_(this)}function Kx(){this.imgCount--,R_(this)}var Zo=null;function Xo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zo=new Map,t.forEach(Gx,e),Zo=null,il.call(e))}function Gx(e,t){if(!(t.state.loading&4)){var i=Zo.get(e);if(i)var a=i.get(null);else{i=new Map,Zo.set(e,i);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<u.length;m++){var R=u[m];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(i.set(R.dataset.precedence,R),a=R)}a&&i.set(null,a)}u=t.instance,R=u.getAttribute("data-precedence"),m=i.get(R)||a,m===a&&i.set(null,u),i.set(R,u),this.count++,a=il.bind(this),u.addEventListener("load",a),u.addEventListener("error",a),m?m.parentNode.insertBefore(u,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Kr={$$typeof:he,Provider:null,Consumer:null,_currentValue:Re,_currentValue2:Re,_threadCount:0};function Yx(e,t,i,a,u,m,R,H,K){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Kc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kc(0),this.hiddenUpdates=Kc(null),this.identifierPrefix=a,this.onUncaughtError=u,this.onCaughtError=m,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.transitionTypes=null,this.incompleteTransitions=new Map}function D_(e,t,i,a,u,m,R,H,K,ie,oe,_e){return e=new Yx(e,t,i,R,K,ie,oe,_e,H),t=1,m===!0&&(t|=24),m=hs(3,null,null,t),e.current=m,m.stateNode=e,t=ju(),t.refCount++,e.pooledCache=t,t.refCount++,m.memoizedState={element:a,isDehydrated:i,cache:t},Du(m),e}function A_(e){return e?(e=_r,e):_r}function O_(e,t,i,a,u,m){u=A_(u),a.context===null?a.context=u:a.pendingContext=u,a=en(t),a.payload={element:i},m=m===void 0?null:m,m!==null&&(a.callback=m),i=tn(e,a,t),i!==null&&(ps(i,e,t),La(i,e,t))}function L_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function fd(e,t){L_(e,t),(e=e.alternate)&&L_(e,t)}function M_(e){if(e.tag===13||e.tag===31){var t=An(e,67108864);t!==null&&ps(t,e,67108864),fd(e,67108864)}}function B_(e){if(e.tag===13||e.tag===31){var t=Rs();t=Gc(t);var i=An(e,t);i!==null&&ps(i,e,t),fd(e,t)}}var Gr=!0;function Zx(e,t,i,a){var u=me.T;me.T=null;var m=ge.p;try{ge.p=2,md(e,t,i,a)}finally{ge.p=m,me.T=u}}function Xx(e,t,i,a){var u=me.T;me.T=null;var m=ge.p;try{ge.p=8,md(e,t,i,a)}finally{ge.p=m,me.T=u}}function md(e,t,i,a){if(Gr){var u=pd(a);if(u===null)Zh(e,t,a,Wo,i),H_(e,a);else if(Qx(u,e,t,i,a))a.stopPropagation();else if(H_(e,a),t&4&&-1<Wx.indexOf(e)){for(;u!==null;){var m=lr(u);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var R=jn(m.pendingLanes);if(R!==0){var H=m;for(H.pendingLanes|=2,H.entangledLanes|=2;R;){var K=1<<31-ws(R);H.entanglements[1]|=K,R&=~K}vi(m),(nt&6)===0&&(Bo=ns()+500,Xa(0))}}break;case 31:case 13:H=An(m,2),H!==null&&ps(H,m,2),Uo(),fd(m,2)}if(m=pd(a),m===null&&Zh(e,t,a,Wo,i),m===u)break;u=m}u!==null&&a.stopPropagation()}else Zh(e,t,a,null,i)}}function pd(e){return e=eu(e),gd(e)}var Wo=null;function gd(e){if(Wo=null,e=Tn(e),e!==null){var t=_(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=w(t),e!==null)return e;e=null}else if(i===31){if(e=c(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Wo=e,null}function I_(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ai()){case Vi:return 2;case fa:return 8;case kl:case uS:return 32;case Cm:return 268435456;default:return 32}default:return 32}}var vd=!1,mn=null,pn=null,gn=null,nl=new Map,rl=new Map,vn=[],Wx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function H_(e,t){switch(e){case"focusin":case"focusout":mn=null;break;case"dragenter":case"dragleave":pn=null;break;case"mouseover":case"mouseout":gn=null;break;case"pointerover":case"pointerout":nl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":rl.delete(t.pointerId)}}function al(e,t,i,a,u,m){return e===null||e.nativeEvent!==m?(e={blockedOn:t,domEventName:i,eventSystemFlags:a,nativeEvent:m,targetContainers:[u]},t!==null&&(t=lr(t),t!==null&&M_(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Qx(e,t,i,a,u){switch(t){case"focusin":return mn=al(mn,e,t,i,a,u),!0;case"dragenter":return pn=al(pn,e,t,i,a,u),!0;case"mouseover":return gn=al(gn,e,t,i,a,u),!0;case"pointerover":var m=u.pointerId;return nl.set(m,al(nl.get(m)||null,e,t,i,a,u)),!0;case"gotpointercapture":return m=u.pointerId,rl.set(m,al(rl.get(m)||null,e,t,i,a,u)),!0}return!1}function U_(e){var t=Tn(e.target);if(t!==null){var i=_(t);if(i!==null){if(t=i.tag,t===13){if(t=w(i),t!==null){e.blockedOn=t,Dm(e.priority,function(){B_(i)});return}}else if(t===31){if(t=c(i),t!==null){e.blockedOn=t,Dm(e.priority,function(){B_(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=pd(e.nativeEvent);if(i===null){i=e.nativeEvent;var a=new i.constructor(i.type,i);Jc=a,i.target.dispatchEvent(a),Jc=null}else return t=lr(i),t!==null&&M_(t),e.blockedOn=i,!1;t.shift()}return!0}function z_(e,t,i){Qo(e)&&i.delete(t)}function Jx(){vd=!1,mn!==null&&Qo(mn)&&(mn=null),pn!==null&&Qo(pn)&&(pn=null),gn!==null&&Qo(gn)&&(gn=null),nl.forEach(z_),rl.forEach(z_)}function Jo(e,t){e.blockedOn===t&&(e.blockedOn=null,vd||(vd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Jx)))}var ec=null;function $_(e){ec!==e&&(ec=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var t=0;t<e.length;t+=3){var i=e[t],a=e[t+1],u=e[t+2];if(typeof a!="function"){if(gd(a||i)===null)continue;break}var m=lr(i);m!==null&&(e.splice(t,3),t-=3,Qu(m,{pending:!0,data:u,method:i.method,action:a},a,u))}}))}function Yr(e){function t(K){return Jo(K,e)}mn!==null&&Jo(mn,e),pn!==null&&Jo(pn,e),gn!==null&&Jo(gn,e),nl.forEach(t),rl.forEach(t);for(var i=0;i<vn.length;i++){var a=vn[i];a.blockedOn===e&&(a.blockedOn=null)}for(;0<vn.length&&(i=vn[0],i.blockedOn===null);)U_(i),i.blockedOn===null&&vn.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(a=0;a<i.length;a+=3){var u=i[a],m=i[a+1],R=u[us]||null;if(typeof m=="function")R||$_(i);else if(R){var H=null;if(m&&m.hasAttribute("formAction")){if(u=m,R=m[us]||null)H=R.formAction;else if(gd(u)!==null)continue}else H=R.action;typeof H=="function"?i[a+1]=H:(i.splice(a,3),a-=3),$_(i)}}}function P_(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(R){return u=R})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),a||setTimeout(i,20)}function i(){if(!a&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function _d(e){this._internalRoot=e}tc.prototype.render=_d.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var i=t.current,a=Rs();O_(i,a,e,t,null,null)},tc.prototype.unmount=_d.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;O_(e.current,2,null,e,null,null),Uo(),t[ar]=null}};function tc(e){this._internalRoot=e}tc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rm();e={blockedOn:null,target:e,priority:t};for(var i=0;i<vn.length&&t!==0&&t<vn[i].priority;i++);vn.splice(i,0,e),i===0&&U_(e)}};var F_=n.version;if(F_!=="19.3.0")throw Error(o(527,F_,"19.3.0"));ge.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=y(t),e=e!==null?p(e):null,e=e===null?null:e.stateNode,e};var ew={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:me,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{ma=sc.inject(ew),xs=sc}catch{}}return ol.createRoot=function(e,t){if(!d(e))throw Error(o(299));var i=!1,a="",u=Ag,m=Og,R=Lg;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(m=t.onCaughtError),t.onRecoverableError!==void 0&&(R=t.onRecoverableError)),t=D_(e,1,!1,null,null,i,a,null,u,m,R,P_),e[ar]=t.current,Yh(e),new _d(t)},ol.hydrateRoot=function(e,t,i){if(!d(e))throw Error(o(299));var a=!1,u="",m=Ag,R=Og,H=Lg,K=null;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(R=i.onCaughtError),i.onRecoverableError!==void 0&&(H=i.onRecoverableError),i.formState!==void 0&&(K=i.formState)),t=D_(e,1,!0,t,i??null,a,u,K,m,R,H,P_),t.context=A_(null),i=t.current,a=Rs(),a=Gc(a),u=en(a),u.callback=null,tn(i,u,a),i=a,t.current.lanes=i,ga(t,i),vi(t),e[ar]=t.current,Yh(e),new tc(t)},ol.version="19.3.0",ol}var J_;function cw(){if(J_)return Sd.exports;J_=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),Sd.exports=ow(),Sd.exports}var uw=cw();var Kf=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ub=/^[\\/]{2}/;function hw(s,n){return n+s.replace(/\\/g,"/")}var ey="popstate";function ty(s){return typeof s=="object"&&s!=null&&"pathname"in s&&"search"in s&&"hash"in s&&"state"in s&&"key"in s}function dw(s={}){function n(d,_){let{pathname:w="/",search:c="",hash:h=""}=sr(d.location.hash.substring(1));return!w.startsWith("/")&&!w.startsWith(".")&&(w="/"+w),mf("",{pathname:w,search:c,hash:h},_.state&&_.state.usr||null,_.state&&_.state.key||"default")}function l(d,_){let w=d.document.querySelector("base"),c="";if(w&&w.getAttribute("href")){let h=d.location.href,y=h.indexOf("#");c=y===-1?h:h.slice(0,y)}return c+"#"+(typeof _=="string"?_:Wn(_))}function o(d,_){qs(d.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(_)})`)}return mw(n,l,o,s)}function bt(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function qs(s,n){if(!s){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function fw(){return Math.random().toString(36).substring(2,10)}function sy(s,n){return{usr:s.state,key:s.key,idx:n,masked:s.mask?{pathname:s.pathname,search:s.search,hash:s.hash}:void 0}}function mf(s,n,l=null,o,d){return{pathname:typeof s=="string"?s:s.pathname,search:"",hash:"",...typeof n=="string"?sr(n):n,state:l,key:n&&n.key||o||fw(),mask:d}}function Wn({pathname:s="/",search:n="",hash:l=""}){return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),l&&l!=="#"&&(s+=l.charAt(0)==="#"?l:"#"+l),s}function sr(s){let n={};if(s){let l=s.indexOf("#");l>=0&&(n.hash=s.substring(l),s=s.substring(0,l));let o=s.indexOf("?");o>=0&&(n.search=s.substring(o),s=s.substring(0,o)),s&&(n.pathname=s)}return n}function mw(s,n,l,o={}){let{window:d=document.defaultView,v5Compat:_=!1}=o,w=d.history,c="POP",h=null,y=p();y==null&&(y=0,w.replaceState({...w.state,idx:y},""));function p(){return(w.state||{idx:null}).idx}function f(){c="POP";let g=p(),b=g==null?null:g-y;y=g,h&&h({action:c,location:E.location,delta:b})}function x(g,b){c="PUSH";let v=ty(g)?g:mf(E.location,g,b);l&&l(v,g),y=p()+1;let S=sy(v,y),N=E.createHref(v.mask||v);try{w.pushState(S,"",N)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;d.location.assign(N)}_&&h&&h({action:c,location:E.location,delta:1})}function C(g,b){c="REPLACE";let v=ty(g)?g:mf(E.location,g,b);l&&l(v,g),y=p();let S=sy(v,y),N=E.createHref(v.mask||v);w.replaceState(S,"",N),_&&h&&h({action:c,location:E.location,delta:0})}function j(g){return pw(d,g)}let E={get action(){return c},get location(){return s(d,w)},listen(g){if(h)throw new Error("A history only accepts one active listener");return d.addEventListener(ey,f),h=g,()=>{d.removeEventListener(ey,f),h=null}},createHref(g){return n(d,g)},createURL:j,encodeLocation(g){let b=j(g);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:x,replace:C,go(g){return w.go(g)}};return E}function pw(s,n,l=!1){let o="http://localhost";s&&(o=s.location.origin!=="null"?s.location.origin:s.location.href),bt(o,"No window.location.(origin|href) available to create URL");let d=typeof n=="string"?n:Wn(n);return d=d.replace(/ $/,"%20"),!l&&Ub.test(d)&&(d=o+d),new URL(d,o)}function zb(s,n,l="/"){return gw(s,n,l,!1)}function gw(s,n,l,o,d){let _=typeof n=="string"?sr(n):n,w=Ui(_.pathname||"/",l);if(w==null)return null;let c=vw(s),h=null,y=Tw(w);for(let p=0;h==null&&p<c.length;++p)h=jw(c[p],y,o);return h}function vw(s){let n=$b(s);return _w(n),n}function $b(s,n=[],l=[],o="",d=!1){let _=(w,c,h=d,y)=>{let p={relativePath:y===void 0?w.path||"":y,caseSensitive:w.caseSensitive===!0,childrenIndex:c,route:w};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(o)&&h)return;bt(p.relativePath.startsWith(o),`Absolute route path "${p.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(o.length)}let f=ti([o,p.relativePath]),x=l.concat(p);w.children&&w.children.length>0&&(bt(w.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),$b(w.children,n,x,f,h)),!(w.path==null&&!w.index)&&n.push({path:f,score:Ew(f,w.index),routesMeta:x.map((C,j)=>{let[E,g]=Vb(C.relativePath,C.caseSensitive,j===x.length-1);return{...C,matcher:E,compiledParams:g}})})};return s.forEach((w,c)=>{if(w.path===""||!w.path?.includes("?"))_(w,c);else for(let h of Pb(w.path))_(w,c,!0,h)}),n}function Pb(s){let n=s.split("/");if(n.length===0)return[];let[l,...o]=n,d=l.endsWith("?"),_=l.replace(/\?$/,"");if(o.length===0)return d?[_,""]:[_];let w=Pb(o.join("/")),c=[];return c.push(...w.map(h=>h===""?_:[_,h].join("/"))),d&&c.push(...w),c.map(h=>s.startsWith("/")&&h===""?"/":h)}function _w(s){s.sort((n,l)=>n.score!==l.score?l.score-n.score:Nw(n.routesMeta.map(o=>o.childrenIndex),l.routesMeta.map(o=>o.childrenIndex)))}var yw=/^:[\w-]+$/,bw=3,Sw=2,xw=1,ww=10,Cw=-2,iy=s=>s==="*";function Ew(s,n){let l=s.split("/"),o=l.length;return l.some(iy)&&(o+=Cw),n&&(o+=Sw),l.filter(d=>!iy(d)).reduce((d,_)=>d+(yw.test(_)?bw:_===""?xw:ww),o)}function Nw(s,n){return s.length===n.length&&s.slice(0,-1).every((o,d)=>o===n[d])?s[s.length-1]-n[n.length-1]:0}function jw(s,n,l=!1){let{routesMeta:o}=s,d={},_="/",w=[];for(let c=0;c<o.length;++c){let h=o[c],y=c===o.length-1,p=_==="/"?n:n.slice(_.length)||"/",f={path:h.relativePath,caseSensitive:h.caseSensitive,end:y},x=h.matcher&&h.compiledParams?Fb(f,p,h.matcher,h.compiledParams):gc(f,p),C=h.route;if(!x&&y&&l&&!o[o.length-1].route.index&&(x=gc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!x)return null;Object.assign(d,x.params),w.push({params:d,pathname:ti([_,x.pathname]),pathnameBase:Dw(ti([_,x.pathnameBase])),route:C}),x.pathnameBase!=="/"&&(_=ti([_,x.pathnameBase]))}return w}function gc(s,n){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[l,o]=Vb(s.path,s.caseSensitive,s.end);return Fb(s,n,l,o)}function Fb(s,n,l,o){let d=n.match(l);if(!d)return null;let _=d[0],w=ta(_,1),c=d.slice(1);return{params:o.reduce((y,{paramName:p,isOptional:f},x)=>{if(p==="*"){let j=c[x]||"";w=ta(_.slice(0,_.length-j.length),1)}const C=c[x];return f&&!C?y[p]=void 0:y[p]=(C||"").replace(/%2F/g,"/"),y},{}),pathname:_,pathnameBase:w,pattern:s}}function Vb(s,n=!1,l=!0){qs(s==="*"||!s.endsWith("*")||s.endsWith("/*"),`Route path "${s}" will be treated as if it were "${s.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${s.replace(/\*$/,"/*")}".`);let o=[],d="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(w,c,h,y,p)=>{if(o.push({paramName:c,isOptional:h!=null}),h){let f=p.charAt(y+w.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return s.endsWith("*")?(o.push({paramName:"*"}),d+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?d+="\\/*$":s!==""&&s!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,n?void 0:"i"),o]}function Tw(s){try{return s.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return qs(!1,`The URL path "${s}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),s}}function Ui(s,n){if(n==="/")return s;if(!s.toLowerCase().startsWith(n.toLowerCase()))return null;let l=n.endsWith("/")?n.length-1:n.length,o=s.charAt(l);return o&&o!=="/"?null:s.slice(l)||"/"}function kw(s,n="/"){let{pathname:l,search:o="",hash:d=""}=typeof s=="string"?sr(s):s,_;return l?(l=qb(l),l.startsWith("/")||l.startsWith("\\")?_=ny(l.substring(1),"/"):_=ny(l,n)):_=n,{pathname:_,search:Aw(o),hash:Ow(d)}}function ny(s,n){let l=ta(n).split("/");return s.split("/").forEach(d=>{d===".."?l.length>1&&l.pop():d!=="."&&l.push(d)}),l.length>1?l.join("/"):"/"}function Ed(s,n,l,o){return`Cannot include a '${s}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${l}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Rw(s){return s.filter((n,l)=>l===0||n.route.path&&n.route.path.length>0)}function Gf(s){let n=Rw(s);return n.map((l,o)=>o===n.length-1?l.pathname:l.pathnameBase)}function Oc(s,n,l,o=!1){let d;typeof s=="string"?d=sr(s):(d={...s},bt(!d.pathname||!d.pathname.includes("?"),Ed("?","pathname","search",d)),bt(!d.pathname||!d.pathname.includes("#"),Ed("#","pathname","hash",d)),bt(!d.search||!d.search.includes("#"),Ed("#","search","hash",d)));let _=s===""||d.pathname==="",w=_?"/":d.pathname,c;if(w==null)c=l;else{let f=n.length-1;if(!o&&w.startsWith("..")){let x=w.split("/");for(;x[0]==="..";)x.shift(),f-=1;d.pathname=x.join("/")}c=f>=0?n[f]:"/"}let h=kw(d,c),y=w&&w!=="/"&&w.endsWith("/"),p=(_||w===".")&&l.endsWith("/");return!h.pathname.endsWith("/")&&(y||p)&&(h.pathname+="/"),h}var qb=s=>s.replace(/[\\/]{2,}/g,"/"),ti=s=>qb(s.join("/"));function ta(s,n=0){let l=s.length;for(;l>n&&s.charCodeAt(l-1)===47;)l--;return l===s.length?s:s.slice(0,l)}var Dw=s=>ta(s).replace(/^\/*/,"/"),Aw=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,Ow=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s,Lw=class{constructor(s,n,l,o=!1){this.status=s,this.statusText=n||"",this.internal=o,l instanceof Error?(this.data=l.toString(),this.error=l):this.data=l}};function Mw(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}function Bw(s){let n=s.map(l=>l.route.path).filter(Boolean);return ti(n)||"/"}var Kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gb(s,n){let l=s;if(typeof l!="string"||!Kf.test(l))return{absoluteURL:void 0,isExternal:!1,to:l};let o=l,d=!1;if(Kb)try{let _=new URL(window.location.href),w=Ub.test(l)?new URL(hw(l,_.protocol)):new URL(l),c=Ui(w.pathname,n);w.origin===_.origin&&c!=null?l=c+w.search+w.hash:d=!0}catch{qs(!1,`<Link to="${l}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:d,to:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ry=new URL("http://localhost");function Yf(s){if(s.createURL)return s.createURL("/");try{return new URL(s.createHref("/"),ry)}catch{return ry}}function Nd(s,n){return s.origin===n.origin&&(s.origin!=="null"||s.protocol===n.protocol&&s.host===n.host)}function Iw(s,n){if(s.startsWith("//"))return!0;let l=n.protocol.toLowerCase();return s.toLowerCase().startsWith(l)?n.host===""||s.slice(l.length).startsWith("//"):!1}function Zf(s,n,l,o){let d=null;try{d=s==null?null:new URL(s,l)}catch{}let _=new URL(n,l),w=d!=null&&!Nd(d,l),c=!Nd(_,l);if(o==="reject"){if(w||c)throw new Error("External navigation is not allowed")}else if(c&&(d==null||!Iw(s,d)||!Nd(d,_)))throw new Error("External navigation is not allowed")}var Yb=["POST","PUT","PATCH","DELETE"];new Set(Yb);var Hw=["GET",...Yb];new Set(Hw);var Uw=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function zw(s){try{return Uw.includes(new URL(s).protocol)}catch{return!1}}var oa=M.createContext(null);oa.displayName="DataRouter";var Lc=M.createContext(null);Lc.displayName="DataRouterState";var Zb=M.createContext(!1);function $w(){return M.useContext(Zb)}var Xb=M.createContext({isTransitioning:!1});Xb.displayName="ViewTransition";var Pw=M.createContext(new Map);Pw.displayName="Fetchers";var Fw=M.createContext(null);Fw.displayName="Await";var Os=M.createContext(null);Os.displayName="Navigation";var wl=M.createContext(null);wl.displayName="Location";var ni=M.createContext({outlet:null,matches:[],isDataRoute:!1});ni.displayName="Route";var Xf=M.createContext(null);Xf.displayName="RouteError";var Wb="REACT_ROUTER_ERROR",Vw="REDIRECT",qw="ROUTE_ERROR_RESPONSE";function Kw(s){if(s.startsWith(`${Wb}:${Vw}:{`))try{let n=JSON.parse(s.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function Gw(s){if(s.startsWith(`${Wb}:${qw}:{`))try{let n=JSON.parse(s.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Lw(n.status,n.statusText,n.data)}catch{}}function Yw(s,{relative:n}={}){bt(ca(),"useHref() may be used only in the context of a <Router> component.");let{basename:l,navigator:o}=M.useContext(Os),{hash:d,pathname:_,search:w}=El(s,{relative:n}),c=_;return l!=="/"&&(c=_==="/"?l:ti([l,_])),o.createHref({pathname:c,search:w,hash:d})}function ca(){return M.useContext(wl)!=null}function _s(){return bt(ca(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(wl).location}var Qb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Jb(s){M.useContext(Os).static||M.useLayoutEffect(s)}function Cl(){let{isDataRoute:s}=M.useContext(ni);return s?cC():Zw()}function Zw(){bt(ca(),"useNavigate() may be used only in the context of a <Router> component.");let s=M.useContext(oa),{basename:n,navigator:l}=M.useContext(Os),{matches:o}=M.useContext(ni),{pathname:d}=_s(),_=JSON.stringify(Gf(o)),w=M.useRef(!1);return Jb(()=>{w.current=!0}),M.useCallback((h,y={})=>{if(qs(w.current,Qb),!w.current)return;if(typeof h=="number"){l.go(h);return}let p=Oc(h,JSON.parse(_),d,y.relative==="path");s==null&&n!=="/"&&(p.pathname=p.pathname==="/"?n:ti([n,p.pathname])),Zf(typeof h=="string"?h:Wn(h),l.createHref(p),Yf(l),"reject"),(y.replace?l.replace:l.push)(p,y.state,y)},[n,l,_,d,s])}var Xw=M.createContext(null);function Ww(s){let n=M.useContext(ni).outlet;return M.useMemo(()=>n&&M.createElement(Xw.Provider,{value:s},n),[n,s])}function El(s,{relative:n}={}){let{matches:l}=M.useContext(ni),{pathname:o}=_s(),d=JSON.stringify(Gf(l));return M.useMemo(()=>Oc(s,JSON.parse(d),o,n==="path"),[s,d,o,n])}function Qw(s,n){return e0(s,n)}function e0(s,n,l){bt(ca(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=M.useContext(Os),{matches:d}=M.useContext(ni),_=d[d.length-1],w=_?_.params:{},c=_?_.pathname:"/",h=_?_.pathnameBase:"/",y=_&&_.route;{let g=y&&y.path||"";s0(c,!y||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${g}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
8
+ `+a.stack}}var bi=Object.prototype.hasOwnProperty,Ss=s.unstable_scheduleCallback,Fi=s.unstable_cancelCallback,Tl=s.unstable_shouldYield,rr=s.unstable_requestPaint,ns=s.unstable_now,ai=s.unstable_getCurrentPriorityLevel,Vi=s.unstable_ImmediatePriority,fa=s.unstable_UserBlockingPriority,kl=s.unstable_NormalPriority,hS=s.unstable_LowPriority,Nm=s.unstable_IdlePriority,dS=s.log,fS=s.unstable_setDisableYieldValue,ma=null,xs=null;function qi(e){if(typeof dS=="function"&&fS(e),xs&&typeof xs.setStrictMode=="function")try{xs.setStrictMode(ma,e)}catch{}}var ws=Math.clz32?Math.clz32:gS,mS=Math.log,pS=Math.LN2;function gS(e){return e>>>=0,e===0?32:31-(mS(e)/pS|0)|0}var Rl=256,Dl=262144,Al=4194304;function jn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ol(e,t,i){var a=e.pendingLanes;if(a===0)return 0;var u=0,m=e.suspendedLanes,R=e.pingedLanes;e=e.warmLanes;var H=a&134217727;return H!==0?(a=H&~m,a!==0?u=jn(a):(R&=H,R!==0?u=jn(R):i||(i=H&~e,i!==0&&(u=jn(i))))):(H=a&~m,H!==0?u=jn(H):R!==0?u=jn(R):i||(i=a&~e,i!==0&&(u=jn(i)))),u===0?0:t!==0&&t!==u&&(t&m)===0&&(m=u&-u,i=t&-t,m>=i||m===32&&(i&4194048)!==0)?t:u}function pa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function jm(e,t){(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var a=31-ws(i),u=1<<a;t|=e[a],i&=~u}return t}function vS(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Tm(){var e=Al;return Al<<=1,(Al&62914560)===0&&(Al=4194304),e}function Kc(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function ga(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function _S(e,t,i,a,u,m){var R=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var H=e.entanglements,K=e.expirationTimes,ie=e.hiddenUpdates;for(i=R&~i;0<i;){var oe=31-ws(i),_e=1<<oe;H[oe]=0,K[oe]=-1;var te=ie[oe];if(te!==null)for(ie[oe]=null,oe=0;oe<te.length;oe++){var ae=te[oe];ae!==null&&(ae.lane&=-536870913)}i&=~_e}a!==0&&km(e,a,0),m!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=m&~(R&~t))}function km(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-ws(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|i&261930}function Rm(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var a=31-ws(i),u=1<<a;u&t|e[a]&t&&(e[a]|=t),i&=~u}}function Dm(e,t){var i=t&-t;return i=(i&42)!==0?1:Gc(i),(i&(e.suspendedLanes|t))!==0?0:i}function Gc(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Yc(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Am(){var e=ge.p;return e!==0?e:(e=window.event,e===void 0?32:U_(e.type))}function Om(e,t){var i=ge.p;try{return ge.p=e,t()}finally{ge.p=i}}var Si=Math.random().toString(36).slice(2),qt="__reactFiber$"+Si,us="__reactProps$"+Si,ar="__reactContainer$"+Si,Lm="__reactEvents$"+Si,yS="__reactListeners$"+Si,bS="__reactHandles$"+Si,Mm="__reactResources$"+Si,va="__reactMarker$"+Si,Ll="__reactLoad$"+Si;function Ml(e){delete e[qt],delete e[us],delete e[yS],delete e[bS]}function Tn(e){var t;if(t=e[qt])return t;for(var i=e.parentNode;i;){if(t=i[ar]||i[qt]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=y_(e);e!==null;){if(i=e[qt])return i;e=y_(e)}return t}e=i,i=e.parentNode}return null}function lr(e){if(e=e[qt]||e[ar]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _a(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function or(e){var t=e[Mm];return t||(t=e[Mm]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[va]=!0}function Bm(e){e[Ll]=void 0}var Im=new Set,Hm={};function kn(e,t){cr(e,t),cr(e+"Capture",t)}function cr(e,t){for(Hm[e]=t,e=0;e<t.length;e++)Im.add(t[e])}var SS=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Um={},zm={};function xS(e){return bi.call(zm,e)?!0:bi.call(Um,e)?!1:SS.test(e)?zm[e]=!0:(Um[e]=!0,!1)}var it=!1;function $m(){var e=it;return it=!1,e}function Bl(e,t,i){if(xS(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,i)}}function Il(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,i)}}function xi(e,t,i,a){if(a===null)e.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,a)}}function Cs(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wS(e,t,i){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var u=a.get,m=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(R){i=""+R,m.call(this,R)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return i},setValue:function(R){i=""+R},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zc(e){if(!e._valueTracker){var t=Pm(e)?"checked":"value";e._valueTracker=wS(e,t,""+e[t])}}function Fm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),a="";return e&&(a=Pm(e)?e.checked?"true":"false":e.value),e=a,e!==i?(t.setValue(e),!0):!1}var CS=/[\n"\\]/g;function Ls(e){return e.replace(CS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xc(e,t,i,a,u,m,R,H){e.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?e.type=R:e.removeAttribute("type"),t!=null?R==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cs(t)):e.value!==""+Cs(t)&&(e.value=""+Cs(t)):R!=="submit"&&R!=="reset"||e.removeAttribute("value"),t!=null?R==="number"&&e.value==t?Wc(e,Cs(e.value)):Wc(e,Cs(t)):i!=null?Wc(e,Cs(i)):a!=null&&e.removeAttribute("value"),u==null&&m!=null&&(e.defaultChecked=!!m),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?e.name=""+Cs(H):e.removeAttribute("name")}function Vm(e,t,i,a,u,m,R,H){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),t!=null||i!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){Zc(e);return}i=i!=null?""+Cs(i):"",t=t!=null?""+Cs(t):i,H||t===e.value||(e.value=t),e.defaultValue=t}a=a??u,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=H?e.checked:!!a,e.defaultChecked=!!a,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(e.name=R),Zc(e)}function Wc(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function ur(e,t,i,a){if(e=e.options,t){t={};for(var u=0;u<i.length;u++)t["$"+i[u]]=!0;for(i=0;i<e.length;i++)u=t.hasOwnProperty("$"+e[i].value),e[i].selected!==u&&(e[i].selected=u),u&&a&&(e[i].defaultSelected=!0)}else{for(i=""+Cs(i),t=null,u=0;u<e.length;u++){if(e[u].value===i){e[u].selected=!0,a&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function qm(e,t,i){if(t!=null&&(t=""+Cs(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Cs(i):""}function Km(e,t,i,a){if(t==null){if(a!=null){if(i!=null)throw Error(o(92));if(pe(a)){if(1<a.length)throw Error(o(93));a=a[0]}i=a}i==null&&(i=""),t=i}i=Cs(t),e.defaultValue=i,a=e.textContent,a===i&&a!==""&&a!==null&&(e.value=a),Zc(e)}function hr(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var ES=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Gm(e,t,i){var a=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,i):typeof i!="number"||i===0||ES.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Ym(e,t,i){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,i!=null){for(var a in i)!i.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="",it=!0);for(var u in t)a=t[u],t.hasOwnProperty(u)&&i[u]!==a&&(Gm(e,u,a),it=!0)}else for(var m in t)t.hasOwnProperty(m)&&Gm(e,m,t[m])}function Qc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var NS=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),jS=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hl(e){return jS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function li(){}var Jc=null;function eu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dr=null,fr=null;function Zm(e){var t=lr(e);if(t&&(e=t.stateNode)){var i=e[us]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Ls(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var a=i[t];if(a!==e&&a.form===e.form){var u=a[us]||null;if(!u)throw Error(o(90));Xc(a,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<i.length;t++)a=i[t],a.form===e.form&&Fm(a)}break e;case"textarea":qm(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&ur(e,!!i.multiple,t,!1)}}}var tu=!1;function Xm(e,t,i){if(tu)return e(t,i);tu=!0;try{var a=e(t);return a}finally{if(tu=!1,(dr!==null||fr!==null)&&(Uo(),dr&&(t=dr,e=fr,fr=dr=null,Zm(t),e)))for(t=0;t<e.length;t++)Zm(e[t])}}function ya(e,t){var i=e.stateNode;if(i===null)return null;var a=i[us]||null;if(a===null)return null;i=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(o(231,t,typeof i));return i}var wi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),su=!1;if(wi)try{var ba={};Object.defineProperty(ba,"passive",{get:function(){su=!0}}),window.addEventListener("test",ba,ba),window.removeEventListener("test",ba,ba)}catch{su=!1}var Ki=null,iu=null,Ul=null;function Wm(){if(Ul)return Ul;var e,t=iu,i=t.length,a,u="value"in Ki?Ki.value:Ki.textContent,m=u.length;for(e=0;e<i&&t[e]===u[e];e++);var R=i-e;for(a=1;a<=R&&t[i-a]===u[m-a];a++);return Ul=u.slice(e,1<a?1-a:void 0)}function zl(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 $l(){return!0}function Qm(){return!1}function rs(e){function t(i,a,u,m,R){this._reactName=i,this._targetInst=u,this.type=a,this.nativeEvent=m,this.target=R,this.currentTarget=null;for(var H in e)e.hasOwnProperty(H)&&(i=e[H],this[H]=i?i(m):m[H]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?$l:Qm,this.isPropagationStopped=Qm,this}return O(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=$l)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=$l)},persist:function(){},isPersistent:$l}),t}var Gi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pl=rs(Gi),Sa=O({},Gi,{view:0,detail:0}),TS=rs(Sa),nu,ru,xa,Fl=O({},Sa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lu,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!==xa&&(xa&&e.type==="mousemove"?(nu=e.screenX-xa.screenX,ru=e.screenY-xa.screenY):ru=nu=0,xa=e),nu)},movementY:function(e){return"movementY"in e?e.movementY:ru}}),Jm=rs(Fl),kS=O({},Fl,{dataTransfer:0}),RS=rs(kS),DS=O({},Sa,{relatedTarget:0}),au=rs(DS),AS=O({},Gi,{animationName:0,elapsedTime:0,pseudoElement:0}),OS=rs(AS),LS=O({},Gi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),MS=rs(LS),BS=O({},Gi,{data:0}),ep=rs(BS),IS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},HS={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"},US={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=US[e])?!!t[e]:!1}function lu(){return zS}var $S=O({},Sa,{key:function(e){if(e.key){var t=IS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=zl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?HS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lu,charCode:function(e){return e.type==="keypress"?zl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),PS=rs($S),FS=O({},Fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tp=rs(FS),VS=O({},Gi,{submitter:0}),qS=rs(VS),KS=O({},Sa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lu}),GS=rs(KS),YS=O({},Gi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ZS=rs(YS),XS=O({},Fl,{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}),WS=rs(XS),QS=O({},Gi,{newState:0,oldState:0,source:0}),JS=rs(QS),e1=[9,13,27,32],ou=wi&&"CompositionEvent"in window,wa=null;wi&&"documentMode"in document&&(wa=document.documentMode);var t1=wi&&"TextEvent"in window&&!wa,sp=wi&&(!ou||wa&&8<wa&&11>=wa),ip=" ",np=!1;function rp(e,t){switch(e){case"keyup":return e1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ap(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mr=!1;function s1(e,t){switch(e){case"compositionend":return ap(t);case"keypress":return t.which!==32?null:(np=!0,ip);case"textInput":return e=t.data,e===ip&&np?null:e;default:return null}}function i1(e,t){if(mr)return e==="compositionend"||!ou&&rp(e,t)?(e=Wm(),Ul=iu=Ki=null,mr=!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 sp&&t.locale!=="ko"?null:t.data;default:return null}}var n1={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 lp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!n1[e.type]:t==="textarea"}function op(e,t,i,a){dr?fr?fr.push(a):fr=[a]:dr=a,t=qo(t,"onChange"),0<t.length&&(i=new Pl("onChange","change",null,i,a),e.push({event:i,listeners:t}))}var Ca=null,Ea=null;function r1(e){Zv(e,0)}function Vl(e){var t=_a(e);if(Fm(t))return e}function cp(e,t){if(e==="change")return t}var up=!1;if(wi){var cu;if(wi){var uu="oninput"in document;if(!uu){var hp=document.createElement("div");hp.setAttribute("oninput","return;"),uu=typeof hp.oninput=="function"}cu=uu}else cu=!1;up=cu&&(!document.documentMode||9<document.documentMode)}function dp(){Ca&&(Ca.detachEvent("onpropertychange",fp),Ea=Ca=null)}function fp(e){if(e.propertyName==="value"&&Vl(Ea)){var t=[];op(t,Ea,e,eu(e)),Xm(r1,t)}}function a1(e,t,i){e==="focusin"?(dp(),Ca=t,Ea=i,Ca.attachEvent("onpropertychange",fp)):e==="focusout"&&dp()}function l1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Vl(Ea)}function o1(e,t){if(e==="click")return Vl(t)}function c1(e,t){if(e==="input"||e==="change")return Vl(t)}function u1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Es=typeof Object.is=="function"?Object.is:u1;function Na(e,t){if(Es(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(a=0;a<i.length;a++){var u=i[a];if(!bi.call(t,u)||!Es(e[u],t[u]))return!1}return!0}function hu(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 mp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pp(e,t){var i=mp(e);e=0;for(var a;i;){if(i.nodeType===3){if(a=e+i.textContent.length,e<=t&&a>=t)return{node:i,offset:t-e};e=a}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=mp(i)}}function gp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hu(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=hu(e.document)}return t}function du(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var h1=wi&&"documentMode"in document&&11>=document.documentMode,pr=null,fu=null,ja=null,mu=!1;function _p(e,t,i){var a=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;mu||pr==null||pr!==hu(a)||(a=pr,"selectionStart"in a&&du(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),ja&&Na(ja,a)||(ja=a,a=qo(fu,"onSelect"),0<a.length&&(t=new Pl("onSelect","select",null,t,i),e.push({event:t,listeners:a}),t.target=pr)))}function Rn(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var gr={animationend:Rn("Animation","AnimationEnd"),animationiteration:Rn("Animation","AnimationIteration"),animationstart:Rn("Animation","AnimationStart"),transitionrun:Rn("Transition","TransitionRun"),transitionstart:Rn("Transition","TransitionStart"),transitioncancel:Rn("Transition","TransitionCancel"),transitionend:Rn("Transition","TransitionEnd")},pu={},yp={};wi&&(yp=document.createElement("div").style,"AnimationEvent"in window||(delete gr.animationend.animation,delete gr.animationiteration.animation,delete gr.animationstart.animation),"TransitionEvent"in window||delete gr.transitionend.transition);function Dn(e){if(pu[e])return pu[e];if(!gr[e])return e;var t=gr[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in yp)return pu[e]=t[i];return e}var bp=Dn("animationend"),Sp=Dn("animationiteration"),xp=Dn("animationstart"),d1=Dn("transitionrun"),f1=Dn("transitionstart"),m1=Dn("transitioncancel"),wp=Dn("transitionend"),Cp=new Map,gu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");gu.push("scrollEnd");function Gs(e,t){Cp.set(e,t),kn(t,[e])}var p1=0;function Ci(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Ws.identifierPrefix;var i=p1++;return e="_"+e+"t_"+i.toString(32)+"_",t.autoName=e}function Ep(e){if(e==null||typeof e=="string")return e;var t=null,i=Br;if(i!==null)for(var a=0;a<i.length;a++){var u=e[i[a]];if(u!=null){if(u==="none")return"none";t=t==null?u:t+(" "+u)}}return t??e.default}function Ei(e,t){return e=Ep(e),t=Ep(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var ql=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ms=[],vr=0,vu=0;function Kl(){for(var e=vr,t=vu=vr=0;t<e;){var i=Ms[t];Ms[t++]=null;var a=Ms[t];Ms[t++]=null;var u=Ms[t];Ms[t++]=null;var m=Ms[t];if(Ms[t++]=null,a!==null&&u!==null){var R=a.pending;R===null?u.next=u:(u.next=R.next,R.next=u),a.pending=u}m!==0&&Np(i,u,m)}}function Gl(e,t,i,a){Ms[vr++]=e,Ms[vr++]=t,Ms[vr++]=i,Ms[vr++]=a,vu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function _u(e,t,i,a){return Gl(e,t,i,a),Yl(e)}function An(e,t){return Gl(e,null,null,t),Yl(e)}function Np(e,t,i){e.lanes|=i;var a=e.alternate;a!==null&&(a.lanes|=i);for(var u=!1,m=e.return;m!==null;)m.childLanes|=i,a=m.alternate,a!==null&&(a.childLanes|=i),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(u=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,u&&t!==null&&(u=31-ws(i),e=m.hiddenUpdates,a=e[u],a===null?e[u]=[t]:a.push(t),t.lane=i|536870912),m):null}function Yl(e){if(50<Za)throw Za=0,Ho=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var _r={};function g1(e,t,i,a){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hs(e,t,i,a){return new g1(e,t,i,a)}function yu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ni(e,t){var i=e.alternate;return i===null?(i=hs(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&1206910976,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function jp(e,t){e.flags&=1206910978;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Zl(e,t,i,a,u,m){var R=0;if(a=e,typeof a=="function")yu(a)&&(R=1);else if(typeof a=="string")R=Vx(e,i,Bt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(a){case F:return e=hs(31,i,t,u),e.elementType=F,e.lanes=m,e;case q:return On(i.children,u,m,t);case Y:R=8,u|=24;break;case P:return e=hs(12,i,t,u|2),e.elementType=P,e.lanes=m,e;case W:return e=hs(13,i,t,u),e.elementType=W,e.lanes=m,e;case I:return e=hs(19,i,t,u),e.elementType=I,e.lanes=m,e;case $:case z:return e=u|32,e=hs(30,i,t,e),e.elementType=z,e.lanes=m,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case he:R=10;break e;case Q:R=9;break e;case ne:R=11;break e;case A:R=14;break e;case B:R=16,a=null;break e}R=29,i=Error(o(130,e===null?"null":typeof e,"")),a=null}return t=hs(R,i,t,u),t.elementType=e,t.type=a,t.lanes=m,t}function On(e,t,i,a){return e=hs(7,e,a,t),e.lanes=i,e}function bu(e,t,i){return e=hs(6,e,null,t),e.lanes=i,e}function Tp(e){var t=hs(18,null,null,0);return t.stateNode=e,t}function Su(e,t,i){return t=hs(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var kp=new WeakMap;function Bs(e,t){if(typeof e=="object"&&e!==null){var i=kp.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Vt(t)},kp.set(e,t),t)}return{value:e,source:t,stack:Vt(t)}}var yr=[],br=0,Xl=null,Ta=0,Is=[],Hs=0,Yi=null,oi=1,ci="";function ji(e,t){yr[br++]=Ta,yr[br++]=Xl,Xl=e,Ta=t}function Rp(e,t,i){Is[Hs++]=oi,Is[Hs++]=ci,Is[Hs++]=Yi,Yi=e;var a=oi;e=ci;var u=32-ws(a)-1;a&=~(1<<u),i+=1;var m=32-ws(t)+u;if(30<m){var R=u-u%5;m=(a&(1<<R)-1).toString(32),a>>=R,u-=R,oi=1<<32-ws(t)+u|i<<u|a,ci=m+e}else oi=1<<m|i<<u|a,ci=e}function Wl(e){e.return!==null&&(ji(e,1),Rp(e,1,0))}function xu(e){for(;e===Xl;)Xl=yr[--br],yr[br]=null,Ta=yr[--br],yr[br]=null;for(;e===Yi;)Yi=Is[--Hs],Is[Hs]=null,ci=Is[--Hs],Is[Hs]=null,oi=Is[--Hs],Is[Hs]=null}function Dp(e,t){Is[Hs++]=oi,Is[Hs++]=ci,Is[Hs++]=Yi,oi=t.id,ci=t.overflow,Yi=e}var zt=null,mt=null,Fe=!1,Zi=null,Us=!1,wu=Error(o(519));function Xi(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ka(Bs(t,e)),wu}function Ap(e){var t=e.stateNode,i=e.type,a=e.memoizedProps;switch(t[qt]=e,t[us]=a,i){case"dialog":Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":case"embed":Ye("load",t);break;case"video":case"audio":for(i=0;i<Wa.length;i++)Ye(Wa[i],t);break;case"source":Ye("error",t);break;case"img":case"image":case"link":Ye("error",t),Ye("load",t);break;case"details":Ye("toggle",t);break;case"input":Ye("invalid",t),Vm(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Ye("invalid",t);break;case"textarea":Ye("invalid",t),Km(t,a.value,a.defaultValue,a.children)}i=a.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||a.suppressHydrationWarning===!0||Jv(t.textContent,i)?(a.popover!=null&&(Ye("beforetoggle",t),Ye("toggle",t)),a.onScroll!=null&&Ye("scroll",t),a.onScrollEnd!=null&&Ye("scrollend",t),a.onClick!=null&&(t.onclick=li),t=!0):t=!1,t||Xi(e,!0)}function Ql(e){for(zt=e.return;zt;)switch(zt.tag){case 5:case 31:case 13:Us=!1;return;case 27:case 3:Us=!0;return;default:zt=zt.return}}function Sr(e){if(e!==zt)return!1;if(!Fe)return Ql(e),Fe=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Jh(e.type,e.memoizedProps)),i=!i),i&&mt&&Xi(e),Ql(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=__(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=__(e)}else t===27?(t=mt,fn(e.type)?(e=od,od=null,mt=e):mt=t):mt=zt?$s(e.stateNode.nextSibling):null;return!0}function Ln(){mt=zt=null,Fe=!1}function Cu(){var e=Zi;return e!==null&&(ms===null?ms=e:ms.push.apply(ms,e),Zi=null),e}function ka(e){Zi===null?Zi=[e]:Zi.push(e)}var Eu=at(null),Mn=null,Ti=null;function Wi(e,t,i){Ke(Eu,t._currentValue),t._currentValue=i}function ki(e){e._currentValue=Eu.current,we(Eu)}function Jl(e,t,i){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===i)break;e=e.return}}function Nu(e,t,i,a){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var m=u.dependencies;if(m!==null){var R=u.child;m=m.firstContext;e:for(;m!==null;){var H=m;m=u;for(var K=0;K<t.length;K++)if(H.context===t[K]){m.lanes|=i,H=m.alternate,H!==null&&(H.lanes|=i),Jl(m.return,i,e),a||(R=null);break e}m=H.next}}else if(u.tag===18){if(R=u.return,R===null)throw Error(o(341));R.lanes|=i,m=R.alternate,m!==null&&(m.lanes|=i),Jl(R,i,e),R=null}else u.tag===13&&u.memoizedState!==null&&u.memoizedState.dehydrated===null?(u.lanes|=i,R=u.alternate,R!==null&&(R.lanes|=i),Jl(u.return,i,e),R=u.child,R=R!==null?R.sibling:null):R=u.child;if(R!==null)R.return=u;else for(R=u;R!==null;){if(R===e){R=null;break}if(u=R.sibling,u!==null){u.return=R.return,R=u;break}R=R.return}u=R}}function Bn(e,t,i,a){e=null;for(var u=t,m=!1;u!==null;){if(!m){if((u.flags&524288)!==0)m=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var R=u.alternate;if(R===null)throw Error(o(387));if(R=R.memoizedProps,R!==null){var H=u.type;Es(u.pendingProps.value,R.value)||(e!==null?e.push(H):e=[H])}}else if(u===es.current){if(R=u.alternate,R===null)throw Error(o(387));R.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Kr):e=[Kr])}u=u.return}return e!==null&&Nu(t,e,i,a),t.flags|=262144,e!==null}function eo(e){for(e=e.firstContext;e!==null;){if(!Es(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function In(e){Mn=e,Ti=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kt(e){return Op(Mn,e)}function to(e,t){return Mn===null&&In(e),Op(e,t)}function Op(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Ti===null){if(e===null)throw Error(o(308));Ti=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ti=Ti.next=t;return i}var v1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},_1=s.unstable_scheduleCallback,y1=s.unstable_NormalPriority,kt={$$typeof:he,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ju(){return{controller:new v1,data:new Map,refCount:0}}function Ra(e){e.refCount--,e.refCount===0&&_1(y1,function(){e.controller.abort()})}function Lp(e,t){if((e.pendingLanes&4194048)!==0){var i=e.transitionTypes;for(i===null&&(i=e.transitionTypes=[]),e=0;e<t.length;e++){var a=t[e];i.indexOf(a)===-1&&i.push(a)}}}var Da=null;function b1(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Aa=null,Tu=0,Hn=0,xr=null;function S1(e,t){if(Aa===null){var i=Aa=[];Tu=0,Hn=Vh(),xr={status:"pending",value:void 0,then:function(a){i.push(a)}}}return Tu++,t.then(Mp,Mp),t}function Mp(){if(--Tu===0&&(Da=null,Aa!==null)){xr!==null&&(xr.status="fulfilled");var e=Aa;Aa=null,Hn=0,xr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function x1(e,t){var i=[],a={status:"pending",value:null,reason:null,then:function(u){i.push(u)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var u=0;u<i.length;u++)(0,i[u])(t)},function(u){for(a.status="rejected",a.reason=u,u=0;u<i.length;u++)(0,i[u])(void 0)}),a}var Bp=me.S;me.S=function(e,t){if(Tv=ns(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&S1(e,t),Da!==null)for(var i=zr;i!==null;)Lp(i,Da),i=i.next;if(i=e.types,i!==null){for(var a=zr;a!==null;)Lp(a,i),a=a.next;if(Hn!==0){a=Da,a===null&&(a=Da=[]);for(var u=0;u<i.length;u++){var m=i[u];a.indexOf(m)===-1&&a.push(m)}}}Bp!==null&&Bp(e,t)};var Un=at(null);function ku(){var e=Un.current;return e!==null?e:ft.pooledCache}function so(e,t){t===null?Ke(Un,Un.current):Ke(Un,t.pool)}function Ip(){var e=ku();return e===null?null:{parent:kt._currentValue,pool:e}}var wr=Error(o(460)),Ru=Error(o(474)),io=Error(o(542)),no={then:function(){}};function Hp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Up(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(li,li),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,$p(e),e===void 0&&!("reason"in t)?Error(o(600)):e;default:if(typeof t.status=="string")t.then(li,li);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=a}},function(a){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,$p(e),e}throw $n=t,wr}}function zn(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?($n=i,wr):i}}var $n=null;function zp(){if($n===null)throw Error(o(459));var e=$n;return $n=null,e}function $p(e){if(e===wr||e===io)throw Error(o(483))}var Cr=null,Oa=0;function ro(e){var t=Oa;return Oa+=1,Cr===null&&(Cr=[]),Up(Cr,e,t)}function Qi(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ao(e,t){throw t.$$typeof===k?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Pp(e){function t(se,X){if(e){var re=se.deletions;re===null?(se.deletions=[X],se.flags|=16):re.push(X)}}function i(se,X){if(!e)return null;for(;X!==null;)t(se,X),X=X.sibling;return null}function a(se){for(var X=new Map;se!==null;)se.key===null?X.set(se.index,se):X.set(se.key,se),se=se.sibling;return X}function u(se,X){return se=Ni(se,X),se.index=0,se.sibling=null,se}function m(se,X,re){return se.index=re,e?(re=se.alternate,re!==null?(re=re.index,re<X?(se.flags|=2,X):re):(se.flags|=134217730,X)):(se.flags|=1048576,X)}function R(se){return e&&se.alternate===null&&(se.flags|=134217730),se}function H(se,X,re,ve){return X===null||X.tag!==6?(X=bu(re,se.mode,ve),X.return=se,X):(X=u(X,re),X.return=se,X)}function K(se,X,re,ve){var Ce=re.type;return Ce===q?(se=oe(se,X,re.props.children,ve,re.key),Qi(se,re),se):X!==null&&(X.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&zn(Ce)===X.type)?(X=u(X,re.props),Qi(X,re),X.return=se,X):(X=Zl(re.type,re.key,re.props,null,se.mode,ve),Qi(X,re),X.return=se,X)}function ie(se,X,re,ve){return X===null||X.tag!==4||X.stateNode.containerInfo!==re.containerInfo||X.stateNode.implementation!==re.implementation?(X=Su(re,se.mode,ve),X.return=se,X):(X=u(X,re.children||[]),X.return=se,X)}function oe(se,X,re,ve,Ce){return X===null||X.tag!==7?(X=On(re,se.mode,ve,Ce),X.return=se,X):(X=u(X,re),X.return=se,X)}function _e(se,X,re){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=bu(""+X,se.mode,re),X.return=se,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case L:return re=Zl(X.type,X.key,X.props,null,se.mode,re),Qi(re,X),re.return=se,re;case V:return X=Su(X,se.mode,re),X.return=se,X;case B:return X=zn(X),_e(se,X,re)}if(pe(X)||Z(X))return X=On(X,se.mode,re,null),X.return=se,X;if(typeof X.then=="function")return _e(se,ro(X),re);if(X.$$typeof===he)return _e(se,to(se,X),re);ao(se,X)}return null}function te(se,X,re,ve){var Ce=X!==null?X.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Ce!==null?null:H(se,X,""+re,ve);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case L:return re.key===Ce?K(se,X,re,ve):null;case V:return re.key===Ce?ie(se,X,re,ve):null;case B:return re=zn(re),te(se,X,re,ve)}if(pe(re)||Z(re))return Ce!==null?null:oe(se,X,re,ve,null);if(typeof re.then=="function")return te(se,X,ro(re),ve);if(re.$$typeof===he)return te(se,X,to(se,re),ve);ao(se,re)}return null}function ae(se,X,re,ve,Ce){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return se=se.get(re)||null,H(X,se,""+ve,Ce);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case L:return se=se.get(ve.key===null?re:ve.key)||null,K(X,se,ve,Ce);case V:return se=se.get(ve.key===null?re:ve.key)||null,ie(X,se,ve,Ce);case B:return ve=zn(ve),ae(se,X,re,ve,Ce)}if(pe(ve)||Z(ve))return se=se.get(re)||null,oe(X,se,ve,Ce,null);if(typeof ve.then=="function")return ae(se,X,re,ro(ve),Ce);if(ve.$$typeof===he)return ae(se,X,re,to(X,ve),Ce);ao(X,ve)}return null}function be(se,X,re,ve){for(var Ce=null,Xe=null,Te=X,Ae=X=0,At=null;Te!==null&&Ae<re.length;Ae++){Te.index>Ae?(At=Te,Te=null):At=Te.sibling;var Je=te(se,Te,re[Ae],ve);if(Je===null){Te===null&&(Te=At);break}e&&Te&&Je.alternate===null&&t(se,Te),X=m(Je,X,Ae),Xe===null?Ce=Je:Xe.sibling=Je,Xe=Je,Te=At}if(Ae===re.length)return i(se,Te),Fe&&ji(se,Ae),Ce;if(Te===null){for(;Ae<re.length;Ae++)Te=_e(se,re[Ae],ve),Te!==null&&(X=m(Te,X,Ae),Xe===null?Ce=Te:Xe.sibling=Te,Xe=Te);return Fe&&ji(se,Ae),Ce}for(Te=a(Te);Ae<re.length;Ae++)At=ae(Te,se,Ae,re[Ae],ve),At!==null&&(e&&(Je=At.alternate,Je!==null&&Te.delete(Je.key===null?Ae:Je.key)),X=m(At,X,Ae),Xe===null?Ce=At:Xe.sibling=At,Xe=At);return e&&Te.forEach(function(_n){return t(se,_n)}),Fe&&ji(se,Ae),Ce}function Ne(se,X,re,ve){if(re==null)throw Error(o(151));for(var Ce=null,Xe=null,Te=X,Ae=X=0,At=null,Je=re.next();Te!==null&&!Je.done;Ae++,Je=re.next()){Te.index>Ae?(At=Te,Te=null):At=Te.sibling;var _n=te(se,Te,Je.value,ve);if(_n===null){Te===null&&(Te=At);break}e&&Te&&_n.alternate===null&&t(se,Te),X=m(_n,X,Ae),Xe===null?Ce=_n:Xe.sibling=_n,Xe=_n,Te=At}if(Je.done)return i(se,Te),Fe&&ji(se,Ae),Ce;if(Te===null){for(;!Je.done;Ae++,Je=re.next())Je=_e(se,Je.value,ve),Je!==null&&(X=m(Je,X,Ae),Xe===null?Ce=Je:Xe.sibling=Je,Xe=Je);return Fe&&ji(se,Ae),Ce}for(Te=a(Te);!Je.done;Ae++,Je=re.next())Je=ae(Te,se,Ae,Je.value,ve),Je!==null&&(e&&(At=Je.alternate,At!==null&&Te.delete(At.key===null?Ae:At.key)),X=m(Je,X,Ae),Xe===null?Ce=Je:Xe.sibling=Je,Xe=Je);return e&&Te.forEach(function(sw){return t(se,sw)}),Fe&&ji(se,Ae),Ce}function ze(se,X,re,ve){if(typeof re=="object"&&re!==null&&re.type===q&&re.key===null&&re.props.ref===void 0&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case L:e:{for(var Ce=re.key;X!==null;){if(X.key===Ce){if(Ce=re.type,Ce===q){if(X.tag===7){i(se,X.sibling),ve=u(X,re.props.children),Qi(ve,re),ve.return=se,se=ve;break e}}else if(X.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&zn(Ce)===X.type){i(se,X.sibling),ve=u(X,re.props),Qi(ve,re),ve.return=se,se=ve;break e}i(se,X);break}else t(se,X);X=X.sibling}re.type===q?(ve=On(re.props.children,se.mode,ve,re.key),Qi(ve,re),ve.return=se,se=ve):(ve=Zl(re.type,re.key,re.props,null,se.mode,ve),Qi(ve,re),ve.return=se,se=ve)}return R(se);case V:e:{for(Ce=re.key;X!==null;){if(X.key===Ce)if(X.tag===4&&X.stateNode.containerInfo===re.containerInfo&&X.stateNode.implementation===re.implementation){i(se,X.sibling),ve=u(X,re.children||[]),ve.return=se,se=ve;break e}else{i(se,X);break}else t(se,X);X=X.sibling}ve=Su(re,se.mode,ve),ve.return=se,se=ve}return R(se);case B:return re=zn(re),ze(se,X,re,ve)}if(pe(re))return be(se,X,re,ve);if(Z(re)){if(Ce=Z(re),typeof Ce!="function")throw Error(o(150));return re=Ce.call(re),Ne(se,X,re,ve)}if(typeof re.then=="function")return ze(se,X,ro(re),ve);if(re.$$typeof===he)return ze(se,X,to(se,re),ve);ao(se,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,X!==null&&X.tag===6?(i(se,X.sibling),ve=u(X,re),ve.return=se,se=ve):(i(se,X),ve=bu(re,se.mode,ve),ve.return=se,se=ve),R(se)):i(se,X)}return function(se,X,re,ve){try{Oa=0;var Ce=ze(se,X,re,ve);return Cr=null,Ce}catch(Te){if(Te===wr||Te===io)throw Te;var Xe=hs(29,Te,null,se.mode);return Xe.lanes=ve,Xe.return=se,Xe}}}var Pn=Pp(!0),Fp=Pp(!1),Ji=!1;function Du(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Au(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function en(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function tn(e,t,i){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(nt&2)!==0){var u=a.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),a.pending=t,t=Yl(e),Np(e,null,i),t}return Gl(e,a,t,i),Yl(e)}function La(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,i|=a,t.lanes=i,Rm(e,i)}}function Ou(e,t){var i=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,i===a)){var u=null,m=null;if(i=i.firstBaseUpdate,i!==null){do{var R={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};m===null?u=m=R:m=m.next=R,i=i.next}while(i!==null);m===null?u=m=t:m=m.next=t}else u=m=t;i={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:m,shared:a.shared,callbacks:a.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Lu=!1;function Ma(){if(Lu){var e=xr;if(e!==null)throw e}}function Ba(e,t,i,a){Lu=!1;var u=e.updateQueue;Ji=!1;var m=u.firstBaseUpdate,R=u.lastBaseUpdate,H=u.shared.pending;if(H!==null){u.shared.pending=null;var K=H,ie=K.next;K.next=null,R===null?m=ie:R.next=ie,R=K;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,H=oe.lastBaseUpdate,H!==R&&(H===null?oe.firstBaseUpdate=ie:H.next=ie,oe.lastBaseUpdate=K))}if(m!==null){var _e=u.baseState;R=0,oe=ie=K=null,H=m;do{var te=H.lane&-536870913,ae=te!==H.lane;if(ae?(Ze&te)===te:(a&te)===te){te!==0&&te===Hn&&(Lu=!0),oe!==null&&(oe=oe.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var be=e,Ne=H;te=t;var ze=i;switch(Ne.tag){case 1:if(be=Ne.payload,typeof be=="function"){_e=be.call(ze,_e,te);break e}_e=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ne.payload,te=typeof be=="function"?be.call(ze,_e,te):be,te==null)break e;_e=O({},_e,te);break e;case 2:Ji=!0}}te=H.callback,te!==null&&(e.flags|=64,ae&&(e.flags|=8192),ae=u.callbacks,ae===null?u.callbacks=[te]:ae.push(te))}else ae={lane:te,tag:H.tag,payload:H.payload,callback:H.callback,next:null},oe===null?(ie=oe=ae,K=_e):oe=oe.next=ae,R|=te;if(H=H.next,H===null){if(H=u.shared.pending,H===null)break;ae=H,H=ae.next,ae.next=null,u.lastBaseUpdate=ae,u.shared.pending=null}}while(!0);oe===null&&(K=_e),u.baseState=K,u.firstBaseUpdate=ie,u.lastBaseUpdate=oe,m===null&&(u.shared.lanes=0),cn|=R,e.lanes=R,e.memoizedState=_e}}function Vp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function qp(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Vp(i[e],t)}var sn=at(null),lo=at(0);function Kp(e,t){e=Li,Ke(lo,e),Ke(sn,t),Li=e|t.baseLanes}function Mu(){Ke(lo,Li),Ke(sn,sn.current)}function Bu(){Li=lo.current,we(sn),we(lo)}var Gt=at(null),ts=null;function nn(e){var t=e.alternate;Ke(Yt,Yt.current&1),Ke(Gt,e),ts===null&&(t===null||sn.current!==null||t.memoizedState!==null)&&(ts=e)}function Iu(e){Ke(Yt,Yt.current),Ke(Gt,e),ts===null&&(ts=e)}function Gp(e){e.tag===22?(Ke(Yt,Yt.current),Ke(Gt,e),ts===null&&(ts=e)):rn()}function rn(){Ke(Yt,Yt.current),Ke(Gt,Gt.current)}function Ns(e){we(Gt),ts===e&&(ts=null),we(Yt)}var Yt=at(0);function Ia(e,t){Ke(Gt,Gt.current),Ke(Yt,t)}function Hu(e){we(Yt),we(Gt),ts===e&&(ts=null)}function oo(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||ad(i)||ld(i)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)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 Ri=0,Ue=null,ht=null,Rt=null,co=!1,Er=!1,Fn=!1,uo=0,Ha=0,Nr=null,w1=0;function Ct(){throw Error(o(321))}function Uu(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Es(e[i],t[i]))return!1;return!0}function zu(e,t,i,a,u,m){return Ri=m,Ue=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,me.H=e===null||e.memoizedState===null?Rg:Dg,Fn=!1,m=i(a,u),Fn=!1,Er&&(m=Zp(t,i,a,u)),Yp(e),m}function Yp(e){me.H=_o;var t=ht!==null&&ht.next!==null;if(Ri=0,Rt=ht=Ue=null,co=!1,Ha=0,Nr=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&eo(e)&&(Dt=!0))}function Zp(e,t,i,a){Ue=e;var u=0;do{if(Er&&(Nr=null),Ha=0,Er=!1,25<=u)throw Error(o(301));if(u+=1,Rt=ht=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}me.H=D1,m=t(i,a)}while(Er);return m}function C1(){var e=me.H,t=e.useState()[0];return t=typeof t.then=="function"?Ua(t):t,e=e.useState()[0],(ht!==null?ht.memoizedState:null)!==e&&(Ue.flags|=1024),t}function $u(){var e=uo!==0;return uo=0,e}function Pu(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Fu(e){if(co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}co=!1}Ri=0,Rt=ht=Ue=null,Er=!1,Ha=uo=0,Nr=null}function as(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Ue.memoizedState=Rt=e:Rt=Rt.next=e,Rt}function Tt(){if(ht===null){var e=Ue.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var t=Rt===null?Ue.memoizedState:Rt.next;if(t!==null)Rt=t,ht=e;else{if(e===null)throw Ue.alternate===null?Error(o(467)):Error(o(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},Rt===null?Ue.memoizedState=Rt=e:Rt=Rt.next=e}return Rt}function ho(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ua(e){var t=Ha;return Ha+=1,Nr===null&&(Nr=[]),e=Up(Nr,e,t),t=Ue,(Rt===null?t.memoizedState:Rt.next)===null&&(t=t.alternate,me.H=t===null||t.memoizedState===null?Rg:Dg),e}function fo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ua(e);if(e.$$typeof===ee)return;if(e.$$typeof===he)return Kt(e)}throw Error(o(438,String(e)))}function Vu(e){var t=null,i=Ue.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var a=Ue.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=ho(),Ue.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),a=0;a<e;a++)i[a]=J;return t.index++,i}function Di(e,t){return typeof t=="function"?t(e):t}function mo(e){var t=Tt();return qu(t,ht,e)}function qu(e,t,i){var a=e.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=i;var u=e.baseQueue,m=a.pending;if(m!==null){if(u!==null){var R=u.next;u.next=m.next,m.next=R}t.baseQueue=u=m,a.pending=null}if(m=e.baseState,u===null)e.memoizedState=m;else{t=u.next;var H=R=null,K=null,ie=t,oe=!1;do{var _e=ie.lane&-536870913;if(_e!==ie.lane?(Ze&_e)===_e:(Ri&_e)===_e){var te=ie.revertLane;if(te===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),_e===Hn&&(oe=!0);else if((Ri&te)===te){ie=ie.next,te===Hn&&(oe=!0);continue}else _e={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(H=K=_e,R=m):K=K.next=_e,Ue.lanes|=te,cn|=te;_e=ie.action,Fn&&i(m,_e),m=ie.hasEagerState?ie.eagerState:i(m,_e)}else te={lane:_e,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(H=K=te,R=m):K=K.next=te,Ue.lanes|=_e,cn|=_e;ie=ie.next}while(ie!==null&&ie!==t);if(K===null?R=m:K.next=H,!Es(m,e.memoizedState)&&(Dt=!0,oe&&(i=xr,i!==null)))throw i;e.memoizedState=m,e.baseState=R,e.baseQueue=K,a.lastRenderedState=m}return u===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Ku(e){var t=Tt(),i=t.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=e;var a=i.dispatch,u=i.pending,m=t.memoizedState;if(u!==null){i.pending=null;var R=u=u.next;do m=e(m,R.action),R=R.next;while(R!==u);Es(m,t.memoizedState)||(Dt=!0),t.memoizedState=m,t.baseQueue===null&&(t.baseState=m),i.lastRenderedState=m}return[m,a]}function Xp(e,t,i){var a=Ue,u=Tt(),m=Fe;if(m){if(i===void 0)throw Error(o(407));i=i()}else i=t();var R=!Es((ht||u).memoizedState,i);if(R&&(u.memoizedState=i,Dt=!0),u=u.queue,Zu(Jp.bind(null,a,u,e),[e]),e=u.getSnapshot!==t||R||Rt!==null&&(Rt.memoizedState.tag&1)!==0,jr(e?9:8,{destroy:void 0},Qp.bind(null,a,u,i,t),null),e){if(a.flags|=2048,ft===null)throw Error(o(349));m||(Ri&127)!==0||Wp(a,t,i)}return i}function Wp(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=Ue.updateQueue,t===null?(t=ho(),Ue.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Qp(e,t,i,a){t.value=i,t.getSnapshot=a,eg(t)&&tg(e)}function Jp(e,t,i){return i(function(){eg(t)&&tg(e)})}function eg(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Es(e,i)}catch{return!0}}function tg(e){var t=An(e,2);t!==null&&ps(t,e,2)}function Gu(e){var t=as();if(typeof e=="function"){var i=e;if(e=i(),Fn){qi(!0);try{i()}finally{qi(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:e},t}function sg(e,t,i,a){return e.baseState=i,qu(e,ht,typeof a=="function"?a:Di)}function E1(e,t,i,a,u){if(vo(e))throw Error(o(485));if(e=t.action,e!==null){var m={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){m.listeners.push(R)}};me.T!==null?i(!0):m.isTransition=!1,a(m),i=t.pending,i===null?(m.next=t.pending=m,ig(t,m)):(m.next=i.next,t.pending=i.next=m)}}function ig(e,t){var i=t.action,a=t.payload,u=e.state;if(t.isTransition){var m=me.T,R={};R.types=m!==null?m.types:null,me.T=R;try{var H=i(u,a),K=me.S;K!==null&&K(R,H),ng(e,t,H)}catch(ie){Yu(e,t,ie)}finally{m!==null&&R.types!==null&&(m.types=R.types),me.T=m}}else try{m=i(u,a),ng(e,t,m)}catch(ie){Yu(e,t,ie)}}function ng(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(a){rg(e,t,a)},function(a){return Yu(e,t,a)}):rg(e,t,i)}function rg(e,t,i){t.status="fulfilled",t.value=i,ag(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,ig(e,i)))}function Yu(e,t,i){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=i,ag(t),t=t.next;while(t!==a)}e.action=null}function ag(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function lg(e,t){return t}function og(e,t){if(Fe){var i=ft.formState;if(i!==null){e:{var a=Ue;if(Fe){if(mt){t:{for(var u=mt,m=Us;u.nodeType!==8;){if(!m){u=null;break t}if(u=$s(u.nextSibling),u===null){u=null;break t}}m=u.data,u=m==="F!"||m==="F"?u:null}if(u){mt=$s(u.nextSibling),a=u.data==="F!";break e}}Xi(a)}a=!1}a&&(t=i[0])}}return i=as(),i.memoizedState=i.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lg,lastRenderedState:t},i.queue=a,i=jg.bind(null,Ue,a),a.dispatch=i,a=Gu(!1),m=eh.bind(null,Ue,!1,a.queue),a=as(),u={state:t,dispatch:null,action:e,pending:null},a.queue=u,i=E1.bind(null,Ue,u,m,i),u.dispatch=i,a.memoizedState=e,[t,i,!1]}function cg(e){var t=Tt();return ug(t,ht,e)}function ug(e,t,i){if(t=qu(e,t,lg)[0],e=mo(Di)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ua(t)}catch(R){throw R===wr?io:R}else a=t;t=Tt();var u=t.queue,m=u.dispatch;return i!==t.memoizedState&&(Ue.flags|=2048,jr(9,{destroy:void 0},N1.bind(null,u,i),null)),[a,m,e]}function N1(e,t){e.action=t}function hg(e){var t=Tt(),i=ht;if(i!==null)return ug(t,i,e);Tt(),t=t.memoizedState,i=Tt();var a=i.queue.dispatch;return i.memoizedState=e,[t,a,!1]}function jr(e,t,i,a){return e={tag:e,create:i,deps:a,inst:t,next:null},t=Ue.updateQueue,t===null&&(t=ho(),Ue.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(a=i.next,i.next=e,e.next=a,t.lastEffect=e),e}function dg(){return Tt().memoizedState}function po(e,t,i,a){var u=as();Ue.flags|=e,u.memoizedState=jr(1|t,{destroy:void 0},i,a===void 0?null:a)}function go(e,t,i,a){var u=Tt();a=a===void 0?null:a;var m=u.memoizedState.inst;ht!==null&&a!==null&&Uu(a,ht.memoizedState.deps)?u.memoizedState=jr(t,m,i,a):(Ue.flags|=e,u.memoizedState=jr(1|t,m,i,a))}function fg(e,t){po(8390656,8,e,t)}function Zu(e,t){go(2048,8,e,t)}function j1(e){Ue.flags|=4;var t=Ue.updateQueue;if(t===null)t=ho(),Ue.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function mg(e){var t=Tt().memoizedState;return j1({ref:t,nextImpl:e}),function(){if((nt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function pg(e,t){return go(4,2,e,t)}function gg(e,t){return go(4,4,e,t)}function vg(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _g(e,t,i){i=i!=null?i.concat([e]):null,go(4,4,vg.bind(null,t,e),i)}function Xu(){}function yg(e,t){var i=Tt();t=t===void 0?null:t;var a=i.memoizedState;return t!==null&&Uu(t,a[1])?a[0]:(i.memoizedState=[e,t],e)}function bg(e,t){var i=Tt();t=t===void 0?null:t;var a=i.memoizedState;if(t!==null&&Uu(t,a[1]))return a[0];if(a=e(),Fn){qi(!0);try{e()}finally{qi(!1)}}return i.memoizedState=[a,t],a}function Wu(e,t,i){return i===void 0||(Ri&1073741824)!==0&&(Ze&261930)===0?e.memoizedState=t:(e.memoizedState=i,e=Rv(),Ue.lanes|=e,cn|=e,i)}function Sg(e,t,i,a){return Es(i,t)?i:sn.current!==null?(e=Wu(e,i,a),Es(e,t)||(Dt=!0),e):(Ri&106)===0||(Ri&1073741824)!==0&&(Ze&261930)===0?(Dt=!0,e.memoizedState=i):(e=Rv(),Ue.lanes|=e,cn|=e,t)}function xg(e,t,i,a,u){var m=ge.p;ge.p=m!==0&&8>m?m:8;var R=me.T,H={};H.types=R!==null?R.types:null,me.T=H,eh(e,!1,t,i);try{var K=u(),ie=me.S;if(ie!==null&&ie(H,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var oe=x1(K,a);za(e,t,oe,Rs(e))}else za(e,t,a,Rs(e))}catch(_e){za(e,t,{then:function(){},status:"rejected",reason:_e},Rs())}finally{ge.p=m,R!==null&&H.types!==null&&(R.types=H.types),me.T=R}}function T1(){}function Qu(e,t,i,a){if(e.tag!==5)throw Error(o(476));var u=wg(e).queue;xg(e,u,t,Re,i===null?T1:function(){return Cg(e),i(a)})}function wg(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Re,baseState:Re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:Re},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cg(e){var t=wg(e);t.next===null&&(t=e.alternate.memoizedState),za(e,t.next.queue,{},Rs())}function Ju(){return Kt(Kr)}function Eg(){return Tt().memoizedState}function Ng(){return Tt().memoizedState}function k1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Rs();e=en(i);var a=tn(t,e,i);a!==null&&(ps(a,t,i),La(a,t,i)),t={cache:ju()},e.payload=t;return}t=t.return}}function R1(e,t,i){var a=Rs();i={lane:a,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},vo(e)?Tg(t,i):(i=_u(e,t,i,a),i!==null&&(ps(i,e,a),kg(i,t,a)))}function jg(e,t,i){var a=Rs();za(e,t,i,a)}function za(e,t,i,a){var u={lane:a,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(vo(e))Tg(t,u);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var R=t.lastRenderedState,H=m(R,i);if(u.hasEagerState=!0,u.eagerState=H,Es(H,R))return Gl(e,t,u,0),ft===null&&Kl(),!1}catch{}if(i=_u(e,t,u,a),i!==null)return ps(i,e,a),kg(i,t,a),!0}return!1}function eh(e,t,i,a){if(a={lane:2,revertLane:Vh(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},vo(e)){if(t)throw Error(o(479))}else t=_u(e,i,a,2),t!==null&&ps(t,e,2)}function vo(e){var t=e.alternate;return e===Ue||t!==null&&t===Ue}function Tg(e,t){Er=co=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function kg(e,t,i){if((i&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,i|=a,t.lanes=i,Rm(e,i)}}var _o={readContext:Kt,use:fo,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct,useEffectEvent:Ct},Rg={readContext:Kt,use:fo,useCallback:function(e,t){return as().memoizedState=[e,t===void 0?null:t],e},useContext:Kt,useEffect:fg,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,po(4194308,4,vg.bind(null,t,e),i)},useLayoutEffect:function(e,t){return po(4194308,4,e,t)},useInsertionEffect:function(e,t){po(4,2,e,t)},useMemo:function(e,t){var i=as();t=t===void 0?null:t;var a=e();if(Fn){qi(!0);try{e()}finally{qi(!1)}}return i.memoizedState=[a,t],a},useReducer:function(e,t,i){var a=as();if(i!==void 0){var u=i(t);if(Fn){qi(!0);try{i(t)}finally{qi(!1)}}}else u=t;return a.memoizedState=a.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},a.queue=e,e=e.dispatch=R1.bind(null,Ue,e),[a.memoizedState,e]},useRef:function(e){var t=as();return e={current:e},t.memoizedState=e},useState:function(e){e=Gu(e);var t=e.queue,i=jg.bind(null,Ue,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Xu,useDeferredValue:function(e,t){var i=as();return Wu(i,e,t)},useTransition:function(){var e=Gu(!1);return e=xg.bind(null,Ue,e.queue,!0,!1),as().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var a=Ue,u=as();if(Fe){if(i===void 0)throw Error(o(407));i=i()}else{if(i=t(),ft===null)throw Error(o(349));(Ze&127)!==0||Wp(a,t,i)}u.memoizedState=i;var m={value:i,getSnapshot:t};return u.queue=m,fg(Jp.bind(null,a,m,e),[e]),a.flags|=2048,jr(9,{destroy:void 0},Qp.bind(null,a,m,i,t),null),i},useId:function(){var e=as(),t=ft.identifierPrefix;if(Fe){var i=ci,a=oi;i=(a&~(1<<32-ws(a)-1)).toString(32)+i,t="_"+t+"R_"+i,i=uo++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=w1++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ju,useFormState:og,useActionState:og,useOptimistic:function(e){var t=as();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=eh.bind(null,Ue,!0,i),i.dispatch=t,[e,t]},useMemoCache:Vu,useCacheRefresh:function(){return as().memoizedState=k1.bind(null,Ue)},useEffectEvent:function(e){var t=as(),i={impl:e};return t.memoizedState=i,function(){if((nt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Dg={readContext:Kt,use:fo,useCallback:yg,useContext:Kt,useEffect:Zu,useImperativeHandle:_g,useInsertionEffect:pg,useLayoutEffect:gg,useMemo:bg,useReducer:mo,useRef:dg,useState:function(){return mo(Di)},useDebugValue:Xu,useDeferredValue:function(e,t){var i=Tt();return Sg(i,ht.memoizedState,e,t)},useTransition:function(){var e=mo(Di)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ua(e),t]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:Ju,useFormState:cg,useActionState:cg,useOptimistic:function(e,t){var i=Tt();return sg(i,ht,e,t)},useMemoCache:Vu,useCacheRefresh:Ng,useEffectEvent:mg},D1={readContext:Kt,use:fo,useCallback:yg,useContext:Kt,useEffect:Zu,useImperativeHandle:_g,useInsertionEffect:pg,useLayoutEffect:gg,useMemo:bg,useReducer:Ku,useRef:dg,useState:function(){return Ku(Di)},useDebugValue:Xu,useDeferredValue:function(e,t){var i=Tt();return ht===null?Wu(i,e,t):Sg(i,ht.memoizedState,e,t)},useTransition:function(){var e=Ku(Di)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ua(e),t]},useSyncExternalStore:Xp,useId:Eg,useHostTransitionStatus:Ju,useFormState:hg,useActionState:hg,useOptimistic:function(e,t){var i=Tt();return ht!==null?sg(i,ht,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Vu,useCacheRefresh:Ng,useEffectEvent:mg};function th(e,t,i,a){t=e.memoizedState,i=i(a,t),i=i==null?t:O({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var sh={enqueueSetState:function(e,t,i){e=e._reactInternals;var a=Rs(),u=en(a);u.payload=t,i!=null&&(u.callback=i),t=tn(e,u,a),t!==null&&(ps(t,e,a),La(t,e,a))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var a=Rs(),u=en(a);u.tag=1,u.payload=t,i!=null&&(u.callback=i),t=tn(e,u,a),t!==null&&(ps(t,e,a),La(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Rs(),a=en(i);a.tag=2,t!=null&&(a.callback=t),t=tn(e,a,i),t!==null&&(ps(t,e,i),La(t,e,i))}};function Ag(e,t,i,a,u,m,R){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,m,R):t.prototype&&t.prototype.isPureReactComponent?!Na(i,a)||!Na(u,m):!0}function Og(e,t,i,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,a),t.state!==e&&sh.enqueueReplaceState(t,t.state,null)}function Vn(e,t){var i=t;if("ref"in t){i={};for(var a in t)a!=="ref"&&(i[a]=t[a])}if(e=e.defaultProps){i===t&&(i=O({},i));for(var u in e)i[u]===void 0&&(i[u]=e[u])}return i}function Lg(e){ql(e)}function Mg(e){console.error(e)}function Bg(e){ql(e)}function yo(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Ig(e,t,i){try{var a=e.onCaughtError;a(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function ih(e,t,i){return i=en(i),i.tag=3,i.payload={element:null},i.callback=function(){yo(e,t)},i}function Hg(e){return e=en(e),e.tag=3,e}function Ug(e,t,i,a){var u=i.type.getDerivedStateFromError;if(typeof u=="function"){var m=a.value;e.payload=function(){return u(m)},e.callback=function(){Ig(t,i,a)}}var R=i.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(e.callback=function(){Ig(t,i,a),typeof u!="function"&&(un===null?un=new Set([this]):un.add(this));var H=a.stack;this.componentDidCatch(a.value,{componentStack:H!==null?H:""})})}function A1(e,t,i,a,u){if(i.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=i.alternate,t!==null&&Bn(t,i,u,!0),i=Gt.current,i!==null){switch(i.tag){case 31:case 13:case 19:return ts===null?zo():i.alternate===null&&Et===0&&(Et=3),i.flags&=-257,i.flags|=65536,i.lanes=u,a===no?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([a]):t.add(a),$h(e,a,u)),!1;case 22:return i.flags|=65536,a===no?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([a]):i.add(a)),$h(e,a,u)),!1}throw Error(o(435,i.tag))}return $h(e,a,u),zo(),!1}if(Fe)return t=Gt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,a!==wu&&(e=Error(o(422),{cause:a}),ka(Bs(e,i)))):(a!==wu&&(t=Error(o(423),{cause:a}),ka(Bs(t,i))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,a=Bs(a,i),u=ih(e.stateNode,a,u),Ou(e,u),Et!==4&&(Et=2)),!1;var m=Error(o(520),{cause:a});if(m=Bs(m,i),Ya===null?Ya=[m]:Ya.push(m),Et!==4&&(Et=2),t===null)return!0;a=Bs(a,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=u&-u,i.lanes|=e,e=ih(i.stateNode,a,e),Ou(i,e),!1;case 1:if(t=i.type,m=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(un===null||!un.has(m))))return i.flags|=65536,u&=-u,i.lanes|=u,u=Hg(u),Ug(u,e,i,a),Ou(i,u),!1;break;case 22:if(i.memoizedState!==null)return i.flags|=65536,!1}i=i.return}while(i!==null);return!1}var nh=Error(o(461)),Dt=!1;function Ht(e,t,i,a){t.child=e===null?Fp(t,null,i,a):Pn(t,e.child,i,a)}function zg(e,t,i,a,u){i=i.render;var m=t.ref;if("ref"in a){var R={};for(var H in a)H!=="ref"&&(R[H]=a[H])}else R=a;return In(t),a=zu(e,t,i,R,m,u),H=$u(),e!==null&&!Dt?(Pu(e,t,u),Ai(e,t,u)):(Fe&&H&&Wl(t),t.flags|=1,Ht(e,t,a,u),t.child)}function $g(e,t,i,a,u){if(e===null){var m=i.type;return typeof m=="function"&&!yu(m)&&m.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=m,Pg(e,t,m,a,u)):(e=Zl(i.type,null,a,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(m=e.child,!dh(e,u)){var R=m.memoizedProps;if(i=i.compare,i=i!==null?i:Na,i(R,a)&&e.ref===t.ref)return Ai(e,t,u)}return t.flags|=1,e=Ni(m,a),e.ref=t.ref,e.return=t,t.child=e}function Pg(e,t,i,a,u){if(e!==null){var m=e.memoizedProps;if(Na(m,a)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=a=m,dh(e,u))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,Ai(e,t,u)}return rh(e,t,i,a,u)}function Fg(e,t,i,a){var u=a.children,m=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(m=m!==null?m.baseLanes|i:i,e!==null){for(a=t.child=e.child,u=0;a!==null;)u=u|a.lanes|a.childLanes,a=a.sibling;a=u&~m}else a=0,t.child=null;return Vg(e,t,m,i,a)}if((i&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&so(t,m!==null?m.cachePool:null),m!==null?Kp(t,m):Mu(),Gp(t);else return a=t.lanes=536870912,Vg(e,t,m!==null?m.baseLanes|i:i,i,a)}else m!==null?(so(t,m.cachePool),Kp(t,m),rn(),t.memoizedState=null):(e!==null&&so(t,null),Mu(),rn());return Ht(e,t,u,i),t.child}function $a(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Vg(e,t,i,a,u){var m=ku();return m=m===null?null:{parent:kt._currentValue,pool:m},t.memoizedState={baseLanes:i,cachePool:m},e!==null&&so(t,null),Mu(),Gp(t),e!==null&&Bn(e,t,a,!0),t.childLanes=u,null}function bo(e,t){return t=So({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function qg(e,t,i){return Pn(t,e.child,null,i),e=bo(t,t.pendingProps),e.flags|=2,Ns(t),t.memoizedState=null,e}function O1(e,t,i){var a=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Fe){if(a.mode==="hidden")return e=bo(t,a),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},$a(null,e);if(Iu(t),(e=mt)?(e=v_(e,Us),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi!==null?{id:oi,overflow:ci}:null,retryLane:536870912,hydrationErrors:null},i=Tp(e),i.return=t,t.child=i,zt=t,mt=null)):e=null,e===null)throw Xi(t);return t.lanes=536870912,null}return bo(t,a)}var m=e.memoizedState;if(m!==null){var R=m.dehydrated;if(Iu(t),u)if(t.flags&256)t.flags&=-257,t=qg(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Dt||Bn(e,t,i,!1),u=(i&e.childLanes)!==0,Dt||u){if(sn.current===null){if(a=ft,a!==null&&(R=Dm(a,i),R!==0&&R!==m.retryLane))throw m.retryLane=R,An(e,R),ps(a,e,R),nh;zo()}t=qg(e,t,i)}else e=m.treeContext,mt=$s(R.nextSibling),zt=t,Fe=!0,Zi=null,Us=!1,e!==null&&Dp(t,e),t=bo(t,a),t.flags|=134221824;return t}return e=Ni(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Tr(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function rh(e,t,i,a,u){return In(t),i=zu(e,t,i,a,void 0,u),a=$u(),e!==null&&!Dt?(Pu(e,t,u),Ai(e,t,u)):(Fe&&a&&Wl(t),t.flags|=1,Ht(e,t,i,u),t.child)}function Kg(e,t,i,a,u,m){return In(t),t.updateQueue=null,i=Zp(t,a,i,u),Yp(e),a=$u(),e!==null&&!Dt?(Pu(e,t,m),Ai(e,t,m)):(Fe&&a&&Wl(t),t.flags|=1,Ht(e,t,i,m),t.child)}function Gg(e,t,i,a,u){if(In(t),t.stateNode===null){var m=_r,R=i.contextType;typeof R=="object"&&R!==null&&(m=Kt(R)),m=new i(a,m),t.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=sh,t.stateNode=m,m._reactInternals=t,m=t.stateNode,m.props=a,m.state=t.memoizedState,m.refs={},Du(t),R=i.contextType,m.context=typeof R=="object"&&R!==null?Kt(R):_r,m.state=t.memoizedState,R=i.getDerivedStateFromProps,typeof R=="function"&&(th(t,i,R,a),m.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(R=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),R!==m.state&&sh.enqueueReplaceState(m,m.state,null),Ba(t,a,m,u),Ma(),m.state=t.memoizedState),typeof m.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){m=t.stateNode;var H=t.memoizedProps,K=Vn(i,H);m.props=K;var ie=m.context,oe=i.contextType;R=_r,typeof oe=="object"&&oe!==null&&(R=Kt(oe));var _e=i.getDerivedStateFromProps;oe=typeof _e=="function"||typeof m.getSnapshotBeforeUpdate=="function",H=t.pendingProps!==H,oe||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(H||ie!==R)&&Og(t,m,a,R),Ji=!1;var te=t.memoizedState;m.state=te,Ba(t,a,m,u),Ma(),ie=t.memoizedState,H||te!==ie||Ji?(typeof _e=="function"&&(th(t,i,_e,a),ie=t.memoizedState),(K=Ji||Ag(t,i,K,a,te,ie,R))?(oe||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(t.flags|=4194308)):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=ie),m.props=a,m.state=ie,m.context=R,a=K):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{m=t.stateNode,Au(e,t),R=t.memoizedProps,oe=Vn(i,R),m.props=oe,_e=t.pendingProps,te=m.context,ie=i.contextType,K=_r,typeof ie=="object"&&ie!==null&&(K=Kt(ie)),H=i.getDerivedStateFromProps,(ie=typeof H=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(R!==_e||te!==K)&&Og(t,m,a,K),Ji=!1,te=t.memoizedState,m.state=te,Ba(t,a,m,u),Ma();var ae=t.memoizedState;R!==_e||te!==ae||Ji||e!==null&&e.dependencies!==null&&eo(e.dependencies)?(typeof H=="function"&&(th(t,i,H,a),ae=t.memoizedState),(oe=Ji||Ag(t,i,oe,a,te,ae,K)||e!==null&&e.dependencies!==null&&eo(e.dependencies))?(ie||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(a,ae,K),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(a,ae,K)),typeof m.componentDidUpdate=="function"&&(t.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof m.componentDidUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=ae),m.props=a,m.state=ae,m.context=K,a=oe):(typeof m.componentDidUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||R===e.memoizedProps&&te===e.memoizedState||(t.flags|=1024),a=!1)}return m=a,Tr(e,t),a=(t.flags&128)!==0,m||a?(m=t.stateNode,i=a&&typeof i.getDerivedStateFromError!="function"?null:m.render(),t.flags|=1,e!==null&&a?(t.child=Pn(t,e.child,null,u),t.child=Pn(t,null,i,u)):Ht(e,t,i,u),t.memoizedState=m.state,e=t.child):e=Ai(e,t,u),e}function Yg(e,t,i,a){return Ln(),t.flags|=256,Ht(e,t,i,a),t.child}var ah={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lh(e){return{baseLanes:e,cachePool:Ip()}}function oh(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=ks),e}function Zg(e,t,i){var a=t.pendingProps,u=!1,m=(t.flags&128)!==0,R;if((R=m)||(R=e!==null&&e.memoizedState===null?!1:(Yt.current&2)!==0),R&&(u=!0,t.flags&=-129),R=(t.flags&32)!==0,t.flags&=-33,e===null){if(Fe){if(u?nn(t):rn(),(e=mt)?(e=v_(e,Us),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi!==null?{id:oi,overflow:ci}:null,retryLane:536870912,hydrationErrors:null},i=Tp(e),i.return=t,t.child=i,zt=t,mt=null)):e=null,e===null)throw Xi(t);return ld(e)?t.lanes=32:t.lanes=536870912,null}return m=a.children,a=a.fallback,u?(rn(),u=t.mode,m=So({mode:"hidden",children:m},u),a=On(a,u,i,null),m.return=t,a.return=t,m.sibling=a,t.child=m,a=t.child,a.memoizedState=lh(i),a.childLanes=oh(e,R,i),t.memoizedState=ah,$a(null,a)):(nn(t),ch(t,m))}var H=e.memoizedState;if(H!==null){var K=H.dehydrated;if(K!==null)return L1(e,t,m,R,a,K,H,i)}return u?(rn(),u=a.fallback,m=t.mode,H=e.child,K=H.sibling,a=Ni(H,{mode:"hidden",children:a.children}),a.subtreeFlags=H.subtreeFlags&1206910976,K!==null?u=Ni(K,u):(u=On(u,m,i,null),u.flags|=2),u.return=t,a.return=t,a.sibling=u,t.child=a,$a(null,a),a=t.child,u=e.child.memoizedState,u===null?u=lh(i):(m=u.cachePool,m!==null?(H=kt._currentValue,m=m.parent!==H?{parent:H,pool:H}:m):m=Ip(),u={baseLanes:u.baseLanes|i,cachePool:m}),a.memoizedState=u,a.childLanes=oh(e,R,i),t.memoizedState=ah,$a(e.child,a)):(nn(t),i=e.child,e=i.sibling,i=Ni(i,{mode:"visible",children:a.children}),i.return=t,i.sibling=null,e!==null&&(R=t.deletions,R===null?(t.deletions=[e],t.flags|=16):R.push(e)),t.child=i,t.memoizedState=null,i)}function ch(e,t){return t=So({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function So(e,t){return e=hs(22,e,null,t),e.lanes=0,e}function xo(e,t,i){return Pn(t,e.child,null,i),e=ch(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function L1(e,t,i,a,u,m,R,H){if(i)return t.flags&256?(nn(t),t.flags&=-257,xo(e,t,H)):t.memoizedState!==null?(rn(),t.child=e.child,t.flags|=128,null):(rn(),m=u.fallback,R=t.mode,u=So({mode:"visible",children:u.children},R),m=On(m,R,H,null),m.flags|=2,u.return=t,m.return=t,u.sibling=m,t.child=u,Pn(t,e.child,null,H),u=t.child,u.memoizedState=lh(H),u.childLanes=oh(e,a,H),t.memoizedState=ah,$a(null,u));if(nn(t),ld(m)){if(a=m.nextSibling&&m.nextSibling.dataset,a)var K=a.dgst;return a=K,a!==""&&(u=Error(o(419)),u.stack="",u.digest=a,ka({value:u,source:null,stack:null})),xo(e,t,H)}if(Dt||Bn(e,t,H,!1),a=(H&e.childLanes)!==0,Dt||a){if(sn.current!==null)return xo(e,t,H);if(a=ft,a!==null&&(u=Dm(a,H),u!==0&&u!==R.retryLane))throw R.retryLane=u,An(e,u),ps(a,e,u),nh;return ad(m)||zo(),xo(e,t,H)}return ad(m)?(t.flags|=192,t.child=e.child,null):(e=R.treeContext,mt=$s(m.nextSibling),zt=t,Fe=!0,Zi=null,Us=!1,e!==null&&Dp(t,e),t=ch(t,u.children),t.flags|=134221824,t)}function Xg(e,t,i){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Jl(e.return,t,i)}function Wg(e){for(var t=null;e!==null;){var i=e.alternate;i!==null&&oo(i)===null&&(t=e),e=e.sibling}return t}function wo(e,t,i,a,u,m){var R=e.memoizedState;R===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:i,tailMode:u,treeForkCount:m}:(R.isBackwards=t,R.rendering=null,R.renderingStartTime=0,R.last=a,R.tail=i,R.tailMode=u,R.treeForkCount=m)}function uh(e){var t=e.child;for(e.child=null;t!==null;){var i=t.sibling;t.sibling=e.child,e.child=t,t=i}}function hh(e,t,i){var a=t.pendingProps,u=a.revealOrder,m=a.tail;a=a.children;var R=Yt.current;if(t.flags&128)return Ia(t,R),null;var H=(R&2)!==0;if(H?(R=R&1|2,t.flags|=128):R&=1,Ia(t,R),u==="backwards"&&e!==null?(uh(e),Ht(e,t,a,i),uh(e)):Ht(e,t,a,i),a=Fe?Ta:0,!H&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xg(e,i,t);else if(e.tag===19)Xg(e,i,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}switch(u){case"backwards":i=Wg(t.child),i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null,uh(t)),wo(t,!0,u,null,m,a);break;case"unstable_legacy-backwards":for(i=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&oo(e)===null){t.child=u;break}e=u.sibling,u.sibling=i,i=u,u=e}wo(t,!0,i,null,m,a);break;case"together":wo(t,!1,null,null,void 0,a);break;case"independent":t.memoizedState=null;break;default:i=Wg(t.child),i===null?(u=t.child,t.child=null):(u=i.sibling,i.sibling=null),wo(t,!1,u,i,m,a)}return t.child}function Qg(e,t,i){var a=t.pendingProps;return Wi(t,t.type,a.value),Ht(e,t,a.children,i),t.child}function Ai(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),cn|=t.lanes,(i&t.childLanes)===0)if(e!==null){if(Bn(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,i=Ni(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Ni(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function dh(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&eo(e)))}function M1(e,t,i){switch(t.tag){case 3:wt(t,t.stateNode.containerInfo),Wi(t,kt,e.memoizedState.cache),Ln();break;case 27:case 5:G(t);break;case 4:wt(t,t.stateNode.containerInfo);break;case 10:Wi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Iu(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return nn(t),t.flags|=128,null;a=Bn(e,t,i,!1);var u=t.child.childLanes;return a||(i&u)!==0?Zg(e,t,i):(nn(t),e=Ai(e,t,i),e!==null?e.sibling:null)}nn(t);break;case 19:if(t.flags&128)return hh(e,t,i);if(u=(e.flags&128)!==0,a=(i&t.childLanes)!==0,a||(Bn(e,t,i,!1),a=(i&t.childLanes)!==0),u){if(a)return hh(e,t,i);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Ia(t,Yt.current),a)break;return null;case 22:return t.lanes=0,Fg(e,t,i,t.pendingProps);case 24:Wi(t,kt,e.memoizedState.cache)}return Ai(e,t,i)}function Jg(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!dh(e,i)&&(t.flags&128)===0)return Dt=!1,M1(e,t,i);Dt=(e.flags&131072)!==0}else Dt=!1,Fe&&(t.flags&1048576)!==0&&Rp(t,Ta,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=zn(t.elementType),t.type=e,typeof e=="function")yu(e)?(a=Vn(e,a),t.tag=1,t=Gg(null,t,e,a,i)):(t.tag=0,t=rh(null,t,e,a,i));else{if(e!=null){var u=e.$$typeof;if(u===ne){t.tag=11,t=zg(null,t,e,a,i);break e}else if(u===A){t.tag=14,t=$g(null,t,e,a,i);break e}else if(u===he){t.tag=10,t.type=e,t=Qg(null,t,i);break e}}throw t=ue(e)||e,Error(o(306,t,""))}}return t;case 0:return rh(e,t,t.type,t.pendingProps,i);case 1:return a=t.type,u=Vn(a,t.pendingProps),Gg(e,t,a,u,i);case 3:e:{if(wt(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var m=t.memoizedState;u=m.element,Au(e,t),Ba(t,a,null,i);var R=t.memoizedState;if(a=R.cache,Wi(t,kt,a),a!==m.cache&&Nu(t,[kt],i,!0),Ma(),a=R.element,m.isDehydrated)if(m={element:a,isDehydrated:!1,cache:R.cache},t.updateQueue.baseState=m,t.memoizedState=m,t.flags&256){t=Yg(e,t,a,i);break e}else if(a!==u){u=Bs(Error(o(424)),t),ka(u),t=Yg(e,t,a,i);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,mt=$s(e.firstChild),zt=t,Fe=!0,Zi=null,Us=!0,i=Fp(t,null,a,i),t.child=i;i;)i.flags=i.flags&-3|134221824,i=i.sibling;else{if(Ln(),a===u){t=Ai(e,t,i);break e}Ht(e,t,a,i)}t=t.child}return t;case 26:return Tr(e,t),e===null?(i=C_(t.type,null,t.pendingProps,null))?t.memoizedState=i:Fe||(t.stateNode=i_(t.type,t.pendingProps,is.current,t)):t.memoizedState=C_(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return G(t),e===null&&Fe&&(a=t.stateNode=b_(t.type,t.pendingProps,is.current),zt=t,Us=!0,u=mt,fn(t.type)?(od=u,mt=$s(a.firstChild)):mt=u),Ht(e,t,t.pendingProps.children,i),Tr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fe&&((u=a=mt)&&(a=kx(a,t.type,t.pendingProps,Us),a!==null?(t.stateNode=a,zt=t,mt=$s(a.firstChild),Us=!1,u=!0):u=!1),u||Xi(t)),G(t),u=t.type,m=t.pendingProps,R=e!==null?e.memoizedProps:null,a=m.children,Jh(u,m)?a=null:R!==null&&Jh(u,R)&&(t.flags|=32),t.memoizedState!==null&&(u=zu(e,t,C1,null,null,i),Kr._currentValue=u),Tr(e,t),Ht(e,t,a,i),t.child;case 6:return e===null&&Fe&&((e=i=mt)&&(i=Rx(i,t.pendingProps,Us),i!==null?(t.stateNode=i,zt=t,mt=null,e=!0):e=!1),e||Xi(t)),null;case 13:return Zg(e,t,i);case 4:return wt(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Pn(t,null,a,i):Ht(e,t,a,i),t.child;case 11:return zg(e,t,t.type,t.pendingProps,i);case 7:return a=t.pendingProps,Tr(e,t),Ht(e,t,a,i),t.child;case 8:return Ht(e,t,t.pendingProps.children,i),t.child;case 12:return Ht(e,t,t.pendingProps.children,i),t.child;case 10:return Qg(e,t,i);case 9:return u=t.type._context,a=t.pendingProps.children,In(t),u=Kt(u),a=a(u),t.flags|=1,Ht(e,t,a,i),t.child;case 14:return $g(e,t,t.type,t.pendingProps,i);case 15:return Pg(e,t,t.type,t.pendingProps,i);case 19:return hh(e,t,i);case 31:return O1(e,t,i);case 22:return Fg(e,t,i,t.pendingProps);case 24:return In(t),a=Kt(kt),e===null?(u=ku(),u===null&&(u=ft,m=ju(),u.pooledCache=m,m.refCount++,m!==null&&(u.pooledCacheLanes|=i),u=m),t.memoizedState={parent:a,cache:u},Du(t),Wi(t,kt,u)):((e.lanes&i)!==0&&(Au(e,t),Ba(t,null,null,i),Ma()),u=e.memoizedState,m=t.memoizedState,u.parent!==a?(u={parent:a,cache:a},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Wi(t,kt,a)):(a=m.cache,Wi(t,kt,a),a!==u.cache&&Nu(t,[kt],i,!0))),Ht(e,t,t.pendingProps.children,i),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),a=t.pendingProps,a.name!=null&&a.name!=="auto"?t.flags|=e===null?18882560:18874368:Fe&&Wl(t),e!==null&&e.memoizedProps.name!==a.name?t.flags|=4194816:Tr(e,t),Ht(e,t,a.children,i),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Oi(e){e.flags|=4}function fh(e,t,i,a,u){var m;if((m=(e.mode&32)!==0)&&(m=i===null?T_(t,a):T_(t,a)&&(a.src!==i.src||a.srcSet!==i.srcSet)),m){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Lv())e.flags|=8192;else throw $n=no,Ru}else e.flags&=-16777217}function ev(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!k_(t))if(Lv())e.flags|=8192;else throw $n=no,Ru}function Co(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Tm():536870912,e.lanes|=t,Or|=t)}function Pa(e,t){if(!Fe)switch(e.tailMode){case"visible":break;case"collapsed":for(var i=e.tail,a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null;break;default:for(t=e.tail,i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,a=0;if(t)for(var u=e.child;u!==null;)i|=u.lanes|u.childLanes,a|=u.subtreeFlags&1206910976,a|=u.flags&1206910976,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)i|=u.lanes|u.childLanes,a|=u.subtreeFlags,a|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=a,e.childLanes=i,t}function B1(e,t,i){var a=t.pendingProps;switch(xu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return i=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ki(kt),It(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Sr(t)?Oi(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cu())),pt(t),null;case 26:var u=t.type,m=t.memoizedState;return e===null?(Oi(t),m!==null?(pt(t),ev(t,m)):(pt(t),fh(t,u,null,a,i))):m?m!==e.memoizedState?(Oi(t),pt(t),ev(t,m)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Oi(t),pt(t),fh(t,u,e,a,i)),null;case 27:if(Se(t),i=is.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Oi(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return pt(t),t.subtreeFlags&=-33554433,null}e=Bt.current,Sr(t)?Ap(t):(e=b_(u,a,i),t.stateNode=e,Oi(t))}return pt(t),t.subtreeFlags&=-33554433,null;case 5:if(Se(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Oi(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return pt(t),t.subtreeFlags&=-33554433,null}if(m=Bt.current,Sr(t))Ap(t);else{var R=Ja(is.current);switch(m){case 1:m=R.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:m=R.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":m=R.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":m=R.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":m=R.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof a.is=="string"?R.createElement("select",{is:a.is}):R.createElement("select"),a.multiple?m.multiple=!0:a.size&&(m.size=a.size);break;default:m=typeof a.is=="string"?R.createElement(u,{is:a.is}):R.createElement(u)}}m[qt]=t,m[us]=a;e:for(R=t.child;R!==null;){if(R.tag===5||R.tag===6)m.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===t)break e;for(;R.sibling===null;){if(R.return===null||R.return===t)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}t.stateNode=m;e:switch(Xt(m,u,a),u){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Oi(t)}}return pt(t),t.subtreeFlags&=-33554433,fh(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Oi(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=is.current,Sr(t)){if(e=t.stateNode,i=t.memoizedProps,a=null,u=zt,u!==null)switch(u.tag){case 27:case 5:a=u.memoizedProps}e[qt]=t,e=!!(e.nodeValue===i||a!==null&&a.suppressHydrationWarning===!0||Jv(e.nodeValue,i)),e||Xi(t,!0)}else e=Ja(e).createTextNode(a),e[qt]=t,t.stateNode=e}return pt(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(a=Sr(t),i!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[qt]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else i=Cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Ns(t),t):(Ns(t),null);if((t.flags&128)!==0)throw Error(o(558))}return pt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Sr(t),a!==null&&a.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[qt]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),u=!1}else u=Cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Ns(t),t):(Ns(t),null)}return Ns(t),(t.flags&128)!==0?(t.lanes=i,t):(i=a!==null,e=e!==null&&e.memoizedState!==null,i&&(a=t.child,u=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(u=a.alternate.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==u&&(a.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Co(t,t.updateQueue),pt(t),null);case 4:return It(),e===null&&Yh(t.stateNode.containerInfo),t.flags|=67108864,pt(t),null;case 10:return ki(t.type),pt(t),null;case 19:if(Hu(t),a=t.memoizedState,a===null)return pt(t),null;if(u=(t.flags&128)!==0,m=a.rendering,m===null)if(u)Pa(a,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(m=oo(e),m!==null){for(t.flags|=128,Pa(a,!1),e=m.updateQueue,t.updateQueue=e,Co(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)jp(i,e),i=i.sibling;return Ia(t,Yt.current&1|2),Fe&&ji(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ns()>Bo&&(t.flags|=128,u=!0,Pa(a,!1),t.lanes=4194304)}else{if(!u)if(e=oo(m),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Co(t,e),Pa(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!m.alternate&&!Fe)return pt(t),null}else 2*ns()-a.renderingStartTime>Bo&&i!==536870912&&(t.flags|=128,u=!0,Pa(a,!1),t.lanes=4194304);a.isBackwards?(m.sibling=t.child,t.child=m):(e=a.last,e!==null?e.sibling=m:t.child=m,a.last=m)}if(a.tail!==null){e=a.tail;e:{for(i=e;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ns(),e.sibling=null,m=Yt.current,m=u?m&1|2:m&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!i||Fe?Ia(t,m):(i=m,Ke(Gt,t),Ke(Yt,i),ts===null&&(ts=t)),Fe&&ji(t,a.treeForkCount),e}return pt(t),null;case 22:case 23:return Ns(t),Bu(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(i&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),i=t.updateQueue,i!==null&&Co(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==i&&(t.flags|=2048),e!==null&&we(Un),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ki(kt),pt(t),null;case 25:return null;case 30:return t.flags|=33554432,pt(t),null}throw Error(o(156,t.tag))}function I1(e,t){switch(xu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ki(kt),It(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Se(t),null;case 31:if(t.memoizedState!==null){if(Ns(t),t.alternate===null)throw Error(o(340));Ln()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ns(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ln()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return It(),null;case 10:return ki(t.type),null;case 22:case 23:return Ns(t),Bu(),e!==null&&we(Un),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ki(kt),null;case 25:return null;default:return null}}function tv(e,t){switch(xu(t),t.tag){case 3:ki(kt),It();break;case 26:case 27:case 5:Se(t);break;case 4:It();break;case 31:t.memoizedState!==null&&Ns(t);break;case 13:Ns(t);break;case 19:Hu(t);break;case 10:ki(t.type);break;case 22:case 23:Ns(t),Bu(),e!==null&&we(Un);break;case 24:ki(kt)}}function Fa(e,t){try{var i=t.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var u=a.next;i=u;do{if((i.tag&e)===e){a=void 0;var m=i.create,R=i.inst;a=m(),R.destroy=a}i=i.next}while(i!==u)}}catch(H){ot(t,t.return,H)}}function an(e,t,i){try{var a=t.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var m=u.next;a=m;do{if((a.tag&e)===e){var R=a.inst,H=R.destroy;if(H!==void 0){R.destroy=void 0,u=t;var K=i,ie=H;try{ie()}catch(oe){ot(u,K,oe)}}}a=a.next}while(a!==m)}}catch(oe){ot(t,t.return,oe)}}function sv(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{qp(t,i)}catch(a){ot(e,e.return,a)}}}function iv(e,t,i){i.props=Vn(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(a){ot(e,t,a)}}function ui(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:var u=e.stateNode,m=Ci(e.memoizedProps,u);(u.ref===null||u.ref.name!==m)&&(u.ref=u_(m)),a=u.ref;break;case 7:if(e.stateNode===null){var R=new Ds(e);f(e.child,!1,jx,R,void 0,void 0),e.stateNode=R}a=e.stateNode;break;default:a=e.stateNode}typeof i=="function"?e.refCleanup=i(a):i.current=a}}catch(H){ot(e,t,H)}}function Zt(e,t){var i=e.ref,a=e.refCleanup;if(i!==null)if(typeof a=="function")try{a()}catch(u){ot(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(u){ot(e,t,u)}else i.current=null}function Eo(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var i=0;i<t.length;i++)g_(e.stateNode,t[i])}function nv(e){for(var t=e.return;t!==null&&(ph(t)&&g_(e.stateNode,t.stateNode),!mh(t));)t=t.return}function Va(e){for(var t=e.return;t!==null&&(ph(t)&&Tx(e.stateNode,t.stateNode),!mh(t));)t=t.return}function mh(e){return e.tag===5||e.tag===3||e.tag===27}function ph(e){return e&&e.tag===7&&e.stateNode!==null}function gh(e){var t=e.type,i=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&a.focus();break e;case"img":i.src?a.src=i.src:i.srcSet&&(a.srcset=i.srcSet)}}catch(u){ot(e,e.return,u)}}function vh(e,t,i){try{var a=e.stateNode;cx(a,e.type,i,t),a[us]=t}catch(u){ot(e,e.return,u)}}function rv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&fn(e.type)||e.tag===4}function _h(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&fn(e.type)||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 yh(e,t,i,a){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(u,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(u),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=li)),Eo(e,a),it=!0;else if(u!==4&&(u===27&&(Eo(e,a),a=null,fn(e.type)&&(i=e.stateNode,t=null)),e=e.child,e!==null))for(yh(e,t,i,a),e=e.sibling;e!==null;)yh(e,t,i,a),e=e.sibling}function No(e,t,i,a){var u=e.tag;if(u===5||u===6)u=e.stateNode,t?i.insertBefore(u,t):i.appendChild(u),Eo(e,a),it=!0;else if(u!==4&&(u===27&&(Eo(e,a),a=null,fn(e.type)&&(i=e.stateNode)),e=e.child,e!==null))for(No(e,t,i,a),e=e.sibling;e!==null;)No(e,t,i,a),e=e.sibling}function av(e){var t=e.stateNode,i=e.memoizedProps;try{for(var a=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Xt(t,a,i),t[qt]=e,t[us]=i}catch(m){ot(e,e.return,m)}}var jo=!1,js=null;function lv(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(jo=!0)}var hi=null;function ov(){var e=hi;return hi=null,e}var ds=0;function kr(e,t,i,a,u){return ds=0,cv(e.child,t,i,a,u)}function cv(e,t,i,a,u){for(var m=!1;e!==null;){if(e.tag===5){var R=e.stateNode;if(a!==null){var H=sd(R);a.push(H),H.view&&(m=!0)}else m||sd(R).view&&(m=!0);jo=!0,o_(R,ds===0?t:t+"_"+ds,i),ds++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&u||cv(e.child,t,i,a,u)&&(m=!0));e=e.sibling}return m}function di(e,t){for(;e!==null;)e.tag===5?c_(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||di(e.child,t)),e=e.sibling}function To(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(To(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(o(544));var i=t.name;t=Ei(t.default,t.share),t!=="none"&&(kr(e,i,t,null,!1)||di(e.child,!1))}e=e.sibling}}function bh(e,t){if(e.tag===30){var i=e.stateNode,a=e.memoizedProps,u=Ci(a,i),m=Ei(a.default,i.paired?a.share:a.enter);m!=="none"?kr(e,u,m,null,!1)?(To(e),i.paired||t||Ir(e,a.onEnter)):di(e.child,!1):To(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)bh(e,t),e=e.sibling;else To(e)}function Sh(e){if(js!==null&&js.size!==0){var t=js;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var i=e.memoizedProps,a=i.name;if(a!=null&&a!=="auto"){var u=t.get(a);if(u!==void 0){var m=Ei(i.default,i.share);if(m!=="none"&&(kr(e,a,m,null,!1)?(m=e.stateNode,u.paired=m,m.paired=u,Ir(e,i.onShare)):di(e.child,!1)),t.delete(a),t.size===0)break}}}Sh(e)}e=e.sibling}}}function xh(e){if(e.tag===30){var t=e.memoizedProps,i=Ci(t,e.stateNode),a=js!==null?js.get(i):void 0,u=Ei(t.default,a!==void 0?t.share:t.exit);u!=="none"&&(kr(e,i,u,null,!1)?a!==void 0?(u=e.stateNode,a.paired=u,u.paired=a,js.delete(i),Ir(e,t.onShare)):Ir(e,t.onExit):di(e.child,!1)),js!==null&&Sh(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)xh(e),e=e.sibling;else js!==null&&Sh(e)}function uv(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,i=Ci(t,e.stateNode);t=Ei(t.default,t.update),e.flags&=-5,t!=="none"&&kr(e,i,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&uv(e);e=e.sibling}}function wh(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,di(e.child,!1))}wh(e)}e=e.sibling}}function ko(e){if(e.tag===30)e.stateNode.paired=null,di(e.child,!1),wh(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)ko(e),e=e.sibling;else wh(e)}function hv(e){for(e=e.child;e!==null;)e.tag===30?di(e.child,!1):(e.subtreeFlags&33554432)!==0&&hv(e),e=e.sibling}function Ch(e,t,i,a,u,m,R){for(var H=!1;t!==null;){if(t.tag===5){var K=t.stateNode;if(m!==null&&ds<m.length){var ie=m[ds],oe=sd(K);(ie.view||oe.view)&&(H=!0);var _e;if(_e=(e.flags&4)===0)if(oe.clip)_e=!0;else{_e=ie.rect;var te=oe.rect;_e=_e.y!==te.y||_e.x!==te.x||_e.height!==te.height||_e.width!==te.width}_e&&(e.flags|=4),oe.abs?oe=!ie.abs:(ie=ie.rect,oe=oe.rect,oe=ie.height!==oe.height||ie.width!==oe.width),oe&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&o_(K,ds===0?i:i+"_"+ds,u),H&&(e.flags&4)!==0||(hi===null&&(hi=[]),hi.push(K,ds===0?a:a+"_"+ds,t.memoizedProps)),ds++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&R?e.flags|=t.flags&32:Ch(e,t.child,i,a,u,m,R)&&(H=!0));t=t.sibling}return H}function dv(e,t){for(e=e.child;e!==null;){if(e.tag===30){var i=e.memoizedProps,a=e.stateNode,u=Ci(i,a),m=Ei(i.default,i.update),R;R=e.memoizedState,e.memoizedState=null,a=e;var H=e.child;ds=0,u=Ch(a,H,u,u,m,R,!1),(e.flags&4)!==0&&u&&Ir(e,i.onUpdate)}else(e.subtreeFlags&33554432)!==0&&dv(e);e=e.sibling}}var $t=!1,rt=!1,fi=!1,Eh=!1,fv=typeof WeakSet=="function"?WeakSet:Set,Pt=null,mi=!1,qa=!1,Ro=!1,Nh=!1;function H1(e,t,i){if(e=e.containerInfo,Wh=Gr,e=vp(e),du(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var m=u.anchorOffset,R=u.focusNode;u=u.focusOffset;try{a.nodeType,R.nodeType}catch{a=null;break e}var H=0,K=-1,ie=-1,oe=0,_e=0,te=e,ae=null;t:for(;;){for(var be;te!==a||m!==0&&te.nodeType!==3||(K=H+m),te!==R||u!==0&&te.nodeType!==3||(ie=H+u),te.nodeType===3&&(H+=te.nodeValue.length),(be=te.firstChild)!==null;)ae=te,te=be;for(;;){if(te===e)break t;if(ae===a&&++oe===m&&(K=H),ae===R&&++_e===u&&(ie=H),(be=te.nextSibling)!==null)break;te=ae,ae=te.parentNode}te=be}a=K===-1||ie===-1?null:{start:K,end:ie}}else a=null}a=a||{start:0,end:0}}else a=null;for(Qh={focusedElem:e,selectionRange:a},Gr=!1,i=(i&335544064)===i,Pt=t,t=i?9270:1024;Pt!==null;){if(e=Pt,i&&(a=e.deletions,a!==null))for(m=0;m<a.length;m++)i&&xh(a[m]);if(e.alternate===null&&(e.flags&2)!==0)i&&lv(e),Do(i);else{if(e.tag===22){if(a=e.alternate,e.memoizedState!==null){a!==null&&a.memoizedState===null&&i&&xh(a),Do(i);continue}else if(a!==null&&a.memoizedState!==null){i&&lv(e),Do(i);continue}}a=e.child,(e.subtreeFlags&t)!==0&&a!==null?(a.return=e,Pt=a):(i&&uv(e),Do(i))}}js=null}function Do(e){for(;Pt!==null;){var t=Pt,i=e,a=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((u&1024)!==0&&a!==null){i=void 0,u=a.memoizedProps,a=a.memoizedState;var m=t.stateNode;try{var R=Vn(t.type,u);i=m.getSnapshotBeforeUpdate(R,a),m.__reactInternalSnapshotBeforeUpdate=i}catch(H){ot(t,t.return,H)}}break;case 3:if((u&1024)!==0){if(a=t.stateNode.containerInfo,i=a.nodeType,i===9)rd(a);else if(i===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":rd(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:i&&a!==null&&(i=Ci(a.memoizedProps,a.stateNode),u=t.memoizedProps,u=Ei(u.default,u.update),u!=="none"&&kr(a,i,u,a.memoizedState=[],!0));break;default:if((u&1024)!==0)throw Error(o(163))}if(a=t.sibling,a!==null){a.return=t.return,Pt=a;break}Pt=t.return}}function mv(e,t,i){var a=i.flags;switch(i.tag){case 0:case 11:case 15:pi(e,i),a&4&&Fa(5,i);break;case 1:if(pi(e,i),a&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(R){ot(i,i.return,R)}else{var u=Vn(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(R){ot(i,i.return,R)}}a&64&&sv(i),a&512&&ui(i,i.return);break;case 3:if(pi(e,i),a&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{qp(e,t)}catch(R){ot(i,i.return,R)}}break;case 27:t===null&&a&4&&av(i);case 26:case 5:pi(e,i),t===null&&a&4&&gh(i),a&512&&ui(i,i.return);break;case 12:pi(e,i);break;case 31:pi(e,i),a&4&&_v(e,i);break;case 13:pi(e,i),a&4&&yv(e,i),a&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=X1.bind(null,i),Dx(e,i))));break;case 22:if(a=i.memoizedState!==null||$t,!a){var m=t!==null&&t.memoizedState!==null||rt;t=$t,u=rt,$t=a,(rt=m)&&!u?(a=2,(i.subtreeFlags&8772)!==0&&(a|=1),Xs(e,i,a)):pi(e,i),$t=t,rt=u}break;case 30:pi(e,i),a&512&&ui(i,i.return);break;case 7:a&512&&ui(i,i.return);default:pi(e,i)}}function jh(e,t){for(e=e.child;e!==null;)pv(e,t),e=e.sibling}function pv(e,t){switch(e.tag){case 5:case 26:try{var i=e.stateNode;if(t){var a=i.style;typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"}else{var u=e.stateNode,m=e.memoizedProps.style,R=m!=null&&m.hasOwnProperty("display")?m.display:null;u.style.display=R==null||typeof R=="boolean"?"":(""+R).trim()}}catch(K){ot(e,e.return,K)}Th(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,it=!0}catch(K){ot(e,e.return,K)}break;case 18:try{var H=e.stateNode;t?l_(H,!0):l_(e.stateNode,!1)}catch(K){ot(e,e.return,K)}break;case 22:case 23:e.memoizedState===null&&jh(e,t);break;default:jh(e,t)}}function Th(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var i=e,a=t;switch(i.tag){case 4:pv(i,a);break e;case 22:i.memoizedState===null&&Th(i,a);break e;default:Th(i,a)}}e=e.sibling}}function gv(e){var t=e.alternate;t!==null&&(e.alternate=null,gv(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ml(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,fs=!1;function Ys(e,t,i){for(i=i.child;i!==null;)vv(e,t,i),i=i.sibling}function vv(e,t,i){if(xs&&typeof xs.onCommitFiberUnmount=="function")try{xs.onCommitFiberUnmount(ma,i)}catch{}switch(i.tag){case 26:rt||Zt(i,t),Ys(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&!rt&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:rt||Zt(i,t),Va(i);var a=vt,u=fs;fn(i.type)&&(vt=i.stateNode,fs=!1),Ys(e,t,i),S_(i.stateNode,i.type,i.memoizedProps),vt=a,fs=u;break;case 5:rt||Zt(i,t),Va(i);case 6:if(i.tag===6&&Va(i),a=vt,u=fs,vt=null,Ys(e,t,i),vt=a,fs=u,vt!==null)if(fs)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(i.stateNode),it=!0}catch(m){ot(i,t,m)}else try{vt.removeChild(i.stateNode),it=!0}catch(m){ot(i,t,m)}break;case 18:vt!==null&&(fs?(e=vt,a_(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Yr(e)):a_(vt,i.stateNode));break;case 4:a=vt,u=fs,vt=i.stateNode.containerInfo,fs=!0,Ys(e,t,i),vt=a,fs=u;break;case 0:case 11:case 14:case 15:an(2,i,t),rt||an(4,i,t),Ys(e,t,i);break;case 1:rt||(Zt(i,t),a=i.stateNode,typeof a.componentWillUnmount=="function"&&iv(i,t,a)),Ys(e,t,i);break;case 21:Ys(e,t,i);break;case 22:rt=(a=rt)||i.memoizedState!==null,Ys(e,t,i),rt=a;break;case 30:Zt(i,t),Ys(e,t,i);break;case 7:rt||Zt(i,t),Ys(e,t,i);break;default:Ys(e,t,i)}}function _v(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Yr(e)}catch(i){ot(t,t.return,i)}}}function yv(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Yr(e)}catch(i){ot(t,t.return,i)}}function U1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fv),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fv),t;default:throw Error(o(435,e.tag))}}function Ao(e,t){var i=U1(e);t.forEach(function(a){if(!i.has(a)){i.add(a);var u=W1.bind(null,e,a);a.then(u,u)}})}function ls(e,t,i){var a=t.deletions;if(a!==null)for(var u=0;u<a.length;u++){var m=a[u],R=e,H=t,K=H;e:for(;K!==null;){switch(K.tag){case 27:if(fn(K.type)){vt=K.stateNode,fs=!1;break e}break;case 5:vt=K.stateNode,fs=!1;break e;case 3:case 4:vt=K.stateNode.containerInfo,fs=!0;break e}K=K.return}if(vt===null)throw Error(o(160));vv(R,H,m),vt=null,fs=!1,R=m.alternate,R!==null&&(R.return=null),m.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bv(t,e,i),t=t.sibling}var Zs=null;function bv(e,t,i){var a=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(u&4&&(a=e.updateQueue,a=a!==null?a.events:null,a!==null))for(var m=0;m<a.length;m++){var R=a[m];R.ref.impl=R.nextImpl}ls(t,e,i),os(e),u&4&&(an(3,e,e.return),Fa(3,e),an(5,e,e.return));break;case 1:ls(t,e,i),os(e),u&512&&(rt||a===null||Zt(a,a.return)),u&64&&$t&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?t:i.concat(t))));break;case 26:if(m=Zs,ls(t,e,i),os(e),u&512&&(rt||a===null||Zt(a,a.return)),u&4)if(u=a!==null?a.memoizedState:null,i=e.memoizedState,a===null)if(i===null)if(e.stateNode===null)if($t)e.stateNode=i_(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,i=e.memoizedProps,u=m.ownerDocument||m;t:switch(t){case"title":a=u.getElementsByTagName("title")[0],(!a||a[va]||a[qt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=u.createElement(t),u.head.insertBefore(a,u.querySelector("head > title"))),Xt(a,t,i),a[qt]=e,Ut(a),t=a;break e;case"link":if(m=j_("link","href",u).get(t+(i.href||""))){for(R=0;R<m.length;R++)if(a=m[R],a.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&a.getAttribute("rel")===(i.rel==null?null:i.rel)&&a.getAttribute("title")===(i.title==null?null:i.title)&&a.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){m.splice(R,1);break t}}a=u.createElement(t),Xt(a,t,i),u.head.appendChild(a);break;case"meta":if(m=j_("meta","content",u).get(t+(i.content||""))){for(R=0;R<m.length;R++)if(a=m[R],a.getAttribute("content")===(i.content==null?null:""+i.content)&&a.getAttribute("name")===(i.name==null?null:i.name)&&a.getAttribute("property")===(i.property==null?null:i.property)&&a.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&a.getAttribute("charset")===(i.charSet==null?null:i.charSet)){m.splice(R,1);break t}}a=u.createElement(t),Xt(a,t,i),u.head.appendChild(a);break;default:throw Error(o(468,t))}a[qt]=e,Ut(a),t=a}e.stateNode=t}else $t||dd(m,e.type,e.stateNode);else e.stateNode=N_(m,i,e.memoizedProps);else u!==i?(u===null?(t=a.stateNode,t===null||rt||t.parentNode.removeChild(t)):u.count--,i===null?$t||dd(m,e.type,e.stateNode):N_(m,i,e.memoizedProps)):i===null&&e.stateNode!==null&&vh(e,e.memoizedProps,a.memoizedProps);break;case 27:ls(t,e,i),os(e),u&512&&(rt||a===null||Zt(a,a.return)),a!==null&&u&4&&vh(e,e.memoizedProps,a.memoizedProps);break;case 5:if(m=fi,fi=!1,ls(t,e,i),fi=m,os(e),u&512&&(rt||a===null||Zt(a,a.return)),e.flags&32){t=e.stateNode;try{hr(t,""),it=!0}catch(oe){ot(e,e.return,oe)}}u&4&&e.stateNode!=null&&(t=e.memoizedProps,vh(e,t,a!==null?a.memoizedProps:t)),u&1024&&(Eh=!0);break;case 6:if(ls(t,e,i),os(e),u&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,i=e.stateNode;try{i.nodeValue=t,it=!0}catch(oe){ot(e,e.return,oe)}}break;case 3:if(it=!1,Go=null,m=Zs,Zs=el(t.containerInfo),ls(t,e,i),Zs=m,os(e),u&4&&a!==null&&a.memoizedState.isDehydrated)try{Yr(t.containerInfo)}catch(oe){ot(e,e.return,oe)}Eh&&(Eh=!1,Sv(e)),it=!1;break;case 4:u=fi,fi=$t,a=$m(),m=Zs,Zs=el(e.stateNode.containerInfo),ls(t,e,i),os(e),Zs=m,it&&qa&&(Ro=!0),it=a,fi=u;break;case 12:ls(t,e,i),os(e);break;case 31:ls(t,e,i),os(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ao(e,t)));break;case 13:ls(t,e,i),os(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Mo=ns()),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ao(e,t)));break;case 22:m=e.memoizedState!==null,R=a!==null&&a.memoizedState!==null;var H=$t,K=rt,ie=fi;$t=H||m,fi=ie||m,rt=K||R,ls(t,e,i),rt=K,fi=ie,$t=H,os(e),u&8192&&(t=e.stateNode,t._visibility=m?t._visibility&-2:t._visibility|1,!m||a===null||R||$t||rt||(t=R||rt,i=$t,a=rt,$t=m||$t,rt=t,ln(e,2),$t=i,rt=a),!m&&fi||jh(e,m)),u&4&&(t=e.updateQueue,t!==null&&(i=t.retryQueue,i!==null&&(t.retryQueue=null,Ao(e,i))));break;case 19:ls(t,e,i),os(e),u&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ao(e,t)));break;case 30:u&512&&(rt||a===null||Zt(a,a.return)),u=$m(),m=qa,R=(i&335544064)===i,H=e.memoizedProps,qa=R&&Ei(H.default,H.update)!=="none",ls(t,e,i),os(e),R&&a!==null&&it&&(e.flags|=4),qa=m,it=u;break;case 21:break;case 7:u&512&&(rt||a===null||Zt(a,a.return)),a&&a.stateNode!==null&&(a.stateNode._fragmentFiber=e);default:ls(t,e,i),os(e)}}function os(e){var t=e.flags;if(t&2){try{for(var i,a=e.return;a!==null;){if(rv(a)){i=a;break}a=a.return}a=null;for(var u=e.return;u!==null;){if(ph(u)){var m=u.stateNode;a===null?a=[m]:a.push(m)}if(mh(u))break;u=u.return}var R=a;if(i==null)throw Error(o(160));switch(i.tag){case 27:var H=i.stateNode,K=_h(e);No(e,K,H,R);break;case 5:var ie=i.stateNode;i.flags&32&&(hr(ie,""),i.flags&=-33);var oe=_h(e);No(e,oe,ie,R);break;case 3:case 4:var _e=i.stateNode.containerInfo,te=_h(e);yh(e,te,_e,R);break;default:throw Error(o(161))}}catch(ae){ot(e,e.return,ae)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sv(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Gr=!0,t.reset(),Gr=!1),e=e.sibling}}function Rr(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)xv(t,e),t=t.sibling;else dv(t)}function xv(e,t){var i=e.alternate;if(i===null)bh(e,!1);else switch(e.tag){case 3:if(Nh=mi=!1,ov(),Rr(t,e),!mi&&!Ro){if(e=hi,e!==null)for(var a=0;a<e.length;a+=3){i=e[a];var u=e[a+1];c_(i,e[a+2]),i=i.ownerDocument.documentElement,i!==null&&i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+u+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Nh=!0}hi=null;break;case 5:Rr(t,e);break;case 4:a=mi,mi=!1,Rr(t,e),mi&&(Ro=!0),mi=a;break;case 22:e.memoizedState===null&&(i.memoizedState!==null?bh(e,!1):Rr(t,e));break;case 30:a=mi,u=ov(),mi=!1,Rr(t,e),mi&&(e.flags|=4);var m=e.memoizedProps,R=e.stateNode;t=Ci(m,R),R=Ci(i.memoizedProps,R);var H=Ei(m.default,m.update);H==="none"?t=!1:(m=i.memoizedState,i.memoizedState=null,i=e.child,ds=0,t=Ch(e,i,t,R,H,m,!0),ds!==(m===null?0:m.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Ir(e,e.memoizedProps.onUpdate),hi=u):u!==null&&(u.push.apply(u,hi),hi=u),mi=(e.flags&32)!==0?!0:a;break;default:Rr(t,e)}}function pi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)mv(e,t.alternate,t),t=t.sibling}function ln(e,t){for(e=e.child;e!==null;){var i=e,a=t;switch(i.tag){case 0:case 11:case 14:case 15:an(4,i,i.return),ln(i,a);break;case 1:Zt(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&iv(i,i.return,u),ln(i,a);break;case 27:(a&2)!==0&&S_(i.stateNode,i.type,i.memoizedProps);case 5:Zt(i,i.return),i.tag!==5&&i.tag!==27||Va(i),ln(i,a);break;case 6:Va(i);break;case 26:Zt(i,i.return),u=i.stateNode,i.memoizedState!==null||u===null||rt||u.parentNode.removeChild(u),ln(i,a);break;case 22:i.memoizedState===null&&ln(i,a);break;case 30:Zt(i,i.return),ln(i,a);break;case 7:Zt(i,i.return);default:ln(i,a)}e=e.sibling}}function Xs(e,t,i){for(i=(t.subtreeFlags&8772)!==0?i:i&-2,t=t.child;t!==null;){var a=t.alternate,u=e,m=t,R=m.flags,H=(i&1)!==0;switch(m.tag){case 0:case 11:case 15:Xs(u,m,i),Fa(4,m);break;case 1:if(Xs(u,m,i),a=m,u=a.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(oe){ot(a,a.return,oe)}if(a=m,u=a.updateQueue,u!==null){var K=a.stateNode;try{var ie=u.shared.hiddenCallbacks;if(ie!==null)for(u.shared.hiddenCallbacks=null,u=0;u<ie.length;u++)Vp(ie[u],K)}catch(oe){ot(a,a.return,oe)}}H&&R&64&&sv(m),ui(m,m.return);break;case 27:(i&2)!==0&&av(m);case 5:m.tag!==5&&m.tag!==27||nv(m),Xs(u,m,i),H&&a===null&&R&4&&gh(m),ui(m,m.return);break;case 6:nv(m);break;case 26:K=m.stateNode,m.memoizedState!==null||K===null||$t||dd(el(K.ownerDocument),m.type,K),Xs(u,m,i),H&&a===null&&R&4&&gh(m),ui(m,m.return);break;case 12:Xs(u,m,i);break;case 31:Xs(u,m,i),H&&R&4&&_v(u,m);break;case 13:Xs(u,m,i),H&&R&4&&yv(u,m);break;case 22:m.memoizedState===null&&Xs(u,m,i),ui(m,m.return);break;case 30:Xs(u,m,i),ui(m,m.return);break;case 7:ui(m,m.return);default:Xs(u,m,i)}t=t.sibling}}function kh(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Ra(i))}function Rh(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ra(e))}function zs(e,t,i,a){var u=(i&335544064)===i;if(t.subtreeFlags&(u?10262:10256))for(t=t.child;t!==null;)wv(e,t,i,a),t=t.sibling;else u&&hv(t)}function wv(e,t,i,a){var u=(i&335544064)===i;u&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ko(t);var m=t.flags;switch(t.tag){case 0:case 11:case 15:zs(e,t,i,a),m&2048&&Fa(9,t);break;case 1:zs(e,t,i,a);break;case 3:zs(e,t,i,a),u&&Nh&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),m&2048&&(m=null,t.alternate!==null&&(m=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==m&&(t.refCount++,m!=null&&Ra(m)));break;case 12:if(m&2048){zs(e,t,i,a),m=t.stateNode;try{var R=t.memoizedProps,H=R.id,K=R.onPostCommit;typeof K=="function"&&K(H,t.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(ie){ot(t,t.return,ie)}}else zs(e,t,i,a);break;case 31:zs(e,t,i,a);break;case 13:zs(e,t,i,a);break;case 23:break;case 22:R=t.stateNode,H=t.alternate,t.memoizedState!==null?(u&&H!==null&&H.memoizedState===null&&ko(H),R._visibility&2?zs(e,t,i,a):Ka(e,t)):(u&&H!==null&&H.memoizedState!==null&&ko(t),R._visibility&2?zs(e,t,i,a):(R._visibility|=2,Dr(e,t,i,a,(t.subtreeFlags&10256)!==0||!1))),m&2048&&kh(H,t);break;case 24:zs(e,t,i,a),m&2048&&Rh(t.alternate,t);break;case 30:u&&(m=t.alternate,m!==null&&(di(m.child,!0),di(t.child,!0))),zs(e,t,i,a);break;default:zs(e,t,i,a)}}function Dr(e,t,i,a,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var m=e,R=t,H=i,K=a,ie=R.flags;switch(R.tag){case 0:case 11:case 15:Dr(m,R,H,K,u),Fa(8,R);break;case 23:break;case 22:var oe=R.stateNode;R.memoizedState!==null?oe._visibility&2?Dr(m,R,H,K,u):Ka(m,R):(oe._visibility|=2,Dr(m,R,H,K,u)),u&&ie&2048&&kh(R.alternate,R);break;case 24:Dr(m,R,H,K,u),u&&ie&2048&&Rh(R.alternate,R);break;default:Dr(m,R,H,K,u)}t=t.sibling}}function Ka(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,a=t,u=a.flags;switch(a.tag){case 22:Ka(i,a),u&2048&&kh(a.alternate,a);break;case 24:Ka(i,a),u&2048&&Rh(a.alternate,a);break;default:Ka(i,a)}t=t.sibling}}var qn=8192;function Kn(e,t,i){if(e.subtreeFlags&qn)for(e=e.child;e!==null;)Cv(e,t,i),e=e.sibling}function Cv(e,t,i){switch(e.tag){case 26:Kn(e,t,i),e.flags&qn&&(e.memoizedState!==null?qx(i,Zs,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&D_(i,e)));break;case 5:Kn(e,t,i),e.flags&qn&&(e=e.stateNode,(t&335544128)===t&&D_(i,e));break;case 3:case 4:var a=Zs;Zs=el(e.stateNode.containerInfo),Kn(e,t,i),Zs=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=qn,qn=16777216,Kn(e,t,i),qn=a):Kn(e,t,i));break;case 30:if((e.flags&qn)!==0&&(a=e.memoizedProps.name,a!=null&&a!=="auto")){var u=e.stateNode;u.paired=null,js===null&&(js=new Map),js.set(a,u)}Kn(e,t,i);break;default:Kn(e,t,i)}}function Ev(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ga(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var a=t[i];Pt=a,jv(a,e)}Ev(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Nv(e),e=e.sibling}function Nv(e){switch(e.tag){case 0:case 11:case 15:Ga(e),e.flags&2048&&an(9,e,e.return);break;case 3:Ga(e);break;case 12:Ga(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Oo(e)):Ga(e);break;default:Ga(e)}}function Oo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var i=0;i<t.length;i++){var a=t[i];Pt=a,jv(a,e)}Ev(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:an(8,t,t.return),Oo(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,Oo(t));break;default:Oo(t)}e=e.sibling}}function jv(e,t){for(;Pt!==null;){var i=Pt;switch(i.tag){case 0:case 11:case 15:an(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var a=i.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Ra(i.memoizedState.cache)}if(a=i.child,a!==null)a.return=i,Pt=a;else e:for(i=e;Pt!==null;){a=Pt;var u=a.sibling,m=a.return;if(gv(a),a===i){Pt=null;break e}if(u!==null){u.return=m,Pt=u;break e}Pt=m}}}var z1={getCacheForType:function(e){var t=Kt(kt),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return Kt(kt).controller.signal}},$1=typeof WeakMap=="function"?WeakMap:Map,nt=0,ft=null,Ge=null,Ze=0,lt=0,Ts=null,on=!1,Ar=!1,Dh=!1,Li=0,Et=0,cn=0,Gn=0,Lo=0,ks=0,Or=0,Ya=null,ms=null,Ah=!1,Mo=0,Tv=0,Bo=1/0,Io=null,un=null,St=0,Ws=null,Yn=null,gi=0,Oh=0,Lh=null,kv=null,Lr=null,Mr=null,Br=null,Za=0,Ho=null;function Rs(){return(nt&2)!==0&&Ze!==0?Ze&-Ze:me.T!==null?Vh():Am()}function Rv(){if(ks===0)if((Ze&536870912)===0||Fe){var e=Dl;Dl<<=1,(Dl&3932160)===0&&(Dl=262144),ks=e}else ks=536870912;return e=Gt.current,e!==null&&(e.flags|=32),ks}function Ir(e,t){if(t!=null){var i=e.stateNode,a=i.ref;a===null&&(a=i.ref=u_(Ci(e.memoizedProps,i))),Mr===null&&(Mr=[]),Mr.push(t.bind(null,a))}}function ps(e,t,i){(e===ft&&(lt===2||lt===9)||e.cancelPendingCommit!==null)&&(Hr(e,0),hn(e,Ze,ks,!1)),ga(e,i),((nt&2)===0||e!==ft)&&(e===ft&&((nt&2)===0&&(Gn|=i),Et===4&&hn(e,Ze,ks,!1)),vi(e))}function Dv(e,t,i){if((nt&6)!==0)throw Error(o(327));var a=!i&&(t&127)===0&&(t&e.expiredLanes)===0||pa(e,t),u=a?V1(e,t):Bh(e,t,!0),m=a;do{if(u===0){Ar&&!a&&hn(e,t,0,!1);break}else{if(i=e.current.alternate,m&&!P1(i)){u=Bh(e,t,!1),m=!1;continue}if(u===2){if(m=t,e.errorRecoveryDisabledLanes&m)var R=0;else R=e.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){t=R;e:{var H=e;u=Ya;var K=H.current.memoizedState.isDehydrated;if(K&&(Hr(H,R).flags|=256),R=Bh(H,R,!1),R!==2&&R!==6){if(Dh&&!K){H.errorRecoveryDisabledLanes|=m,Gn|=m,u=4;break e}m=ms,ms=u,m!==null&&(ms===null?ms=m:ms.push.apply(ms,m))}u=R}if(m=!1,u!==2)continue}}if(u===1){Hr(e,0),hn(e,t,0,!0);break}e:{switch(a=e,m=u,m){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:hn(a,t,ks,!on);break e;case 2:ms=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Mo+300-ns(),10<u)){if(hn(a,t,ks,!on),Ol(a,0,!0)!==0)break e;gi=t,a.timeoutHandle=td(Av.bind(null,a,i,ms,Io,Ah,t,ks,Gn,Or,on,m,"Throttled",-0,0),u);break e}Av(a,i,ms,Io,Ah,t,ks,Gn,Or,on,m,null,-0,0)}}break}while(!0);vi(e)}function Av(e,t,i,a,u,m,R,H,K,ie,oe,_e,te,ae){e.timeoutHandle=-1;var be=t.subtreeFlags,Ne=(m&335544064)===m;if(_e=null,(Ne||be&8192||(be&16785408)===16785408)&&(_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:li},js=null,Cv(t,m,_e),Ne&&(be=_e,Ne=e.containerInfo,Ne=(Ne.nodeType===9?Ne:Ne.ownerDocument).__reactViewTransition,Ne!=null&&(be.count++,be.waitingForViewTransition=!0,be=il.bind(be),Ne.finished.then(be,be))),be=(m&62914560)===m?Mo-ns():(m&4194048)===m?Tv-ns():0,be=Kx(_e,be),be!==null)){gi=m,e.cancelPendingCommit=be(zv.bind(null,e,t,m,i,a,u,R,H,K,ie,oe,_e,null,te,ae)),hn(e,m,R,!ie);return}zv(e,t,m,i,a,u,R,H,K,ie,oe,_e)}function P1(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var a=0;a<i.length;a++){var u=i[a],m=u.getSnapshot;u=u.value;try{if(!Es(m(),u))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;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 hn(e,t,i,a){t=jm(e,t),t&=~Lo,t&=~Gn,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var u=t;0<u;){var m=31-ws(u),R=1<<m;a[m]=-1,u&=~R}i!==0&&km(e,i,t)}function Uo(){return(nt&6)===0?(Xa(0),!1):!0}function Mh(){if(Ge!==null){if(lt===0)var e=Ge.return;else e=Ge,Ti=Mn=null,Fu(e),Cr=null,Oa=0,e=Ge;for(;e!==null;)tv(e.alternate,e),e=e.return;Ge=null}}function Hr(e,t){var i=e.timeoutHandle;return i!==-1&&(e.timeoutHandle=-1,dx(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),gi=0,Mh(),ft=e,Ge=i=Ni(e.current,null),Ze=t,lt=0,Ts=null,on=!1,Ar=pa(e,t),Dh=!1,Or=ks=Lo=Gn=cn=Et=0,ms=Ya=null,Ah=!1,Li=jm(e,t),Kl(),i}function Ov(e,t){Ue=null,me.H=_o,t===wr||t===io?(t=zp(),lt=3):t===Ru?(t=zp(),lt=4):lt=t===nh?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ts=t,Ge===null&&(Et=1,yo(e,Bs(t,e.current)))}function Lv(){var e=Gt.current;return e===null?!0:(Ze&4194048)===Ze?ts===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?e===ts:!1}function Mv(){var e=me.H;return me.H=_o,e===null?_o:e}function Bv(){var e=me.A;return me.A=z1,e}function zo(){Et=4,on||(Ze&4194048)!==Ze&&Gt.current!==null||(Ar=!0),(cn&134217727)===0&&(Gn&134217727)===0||ft===null||hn(ft,Ze,ks,!1)}function Bh(e,t,i){var a=nt;nt|=2;var u=Mv(),m=Bv();(ft!==e||Ze!==t)&&(Io=null,Hr(e,t)),t=!1;var R=Et;e:do try{if(lt!==0&&Ge!==null){var H=Ge,K=Ts;switch(lt){case 8:Mh(),R=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(t=!0);var ie=lt;if(lt=0,Ts=null,Ur(e,H,K,ie),i&&Ar){R=0;break e}break;default:ie=lt,lt=0,Ts=null,Ur(e,H,K,ie)}}F1(),R=Et;break}catch(oe){Ov(e,oe)}while(!0);return t&&e.shellSuspendCounter++,Ti=Mn=null,nt=a,me.H=u,me.A=m,Ge===null&&(ft=null,Ze=0,Kl()),R}function F1(){for(;Ge!==null;)Iv(Ge)}function V1(e,t){var i=nt;nt|=2;var a=Mv(),u=Bv();ft!==e||Ze!==t?(Io=null,Bo=ns()+500,Hr(e,t)):Ar=pa(e,t);e:do try{if(lt!==0&&Ge!==null){t=Ge;var m=Ts;t:switch(lt){case 1:lt=0,Ts=null,Ur(e,t,m,1);break;case 2:case 9:if(Hp(m)){lt=0,Ts=null,Hv(t);break}t=function(){lt!==2&&lt!==9||ft!==e||(lt=7),vi(e)},m.then(t,t);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:Hp(m)?(lt=0,Ts=null,Hv(t)):(lt=0,Ts=null,Ur(e,t,m,7));break;case 5:var R=null;switch(Ge.tag){case 26:R=Ge.memoizedState;case 5:case 27:var H=Ge;if(R?k_(R):H.stateNode.complete){lt=0,Ts=null;var K=H.sibling;if(K!==null)Ge=K;else{var ie=H.return;ie!==null?(Ge=ie,$o(ie)):Ge=null}break t}}lt=0,Ts=null,Ur(e,t,m,5);break;case 6:lt=0,Ts=null,Ur(e,t,m,6);break;case 8:Mh(),Et=6;break e;default:throw Error(o(462))}}q1();break}catch(oe){Ov(e,oe)}while(!0);return Ti=Mn=null,me.H=a,me.A=u,nt=i,Ge!==null?0:(ft=null,Ze=0,Kl(),Et)}function q1(){for(;Ge!==null&&!Tl();)Iv(Ge)}function Iv(e){var t=Jg(e.alternate,e,Li);e.memoizedProps=e.pendingProps,t===null?$o(e):Ge=t}function Hv(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=Kg(i,t,t.pendingProps,t.type,void 0,Ze);break;case 11:t=Kg(i,t,t.pendingProps,t.type.render,t.ref,Ze);break;case 5:Fu(t);var a=t;a===zt&&(Fe?(Ql(a),a.tag===5&&a.stateNode!=null&&(mt=a.stateNode)):(Ql(a),Fe=!0));default:tv(i,t),t=Ge=jp(t,Li),t=Jg(i,t,Li)}e.memoizedProps=e.pendingProps,t===null?$o(e):Ge=t}function Ur(e,t,i,a){Ti=Mn=null,Fu(t),Cr=null,Oa=0;var u=t.return;try{if(A1(e,u,t,i,Ze)){Et=1,yo(e,Bs(i,e.current)),Ge=null;return}}catch(m){if(u!==null)throw Ge=u,m;Et=1,yo(e,Bs(i,e.current)),Ge=null;return}t.flags&32768?(Fe||a===1?e=!0:Ar||(Ze&536870912)!==0?e=!1:(on=e=!0,(a===2||a===9||a===3||a===6)&&(a=Gt.current,a!==null&&a.tag===13&&(a.flags|=16384))),Uv(t,e)):$o(t)}function $o(e){var t=e;do{if((t.flags&32768)!==0){Uv(t,on);return}e=t.return;var i=B1(t.alternate,t,Li);if(i!==null){Ge=i;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);Et===0&&(Et=5)}function Uv(e,t){do{var i=I1(e.alternate,e);if(i!==null){i.flags&=32767,Ge=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=i}while(e!==null);Et=6,Ge=null}function zv(e,t,i,a,u,m,R,H,K,ie,oe,_e){e.cancelPendingCommit=null;do Po();while(St!==0);if((nt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===ft&&(Ge=ft=null,Ze=0),Yn=t,Ws=e,gi=i,Lh=u,kv=a,K1(e,t,i,R,H,K,_e)}}function K1(e,t,i,a,u,m,R){var H=t.lanes|t.childLanes;if(Oh=H,H|=vu,_S(e,i,H,a,u,m),Mr=null,(i&335544064)===i?(Br=b1(e),a=10262):(Br=null,a=10256),(t.subtreeFlags&a)!==0||(t.flags&a)!==0?(e.callbackNode=null,e.callbackPriority=0,Q1(kl,function(){return zh(),null})):(e.callbackNode=null,e.callbackPriority=0),jo=!1,a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null,u=ge.p,ge.p=2,m=nt,nt|=4;try{H1(e,t,i)}finally{nt=m,ge.p=u,me.T=a}}St=1,jo?Lr=_x(R,e.containerInfo,Br,Ih,Hh,Y1,Uh,zh,G1):(Ih(),Hh(),Uh())}function G1(e){if(St!==0){var t=Ws.onRecoverableError;t(e,{componentStack:null})}}function Y1(){St===3&&(St=0,xv(Yn,Ws),St=4)}function Ih(){if(St===1){St=0;var e=Ws,t=Yn,i=gi,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=me.T,me.T=null;var u=ge.p;ge.p=2;var m=nt;nt|=4;try{qa=Ro=!1,bv(t,e,i),i=Qh;var R=vp(e.containerInfo),H=i.focusedElem,K=i.selectionRange;if(R!==H&&H&&H.ownerDocument&&gp(H.ownerDocument.documentElement,H)){if(K!==null&&du(H)){var ie=K.start,oe=K.end;if(oe===void 0&&(oe=ie),"selectionStart"in H)H.selectionStart=ie,H.selectionEnd=Math.min(oe,H.value.length);else{var _e=H.ownerDocument||document,te=_e&&_e.defaultView||window;if(te.getSelection){var ae=te.getSelection(),be=H.textContent.length,Ne=Math.min(K.start,be),ze=K.end===void 0?Ne:Math.min(K.end,be);!ae.extend&&Ne>ze&&(R=ze,ze=Ne,Ne=R);var se=pp(H,Ne),X=pp(H,ze);if(se&&X&&(ae.rangeCount!==1||ae.anchorNode!==se.node||ae.anchorOffset!==se.offset||ae.focusNode!==X.node||ae.focusOffset!==X.offset)){var re=_e.createRange();re.setStart(se.node,se.offset),ae.removeAllRanges(),Ne>ze?(ae.addRange(re),ae.extend(X.node,X.offset)):(re.setEnd(X.node,X.offset),ae.addRange(re))}}}}for(_e=[],ae=H;ae=ae.parentNode;)ae.nodeType===1&&_e.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<_e.length;H++){var ve=_e[H];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Gr=!!Wh,Qh=Wh=null}finally{nt=m,ge.p=u,me.T=a}}e.current=t,St=2}}function Hh(){if(St===2){St=0;var e=Ws,t=Yn,i=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||i){i=me.T,me.T=null;var a=ge.p;ge.p=2;var u=nt;nt|=4;try{mv(e,t.alternate,t)}finally{nt=u,ge.p=a,me.T=i}}St=3}}function Uh(){if(St===4||St===3){St=0;var e=Lr;Lr=null,rr();var t=Ws,i=Yn,a=gi,u=kv,m=(a&335544064)===a?10262:10256;if((i.subtreeFlags&m)!==0||(i.flags&m)!==0?St=5:(St=0,Yn=Ws=null,$v(t,t.pendingLanes)),m=t.pendingLanes,m===0&&(un=null),Yc(a),i=i.stateNode,xs&&typeof xs.onCommitFiberRoot=="function")try{xs.onCommitFiberRoot(ma,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=me.T,m=ge.p,ge.p=2,me.T=null;try{for(var R=t.onRecoverableError,H=0;H<u.length;H++){var K=u[H];R(K.value,{componentStack:K.stack})}}finally{me.T=i,ge.p=m}}if(u=Mr,R=Br,Br=null,u!==null&&(Mr=null,R===null&&(R=[]),e!==null))for(K=0;K<u.length;K++)i=(0,u[K])(R),i!==void 0&&e.finished.finally(i);(gi&3)!==0&&Po(),vi(t),m=t.pendingLanes,(a&261930)!==0&&(m&42)!==0?t===Ho?Za++:(Za=0,Ho=t):(Za=0,Ho=null),Xa(0)}}function $v(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ra(t)))}function Po(){return Lr!==null&&(Lr.skipTransition(),Lr=null),Ih(),Hh(),Uh(),zh()}function zh(){if(St!==5)return!1;var e=Ws,t=Oh;Oh=0;var i=Yc(gi),a=me.T,u=ge.p;try{ge.p=32>i?32:i,me.T=null,i=Lh,Lh=null;var m=Ws,R=gi;if(St=0,Yn=Ws=null,gi=0,(nt&6)!==0)throw Error(o(331));var H=nt;if(nt|=4,Nv(m.current),wv(m,m.current,R,i),nt=H,Xa(0,!1),xs&&typeof xs.onPostCommitFiberRoot=="function")try{xs.onPostCommitFiberRoot(ma,m)}catch{}return!0}finally{ge.p=u,me.T=a,$v(e,t)}}function Pv(e,t,i){t=Bs(i,t),t=ih(e.stateNode,t,2),e=tn(e,t,2),e!==null&&(ga(e,2),vi(e))}function ot(e,t,i){if(e.tag===3)Pv(e,e,i);else for(;t!==null;){if(t.tag===3){Pv(t,e,i);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(un===null||!un.has(a))){e=Bs(i,e),i=Hg(2),a=tn(t,i,2),a!==null&&(Ug(i,a,t,e),ga(a,2),vi(a));break}}t=t.return}}function $h(e,t,i){var a=e.pingCache;if(a===null){a=e.pingCache=new $1;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(i)||(Dh=!0,u.add(i),e=Z1.bind(null,e,t,i),t.then(e,e))}function Z1(e,t,i){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,ft===e&&(Ze&i)===i&&((Et===4||Et===3&&(Ze&62914560)===Ze&&300>ns()-Mo)&&(nt&2)===0?Hr(e,0):Lo|=i,Or===Ze&&(Or=0)),vi(e)}function Fv(e,t){t===0&&(t=Tm()),e=An(e,t),e!==null&&(ga(e,t),vi(e))}function X1(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),Fv(e,i)}function W1(e,t){var i=0;switch(e.tag){case 31:case 13:var a=e.stateNode,u=e.memoizedState;u!==null&&(i=u.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),Fv(e,i)}function Q1(e,t){return Ss(e,t)}var zr=null,$r=null,Ph=!1,Fo=!1,Fh=!1,dn=0;function vi(e){e!==$r&&e.next===null&&($r===null?zr=$r=e:$r=$r.next=e),Fo=!0,Ph||(Ph=!0,ex())}function Xa(e,t){if(!Fh&&Fo){Fh=!0;do for(var i=!1,a=zr;a!==null;){if(e!==0){var u=a.pendingLanes;if(u===0)var m=0;else{var R=a.suspendedLanes,H=a.pingedLanes;m=(1<<31-ws(42|e)+1)-1,m&=u&~(R&~H),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(i=!0,Gv(a,m))}else m=Ze,m=Ol(a,a===ft?m:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(m&3)===0||pa(a,m)||(i=!0,Gv(a,m));a=a.next}while(i);Fh=!1}}function J1(){Vv()}function Vv(){Fo=Ph=!1;var e=0;dn!==0&&hx()&&(e=dn);for(var t=ns(),i=null,a=zr;a!==null;){var u=a.next,m=qv(a,t);m===0?(a.next=null,i===null?zr=u:i.next=u,u===null&&($r=i)):(i=a,(e!==0||(m&3)!==0)&&(Fo=!0)),a=u}St!==0&&St!==5||Xa(e),dn!==0&&(dn=0)}function qv(e,t){for(var i=e.suspendedLanes,a=e.pingedLanes,u=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var R=31-ws(m),H=1<<R,K=u[R];K===-1?((H&i)===0||(H&a)!==0)&&(u[R]=vS(H,t)):K<=t&&(e.expiredLanes|=H),m&=~H}if(t=ft,i=Ze,i=Ol(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,i===0||e===t&&(lt===2||lt===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Fi(a),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||pa(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(a!==null&&Fi(a),Yc(i)){case 2:case 8:i=fa;break;case 32:i=kl;break;case 268435456:i=Nm;break;default:i=kl}return a=Kv.bind(null,e),i=Ss(i,a),e.callbackPriority=t,e.callbackNode=i,t}return a!==null&&a!==null&&Fi(a),e.callbackPriority=2,e.callbackNode=null,2}function Kv(e,t){if(St!==0&&St!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Po()&&e.callbackNode!==i)return null;var a=Ze;return a=Ol(e,e===ft?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Dv(e,a,t),qv(e,ns()),e.callbackNode!=null&&e.callbackNode===i?Kv.bind(null,e):null)}function Gv(e,t){if(Po())return null;Dv(e,t,!0)}function ex(){fx(function(){(nt&6)!==0?Ss(Vi,J1):Vv()})}function Vh(){if(dn===0){var e=Hn;e===0&&(e=Rl,Rl<<=1,(Rl&261888)===0&&(Rl=256)),dn=e}return dn}function Yv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Hl(e)}function tx(e,t,i,a,u){if(t==="submit"&&i&&i.stateNode===u){var m=Yv((u[us]||null).action),R=a.submitter;R&&(t=(t=R[us]||null)?Yv(t.formAction):R.getAttribute("formAction"),t!==null&&(m=t,R=null));var H=new Pl("action","action",null,a,u);e.push({event:H,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(dn!==0){var K=new FormData(u,R);Qu(i,{pending:!0,data:K,method:u.method,action:m},null,K)}}else typeof m=="function"&&(H.preventDefault(),K=new FormData(u,R),Qu(i,{pending:!0,data:K,method:u.method,action:m},m,K))},currentTarget:u}]})}}for(var qh=0;qh<gu.length;qh++){var Kh=gu[qh],sx=Kh.toLowerCase(),ix=Kh[0].toUpperCase()+Kh.slice(1);Gs(sx,"on"+ix)}Gs(bp,"onAnimationEnd"),Gs(Sp,"onAnimationIteration"),Gs(xp,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(d1,"onTransitionRun"),Gs(f1,"onTransitionStart"),Gs(m1,"onTransitionCancel"),Gs(wp,"onTransitionEnd"),cr("onMouseEnter",["mouseout","mouseover"]),cr("onMouseLeave",["mouseout","mouseover"]),cr("onPointerEnter",["pointerout","pointerover"]),cr("onPointerLeave",["pointerout","pointerover"]),kn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),kn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),kn("onBeforeInput",["compositionend","keypress","textInput","paste"]),kn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),kn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),kn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wa="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(" "),nx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Wa));function Zv(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var a=e[i],u=a.event;a=a.listeners;e:{var m=void 0;if(t)for(var R=a.length-1;0<=R;R--){var H=a[R],K=H.instance,ie=H.currentTarget;if(H=H.listener,K!==m&&u.isPropagationStopped())break e;m=H,u.currentTarget=ie;try{m(u)}catch(oe){ql(oe)}u.currentTarget=null,m=K}else for(R=0;R<a.length;R++){if(H=a[R],K=H.instance,ie=H.currentTarget,H=H.listener,K!==m&&u.isPropagationStopped())break e;m=H,u.currentTarget=ie;try{m(u)}catch(oe){ql(oe)}u.currentTarget=null,m=K}}}}function Ye(e,t){var i=t[Lm];i===void 0&&(i=t[Lm]=new Set);var a=e+"__bubble";i.has(a)||(Xv(t,e,2,!1),i.add(a))}function Gh(e,t,i){var a=0;t&&(a|=4),Xv(i,e,a,t)}var Vo="_reactListening"+Math.random().toString(36).slice(2);function Yh(e){if(!e[Vo]){e[Vo]=!0,Im.forEach(function(i){i!=="selectionchange"&&(nx.has(i)||Gh(i,!1,e),Gh(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Vo]||(t[Vo]=!0,Gh("selectionchange",!1,t))}}function Xv(e,t,i,a){switch(U_(t)){case 2:var u=Xx;break;case 8:u=Wx;break;default:u=md}i=u.bind(null,t,i,e),u=void 0,!su||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),a?u!==void 0?e.addEventListener(t,i,{capture:!0,passive:u}):e.addEventListener(t,i,!0):u!==void 0?e.addEventListener(t,i,{passive:u}):e.addEventListener(t,i,!1)}function Zh(e,t,i,a,u){var m=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var R=a.tag;if(R===3||R===4){var H=a.stateNode.containerInfo;if(H===u)break;if(R===4)for(R=a.return;R!==null;){var K=R.tag;if((K===3||K===4)&&R.stateNode.containerInfo===u)return;R=R.return}for(;H!==null;){if(R=Tn(H),R===null)return;if(K=R.tag,K===5||K===6||K===26||K===27){a=m=R;continue e}H=H.parentNode}}a=a.return}Xm(function(){var ie=m,oe=eu(i),_e=[];e:{var te=Cp.get(e);if(te!==void 0){var ae=Pl,be=e;switch(e){case"keypress":if(zl(i)===0)break e;case"keydown":case"keyup":ae=PS;break;case"focusin":be="focus",ae=au;break;case"focusout":be="blur",ae=au;break;case"beforeblur":case"afterblur":ae=au;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=Jm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=RS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=GS;break;case bp:case Sp:case xp:ae=OS;break;case wp:ae=ZS;break;case"scroll":case"scrollend":ae=TS;break;case"wheel":ae=WS;break;case"copy":case"cut":case"paste":ae=MS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=tp;break;case"submit":ae=qS;break;case"toggle":case"beforetoggle":ae=JS}var Ne=(t&4)!==0,ze=!Ne&&(e==="scroll"||e==="scrollend"),se=Ne?te!==null?te+"Capture":null:te;Ne=[];for(var X=ie,re;X!==null;){var ve=X;if(re=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||re===null||se===null||(ve=ya(X,se),ve!=null&&Ne.push(Qa(X,ve,re))),ze)break;X=X.return}0<Ne.length&&(te=new ae(te,be,null,i,oe),_e.push({event:te,listeners:Ne}))}}if((t&7)===0){e:{if(ae=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",ae&&i!==Jc&&(be=i.relatedTarget||i.fromElement)&&(Tn(be)||be[ar]))break e;(te||ae)&&(be=oe.window===oe?oe:(ae=oe.ownerDocument)?ae.defaultView||ae.parentWindow:window,te?(ae=i.relatedTarget||i.toElement,te=ie,ae=ae?Tn(ae):null,ae!==null&&(ze=_(ae),Ne=ae.tag,ae!==ze||Ne!==5&&Ne!==27&&Ne!==6)&&(ae=null)):(te=null,ae=ie),te!==ae&&(Ne=Jm,ve="onMouseLeave",se="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=tp,ve="onPointerLeave",se="onPointerEnter",X="pointer"),ze=te==null?be:_a(te),re=ae==null?be:_a(ae),be=new Ne(ve,X+"leave",te,i,oe),be.target=ze,be.relatedTarget=re,ve=null,Tn(oe)===ie&&(Ne=new Ne(se,X+"enter",ae,i,oe),Ne.target=re,Ne.relatedTarget=ze,ve=Ne),ze=ve,Ne=te&&ae?D(te,ae,rx):null,te!==null&&Wv(_e,be,te,Ne,!1),ae!==null&&ze!==null&&Wv(_e,ze,ae,Ne,!0)))}e:{if(te=ie?_a(ie):window,ae=te.nodeName&&te.nodeName.toLowerCase(),ae==="select"||ae==="input"&&te.type==="file")var Ce=cp;else if(lp(te))if(up)Ce=c1;else{Ce=l1;var Xe=a1}else ae=te.nodeName,!ae||ae.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ie&&Qc(ie.elementType)&&(Ce=cp):Ce=o1;if(Ce&&(Ce=Ce(e,ie))){op(_e,Ce,i,oe);break e}Xe&&Xe(e,te,ie)}switch(Xe=ie?_a(ie):window,e){case"focusin":(lp(Xe)||Xe.contentEditable==="true")&&(pr=Xe,fu=ie,ja=null);break;case"focusout":ja=fu=pr=null;break;case"mousedown":mu=!0;break;case"contextmenu":case"mouseup":case"dragend":mu=!1,_p(_e,i,oe);break;case"selectionchange":if(h1)break;case"keydown":case"keyup":_p(_e,i,oe)}var Te;if(ou)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else mr?rp(e,i)&&(Ae="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ae="onCompositionStart");Ae&&(sp&&i.locale!=="ko"&&(mr||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&mr&&(Te=Wm()):(Ki=oe,iu="value"in Ki?Ki.value:Ki.textContent,mr=!0)),Xe=qo(ie,Ae),0<Xe.length&&(Ae=new ep(Ae,e,null,i,oe),_e.push({event:Ae,listeners:Xe}),Te?Ae.data=Te:(Te=ap(i),Te!==null&&(Ae.data=Te)))),(Te=t1?s1(e,i):i1(e,i))&&(Ae=qo(ie,"onBeforeInput"),0<Ae.length&&(Xe=new ep("onBeforeInput","beforeinput",null,i,oe),_e.push({event:Xe,listeners:Ae}),Xe.data=Te)),tx(_e,e,ie,i,oe)}Zv(_e,t)})}function Qa(e,t,i){return{instance:e,listener:t,currentTarget:i}}function qo(e,t){for(var i=t+"Capture",a=[];e!==null;){var u=e,m=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||m===null||(u=ya(e,i),u!=null&&a.unshift(Qa(e,u,m)),u=ya(e,t),u!=null&&a.push(Qa(e,u,m))),e.tag===3)return a;e=e.return}return[]}function rx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Wv(e,t,i,a,u){for(var m=t._reactName,R=[];i!==null&&i!==a;){var H=i,K=H.alternate,ie=H.stateNode;if(H=H.tag,K!==null&&K===a)break;H!==5&&H!==26&&H!==27||ie===null||(K=ie,u?(ie=ya(i,m),ie!=null&&R.unshift(Qa(i,ie,K))):u||(ie=ya(i,m),ie!=null&&R.push(Qa(i,ie,K)))),i=i.return}R.length!==0&&e.push({event:t,listeners:R})}var ax=/\r\n?/g,lx=/\u0000|\uFFFD/g;function Qv(e){return(typeof e=="string"?e:""+e).replace(ax,`
9
+ `).replace(lx,"")}function Jv(e,t){return t=Qv(t),Qv(e)===t}function ct(e,t,i,a,u,m){switch(i){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||hr(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&hr(e,""+a);else return;break;case"className":Il(e,"class",a);break;case"tabIndex":Il(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Il(e,i,a);break;case"style":Ym(e,a,m);return;case"data":if(t!=="object"){Il(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(i);break}a=Hl(a),e.setAttribute(i,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(i==="formAction"?(t!=="input"&&ct(e,t,"name",u.name,u,null),ct(e,t,"formEncType",u.formEncType,u,null),ct(e,t,"formMethod",u.formMethod,u,null),ct(e,t,"formTarget",u.formTarget,u,null)):(ct(e,t,"encType",u.encType,u,null),ct(e,t,"method",u.method,u,null),ct(e,t,"target",u.target,u,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(i);break}a=Hl(a),e.setAttribute(i,a);break;case"onClick":a!=null&&(e.onclick=li);return;case"onScroll":a!=null&&Ye("scroll",e);return;case"onScrollEnd":a!=null&&Ye("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(i=a.__html,i!=null){if(u.children!=null)throw Error(o(60));m?.__html!==i&&(e.innerHTML=i)}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}i=Hl(a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(i,a):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":a===!0?e.setAttribute(i,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(i,a):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(i,a):e.removeAttribute(i);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(i):e.setAttribute(i,a);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),Bl(e,"popover",a);break;case"xlinkActuate":xi(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":xi(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":xi(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":xi(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":xi(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":xi(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":xi(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":xi(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":xi(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Bl(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")i=NS.get(i)||i,Bl(e,i,a);else return}it=!0}function Xh(e,t,i,a,u,m){switch(i){case"style":Ym(e,a,m);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(i=a.__html,i!=null){if(u.children!=null)throw Error(o(60));m?.__html!==i&&(e.innerHTML=i)}}break;case"children":if(typeof a=="string")hr(e,a);else if(typeof a=="number"||typeof a=="bigint")hr(e,""+a);else return;break;case"onScroll":a!=null&&Ye("scroll",e);return;case"onScrollEnd":a!=null&&Ye("scrollend",e);return;case"onClick":a!=null&&(e.onclick=li);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Hm.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(u=i.endsWith("Capture"),m=i.slice(2,u?i.length-7:void 0),t=e[us]||null,t=t!=null?t[i]:null,typeof t=="function"&&e.removeEventListener(m,t,u),typeof a=="function")){typeof t!="function"&&t!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(m,a,u);break e}it=!0,i in e?e[i]=a:a===!0?e.setAttribute(i,""):Bl(e,i,a)}return}it=!0}function Xt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var a=!1,u=!1,m;for(m in i)if(i.hasOwnProperty(m)){var R=i[m];if(R!=null)switch(m){case"src":a=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,m,R,i,null)}}u&&ct(e,t,"srcSet",i.srcSet,i,null),a&&ct(e,t,"src",i.src,i,null);return;case"input":Ye("invalid",e);var H=m=R=u=null,K=null,ie=null;for(a in i)if(i.hasOwnProperty(a)){var oe=i[a];if(oe!=null)switch(a){case"name":u=oe;break;case"type":R=oe;break;case"checked":K=oe;break;case"defaultChecked":ie=oe;break;case"value":m=oe;break;case"defaultValue":H=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(o(137,t));break;default:ct(e,t,a,oe,i,null)}}Vm(e,m,H,K,ie,R,u,!1);return;case"select":Ye("invalid",e),a=R=m=null;for(u in i)if(i.hasOwnProperty(u)&&(H=i[u],H!=null))switch(u){case"value":m=H;break;case"defaultValue":R=H;break;case"multiple":a=H;default:ct(e,t,u,H,i,null)}t=m,i=R,e.multiple=!!a,t!=null?ur(e,!!a,t,!1):i!=null&&ur(e,!!a,i,!0);return;case"textarea":Ye("invalid",e),m=u=a=null;for(R in i)if(i.hasOwnProperty(R)&&(H=i[R],H!=null))switch(R){case"value":a=H;break;case"defaultValue":u=H;break;case"children":m=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(91));break;default:ct(e,t,R,H,i,null)}Km(e,a,u,m);return;case"option":for(K in i)i.hasOwnProperty(K)&&(a=i[K],a!=null)&&(K==="selected"?e.selected=a&&typeof a!="function"&&typeof a!="symbol":ct(e,t,K,a,i,null));return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(a=0;a<Wa.length;a++)Ye(Wa[a],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in i)if(i.hasOwnProperty(ie)&&(a=i[ie],a!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,ie,a,i,null)}return;default:if(Qc(t)){for(oe in i)i.hasOwnProperty(oe)&&(a=i[oe],a!==void 0&&Xh(e,t,oe,a,i,void 0));return}}for(H in i)i.hasOwnProperty(H)&&(a=i[H],a!=null&&ct(e,t,H,a,i,null))}var ox={};function cx(e,t,i,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,m=null,R=null,H=null,K=null,ie=null,oe=null;for(ae in i){var _e=i[ae];if(i.hasOwnProperty(ae)&&_e!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":K=_e;default:a.hasOwnProperty(ae)||ct(e,t,ae,null,a,_e)}}for(var te in a){var ae=a[te];if(_e=i[te],a.hasOwnProperty(te)&&(ae!=null||_e!=null))switch(te){case"type":ae!==_e&&(it=!0),m=ae;break;case"name":ae!==_e&&(it=!0),u=ae;break;case"checked":ae!==_e&&(it=!0),ie=ae;break;case"defaultChecked":ae!==_e&&(it=!0),oe=ae;break;case"value":ae!==_e&&(it=!0),R=ae;break;case"defaultValue":ae!==_e&&(it=!0),H=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(o(137,t));break;default:ae!==_e&&ct(e,t,te,ae,a,_e)}}Xc(e,R,H,K,ie,oe,m,u);return;case"select":ae=R=H=te=null;for(m in i)if(K=i[m],i.hasOwnProperty(m)&&K!=null)switch(m){case"value":break;case"multiple":ae=K;default:a.hasOwnProperty(m)||ct(e,t,m,null,a,K)}for(u in a)if(m=a[u],K=i[u],a.hasOwnProperty(u)&&(m!=null||K!=null))switch(u){case"value":m!==K&&(it=!0),te=m;break;case"defaultValue":m!==K&&(it=!0),H=m;break;case"multiple":m!==K&&(it=!0),R=m;default:m!==K&&ct(e,t,u,m,a,K)}t=H,i=R,a=ae,te!=null?ur(e,!!i,te,!1):!!a!=!!i&&(t!=null?ur(e,!!i,t,!0):ur(e,!!i,i?[]:"",!1));return;case"textarea":ae=te=null;for(H in i)if(u=i[H],i.hasOwnProperty(H)&&u!=null&&!a.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:ct(e,t,H,null,a,u)}for(R in a)if(u=a[R],m=i[R],a.hasOwnProperty(R)&&(u!=null||m!=null))switch(R){case"value":u!==m&&(it=!0),te=u;break;case"defaultValue":u!==m&&(it=!0),ae=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==m&&ct(e,t,R,u,a,m)}qm(e,te,ae);return;case"option":for(var be in i)te=i[be],i.hasOwnProperty(be)&&te!=null&&!a.hasOwnProperty(be)&&(be==="selected"?e.selected=!1:ct(e,t,be,null,a,te));for(K in a)te=a[K],ae=i[K],a.hasOwnProperty(K)&&te!==ae&&(te!=null||ae!=null)&&(K==="selected"?(te!==ae&&(it=!0),e.selected=te&&typeof te!="function"&&typeof te!="symbol"):ct(e,t,K,te,a,ae));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in i)te=i[Ne],i.hasOwnProperty(Ne)&&te!=null&&!a.hasOwnProperty(Ne)&&ct(e,t,Ne,null,a,te);for(ie in a)if(te=a[ie],ae=i[ie],a.hasOwnProperty(ie)&&te!==ae&&(te!=null||ae!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(o(137,t));break;default:ct(e,t,ie,te,a,ae)}return;default:if(Qc(t)){for(var ze in i)te=i[ze],i.hasOwnProperty(ze)&&te!==void 0&&!a.hasOwnProperty(ze)&&Xh(e,t,ze,void 0,a,te);for(oe in a)te=a[oe],ae=i[oe],!a.hasOwnProperty(oe)||te===ae||te===void 0&&ae===void 0||Xh(e,t,oe,te,a,ae);return}}for(var se in i)te=i[se],i.hasOwnProperty(se)&&te!=null&&!a.hasOwnProperty(se)&&ct(e,t,se,null,a,te);for(_e in a)te=a[_e],ae=i[_e],!a.hasOwnProperty(_e)||te===ae||te==null&&ae==null||ct(e,t,_e,te,a,ae)}function e_(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ux(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),a=0;a<i.length;a++){var u=i[a],m=u.transferSize,R=u.initiatorType,H=u.duration;if(m&&H&&e_(R)){for(R=0,H=u.responseEnd,a+=1;a<i.length;a++){var K=i[a],ie=K.startTime;if(ie>H)break;var oe=K.transferSize,_e=K.initiatorType;oe&&e_(_e)&&(K=K.responseEnd,R+=oe*(K<H?1:(H-ie)/(K-ie)))}if(--a,t+=8*(m+R)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Wh=null,Qh=null;function Ja(e){return e.nodeType===9?e:e.ownerDocument}function t_(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function s_(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function i_(e,t,i,a){return i=Ja(i).createElement(e),i[qt]=a,i[us]=t,Xt(i,e,t),Ut(i),i}function Jh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ed=null;function hx(){var e=window.event;return e&&e.type==="popstate"?e===ed?!1:(ed=e,!0):(ed=null,!1)}var td=typeof setTimeout=="function"?setTimeout:void 0,dx=typeof clearTimeout=="function"?clearTimeout:void 0,n_=typeof Promise=="function"?Promise:void 0,r_=typeof requestAnimationFrame=="function"?requestAnimationFrame:td,fx=typeof queueMicrotask=="function"?queueMicrotask:typeof n_<"u"?function(e){return n_.resolve(null).then(e).catch(mx)}:td;function mx(e){setTimeout(function(){throw e})}function fn(e){return e==="head"}function a_(e,t){var i=t,a=0;do{var u=i.nextSibling;if(e.removeChild(i),u&&u.nodeType===8)if(i=u.data,i==="/$"||i==="/&"){if(a===0){e.removeChild(u),Yr(t);return}a--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")a++;else if(i==="html")cd(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,cd(i);for(var m=i.firstChild;m;){var R=m.nextSibling,H=m.nodeName;m[va]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&m.rel.toLowerCase()==="stylesheet"||i.removeChild(m),m=R}}else i==="body"&&cd(e.ownerDocument.body);i=u}while(i);Yr(t)}function l_(e,t){var i=e;e=0;do{var a=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),a&&a.nodeType===8)if(i=a.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=a}while(i)}function o_(e,t,i){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,i!=null&&(e.style.viewTransitionClass=i),i=getComputedStyle(e),i.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var u=a=0;u<t.length;u++){var m=t[u];0<m.width&&0<m.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+i.paddingTop,e.marginBottom="-"+i.paddingBottom)}}function c_(e,t){e=e.style,t=t.style;var i=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=i==null||typeof i=="boolean"?"":(""+i).trim(),i=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=i==null||typeof i=="boolean"?"":(""+i).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(i=t.display,e.display=i==null||typeof i=="boolean"?"":i,i=t.margin,i!=null?e.margin=i:(i=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=i==null||typeof i=="boolean"?"":i,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function px(e,t,i){return i=i.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=i.innerHeight&&e.left<=i.innerWidth}}function sd(e){var t=e.getBoundingClientRect(),i=getComputedStyle(e);return px(t,i,e)}function gx(e){return e.documentElement.clientHeight}function vx(e){this.addEventListener("load",e),this.addEventListener("error",e)}function _x(e,t,i,a,u,m,R,H,K){var ie=t.nodeType===9?t:t.ownerDocument;try{var oe=ie.startViewTransition({update:function(){var te=ie.defaultView,ae=te.navigation&&te.navigation.transition,be=ie.fonts.status;a();var Ne=[];if(be==="loaded"&&(gx(ie),ie.fonts.status==="loading"&&Ne.push(ie.fonts.ready)),be=Ne.length,e!==null)for(var ze=e.suspenseyImages,se=0,X=0;X<ze.length;X++){var re=ze[X];if(!re.complete){var ve=re.getBoundingClientRect();if(0<ve.bottom&&0<ve.right&&ve.top<te.innerHeight&&ve.left<te.innerWidth){if(se+=R_(re),se>Yo){Ne.length=be;break}re=new Promise(vx.bind(re)),Ne.push(re)}}}if(0<Ne.length)return te=Promise.race([Promise.all(Ne),new Promise(function(Ce){return setTimeout(Ce,500)})]).then(u,u),(ae?Promise.allSettled([ae.finished,te]):te).then(m,m);if(u(),ae)return ae.finished.then(m,m);m()},types:i});ie.__reactViewTransition=oe;var _e=[];return oe.ready.then(function(){for(var te=ie.documentElement.getAnimations({subtree:!0}),ae=0;ae<te.length;ae++){var be=te[ae],Ne=be.effect,ze=Ne.pseudoElement;if(ze!=null&&ze.startsWith("::view-transition")){_e.push(be),be=Ne.getKeyframes();for(var se=ze=void 0,X=!0,re=0;re<be.length;re++){var ve=be[re],Ce=ve.width;if(ze===void 0)ze=Ce;else if(ze!==Ce){X=!1;break}if(Ce=ve.height,se===void 0)se=Ce;else if(se!==Ce){X=!1;break}delete ve.width,delete ve.height,ve.transform==="none"&&delete ve.transform}X&&ze!==void 0&&se!==void 0&&(Ne.setKeyframes(be),X=getComputedStyle(Ne.target,Ne.pseudoElement),X.width!==ze||X.height!==se)&&(X=be[0],X.width=ze,X.height=se,X=be[be.length-1],X.width=ze,X.height=se,Ne.setKeyframes(be))}}R()},function(te){ie.__reactViewTransition===oe&&(ie.__reactViewTransition=null);try{typeof te=="object"&&te!==null&&te.name==="InvalidStateError"&&(te.message==="View transition was skipped because document visibility state is hidden."||te.message==="Skipping view transition because document visibility state has become hidden."||te.message==="Skipping view transition because viewport size changed."||te.message==="Transition was aborted because of invalid state")&&(te=null),te!==null&&K(te)}finally{a(),u(),R()}}),oe.finished.finally(function(){for(var te=0;te<_e.length;te++)_e[te].cancel();ie.__reactViewTransition===oe&&(ie.__reactViewTransition=null),H()}),oe}catch{return a(),u(),R(),null}}function Zn(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}Zn.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:O({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Zn.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,i=e.getAnimations({subtree:!0}),a=[],u=0;u<i.length;u++){var m=i[u].effect;m!==null&&m.target===e&&m.pseudoElement===t&&a.push(i[u])}return a},Zn.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function u_(e){return{name:e,group:new Zn("group",e),imagePair:new Zn("image-pair",e),old:new Zn("old",e),new:new Zn("new",e)}}function Ds(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ds.prototype.addEventListener=function(e,t,i){var a=null,u=null;if(!(i!=null&&typeof i!="boolean"&&(a=i.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var m=this._eventListeners;if(d_(m,e,t,i)===-1){var R=this,H=t;i!=null&&typeof i!="boolean"&&i.once===!0&&(H=function(K){R.removeEventListener(e,t,i),typeof t=="function"?t.call(this,K):t.handleEvent(K)}),a!==null&&(u=R.removeEventListener.bind(R,e,t,i),a.addEventListener("abort",u,{once:!0}),u=a.removeEventListener.bind(a,"abort",u)),a=Pr(i),m.push({type:e,listener:t,optionsOrUseCapture:i,attachedListener:H,cleanup:u}),f(this._fragmentFiber.child,!1,yx,e,H,a)}this._eventListeners=m}};function yx(e,t,i,a){return g(e).addEventListener(t,i,a),!1}Ds.prototype.removeEventListener=function(e,t,i){var a=this._eventListeners;if(a!==null&&(t=d_(a,e,t,i),t!==-1)){var u=a[t];i=u.attachedListener;var m=u.cleanup;u=Pr(u.optionsOrUseCapture),f(this._fragmentFiber.child,!1,bx,e,i,u),a.splice(t,1),m!==null&&m()}};function bx(e,t,i,a){return g(e).removeEventListener(t,i,a),!1}function Pr(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function h_(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function d_(e,t,i,a){if(e.length===0)return-1;a=h_(a);for(var u=0;u<e.length;u++){var m=e[u];if(m.type===t&&m.listener===i&&h_(m.optionsOrUseCapture)===a)return u}return-1}Ds.prototype.dispatchEvent=function(e){var t=x(this._fragmentFiber);if(t===null)return!0;t=g(t);var i=this._eventListeners;if(i!==null&&0<i.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(i)for(var u=0;u<i.length;u++){var m=i[u];a.addEventListener(m.type,m.attachedListener,Pr(m.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),i)for(u=0;u<i.length;u++)m=i[u],a.removeEventListener(m.type,m.attachedListener,Pr(m.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},Ds.prototype.focus=function(e){f(this._fragmentFiber.child,!0,f_,e,void 0,void 0)};function f_(e,t){return e.tag===6?!1:(e=g(e),Ax(e,t))}Ds.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,id,t,void 0,void 0);for(var i=t.length-1;0<=i&&!f_(t[i],e);i--);};function id(e,t){return t.push(e),!1}Ds.prototype.blur=function(){var e=x(this._fragmentFiber);e!==null&&(e=g(e),e=Ja(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Sx,e,void 0,void 0))};function Sx(e,t){return e.tag===6?!1:(e=g(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ds.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,xx,e,void 0,void 0)};function xx(e,t){return e.tag===6||(e=g(e),t.observe(e)),!1}Ds.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,wx,e,void 0,void 0);for(var i=t=0;i<Qs.length;i++){var a=Qs[i];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):Qs[t++]=a}Qs.length=t}};function wx(e,t){return e.tag===6||(e=g(e),t.unobserve(e)),!1}var Qs=[],nd=!1;function Cx(e,t,i){Qs.push({fragmentInstance:e,observer:t,instance:i}),nd||(nd=!0,Ox(function(){nd=!1;var a=Qs;Qs=[];for(var u=0;u<a.length;u++){var m=a[u];m.observer.unobserve(m.instance)}}))}Ds.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Ex,e,void 0,void 0),e};function Ex(e,t){if(e.tag===6){e=e.stateNode;var i=e.ownerDocument.createRange();i.selectNodeContents(e),t.push.apply(t,i.getClientRects())}else e=g(e),t.push.apply(t,e.getClientRects());return!1}Ds.prototype.getRootNode=function(e){var t=x(this._fragmentFiber);return t===null?this:g(t).getRootNode(e)},Ds.prototype.compareDocumentPosition=function(e){var t=x(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var i=[];f(this._fragmentFiber.child,!1,id,i,void 0,void 0);var a=g(t);if(i.length===0){if(i=a,C(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(i=t)}t=this._fragmentFiber;var u=a=i.compareDocumentPosition(e);return i===e?u=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(i=j(t)[1],i===null?u=Node.DOCUMENT_POSITION_PRECEDING:(e=g(i).compareDocumentPosition(e),u=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),u|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=g(i[0]),u=g(i[i.length-1]);var m=C(this._fragmentFiber)?t.parentElement:a;if(m==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=m.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,m=m.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_CONTAINED_BY;var R=t.compareDocumentPosition(e),H=u.compareDocumentPosition(e),K=R&Node.DOCUMENT_POSITION_CONTAINED_BY||H&Node.DOCUMENT_POSITION_CONTAINED_BY;return H=a&&m&&R&Node.DOCUMENT_POSITION_FOLLOWING&&H&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||m&&u===e||K||H?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!m&&u===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:R,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Nx(t,this._fragmentFiber,i[0],i[i.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Nx(e,t,i,a,u){var m=Tn(u);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(i=!!m)e:{for(;m!==null;){if(m.tag===7&&(m===t||m.alternate===t)){i=!0;break e}m=m.return}i=!1}return i}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(m===null)return m=u.ownerDocument,u===m||u===m.documentElement||u===m.body;e:{for(m=t,t=x(t);m!==null;){if(!(m.tag!==5&&m.tag!==3&&m.tag!==27||m!==t&&m.alternate!==t)){m=!0;break e}m=m.return}m=!1}return m}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!m)&&!(t=m===i)&&(t=D(i,m,T),t===null?t=!1:(f(t,!0,S,m,i),m=b,b=null,t=m!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!m)&&!(t=m===a)&&(t=D(a,m,T),t===null?t=!1:(f(t,!0,N,m,a),m=b,v=b=null,t=m!==null)),t):!1}function m_(e,t){var i=e.ownerDocument.createRange();i.selectNodeContents(e),e=i.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ds.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(o(566));var t=[];f(this._fragmentFiber.child,!1,id,t,void 0,void 0);var i=e!==!1;if(t.length===0){var a=j(this._fragmentFiber);if(a=i?a[1]||a[0]||x(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=g(a),m_(e,i);return}if(a=g(a),a.nodeType!==9){if(a.nodeType===11){i="host"in a?a.host:null,i!==null&&i.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=i?t.length-1:0;a!==(i?-1:t.length);){var u=t[a];u.tag===6?(u=g(u),m_(u,i)):g(u).scrollIntoView(e),a+=i?-1:1}};function jx(e,t){return e=g(e),p_(e,t),!1}function p_(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function g_(e,t){var i=t._eventListeners;if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];e.addEventListener(u.type,u.attachedListener,Pr(u.optionsOrUseCapture))}e.nodeType!==3&&(i=t._observers,i!==null&&i.forEach(function(m){for(var R=0,H=0;H<Qs.length;H++){var K=Qs[H];(K.fragmentInstance!==t||K.observer!==m||K.instance!==e)&&(Qs[R++]=K)}Qs.length=R,m.observe(e)}),p_(e,t))}function Tx(e,t){var i=t._eventListeners;if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];e.removeEventListener(u.type,u.attachedListener,Pr(u.optionsOrUseCapture))}e.nodeType!==3&&(i=t._observers,i!==null&&i.forEach(function(m){typeof m.rootMargin=="string"?Cx(t,m,e):m.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function rd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":rd(i),Ml(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function kx(e,t,i,a){for(;e.nodeType===1;){var u=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[va])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var m=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=$s(e.nextSibling),e===null)break}return null}function Rx(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=$s(e.nextSibling),e===null))return null;return e}function v_(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=$s(e.nextSibling),e===null))return null;return e}function ad(e){return e.data==="$?"||e.data==="$~"}function ld(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Dx(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var a=function(){t(),i.removeEventListener("DOMContentLoaded",a)};i.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function $s(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var od=null;function __(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return $s(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function y_(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Ax(e,t){function i(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",i,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",i,!0)}return a}function Ox(e){r_(function(){r_(function(t){return e(t)})})}function b_(e,t,i){switch(t=Ja(i),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function S_(e,t,i){for(var a in i){var u=i[a];i.hasOwnProperty(a)&&u!=null&&ct(e,t,a,null,ox,u)}i.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===li&&(e.onclick=null),Ml(e)}function cd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ml(e)}var Ps=new Map,x_=new Set;function el(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Mi=ge.d;ge.d={f:Lx,r:Mx,D:Bx,C:Ix,L:Hx,m:Ux,X:$x,S:zx,M:Px};function Lx(){var e=Mi.f(),t=Uo();return e||t}function Mx(e){var t=lr(e);t!==null&&t.tag===5&&t.type==="form"?Cg(t):Mi.r(e)}var Fr=typeof document>"u"?null:document;function w_(e,t,i){var a=Fr;if(a&&typeof t=="string"&&t){var u=Ls(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof i=="string"&&(u+='[crossorigin="'+i+'"]'),x_.has(u)||(x_.add(u),e={rel:e,crossOrigin:i,href:t},a.querySelector(u)===null&&(t=a.createElement("link"),Xt(t,"link",e),Ut(t),a.head.appendChild(t)))}}function Bx(e){Mi.D(e),w_("dns-prefetch",e,null)}function Ix(e,t){Mi.C(e,t),w_("preconnect",e,t)}function Hx(e,t,i){Mi.L(e,t,i);var a=Fr;if(a&&e&&t){var u='link[rel="preload"][as="'+Ls(t)+'"]';t==="image"&&i&&i.imageSrcSet?(u+='[imagesrcset="'+Ls(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(u+='[imagesizes="'+Ls(i.imageSizes)+'"]')):u+='[href="'+Ls(e)+'"]';var m=u;switch(t){case"style":m=Vr(e);break;case"script":m=qr(e)}if(!(Ps.has(m)||(e=O({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),Ps.set(m,e),a.querySelector(u)!==null||t==="style"&&a.querySelector(tl(m))||t==="script"&&a.querySelector(sl(m))))){var R=a.createElement("link");Xt(R,"link",e),t==="style"&&(R[Ll]=!0,R.onload=R.onerror=function(){Bm(R)}),Ut(R),a.head.appendChild(R)}}}function Ux(e,t){Mi.m(e,t);var i=Fr;if(i&&e){var a=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Ls(a)+'"][href="'+Ls(e)+'"]',m=u;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=qr(e)}if(!Ps.has(m)&&(e=O({rel:"modulepreload",href:e},t),Ps.set(m,e),i.querySelector(u)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(sl(m)))return}a=i.createElement("link"),Xt(a,"link",e),Ut(a),i.head.appendChild(a)}}}function zx(e,t,i){Mi.S(e,t,i);var a=Fr;if(a&&e){var u=or(a).hoistableStyles,m=Vr(e);t=t||"default";var R=u.get(m);if(!R){var H={loading:0,preload:null};if(R=a.querySelector(tl(m)))H.loading=5;else{e=O({rel:"stylesheet",href:e,"data-precedence":t},i),(i=Ps.get(m))&&ud(e,i);var K=R=a.createElement("link");Ut(K),Xt(K,"link",e),K._p=new Promise(function(ie,oe){K.onload=ie,K.onerror=oe}),K.addEventListener("load",function(){H.loading|=1}),K.addEventListener("error",function(){H.loading|=2}),H.loading|=4,Ko(R,t,a)}R={type:"stylesheet",instance:R,count:1,state:H},u.set(m,R)}}}function $x(e,t){Mi.X(e,t);var i=Fr;if(i&&e){var a=or(i).hoistableScripts,u=qr(e),m=a.get(u);m||(m=i.querySelector(sl(u)),m||(e=O({src:e,async:!0},t),(t=Ps.get(u))&&hd(e,t),m=i.createElement("script"),Ut(m),Xt(m,"link",e),i.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},a.set(u,m))}}function Px(e,t){Mi.M(e,t);var i=Fr;if(i&&e){var a=or(i).hoistableScripts,u=qr(e),m=a.get(u);m||(m=i.querySelector(sl(u)),m||(e=O({src:e,async:!0,type:"module"},t),(t=Ps.get(u))&&hd(e,t),m=i.createElement("script"),Ut(m),Xt(m,"link",e),i.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},a.set(u,m))}}function C_(e,t,i,a){var u=(u=is.current)?el(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=Vr(i.href),t=or(u).hoistableStyles,a=t.get(i),a||(a={type:"style",instance:null,count:0,state:null},t.set(i,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Vr(i.href);var m=or(u).hoistableStyles,R=m.get(e);if(R||(u=u.ownerDocument||u,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,R),(m=u.querySelector(tl(e)))?m._p||(R.instance=m,R.state.loading=5):(m=Ps.get(e),m||(m={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Ps.set(e,m)),Fx(u,e,m,R.state))),t&&a===null)throw Error(o(528,""));return R}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(i=qr(i),t=or(u).hoistableScripts,a=t.get(i),a||(a={type:"script",instance:null,count:0,state:null},t.set(i,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Vr(e){return'href="'+Ls(e)+'"'}function tl(e){return'link[rel="stylesheet"]['+e+"]"}function E_(e){return O({},e,{"data-precedence":e.precedence,precedence:null})}function Fx(e,t,i,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Ll]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Ll]=!0,t.onload=t.onerror=Bm.bind(null,t),Xt(t,"link",i),Ut(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function qr(e){return'[src="'+Ls(e)+'"]'}function sl(e){return"script[async]"+e}function N_(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ls(i.href)+'"]');if(a)return t.instance=a,Ut(a),a;var u=O({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ut(a),Xt(a,"style",u),Ko(a,i.precedence,e),t.instance=a;case"stylesheet":u=Vr(i.href);var m=e.querySelector(tl(u));if(m)return t.state.loading|=4,t.instance=m,Ut(m),m;a=E_(i),(u=Ps.get(u))&&ud(a,u),m=(e.ownerDocument||e).createElement("link"),Ut(m);var R=m;return R._p=new Promise(function(H,K){R.onload=H,R.onerror=K}),Xt(m,"link",a),t.state.loading|=4,Ko(m,i.precedence,e),t.instance=m;case"script":return m=qr(i.src),(u=e.querySelector(sl(m)))?(t.instance=u,Ut(u),u):(a=i,(u=Ps.get(m))&&(a=O({},i),hd(a,u)),e=e.ownerDocument||e,u=e.createElement("script"),Ut(u),Xt(u,"link",a),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ko(a,i.precedence,e));return t.instance}function Ko(e,t,i){for(var a=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=a.length?a[a.length-1]:null,m=u,R=0;R<a.length;R++){var H=a[R];if(H.dataset.precedence===t)m=H;else if(m!==u)break}m?m.parentNode.insertBefore(e,m.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function ud(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function hd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Go=null;function j_(e,t,i){if(Go===null){var a=new Map,u=Go=new Map;u.set(i,a)}else u=Go,a=u.get(i),a||(a=new Map,u.set(i,a));if(a.has(e))return a;for(a.set(e,null),i=i.getElementsByTagName(e),u=0;u<i.length;u++){var m=i[u];if(!(m[va]||m[qt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var R=m.getAttribute(t)||"";R=e+R;var H=a.get(R);H?H.push(m):a.set(R,[m])}}return a}function dd(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function Vx(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function T_(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function k_(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function R_(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function D_(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=R_(t),e.suspenseyImages.push(t)),e=Gx.bind(e),t.decode().then(e,e))}function qx(e,t,i,a){if(i.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var u=Vr(a.href),m=t.querySelector(tl(u));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=il.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=m,Ut(m);return}m=t.ownerDocument||t,a=E_(a),(u=Ps.get(u))&&ud(a,u),m=m.createElement("link"),Ut(m);var R=m;R._p=new Promise(function(H,K){R.onload=H,R.onerror=K}),Xt(m,"link",a),i.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=il.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var Yo=0;function Kx(e,t){return e.stylesheets&&e.count===0&&Xo(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var a=setTimeout(function(){if(e.stylesheets&&Xo(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+t);0<e.imgBytes&&Yo===0&&(Yo=62500*ux());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xo(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>Yo?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(u)}}:null}function A_(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Xo(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function il(){this.count--,A_(this)}function Gx(){this.imgCount--,A_(this)}var Zo=null;function Xo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zo=new Map,t.forEach(Yx,e),Zo=null,il.call(e))}function Yx(e,t){if(!(t.state.loading&4)){var i=Zo.get(e);if(i)var a=i.get(null);else{i=new Map,Zo.set(e,i);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<u.length;m++){var R=u[m];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(i.set(R.dataset.precedence,R),a=R)}a&&i.set(null,a)}u=t.instance,R=u.getAttribute("data-precedence"),m=i.get(R)||a,m===a&&i.set(null,u),i.set(R,u),this.count++,a=il.bind(this),u.addEventListener("load",a),u.addEventListener("error",a),m?m.parentNode.insertBefore(u,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Kr={$$typeof:he,Provider:null,Consumer:null,_currentValue:Re,_currentValue2:Re,_threadCount:0};function Zx(e,t,i,a,u,m,R,H,K){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Kc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kc(0),this.hiddenUpdates=Kc(null),this.identifierPrefix=a,this.onUncaughtError=u,this.onCaughtError=m,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.transitionTypes=null,this.incompleteTransitions=new Map}function O_(e,t,i,a,u,m,R,H,K,ie,oe,_e){return e=new Zx(e,t,i,R,K,ie,oe,_e,H),t=1,m===!0&&(t|=24),m=hs(3,null,null,t),e.current=m,m.stateNode=e,t=ju(),t.refCount++,e.pooledCache=t,t.refCount++,m.memoizedState={element:a,isDehydrated:i,cache:t},Du(m),e}function L_(e){return e?(e=_r,e):_r}function M_(e,t,i,a,u,m){u=L_(u),a.context===null?a.context=u:a.pendingContext=u,a=en(t),a.payload={element:i},m=m===void 0?null:m,m!==null&&(a.callback=m),i=tn(e,a,t),i!==null&&(ps(i,e,t),La(i,e,t))}function B_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function fd(e,t){B_(e,t),(e=e.alternate)&&B_(e,t)}function I_(e){if(e.tag===13||e.tag===31){var t=An(e,67108864);t!==null&&ps(t,e,67108864),fd(e,67108864)}}function H_(e){if(e.tag===13||e.tag===31){var t=Rs();t=Gc(t);var i=An(e,t);i!==null&&ps(i,e,t),fd(e,t)}}var Gr=!0;function Xx(e,t,i,a){var u=me.T;me.T=null;var m=ge.p;try{ge.p=2,md(e,t,i,a)}finally{ge.p=m,me.T=u}}function Wx(e,t,i,a){var u=me.T;me.T=null;var m=ge.p;try{ge.p=8,md(e,t,i,a)}finally{ge.p=m,me.T=u}}function md(e,t,i,a){if(Gr){var u=pd(a);if(u===null)Zh(e,t,a,Wo,i),z_(e,a);else if(Jx(u,e,t,i,a))a.stopPropagation();else if(z_(e,a),t&4&&-1<Qx.indexOf(e)){for(;u!==null;){var m=lr(u);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var R=jn(m.pendingLanes);if(R!==0){var H=m;for(H.pendingLanes|=2,H.entangledLanes|=2;R;){var K=1<<31-ws(R);H.entanglements[1]|=K,R&=~K}vi(m),(nt&6)===0&&(Bo=ns()+500,Xa(0))}}break;case 31:case 13:H=An(m,2),H!==null&&ps(H,m,2),Uo(),fd(m,2)}if(m=pd(a),m===null&&Zh(e,t,a,Wo,i),m===u)break;u=m}u!==null&&a.stopPropagation()}else Zh(e,t,a,null,i)}}function pd(e){return e=eu(e),gd(e)}var Wo=null;function gd(e){if(Wo=null,e=Tn(e),e!==null){var t=_(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=w(t),e!==null)return e;e=null}else if(i===31){if(e=c(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Wo=e,null}function U_(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ai()){case Vi:return 2;case fa:return 8;case kl:case hS:return 32;case Nm:return 268435456;default:return 32}default:return 32}}var vd=!1,mn=null,pn=null,gn=null,nl=new Map,rl=new Map,vn=[],Qx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function z_(e,t){switch(e){case"focusin":case"focusout":mn=null;break;case"dragenter":case"dragleave":pn=null;break;case"mouseover":case"mouseout":gn=null;break;case"pointerover":case"pointerout":nl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":rl.delete(t.pointerId)}}function al(e,t,i,a,u,m){return e===null||e.nativeEvent!==m?(e={blockedOn:t,domEventName:i,eventSystemFlags:a,nativeEvent:m,targetContainers:[u]},t!==null&&(t=lr(t),t!==null&&I_(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Jx(e,t,i,a,u){switch(t){case"focusin":return mn=al(mn,e,t,i,a,u),!0;case"dragenter":return pn=al(pn,e,t,i,a,u),!0;case"mouseover":return gn=al(gn,e,t,i,a,u),!0;case"pointerover":var m=u.pointerId;return nl.set(m,al(nl.get(m)||null,e,t,i,a,u)),!0;case"gotpointercapture":return m=u.pointerId,rl.set(m,al(rl.get(m)||null,e,t,i,a,u)),!0}return!1}function $_(e){var t=Tn(e.target);if(t!==null){var i=_(t);if(i!==null){if(t=i.tag,t===13){if(t=w(i),t!==null){e.blockedOn=t,Om(e.priority,function(){H_(i)});return}}else if(t===31){if(t=c(i),t!==null){e.blockedOn=t,Om(e.priority,function(){H_(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=pd(e.nativeEvent);if(i===null){i=e.nativeEvent;var a=new i.constructor(i.type,i);Jc=a,i.target.dispatchEvent(a),Jc=null}else return t=lr(i),t!==null&&I_(t),e.blockedOn=i,!1;t.shift()}return!0}function P_(e,t,i){Qo(e)&&i.delete(t)}function ew(){vd=!1,mn!==null&&Qo(mn)&&(mn=null),pn!==null&&Qo(pn)&&(pn=null),gn!==null&&Qo(gn)&&(gn=null),nl.forEach(P_),rl.forEach(P_)}function Jo(e,t){e.blockedOn===t&&(e.blockedOn=null,vd||(vd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,ew)))}var ec=null;function F_(e){ec!==e&&(ec=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var t=0;t<e.length;t+=3){var i=e[t],a=e[t+1],u=e[t+2];if(typeof a!="function"){if(gd(a||i)===null)continue;break}var m=lr(i);m!==null&&(e.splice(t,3),t-=3,Qu(m,{pending:!0,data:u,method:i.method,action:a},a,u))}}))}function Yr(e){function t(K){return Jo(K,e)}mn!==null&&Jo(mn,e),pn!==null&&Jo(pn,e),gn!==null&&Jo(gn,e),nl.forEach(t),rl.forEach(t);for(var i=0;i<vn.length;i++){var a=vn[i];a.blockedOn===e&&(a.blockedOn=null)}for(;0<vn.length&&(i=vn[0],i.blockedOn===null);)$_(i),i.blockedOn===null&&vn.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(a=0;a<i.length;a+=3){var u=i[a],m=i[a+1],R=u[us]||null;if(typeof m=="function")R||F_(i);else if(R){var H=null;if(m&&m.hasAttribute("formAction")){if(u=m,R=m[us]||null)H=R.formAction;else if(gd(u)!==null)continue}else H=R.action;typeof H=="function"?i[a+1]=H:(i.splice(a,3),a-=3),F_(i)}}}function V_(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(R){return u=R})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),a||setTimeout(i,20)}function i(){if(!a&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function _d(e){this._internalRoot=e}tc.prototype.render=_d.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var i=t.current,a=Rs();M_(i,a,e,t,null,null)},tc.prototype.unmount=_d.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;M_(e.current,2,null,e,null,null),Uo(),t[ar]=null}};function tc(e){this._internalRoot=e}tc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Am();e={blockedOn:null,target:e,priority:t};for(var i=0;i<vn.length&&t!==0&&t<vn[i].priority;i++);vn.splice(i,0,e),i===0&&$_(e)}};var q_=n.version;if(q_!=="19.3.0")throw Error(o(527,q_,"19.3.0"));ge.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=y(t),e=e!==null?p(e):null,e=e===null?null:e.stateNode,e};var tw={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:me,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sc.isDisabled&&sc.supportsFiber)try{ma=sc.inject(tw),xs=sc}catch{}}return ol.createRoot=function(e,t){if(!d(e))throw Error(o(299));var i=!1,a="",u=Lg,m=Mg,R=Bg;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(m=t.onCaughtError),t.onRecoverableError!==void 0&&(R=t.onRecoverableError)),t=O_(e,1,!1,null,null,i,a,null,u,m,R,V_),e[ar]=t.current,Yh(e),new _d(t)},ol.hydrateRoot=function(e,t,i){if(!d(e))throw Error(o(299));var a=!1,u="",m=Lg,R=Mg,H=Bg,K=null;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(R=i.onCaughtError),i.onRecoverableError!==void 0&&(H=i.onRecoverableError),i.formState!==void 0&&(K=i.formState)),t=O_(e,1,!0,t,i??null,a,u,K,m,R,H,V_),t.context=L_(null),i=t.current,a=Rs(),a=Gc(a),u=en(a),u.callback=null,tn(i,u,a),i=a,t.current.lanes=i,ga(t,i),vi(t),e[ar]=t.current,Yh(e),new tc(t)},ol.version="19.3.0",ol}var ty;function uw(){if(ty)return Sd.exports;ty=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),Sd.exports=cw(),Sd.exports}var hw=uw();var Gf=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,$b=/^[\\/]{2}/;function dw(s,n){return n+s.replace(/\\/g,"/")}var sy="popstate";function iy(s){return typeof s=="object"&&s!=null&&"pathname"in s&&"search"in s&&"hash"in s&&"state"in s&&"key"in s}function fw(s={}){function n(d,_){let{pathname:w="/",search:c="",hash:h=""}=sr(d.location.hash.substring(1));return!w.startsWith("/")&&!w.startsWith(".")&&(w="/"+w),mf("",{pathname:w,search:c,hash:h},_.state&&_.state.usr||null,_.state&&_.state.key||"default")}function l(d,_){let w=d.document.querySelector("base"),c="";if(w&&w.getAttribute("href")){let h=d.location.href,y=h.indexOf("#");c=y===-1?h:h.slice(0,y)}return c+"#"+(typeof _=="string"?_:Wn(_))}function o(d,_){qs(d.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(_)})`)}return pw(n,l,o,s)}function bt(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function qs(s,n){if(!s){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function mw(){return Math.random().toString(36).substring(2,10)}function ny(s,n){return{usr:s.state,key:s.key,idx:n,masked:s.mask?{pathname:s.pathname,search:s.search,hash:s.hash}:void 0}}function mf(s,n,l=null,o,d){return{pathname:typeof s=="string"?s:s.pathname,search:"",hash:"",...typeof n=="string"?sr(n):n,state:l,key:n&&n.key||o||mw(),mask:d}}function Wn({pathname:s="/",search:n="",hash:l=""}){return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),l&&l!=="#"&&(s+=l.charAt(0)==="#"?l:"#"+l),s}function sr(s){let n={};if(s){let l=s.indexOf("#");l>=0&&(n.hash=s.substring(l),s=s.substring(0,l));let o=s.indexOf("?");o>=0&&(n.search=s.substring(o),s=s.substring(0,o)),s&&(n.pathname=s)}return n}function pw(s,n,l,o={}){let{window:d=document.defaultView,v5Compat:_=!1}=o,w=d.history,c="POP",h=null,y=p();y==null&&(y=0,w.replaceState({...w.state,idx:y},""));function p(){return(w.state||{idx:null}).idx}function f(){c="POP";let g=p(),b=g==null?null:g-y;y=g,h&&h({action:c,location:E.location,delta:b})}function x(g,b){c="PUSH";let v=iy(g)?g:mf(E.location,g,b);l&&l(v,g),y=p()+1;let S=ny(v,y),N=E.createHref(v.mask||v);try{w.pushState(S,"",N)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;d.location.assign(N)}_&&h&&h({action:c,location:E.location,delta:1})}function C(g,b){c="REPLACE";let v=iy(g)?g:mf(E.location,g,b);l&&l(v,g),y=p();let S=ny(v,y),N=E.createHref(v.mask||v);w.replaceState(S,"",N),_&&h&&h({action:c,location:E.location,delta:0})}function j(g){return gw(d,g)}let E={get action(){return c},get location(){return s(d,w)},listen(g){if(h)throw new Error("A history only accepts one active listener");return d.addEventListener(sy,f),h=g,()=>{d.removeEventListener(sy,f),h=null}},createHref(g){return n(d,g)},createURL:j,encodeLocation(g){let b=j(g);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:x,replace:C,go(g){return w.go(g)}};return E}function gw(s,n,l=!1){let o="http://localhost";s&&(o=s.location.origin!=="null"?s.location.origin:s.location.href),bt(o,"No window.location.(origin|href) available to create URL");let d=typeof n=="string"?n:Wn(n);return d=d.replace(/ $/,"%20"),!l&&$b.test(d)&&(d=o+d),new URL(d,o)}function Pb(s,n,l="/"){return vw(s,n,l,!1)}function vw(s,n,l,o,d){let _=typeof n=="string"?sr(n):n,w=Ui(_.pathname||"/",l);if(w==null)return null;let c=_w(s),h=null,y=kw(w);for(let p=0;h==null&&p<c.length;++p)h=Tw(c[p],y,o);return h}function _w(s){let n=Fb(s);return yw(n),n}function Fb(s,n=[],l=[],o="",d=!1){let _=(w,c,h=d,y)=>{let p={relativePath:y===void 0?w.path||"":y,caseSensitive:w.caseSensitive===!0,childrenIndex:c,route:w};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(o)&&h)return;bt(p.relativePath.startsWith(o),`Absolute route path "${p.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(o.length)}let f=ti([o,p.relativePath]),x=l.concat(p);w.children&&w.children.length>0&&(bt(w.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),Fb(w.children,n,x,f,h)),!(w.path==null&&!w.index)&&n.push({path:f,score:Nw(f,w.index),routesMeta:x.map((C,j)=>{let[E,g]=Kb(C.relativePath,C.caseSensitive,j===x.length-1);return{...C,matcher:E,compiledParams:g}})})};return s.forEach((w,c)=>{if(w.path===""||!w.path?.includes("?"))_(w,c);else for(let h of Vb(w.path))_(w,c,!0,h)}),n}function Vb(s){let n=s.split("/");if(n.length===0)return[];let[l,...o]=n,d=l.endsWith("?"),_=l.replace(/\?$/,"");if(o.length===0)return d?[_,""]:[_];let w=Vb(o.join("/")),c=[];return c.push(...w.map(h=>h===""?_:[_,h].join("/"))),d&&c.push(...w),c.map(h=>s.startsWith("/")&&h===""?"/":h)}function yw(s){s.sort((n,l)=>n.score!==l.score?l.score-n.score:jw(n.routesMeta.map(o=>o.childrenIndex),l.routesMeta.map(o=>o.childrenIndex)))}var bw=/^:[\w-]+$/,Sw=3,xw=2,ww=1,Cw=10,Ew=-2,ry=s=>s==="*";function Nw(s,n){let l=s.split("/"),o=l.length;return l.some(ry)&&(o+=Ew),n&&(o+=xw),l.filter(d=>!ry(d)).reduce((d,_)=>d+(bw.test(_)?Sw:_===""?ww:Cw),o)}function jw(s,n){return s.length===n.length&&s.slice(0,-1).every((o,d)=>o===n[d])?s[s.length-1]-n[n.length-1]:0}function Tw(s,n,l=!1){let{routesMeta:o}=s,d={},_="/",w=[];for(let c=0;c<o.length;++c){let h=o[c],y=c===o.length-1,p=_==="/"?n:n.slice(_.length)||"/",f={path:h.relativePath,caseSensitive:h.caseSensitive,end:y},x=h.matcher&&h.compiledParams?qb(f,p,h.matcher,h.compiledParams):gc(f,p),C=h.route;if(!x&&y&&l&&!o[o.length-1].route.index&&(x=gc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!x)return null;Object.assign(d,x.params),w.push({params:d,pathname:ti([_,x.pathname]),pathnameBase:Aw(ti([_,x.pathnameBase])),route:C}),x.pathnameBase!=="/"&&(_=ti([_,x.pathnameBase]))}return w}function gc(s,n){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[l,o]=Kb(s.path,s.caseSensitive,s.end);return qb(s,n,l,o)}function qb(s,n,l,o){let d=n.match(l);if(!d)return null;let _=d[0],w=ta(_,1),c=d.slice(1);return{params:o.reduce((y,{paramName:p,isOptional:f},x)=>{if(p==="*"){let j=c[x]||"";w=ta(_.slice(0,_.length-j.length),1)}const C=c[x];return f&&!C?y[p]=void 0:y[p]=(C||"").replace(/%2F/g,"/"),y},{}),pathname:_,pathnameBase:w,pattern:s}}function Kb(s,n=!1,l=!0){qs(s==="*"||!s.endsWith("*")||s.endsWith("/*"),`Route path "${s}" will be treated as if it were "${s.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${s.replace(/\*$/,"/*")}".`);let o=[],d="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(w,c,h,y,p)=>{if(o.push({paramName:c,isOptional:h!=null}),h){let f=p.charAt(y+w.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return s.endsWith("*")?(o.push({paramName:"*"}),d+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?d+="\\/*$":s!==""&&s!=="/"&&(d+="(?:(?=\\/|$))"),[new RegExp(d,n?void 0:"i"),o]}function kw(s){try{return s.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return qs(!1,`The URL path "${s}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),s}}function Ui(s,n){if(n==="/")return s;if(!s.toLowerCase().startsWith(n.toLowerCase()))return null;let l=n.endsWith("/")?n.length-1:n.length,o=s.charAt(l);return o&&o!=="/"?null:s.slice(l)||"/"}function Rw(s,n="/"){let{pathname:l,search:o="",hash:d=""}=typeof s=="string"?sr(s):s,_;return l?(l=Gb(l),l.startsWith("/")||l.startsWith("\\")?_=ay(l.substring(1),"/"):_=ay(l,n)):_=n,{pathname:_,search:Ow(o),hash:Lw(d)}}function ay(s,n){let l=ta(n).split("/");return s.split("/").forEach(d=>{d===".."?l.length>1&&l.pop():d!=="."&&l.push(d)}),l.length>1?l.join("/"):"/"}function Ed(s,n,l,o){return`Cannot include a '${s}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${l}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Dw(s){return s.filter((n,l)=>l===0||n.route.path&&n.route.path.length>0)}function Yf(s){let n=Dw(s);return n.map((l,o)=>o===n.length-1?l.pathname:l.pathnameBase)}function Oc(s,n,l,o=!1){let d;typeof s=="string"?d=sr(s):(d={...s},bt(!d.pathname||!d.pathname.includes("?"),Ed("?","pathname","search",d)),bt(!d.pathname||!d.pathname.includes("#"),Ed("#","pathname","hash",d)),bt(!d.search||!d.search.includes("#"),Ed("#","search","hash",d)));let _=s===""||d.pathname==="",w=_?"/":d.pathname,c;if(w==null)c=l;else{let f=n.length-1;if(!o&&w.startsWith("..")){let x=w.split("/");for(;x[0]==="..";)x.shift(),f-=1;d.pathname=x.join("/")}c=f>=0?n[f]:"/"}let h=Rw(d,c),y=w&&w!=="/"&&w.endsWith("/"),p=(_||w===".")&&l.endsWith("/");return!h.pathname.endsWith("/")&&(y||p)&&(h.pathname+="/"),h}var Gb=s=>s.replace(/[\\/]{2,}/g,"/"),ti=s=>Gb(s.join("/"));function ta(s,n=0){let l=s.length;for(;l>n&&s.charCodeAt(l-1)===47;)l--;return l===s.length?s:s.slice(0,l)}var Aw=s=>ta(s).replace(/^\/*/,"/"),Ow=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,Lw=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s,Mw=class{constructor(s,n,l,o=!1){this.status=s,this.statusText=n||"",this.internal=o,l instanceof Error?(this.data=l.toString(),this.error=l):this.data=l}};function Bw(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}function Iw(s){let n=s.map(l=>l.route.path).filter(Boolean);return ti(n)||"/"}var Yb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zb(s,n){let l=s;if(typeof l!="string"||!Gf.test(l))return{absoluteURL:void 0,isExternal:!1,to:l};let o=l,d=!1;if(Yb)try{let _=new URL(window.location.href),w=$b.test(l)?new URL(dw(l,_.protocol)):new URL(l),c=Ui(w.pathname,n);w.origin===_.origin&&c!=null?l=c+w.search+w.hash:d=!0}catch{qs(!1,`<Link to="${l}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:d,to:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ly=new URL("http://localhost");function Zf(s){if(s.createURL)return s.createURL("/");try{return new URL(s.createHref("/"),ly)}catch{return ly}}function Nd(s,n){return s.origin===n.origin&&(s.origin!=="null"||s.protocol===n.protocol&&s.host===n.host)}function Hw(s,n){if(s.startsWith("//"))return!0;let l=n.protocol.toLowerCase();return s.toLowerCase().startsWith(l)?n.host===""||s.slice(l.length).startsWith("//"):!1}function Xf(s,n,l,o){let d=null;try{d=s==null?null:new URL(s,l)}catch{}let _=new URL(n,l),w=d!=null&&!Nd(d,l),c=!Nd(_,l);if(o==="reject"){if(w||c)throw new Error("External navigation is not allowed")}else if(c&&(d==null||!Hw(s,d)||!Nd(d,_)))throw new Error("External navigation is not allowed")}var Xb=["POST","PUT","PATCH","DELETE"];new Set(Xb);var Uw=["GET",...Xb];new Set(Uw);var zw=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function $w(s){try{return zw.includes(new URL(s).protocol)}catch{return!1}}var oa=M.createContext(null);oa.displayName="DataRouter";var Lc=M.createContext(null);Lc.displayName="DataRouterState";var Wb=M.createContext(!1);function Pw(){return M.useContext(Wb)}var Qb=M.createContext({isTransitioning:!1});Qb.displayName="ViewTransition";var Fw=M.createContext(new Map);Fw.displayName="Fetchers";var Vw=M.createContext(null);Vw.displayName="Await";var Os=M.createContext(null);Os.displayName="Navigation";var wl=M.createContext(null);wl.displayName="Location";var ni=M.createContext({outlet:null,matches:[],isDataRoute:!1});ni.displayName="Route";var Wf=M.createContext(null);Wf.displayName="RouteError";var Jb="REACT_ROUTER_ERROR",qw="REDIRECT",Kw="ROUTE_ERROR_RESPONSE";function Gw(s){if(s.startsWith(`${Jb}:${qw}:{`))try{let n=JSON.parse(s.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function Yw(s){if(s.startsWith(`${Jb}:${Kw}:{`))try{let n=JSON.parse(s.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Mw(n.status,n.statusText,n.data)}catch{}}function Zw(s,{relative:n}={}){bt(ca(),"useHref() may be used only in the context of a <Router> component.");let{basename:l,navigator:o}=M.useContext(Os),{hash:d,pathname:_,search:w}=El(s,{relative:n}),c=_;return l!=="/"&&(c=_==="/"?l:ti([l,_])),o.createHref({pathname:c,search:w,hash:d})}function ca(){return M.useContext(wl)!=null}function _s(){return bt(ca(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(wl).location}var e0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function t0(s){M.useContext(Os).static||M.useLayoutEffect(s)}function Cl(){let{isDataRoute:s}=M.useContext(ni);return s?uC():Xw()}function Xw(){bt(ca(),"useNavigate() may be used only in the context of a <Router> component.");let s=M.useContext(oa),{basename:n,navigator:l}=M.useContext(Os),{matches:o}=M.useContext(ni),{pathname:d}=_s(),_=JSON.stringify(Yf(o)),w=M.useRef(!1);return t0(()=>{w.current=!0}),M.useCallback((h,y={})=>{if(qs(w.current,e0),!w.current)return;if(typeof h=="number"){l.go(h);return}let p=Oc(h,JSON.parse(_),d,y.relative==="path");s==null&&n!=="/"&&(p.pathname=p.pathname==="/"?n:ti([n,p.pathname])),Xf(typeof h=="string"?h:Wn(h),l.createHref(p),Zf(l),"reject"),(y.replace?l.replace:l.push)(p,y.state,y)},[n,l,_,d,s])}var Ww=M.createContext(null);function Qw(s){let n=M.useContext(ni).outlet;return M.useMemo(()=>n&&M.createElement(Ww.Provider,{value:s},n),[n,s])}function El(s,{relative:n}={}){let{matches:l}=M.useContext(ni),{pathname:o}=_s(),d=JSON.stringify(Yf(l));return M.useMemo(()=>Oc(s,JSON.parse(d),o,n==="path"),[s,d,o,n])}function Jw(s,n){return s0(s,n)}function s0(s,n,l){bt(ca(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=M.useContext(Os),{matches:d}=M.useContext(ni),_=d[d.length-1],w=_?_.params:{},c=_?_.pathname:"/",h=_?_.pathnameBase:"/",y=_&&_.route;{let g=y&&y.path||"";n0(c,!y||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${g}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
10
 
11
- Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let p=_s(),f;if(n){let g=typeof n=="string"?sr(n):n;bt(h==="/"||g.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${g.pathname}" was given in the \`location\` prop.`),f=g}else f=p;let x=f.pathname||"/",C=x;if(h!=="/"){let g=h.replace(/^\//,"").split("/");C="/"+x.replace(/^\//,"").split("/").slice(g.length).join("/")}let j=l&&l.state.matches.length?l.state.matches.map(g=>Object.assign(g,{route:l.manifest[g.route.id]||g.route})):zb(s,{pathname:C});qs(y||j!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),qs(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=iC(j&&j.map(g=>Object.assign({},g,{params:Object.assign({},w,g.params),pathname:ti([h,o.encodeLocation?o.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?h:ti([h,o.encodeLocation?o.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),d,l);return n&&E?M.createElement(wl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},E):E}function Jw(){let s=oC(),n=Mw(s)?`${s.status} ${s.statusText}`:s instanceof Error?s.message:JSON.stringify(s),l=s instanceof Error?s.stack:null,o="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:o},_={padding:"2px 4px",backgroundColor:o},w=null;return console.error("Error handled by React Router default ErrorBoundary:",s),w=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:_},"ErrorBoundary")," or"," ",M.createElement("code",{style:_},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},n),l?M.createElement("pre",{style:d},l):null,w)}var eC=M.createElement(Jw,null),t0=class extends M.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){this.props.onError?this.props.onError(s,n):console.error("React Router caught the following error during render",s)}render(){let s=this.state.error;if(this.context&&typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){const l=Gw(s.digest);l&&(s=l)}let n=s!==void 0?M.createElement(ni.Provider,{value:this.props.routeContext},M.createElement(Xf.Provider,{value:s,children:this.props.component})):this.props.children;return this.context?M.createElement(tC,{error:s},n):n}};t0.contextType=Zb;var jd=new WeakMap;function tC({children:s,error:n}){let{basename:l,navigator:o}=M.useContext(Os);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let d=Kw(n.digest);if(d){let _=jd.get(n);if(_)throw _;let w=Gb(d.location,l),c=w.absoluteURL||w.to;if(Zf(d.location,c,Yf(o),"allow-explicit"),zw(c))throw new Error("Invalid redirect location");if(Kb&&!jd.get(n))if(w.isExternal||d.reloadDocument)window.location.href=c;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(w.to,{replace:d.replace}));throw jd.set(n,h),h}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return s}function sC({routeContext:s,match:n,children:l}){let o=M.useContext(oa);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),M.createElement(ni.Provider,{value:s},l)}function iC(s,n=[],l){let o=l?.state;if(s==null){if(!o)return null;if(o.errors)s=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)s=o.matches;else return null}let d=s,_=o?.errors;if(_!=null){let p=d.findIndex(f=>f.route.id&&_?.[f.route.id]!==void 0);bt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(_).join(",")}`),d=d.slice(0,Math.min(d.length,p+1))}let w=!1,c=-1;if(l&&o){w=o.renderFallback;for(let p=0;p<d.length;p++){let f=d[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(c=p),f.route.id){let{loaderData:x,errors:C}=o,j=f.route.loader&&!x.hasOwnProperty(f.route.id)&&(!C||C[f.route.id]===void 0);if(f.route.lazy||j){l.isStatic&&(w=!0),c>=0?d=d.slice(0,c+1):d=[d[0]];break}}}}let h=l?.onError,y=o&&h?(p,f)=>{h(p,{location:o.location,params:o.matches?.[0]?.params??{},pattern:Bw(o.matches),errorInfo:f})}:void 0;return d.reduceRight((p,f,x)=>{let C,j=!1,E=null,g=null;o&&(C=_&&f.route.id?_[f.route.id]:void 0,E=f.route.errorElement||eC,w&&(c<0&&x===0?(s0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,g=null):c===x&&(j=!0,g=f.route.hydrateFallbackElement||null)));let b=n.concat(d.slice(0,x+1)),v=()=>{let S;return C?S=E:j?S=g:f.route.Component?S=M.createElement(f.route.Component,null):f.route.element?S=f.route.element:S=p,M.createElement(sC,{match:f,routeContext:{outlet:p,matches:b,isDataRoute:o!=null},children:S})};return o&&(f.route.ErrorBoundary||f.route.errorElement||x===0)?M.createElement(t0,{location:o.location,revalidation:o.revalidation,component:E,error:C,children:v(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:y}):v()},null)}function Wf(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nC(s){let n=M.useContext(oa);return bt(n,Wf(s)),n}function rC(s){let n=M.useContext(Lc);return bt(n,Wf(s)),n}function aC(s){let n=M.useContext(ni);return bt(n,Wf(s)),n}function Qf(s){let n=aC(s),l=n.matches[n.matches.length-1];return bt(l.route.id,`${s} can only be used on routes that contain a unique "id"`),l.route.id}function lC(){return Qf("useRouteId")}function oC(){let s=M.useContext(Xf),n=rC("useRouteError"),l=Qf("useRouteError");return s!==void 0?s:n.errors?.[l]}function cC(){let{router:s}=nC("useNavigate"),n=Qf("useNavigate"),l=M.useRef(!1);return Jb(()=>{l.current=!0}),M.useCallback(async(d,_={})=>{qs(l.current,Qb),l.current&&(typeof d=="number"?await s.navigate(d):await s.navigate(d,{fromRouteId:n,..._}))},[s,n])}var ay={};function s0(s,n,l){!n&&!ay[s]&&(ay[s]=!0,qs(!1,l))}M.memo(uC);function uC({routes:s,manifest:n,future:l,state:o,isStatic:d,onError:_}){return e0(s,void 0,{manifest:n,state:o,isStatic:d,onError:_})}function dc({to:s,replace:n,state:l,relative:o}){bt(ca(),"<Navigate> may be used only in the context of a <Router> component.");let{static:d,navigator:_}=M.useContext(Os);qs(!d,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:w}=M.useContext(ni),{pathname:c}=_s(),h=Cl(),y=Oc(s,Gf(w),c,o==="path");Zf(typeof s=="string"?s:Wn(s),_.createHref(y),Yf(_),"reject");let p=JSON.stringify(y);return M.useEffect(()=>{h(JSON.parse(p),{replace:n,state:l,relative:o})},[h,p,o,n,l]),null}function hC(s){return Ww(s.context)}function Ot(s){bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function dC({basename:s="/",children:n=null,location:l,navigationType:o="POP",navigator:d,static:_=!1,useTransitions:w}){bt(!ca(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=s.replace(/^\/*/,"/"),h=M.useMemo(()=>({basename:c,navigator:d,static:_,useTransitions:w,future:{}}),[c,d,_,w]);typeof l=="string"&&(l=sr(l));let{pathname:y="/",search:p="",hash:f="",state:x=null,key:C="default",mask:j}=l,E=M.useMemo(()=>{let g=Ui(y,c);return g==null?null:{location:{pathname:g,search:p,hash:f,state:x,key:C,mask:j},navigationType:o}},[c,y,p,f,x,C,o,j]);return qs(E!=null,`<Router basename="${c}"> is not able to match the URL "${y}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:M.createElement(Os.Provider,{value:h},M.createElement(wl.Provider,{children:n,value:E}))}function fC({children:s,location:n}){return Qw(pf(s),n)}function pf(s,n=[]){let l=[];return M.Children.forEach(s,(o,d)=>{if(!M.isValidElement(o))return;let _=[...n,d];if(o.type===M.Fragment){l.push.apply(l,pf(o.props.children,_));return}bt(o.type===Ot,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),bt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let w={id:o.props.id||_.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(w.children=pf(o.props.children,_)),l.push(w)}),l}var fc="get",mc="application/x-www-form-urlencoded";function Mc(s){return typeof HTMLElement<"u"&&s instanceof HTMLElement}function mC(s){return Mc(s)&&s.tagName.toLowerCase()==="button"}function pC(s){return Mc(s)&&s.tagName.toLowerCase()==="form"}function gC(s){return Mc(s)&&s.tagName.toLowerCase()==="input"}function vC(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function _C(s,n){return s.button===0&&(!n||n==="_self")&&!vC(s)}var ic=null;function yC(){if(ic===null)try{new FormData(document.createElement("form"),0),ic=!1}catch{ic=!0}return ic}var bC=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Td(s){return s!=null&&!bC.has(s)?(qs(!1,`"${s}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mc}"`),null):s}function SC(s,n){let l,o,d,_,w;if(pC(s)){let c=s.getAttribute("action");o=c?Ui(c,n):null,l=s.getAttribute("method")||fc,d=Td(s.getAttribute("enctype"))||mc,_=new FormData(s)}else if(mC(s)||gC(s)&&(s.type==="submit"||s.type==="image")){let c=s.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=s.getAttribute("formaction")||c.getAttribute("action");if(o=h?Ui(h,n):null,l=s.getAttribute("formmethod")||c.getAttribute("method")||fc,d=Td(s.getAttribute("formenctype"))||Td(c.getAttribute("enctype"))||mc,_=new FormData(c,s),!yC()){let{name:y,type:p,value:f}=s;if(p==="image"){let x=y?`${y}.`:"";_.append(`${x}x`,"0"),_.append(`${x}y`,"0")}else y&&_.append(y,f)}}else{if(Mc(s))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');l=fc,o=null,d=mc,w=s}return _&&d==="text/plain"&&(w=_,_=void 0),{action:o,method:l.toLowerCase(),encType:d,formData:_,body:w}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Jf(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function i0(s,n,l,o){let d=typeof s=="string"?new URL(s,typeof window>"u"?"server://singlefetch/":window.location.origin):s;return l?d.pathname.endsWith("/")?d.pathname=`${d.pathname}_.${o}`:d.pathname=`${d.pathname}.${o}`:d.pathname==="/"?d.pathname=`_root.${o}`:n&&Ui(d.pathname,n)==="/"?d.pathname=`${ta(n)}/_root.${o}`:d.pathname=`${ta(d.pathname)}.${o}`,d}async function xC(s,n){if(s.id in n)return n[s.id];try{let l=await import(s.module);return n[s.id]=l,l}catch(l){return console.error(`Error loading route module \`${s.module}\`, reloading page...`),console.error(l),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function wC(s){return s==null?!1:s.href==null?s.rel==="preload"&&typeof s.imageSrcSet=="string"&&typeof s.imageSizes=="string":typeof s.rel=="string"&&typeof s.href=="string"}async function CC(s,n,l){let o=await Promise.all(s.map(async d=>{let _=n.routes[d.route.id];if(_){let w=await xC(_,l);return w.links?w.links():[]}return[]}));return TC(o.flat(1).filter(wC).filter(d=>d.rel==="stylesheet"||d.rel==="preload").map(d=>d.rel==="stylesheet"?{...d,rel:"prefetch",as:"style"}:{...d,rel:"prefetch"}))}function ly(s,n,l,o,d,_){let w=(h,y)=>l[y]?h.route.id!==l[y].route.id:!0,c=(h,y)=>l[y].pathname!==h.pathname||l[y].route.path?.endsWith("*")&&l[y].params["*"]!==h.params["*"];return _==="assets"?n.filter((h,y)=>w(h,y)||c(h,y)):_==="data"?n.filter((h,y)=>{let p=o.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(w(h,y)||c(h,y))return!0;if(h.route.shouldRevalidate){let f=h.route.shouldRevalidate({currentUrl:new URL(d.pathname+d.search+d.hash,window.origin),currentParams:l[0]?.params||{},nextUrl:new URL(s,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function EC(s,n,{includeHydrateFallback:l}={}){return NC(s.map(o=>{let d=n.routes[o.route.id];if(!d)return[];let _=[d.module];return d.clientActionModule&&(_=_.concat(d.clientActionModule)),d.clientLoaderModule&&(_=_.concat(d.clientLoaderModule)),l&&d.hydrateFallbackModule&&(_=_.concat(d.hydrateFallbackModule)),d.imports&&(_=_.concat(d.imports)),_}).flat(1))}function NC(s){return[...new Set(s)]}function jC(s){let n={},l=Object.keys(s).sort();for(let o of l)n[o]=s[o];return n}function TC(s,n){let l=new Set;return new Set(n),s.reduce((o,d)=>{let _=JSON.stringify(jC(d));return l.has(_)||(l.add(_),o.push({key:_,link:d})),o},[])}function em(){let s=M.useContext(oa);return Jf(s,"You must render this element inside a <DataRouterContext.Provider> element"),s}function kC(){let s=M.useContext(Lc);return Jf(s,"You must render this element inside a <DataRouterStateContext.Provider> element"),s}var tm=M.createContext(void 0);tm.displayName="FrameworkContext";function Bc(){let s=M.useContext(tm);return Jf(s,"You must render this element inside a <HydratedRouter> element"),s}function RC(s,n){let l=M.useContext(tm),[o,d]=M.useState(!1),[_,w]=M.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:y,onMouseLeave:p,onTouchStart:f}=n,x=M.useRef(null);M.useEffect(()=>{if(s==="render"&&w(!0),s==="viewport"){let E=b=>{b.forEach(v=>{w(v.isIntersecting)})},g=new IntersectionObserver(E,{threshold:.5});return x.current&&g.observe(x.current),()=>{g.disconnect()}}},[s]),M.useEffect(()=>{if(o){let E=setTimeout(()=>{w(!0)},100);return()=>{clearTimeout(E)}}},[o]);let C=()=>{d(!0)},j=()=>{d(!1),w(!1)};return l?s!=="intent"?[_,x,{}]:[_,x,{onFocus:cl(c,C),onBlur:cl(h,j),onMouseEnter:cl(y,C),onMouseLeave:cl(p,j),onTouchStart:cl(f,C)}]:[!1,x,{}]}function cl(s,n){return l=>{s&&s(l),l.defaultPrevented||n(l)}}function DC({page:s,...n}){let l=$w(),{nonce:o}=Bc(),{router:d}=em(),_=M.useMemo(()=>zb(d.routes,s,d.basename),[d.routes,s,d.basename]);return _?(n.nonce==null&&o&&(n={...n,nonce:o}),l?M.createElement(OC,{page:s,matches:_,...n}):M.createElement(LC,{page:s,matches:_,...n})):null}function AC(s){let{manifest:n,routeModules:l}=Bc(),[o,d]=M.useState([]);return M.useEffect(()=>{let _=!1;return CC(s,n,l).then(w=>{_||d(w)}),()=>{_=!0}},[s,n,l]),o}function OC({page:s,matches:n,...l}){let o=_s(),{future:d}=Bc(),{basename:_}=em(),w=M.useMemo(()=>{if(s===o.pathname+o.search+o.hash)return[];let c=i0(s,_,d.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,y=[];for(let p of n)typeof p.route.shouldRevalidate=="function"?h=!0:y.push(p.route.id);return h&&y.length>0&&c.searchParams.set("_routes",y.join(",")),[c.pathname+c.search]},[_,d.v8_trailingSlashAwareDataRequests,s,o,n]);return M.createElement(M.Fragment,null,w.map(c=>M.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...l})))}function LC({page:s,matches:n,...l}){let o=_s(),{future:d,manifest:_,routeModules:w}=Bc(),{basename:c}=em(),{loaderData:h,matches:y}=kC(),p=M.useMemo(()=>ly(s,n,y,_,o,"data"),[s,n,y,_,o]),f=M.useMemo(()=>ly(s,n,y,_,o,"assets"),[s,n,y,_,o]),x=M.useMemo(()=>{if(s===o.pathname+o.search+o.hash)return[];let E=new Set,g=!1;if(n.forEach(v=>{let S=_.routes[v.route.id];!S||!S.hasLoader||(!p.some(N=>N.route.id===v.route.id)&&v.route.id in h&&w[v.route.id]?.shouldRevalidate||S.hasClientLoader?g=!0:E.add(v.route.id))}),E.size===0)return[];let b=i0(s,c,d.v8_trailingSlashAwareDataRequests,"data");return g&&E.size>0&&b.searchParams.set("_routes",n.filter(v=>E.has(v.route.id)).map(v=>v.route.id).join(",")),[b.pathname+b.search]},[c,d.v8_trailingSlashAwareDataRequests,h,o,_,p,n,s,w]),C=M.useMemo(()=>EC(f,_),[f,_]),j=AC(f);return M.createElement(M.Fragment,null,x.map(E=>M.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...l})),C.map(E=>M.createElement("link",{key:E,rel:"modulepreload",href:E,...l})),j.map(({key:E,link:g})=>M.createElement("link",{key:E,nonce:l.nonce,...g,crossOrigin:g.crossOrigin??l.crossOrigin})))}function MC(...s){return n=>{s.forEach(l=>{typeof l=="function"?l(n):l!=null&&(l.current=n)})}}var BC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{BC&&(window.__reactRouterVersion="7.18.4")}catch{}function IC({basename:s,children:n,useTransitions:l,window:o}){let d=M.useRef();d.current==null&&(d.current=dw({window:o,v5Compat:!0}));let _=d.current,[w,c]=M.useState({action:_.action,location:_.location}),h=M.useCallback(y=>{l===!1?c(y):M.startTransition(()=>c(y))},[l]);return M.useLayoutEffect(()=>_.listen(h),[_,h]),M.createElement(dC,{basename:s,children:n,location:w.location,navigationType:w.action,navigator:_,useTransitions:l})}var Jt=M.forwardRef(function({onClick:n,discover:l="render",prefetch:o="none",relative:d,reloadDocument:_,replace:w,mask:c,state:h,target:y,to:p,preventScrollReset:f,viewTransition:x,defaultShouldRevalidate:C,...j},E){let{basename:g,navigator:b,useTransitions:v}=M.useContext(Os),S=typeof p=="string"&&Kf.test(p),N=Gb(p,g);p=N.to;let T=Yw(p,{relative:d}),D=_s(),O=null;if(c){let he=Oc(c,[],D.mask?D.mask.pathname:"/",!0);g!=="/"&&(he.pathname=he.pathname==="/"?g:ti([g,he.pathname])),O=b.createHref(he)}let[k,L,V]=RC(o,j),q=zC(p,{replace:w,mask:c,state:h,target:y,preventScrollReset:f,relative:d,viewTransition:x,defaultShouldRevalidate:C,useTransitions:v});function Y(he){n&&n(he),he.defaultPrevented||q(he)}let P=!(N.isExternal||_),Q=M.createElement("a",{...j,...V,href:(P?O:void 0)||N.absoluteURL||T,onClick:P?Y:n,ref:MC(E,L),target:y,"data-discover":!S&&l==="render"?"true":void 0});return k&&!S?M.createElement(M.Fragment,null,Q,M.createElement(DC,{page:T})):Q});Jt.displayName="Link";var sm=M.forwardRef(function({"aria-current":n="page",caseSensitive:l=!1,className:o="",end:d=!1,style:_,to:w,viewTransition:c,children:h,...y},p){let f=El(w,{relative:y.relative}),x=_s(),C=M.useContext(Lc),{navigator:j,basename:E}=M.useContext(Os),g=C!=null&&qC(f)&&c===!0,b=j.encodeLocation?j.encodeLocation(f).pathname:f.pathname,v=x.pathname,S=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;l||(v=v.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase()),S&&E&&(S=Ui(S,E)||S);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let T=v===b||!d&&v.startsWith(b)&&v.charAt(N)==="/",D=S!=null&&(S===b||!d&&S.startsWith(b)&&S.charAt(b.length)==="/"),O={isActive:T,isPending:D,isTransitioning:g},k=T?n:void 0,L;typeof o=="function"?L=o(O):L=[o,T?"active":null,D?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let V=typeof _=="function"?_(O):_;return M.createElement(Jt,{...y,"aria-current":k,className:L,ref:p,style:V,to:w,viewTransition:c},typeof h=="function"?h(O):h)});sm.displayName="NavLink";var HC=M.forwardRef(({discover:s="render",fetcherKey:n,navigate:l,reloadDocument:o,replace:d,state:_,method:w=fc,action:c,onSubmit:h,relative:y,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:x,...C},j)=>{let{useTransitions:E}=M.useContext(Os),g=FC(),b=VC(c,{relative:y}),v=w.toLowerCase()==="get"?"get":"post",S=typeof c=="string"&&Kf.test(c),N=T=>{if(h&&h(T),T.defaultPrevented)return;T.preventDefault();let D=T.nativeEvent.submitter,O=D?.getAttribute("formmethod")||w,k=()=>g(D||T.currentTarget,{fetcherKey:n,method:O,navigate:l,replace:d,state:_,relative:y,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:x});E&&l!==!1?M.startTransition(()=>k()):k()};return M.createElement("form",{ref:j,method:v,action:b,onSubmit:o?h:N,...C,"data-discover":!S&&s==="render"?"true":void 0})});HC.displayName="Form";function UC(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function n0(s){let n=M.useContext(oa);return bt(n,UC(s)),n}function zC(s,{target:n,replace:l,mask:o,state:d,preventScrollReset:_,relative:w,viewTransition:c,defaultShouldRevalidate:h,useTransitions:y}={}){let p=Cl(),f=_s(),x=El(s,{relative:w});return M.useCallback(C=>{if(_C(C,n)){C.preventDefault();let j=l!==void 0?l:Wn(f)===Wn(x),E=()=>p(s,{replace:j,mask:o,state:d,preventScrollReset:_,relative:w,viewTransition:c,defaultShouldRevalidate:h});y?M.startTransition(()=>E()):E()}},[f,p,x,l,o,d,n,s,_,w,c,h,y])}var $C=0,PC=()=>`__${String(++$C)}__`;function FC(){let{router:s}=n0("useSubmit"),{basename:n}=M.useContext(Os),l=lC(),o=s.fetch,d=s.navigate;return M.useCallback(async(_,w={})=>{let{action:c,method:h,encType:y,formData:p,body:f}=SC(_,n);if(w.navigate===!1){let x=w.fetcherKey||PC();await o(x,l,w.action||c,{defaultShouldRevalidate:w.defaultShouldRevalidate,preventScrollReset:w.preventScrollReset,formData:p,body:f,formMethod:w.method||h,formEncType:w.encType||y,flushSync:w.flushSync})}else await d(w.action||c,{defaultShouldRevalidate:w.defaultShouldRevalidate,preventScrollReset:w.preventScrollReset,formData:p,body:f,formMethod:w.method||h,formEncType:w.encType||y,replace:w.replace,state:w.state,fromRouteId:l,flushSync:w.flushSync,viewTransition:w.viewTransition})},[o,d,n,l])}function VC(s,{relative:n}={}){let{basename:l}=M.useContext(Os),o=M.useContext(ni);bt(o,"useFormAction must be used inside a RouteContext");let[d]=o.matches.slice(-1),_={...El(s||".",{relative:n})},w=_s();if(s==null){_.search=w.search;let c=new URLSearchParams(_.search),h=c.getAll("index");if(h.some(p=>p==="")){c.delete("index"),h.filter(f=>f).forEach(f=>c.append("index",f));let p=c.toString();_.search=p?`?${p}`:""}}return(!s||s===".")&&d.route.index&&(_.search=_.search?_.search.replace(/^\?/,"?index&"):"?index"),l!=="/"&&(_.pathname=_.pathname==="/"?l:ti([l,_.pathname])),Wn(_)}function qC(s,{relative:n}={}){let l=M.useContext(Xb);bt(l!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=n0("useViewTransitionState"),d=El(s,{relative:n});if(!l.isTransitioning)return!1;let _=Ui(l.currentLocation.pathname,o)||l.currentLocation.pathname,w=Ui(l.nextLocation.pathname,o)||l.nextLocation.pathname;return gc(d.pathname,w)!=null||gc(d.pathname,_)!=null}var KC=Hb();const r0=M.createContext(void 0),En=s=>{const n=M.useContext(r0);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},GC=({client:s,children:n})=>(M.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),r.jsx(r0.Provider,{value:s,children:n})),YC={setTimeout:(s,n)=>setTimeout(s,n),clearTimeout:s=>clearTimeout(s),setInterval:(s,n)=>setInterval(s,n),clearInterval:s=>clearInterval(s)};var ZC=class{#e=YC;#t=!1;setTimeoutProvider(s){this.#e=s}setTimeout(s,n){return this.#e.setTimeout(s,n)}clearTimeout(s){this.#e.clearTimeout(s)}setInterval(s,n){return this.#e.setInterval(s,n)}clearInterval(s){this.#e.clearInterval(s)}};const Xn=new ZC;function XC(s){setTimeout(s,0)}const WC=typeof window>"u"||"Deno"in globalThis;function gs(){}function QC(s,n){return typeof s=="function"?s(n):s}function a0(s){return typeof s=="number"&&s>=0&&s!==1/0}function l0(s,n){return Math.max(s+(n||0)-Date.now(),0)}function _t(s,n){return typeof s=="function"?s(n):s}function oy(s,n){const{type:l="all",exact:o,fetchStatus:d,predicate:_,queryKey:w,stale:c}=s;if(w){if(o){if(n.queryHash!==im(w,n.options))return!1}else if(!sa(n.queryKey,w))return!1}if(l!=="all"){const h=n.isActive();if(l==="active"&&!h||l==="inactive"&&h)return!1}return!(typeof c=="boolean"&&n.isStale()!==c||d&&d!==n.state.fetchStatus||_&&!_(n))}function cy(s,n){const{exact:l,status:o,predicate:d,mutationKey:_}=s;if(_){if(!n.options.mutationKey)return!1;if(l){if(pl(n.options.mutationKey)!==pl(_))return!1}else if(!sa(n.options.mutationKey,_))return!1}return!(o&&n.state.status!==o||d&&!d(n))}function im(s,n){return(n?.queryKeyHashFn||pl)(s)}function pl(s){return JSON.stringify(s,(n,l)=>gf(l)?Object.keys(l).sort().reduce((o,d)=>(o[d]=l[d],o),{}):l)}function sa(s,n){if(s===n)return!0;if(typeof s!=typeof n)return!1;if(s&&n&&typeof s=="object"&&typeof n=="object"){if(Array.isArray(s)&&Array.isArray(n)){if(n.length>s.length)return!1;for(let o=0;o<n.length;o++)if(!sa(s[o],n[o]))return!1;return!0}const l=Object.keys(n);for(const o of l)if(!sa(s[o],n[o]))return!1;return!0}return!1}const JC=Object.prototype.hasOwnProperty;function o0(s,n,l=0){if(s===n)return s;if(l>500)return n;const o=uy(s)&&uy(n);if(!o&&!(gf(s)&&gf(n)))return n;const d=(o?s:Object.keys(s)).length,_=o?n:Object.keys(n),w=_.length,c=o?new Array(w):{};let h=0;for(let y=0;y<w;y++){const p=o?y:_[y],f=s[p],x=n[p];if(f===x){c[p]=f,(o?y<d:JC.call(s,p))&&h++;continue}if(f===null||x===null||typeof f!="object"||typeof x!="object"){c[p]=x;continue}const C=o0(f,x,l+1);c[p]=C,C===f&&h++}return d===w&&h===d?s:c}function kd(s,n){if(!n||Object.keys(s).length!==Object.keys(n).length)return!1;for(const l in s)if(s[l]!==n[l])return!1;return!0}function uy(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function gf(s){if(!hy(s))return!1;const n=Object.getPrototypeOf(s),l=n?.constructor;if(l===void 0)return!0;if(typeof l!="function")return!1;const o=l.prototype;return!(!hy(o)||!o.hasOwnProperty("isPrototypeOf")||n!==Object.prototype)}function hy(s){return Object.prototype.toString.call(s)==="[object Object]"}function eE(s){return new Promise(n=>{Xn.setTimeout(n,s)})}function vf(s,n,l){return typeof l.structuralSharing=="function"?l.structuralSharing(s,n):l.structuralSharing!==!1?o0(s,n):n}function tE(s,n,l=0){const o=[...s,n];return l&&o.length>l?o.slice(1):o}function sE(s,n,l=0){const o=[n,...s];return l&&o.length>l?o.slice(0,-1):o}const nm=Symbol();function c0(s,n){return!s.queryFn&&n?.initialPromise?()=>n.initialPromise:!s.queryFn||s.queryFn===nm?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function u0(s,n){return typeof s=="function"?s(...n):!!s}function iE(s,n,l){let o=!1,d;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(d??=n(),o||(o=!0,d.aborted?l():d.addEventListener("abort",l,{once:!0})),d)}),s}let nE=()=>WC;const rm=()=>nE();var Nl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},rE=class extends Nl{#e;#t;#s;constructor(){super(),this.#s=s=>{if(typeof window<"u"&&window.addEventListener){const n=()=>s();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(s){this.#s=s,this.#t?.(),this.#t=s(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(s){this.#e!==s&&(this.#e=s,this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(n=>{n(s)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const am=new rE,aE=XC;function lE(){let s=[],n=0,l=c=>{c()},o=c=>{c()},d=aE;const _=c=>{n?s.push(c):d(()=>{l(c)})},w=()=>{const c=s;s=[],c.length&&d(()=>{o(()=>{c.forEach(h=>{l(h)})})})};return{batch:c=>{let h;n++;try{h=c()}finally{n--,n||w()}return h},batchCalls:c=>(...h)=>{_(()=>{c(...h)})},schedule:_,setNotifyFunction:c=>{l=c},setBatchNotifyFunction:c=>{o=c},setScheduler:c=>{d=c}}}const Wt=lE();var oE=class extends Nl{#e=!0;#t;#s;constructor(){super(),this.#s=s=>{if(typeof window<"u"&&window.addEventListener){const n=()=>s(!0),l=()=>s(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",l)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(s){this.#s=s,this.#t?.(),this.#t=s(this.setOnline.bind(this))}setOnline(s){this.#e!==s&&(this.#e=s,this.listeners.forEach(n=>{n(s)}))}isOnline(){return this.#e}};const vc=new oE;function cE(s){return Math.min(1e3*2**s,3e4)}function h0(s){return(s??"online")==="online"?vc.isOnline():!0}var _f=class extends Error{constructor(s){super("CancelledError"),this.revert=s?.revert,this.silent=s?.silent}};function d0(s){let n=!1,l=0,o,d="pending",_,w;const c=new Promise((v,S)=>{_=v,w=S});c.catch(gs);const h=()=>d!=="pending",y=v=>{if(!h()){const S=new _f(v);E(S),s.onCancel?.(S)}},p=()=>{n=!0},f=()=>{n=!1},x=()=>am.isFocused()&&(s.networkMode==="always"||vc.isOnline())&&s.canRun(),C=()=>h0(s.networkMode)&&s.canRun(),j=v=>{h()||(o?.(),d="resolved",_(v))},E=v=>{h()||(o?.(),d="rejected",w(v))},g=()=>new Promise(v=>{o=S=>{(h()||x())&&v(S)},s.onPause?.()}).then(()=>{o=void 0,h()||s.onContinue?.()}),b=()=>{if(h())return;let v;const S=l===0?s.initialPromise:void 0;try{v=S??s.fn()}catch(N){v=Promise.reject(N)}Promise.resolve(v).then(j).catch(N=>{if(h())return;const T=s.retry??(rm()?0:3),D=s.retryDelay??cE,O=typeof D=="function"?D(l,N):D,k=T===!0||typeof T=="number"&&l<T||typeof T=="function"&&T(l,N);if(n||!k){E(N);return}l++,s.onFail?.(l,N),eE(O).then(()=>x()?void 0:g()).then(()=>{n?E(N):b()})})};return{promise:c,status:()=>d,cancel:y,continue:()=>(o?.(),c),cancelRetry:p,continueRetry:f,canStart:C,start:()=>(C()?b():g().then(b),c)}}var f0=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),a0(this.gcTime)&&(this.#e=Xn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(rm()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Xn.clearTimeout(this.#e),this.#e=void 0)}};function uE(s){return{onFetch:(n,l)=>{const o=n.options,d=n.fetchOptions?.meta?.fetchMore?.direction,_=n.state.data?.pages||[],w=n.state.data?.pageParams||[];let c={pages:[],pageParams:[]},h=0;const y=async()=>{let p=!1;const f=j=>{iE(j,()=>n.signal,()=>p=!0)},x=c0(n.options,n.fetchOptions),C=async(j,E,g)=>{if(p)return Promise.reject(n.signal.reason);if(E==null&&j.pages.length)return Promise.resolve(j);const v=(()=>{const D={client:n.client,queryKey:n.queryKey,pageParam:E,direction:g?"backward":"forward",meta:n.options.meta};return f(D),D})(),S=await x(v),{maxPages:N}=n.options,T=g?sE:tE;return{pages:T(j.pages,S,N),pageParams:T(j.pageParams,E,N)}};if(d&&_.length){const j=d==="backward",E=j?hE:dy,g={pages:_,pageParams:w};c=await C(g,E(o,g),j)}else{const j=s??_.length;do{const E=h===0?w[0]??o.initialPageParam:dy(o,c);if(h>0&&E==null)break;c=await C(c,E),h++}while(h<j)}return c};n.options.persister?n.fetchFn=()=>n.options.persister?.(y,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},l):n.fetchFn=y}}}function dy(s,{pages:n,pageParams:l}){const o=n.length-1;return n.length>0?s.getNextPageParam(n[o],n,l[o],l):void 0}function hE(s,{pages:n,pageParams:l}){return n.length>0?s.getPreviousPageParam?.(n[0],n,l[0],l):void 0}var dE=class extends f0{#e;#t;#s;#i;#r;#n;#a;#o;constructor(s){super(),this.#o=!1,this.#a=s.defaultOptions,this.setOptions(s.options),this.observers=[],this.#r=s.client,this.#i=this.#r.getQueryCache(),this.queryKey=s.queryKey,this.queryHash=s.queryHash,this.#t=my(this.options),this.state=s.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#n?.promise}setOptions(s){if(this.options={...this.#a,...s},s?._type&&(this.#e=s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=my(this.options);n.data!==void 0&&(this.setState(fy(n.data,n.dataUpdatedAt)),this.#t=n)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(s,n){const l=vf(this.state.data,s,this.options);return this.#l({data:l,type:"success",dataUpdatedAt:n?.updatedAt,manual:n?.manual}),l}setState(s){this.#l({type:"setState",state:s})}cancel(s){const n=this.#n?.promise;return this.#n?.cancel(s),n?n.then(gs).catch(gs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>_t(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===nm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>_t(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!l0(this.state.dataUpdatedAt,s)}onFocus(){this.observers.find(s=>s.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(s=>s.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){const n=this.observers.indexOf(s);n!==-1&&(this.observers.splice(n,1),this.observers.length||(this.#n&&(this.#o||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(s,n){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(s&&this.setOptions(s),!this.options.queryFn){const h=this.observers.find(y=>y.options.queryFn);h&&this.setOptions(h.options)}const l=new AbortController,o=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(this.#o=!0,l.signal)})},d=()=>{const h=c0(this.options,n),p=(()=>{const f={client:this.#r,queryKey:this.queryKey,meta:this.meta};return o(f),f})();return this.#o=!1,this.options.persister?this.options.persister(h,p,this):h(p)},w=(()=>{const h={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:d};return o(h),h})();(this.#e==="infinite"?uE(this.options.pages):this.options.behavior)?.onFetch(w,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==w.fetchOptions?.meta)&&this.#l({type:"fetch",meta:w.fetchOptions?.meta});const c=this.#n=d0({initialPromise:n?.initialPromise,fn:w.fetchFn,onCancel:h=>{h instanceof _f&&h.revert&&this.setState({...this.#s,fetchStatus:"idle"}),l.abort()},onFail:(h,y)=>{this.#l({type:"failed",failureCount:h,error:y})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:w.options.retry,retryDelay:w.options.retryDelay,networkMode:w.options.networkMode,canRun:()=>!0});try{const h=await c.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#i.config.onSuccess?.(h,this),this.#i.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof _f){if(h.silent)return this.#n.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#l({type:"error",error:h}),this.#i.config.onError?.(h,this),this.#i.config.onSettled?.(this.state.data,h,this),h}finally{this.#n===c&&(this.#n=void 0),this.scheduleGc()}}#l(s){const n=l=>{switch(s.type){case"failed":return{...l,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...m0(l.data,this.options),fetchMeta:s.meta??null};case"success":const o={...l,...fy(s.data,s.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=s.manual?o:void 0,o;case"error":const d=s.error;return{...l,error:d,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:d,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...s.state}}};this.state=n(this.state),Wt.batch(()=>{this.observers.slice().forEach(l=>{l.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:s})})}};function m0(s,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:h0(n.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function fy(s,n){return{data:s,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function my(s){const n=typeof s.initialData=="function"?s.initialData():s.initialData,l=n!==void 0,o=l?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:l?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:l?"success":"pending",fetchStatus:"idle"}}var fE=class extends Nl{#e;#t=void 0;#s=void 0;#i=void 0;#r;#n;#a;#o;#l;#f;#u;#h;#c;#m=new Set;constructor(s,n){super(),this.options=n,this.#e=s,this.#a=null,this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),py(this.#t,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return yf(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return yf(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#S(),this.#t.removeObserver(this)}setOptions(s){const n=this.options,l=this.#t;if(this.options=this.#e.defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof _t(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#t.setOptions(this.options),n._defaulted&&!kd(this.options,n)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const o=this.hasListeners();o&&gy(this.#t,l,this.options,n)&&this.#d(),this.updateResult(),o&&(this.#t!==l||_t(this.options.enabled,this.#t)!==_t(n.enabled,this.#t)||_t(this.options.staleTime,this.#t)!==_t(n.staleTime,this.#t))&&this.#g();const d=this.#v();o&&(this.#t!==l||_t(this.options.enabled,this.#t)!==_t(n.enabled,this.#t)||d!==this.#c)&&this.#_(d)}getOptimisticResult(s){const n=this.#e.getQueryCache().build(this.#e,s),l=this.createResult(n,s);return kd(this.getCurrentResult(),l)||(this.#i=l,this.#n=this.options,this.#r=this.#t.state),l}getCurrentResult(){return this.#i}trackResult(s,n){return new Proxy(s,{get:(l,o)=>(this.trackProp(o),n?.(o),Reflect.get(l,o))})}trackProp(s){this.#m.add(s)}getCurrentQuery(){return this.#t}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const n=this.#e.defaultQueryOptions(s),l=this.#e.getQueryCache().build(this.#e,n);let o=()=>{},d;const _=new Promise(w=>{d=w,o=this.#e.getQueryCache().subscribe(c=>{c.type==="updated"&&c.query.queryHash===l.queryHash&&l.state.data!==void 0&&(o(),w(this.createResult(l,n)))})});return Promise.race([l.fetch().then(()=>{const w=this.createResult(l,n);return d?.(w),w}).finally(()=>{o()}),_])}fetch(s){return this.#d({...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(s){this.#x();let n=this.#t.fetch(this.options,s);return s?.throwOnError||(n=n.catch(gs)),n}#p(s){return!rm()&&_t(this.options.enabled,this.#t)!==!1&&a0(s)}#g(){this.#b();const s=_t(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#p(s))return;const n=l0(this.#i.dataUpdatedAt,s)+1;this.#u=Xn.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#v(){return _t(this.options.refetchInterval,this.#t)??!1}#_(s){this.#S(),this.#c=s,!(this.#c===0||!this.#p(this.#c))&&(this.#h=Xn.setInterval(()=>{(this.options.refetchIntervalInBackground||am.isFocused())&&this.#d()},this.#c))}#y(){this.#g(),this.#_(this.#v())}#b(){this.#u!==void 0&&(Xn.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#h!==void 0&&(Xn.clearInterval(this.#h),this.#h=void 0)}createResult(s,n){const l=this.#t,o=this.options,d=this.#i,_=this.#r,w=this.#n,c=s!==l?s.state:this.#s,{state:h}=s;let y={...h},p=!1,f;if(n._optimisticResults){const T=this.hasListeners(),D=!T&&py(s,n),O=T&&gy(s,l,n,o);(D||O)&&(y={...y,...m0(h.data,s.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:C,status:j}=y;f=y.data;let E=!1;if(n.placeholderData!==void 0&&f===void 0&&j==="pending"){let T;d?.isPlaceholderData&&n.placeholderData===w?.placeholderData?(T=d.data,E=!0):T=typeof n.placeholderData=="function"?n.placeholderData(this.#f?.state.data,this.#f):n.placeholderData,T!==void 0&&(j="success",f=vf(d?.data,T,n),p=!0)}if(n.select&&f!==void 0&&!E)if(d&&f===_?.data&&n.select===this.#o)f=this.#l;else try{this.#o=n.select,f=n.select(f),f=vf(d?.data,f,n),this.#l=f,this.#a=null}catch(T){this.#a=T}else f===void 0&&(this.#a=null);this.#a&&(x=this.#a,f=this.#l,C=Date.now(),j="error",p=!1);const g=y.fetchStatus==="fetching",b=j==="pending",v=j==="error",S=b&&g,N=f!==void 0;return{status:j,fetchStatus:y.fetchStatus,isPending:b,isSuccess:j==="success",isError:v,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:C,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:y.dataUpdateCount>c.dataUpdateCount||y.errorUpdateCount>c.errorUpdateCount,isFetching:g,isRefetching:g&&!b,isLoadingError:v&&!N,isPaused:y.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:v&&N,isStale:lm(s,n),refetch:this.refetch,isEnabled:_t(n.enabled,s)!==!1}}updateResult(){const s=this.#i,n=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#n=this.options,this.#r.data!==void 0&&(this.#f=this.#t),kd(n,s))return;this.#i=n;const o=(()=>{if(!s)return!0;const{notifyOnChangeProps:d}=this.options,_=typeof d=="function"?d():d;if(_==="all"||!_&&!this.#m.size)return!0;const w=new Set(_??this.#m);return this.options.throwOnError&&w.add("error"),Object.keys(this.#i).some(c=>{const h=c;return this.#i[h]!==s[h]&&w.has(h)})})();Wt.batch(()=>{o&&this.listeners.forEach(d=>{d(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#x(){const s=this.#e.getQueryCache().build(this.#e,this.options);if(s===this.#t)return;const n=this.#t;this.#t=s,this.#s=s.state,this.hasListeners()&&(n?.removeObserver(this),s.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function mE(s,n){return _t(n.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&_t(n.retryOnMount,s)===!1)}function py(s,n){return mE(s,n)||s.state.data!==void 0&&yf(s,n,n.refetchOnMount)}function yf(s,n,l){if(_t(n.enabled,s)!==!1&&_t(n.staleTime,s)!=="static"){const o=_t(l,s);return o==="always"||o!==!1&&lm(s,n)}return!1}function gy(s,n,l,o){return(s!==n||_t(o.enabled,s)===!1)&&(!l.suspense||s.state.status!=="error")&&lm(s,l)}function lm(s,n){return _t(n.enabled,s)!==!1&&s.isStaleByTime(_t(n.staleTime,s))}var pE=class extends f0{#e;#t;#s;#i;constructor(s){super(),this.#e=s.client,this.mutationId=s.mutationId,this.#s=s.mutationCache,this.#t=[],this.state=s.state||gE(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){this.#t.includes(s)||(this.#t.push(s),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){this.#t=this.#t.filter(n=>n!==s),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(s){const n=()=>{this.#r({type:"continue"})},l={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},o=this.#i=d0({fn:()=>this.options.mutationFn?this.options.mutationFn(s,l):Promise.reject(new Error("No mutationFn found")),onFail:(w,c)=>{this.#r({type:"failed",failureCount:w,error:c})},onPause:()=>{this.#r({type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)}),d=this.state.status==="pending",_=!o.canStart();try{if(d)n();else{this.#r({type:"pending",variables:s,isPaused:_}),this.#s.config.onMutate&&await this.#s.config.onMutate(s,this,l);const c=await this.options.onMutate?.(s,l);c!==this.state.context&&this.#r({type:"pending",context:c,variables:s,isPaused:_})}const w=await o.start();return await this.#s.config.onSuccess?.(w,s,this.state.context,this,l),await this.options.onSuccess?.(w,s,this.state.context,l),await this.#s.config.onSettled?.(w,null,this.state.variables,this.state.context,this,l),await this.options.onSettled?.(w,null,s,this.state.context,l),this.#r({type:"success",data:w}),w}catch(w){try{await this.#s.config.onError?.(w,s,this.state.context,this,l)}catch(c){Promise.reject(c)}try{await this.options.onError?.(w,s,this.state.context,l)}catch(c){Promise.reject(c)}try{await this.#s.config.onSettled?.(void 0,w,this.state.variables,this.state.context,this,l)}catch(c){Promise.reject(c)}try{await this.options.onSettled?.(void 0,w,s,this.state.context,l)}catch(c){Promise.reject(c)}throw this.#r({type:"error",error:w}),w}finally{this.#i===o&&(this.#i=void 0),this.#s.runNext(this)}}#r(s){const n=l=>{switch(s.type){case"failed":return{...l,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...l,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:s.error,failureCount:l.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Wt.batch(()=>{this.#t.forEach(l=>{l.onMutationUpdate(s)}),this.#s.notify({mutation:this,type:"updated",action:s})})}};function gE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vE=class extends Nl{#e;#t;#s;constructor(s={}){super(),this.config=s,this.#e=new Set,this.#t=new Map,this.#s=0}build(s,n,l){const o=new pE({client:s,mutationCache:this,mutationId:++this.#s,options:s.defaultMutationOptions(n),state:l});return this.add(o),o}add(s){this.#e.add(s);const n=nc(s);if(typeof n=="string"){const l=this.#t.get(n);l?l.push(s):this.#t.set(n,[s])}this.notify({type:"added",mutation:s})}remove(s){if(this.#e.delete(s)){const n=nc(s);if(typeof n=="string"){const l=this.#t.get(n);if(l)if(l.length>1){const o=l.indexOf(s);o!==-1&&l.splice(o,1)}else l[0]===s&&this.#t.delete(n)}}this.notify({type:"removed",mutation:s})}canRun(s){const n=nc(s);if(typeof n=="string"){const l=this.#t.get(n)?.find(o=>o.state.status==="pending");return!l||l===s}else return!0}runNext(s){const n=nc(s);return typeof n=="string"?this.#t.get(n)?.find(l=>l!==s&&l.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Wt.batch(()=>{this.#e.forEach(s=>{this.notify({type:"removed",mutation:s})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(s){const n={exact:!0,...s};return this.getAll().find(l=>cy(n,l))}findAll(s={}){return this.getAll().filter(n=>cy(s,n))}notify(s){Wt.batch(()=>{this.listeners.forEach(n=>{n(s)})})}resumePausedMutations(){const s=this.getAll().filter(n=>n.state.isPaused);return Wt.batch(()=>Promise.all(s.map(n=>n.continue().catch(gs))))}};function nc(s){return s.options.scope?.id}var _E=class extends Nl{#e;constructor(s={}){super(),this.config=s,this.#e=new Map}build(s,n,l){const o=n.queryKey,d=n.queryHash??im(o,n);let _=this.get(d);return _||(_=new dE({client:s,queryKey:o,queryHash:d,options:s.defaultQueryOptions(n),state:l,defaultOptions:s.getQueryDefaults(o)}),this.add(_)),_}add(s){this.#e.has(s.queryHash)||(this.#e.set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){this.#e.get(s.queryHash)===s&&(s.destroy(),this.#e.delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){Wt.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return this.#e.get(s)}getAll(){return[...this.#e.values()]}find(s){const n={exact:!0,...s};return this.getAll().find(l=>oy(n,l))}findAll(s={}){const n=this.getAll();return Object.keys(s).length>0?n.filter(l=>oy(s,l)):n}notify(s){Wt.batch(()=>{this.listeners.forEach(n=>{n(s)})})}onFocus(){Wt.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){Wt.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},yE=class{#e;#t;#s;#i;#r;#n;#a;#o;constructor(s={}){this.#e=s.queryCache||new _E,this.#t=s.mutationCache||new vE,this.#s=s.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#a=am.subscribe(async s=>{s&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=vc.subscribe(async s=>{s&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(s){return this.#e.findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return this.#t.findAll({...s,status:"pending"}).length}getQueryData(s){const n=this.defaultQueryOptions({queryKey:s});return this.#e.get(n.queryHash)?.state.data}ensureQueryData(s){const n=this.defaultQueryOptions(s),l=this.#e.build(this,n),o=l.state.data;return o===void 0?this.fetchQuery(s):(s.revalidateIfStale&&l.isStaleByTime(_t(n.staleTime,l))&&this.prefetchQuery(n),Promise.resolve(o))}getQueriesData(s){return this.#e.findAll(s).map(({queryKey:n,state:l})=>[n,l.data])}setQueryData(s,n,l){const o=this.defaultQueryOptions({queryKey:s}),d=this.#e.get(o.queryHash)?.state.data,_=QC(n,d);if(_!==void 0)return this.#e.build(this,o).setData(_,{...l,manual:!0})}setQueriesData(s,n,l){return Wt.batch(()=>this.#e.findAll(s).map(({queryKey:o})=>[o,this.setQueryData(o,n,l)]))}getQueryState(s){const n=this.defaultQueryOptions({queryKey:s});return this.#e.get(n.queryHash)?.state}removeQueries(s){const n=this.#e;Wt.batch(()=>{n.findAll(s).forEach(l=>{n.remove(l)})})}resetQueries(s,n){const l=this.#e;return Wt.batch(()=>{const o=l.findAll(s),d=new Set(o);return o.forEach(_=>{_.reset()}),this.refetchQueries({type:"active",predicate:_=>d.has(_)},n)})}cancelQueries(s,n={}){const l={revert:!0,...n},o=Wt.batch(()=>this.#e.findAll(s).map(d=>d.cancel(l)));return Promise.all(o).then(gs).catch(gs)}invalidateQueries(s,n={}){return Wt.batch(()=>(this.#e.findAll(s).forEach(l=>{l.invalidate()}),s?.refetchType==="none"?Promise.resolve():this.refetchQueries({...s,type:s?.refetchType??s?.type??"active"},n)))}refetchQueries(s,n={}){const l={...n,cancelRefetch:n.cancelRefetch??!0},o=Wt.batch(()=>this.#e.findAll(s).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let _=d.fetch(void 0,l);return l.throwOnError||(_=_.catch(gs)),d.state.fetchStatus==="paused"?Promise.resolve():_}));return Promise.all(o).then(gs)}async query(s){const n=this.defaultQueryOptions(s);n.retry===void 0&&(n.retry=!1);const l=this.#e.build(this,n),o=l.isStaleByTime(_t(n.staleTime,l))?await l.fetch(n):l.state.data,d=n.select;return d?d(o):o}fetchQuery(s){const n=this.defaultQueryOptions(s);n.retry===void 0&&(n.retry=!1);const l=this.#e.build(this,n);return l.isStaleByTime(_t(n.staleTime,l))?l.fetch(n):Promise.resolve(l.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(gs).catch(gs)}infiniteQuery(s){return s._type="infinite",this.query(s)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(gs).catch(gs)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return vc.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(s){this.#s=s}setQueryDefaults(s,n){this.#i.set(pl(s),{queryKey:s,defaultOptions:n})}getQueryDefaults(s){const n=[...this.#i.values()],l={};return n.forEach(o=>{sa(s,o.queryKey)&&Object.assign(l,o.defaultOptions)}),l}setMutationDefaults(s,n){this.#r.set(pl(s),{mutationKey:s,defaultOptions:n})}getMutationDefaults(s){const n=[...this.#r.values()],l={};return n.forEach(o=>{sa(s,o.mutationKey)&&Object.assign(l,o.defaultOptions)}),l}defaultQueryOptions(s){if(s._defaulted)return s;const n={...this.#s.queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return n.queryHash||(n.queryHash=im(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===nm&&(n.enabled=!1),n}defaultMutationOptions(s){return s?._defaulted?s:{...this.#s.mutations,...s?.mutationKey&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const p0=M.createContext(!1),bE=()=>M.useContext(p0);p0.Provider;function SE(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}const xE=M.createContext(SE()),wE=()=>M.useContext(xE),CE=(s,n,l)=>{const o=l?.state.error&&typeof s.throwOnError=="function"?u0(s.throwOnError,[l.state.error,l]):s.throwOnError;(s.suspense||o)&&(n.isReset()||(s.retryOnMount=!1))},EE=s=>{M.useEffect(()=>{s.clearReset()},[s])},NE=({result:s,errorResetBoundary:n,throwOnError:l,query:o,suspense:d})=>s.isError&&!n.isReset()&&!s.isFetching&&o&&(d&&s.data===void 0||u0(l,[s.error,o])),jE=s=>{if(s.suspense){const l=d=>d==="static"?d:Math.max(d??1e3,1e3),o=s.staleTime;s.staleTime=typeof o=="function"?(...d)=>l(o(...d)):l(o),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},TE=(s,n)=>s?.suspense&&n.isPending,kE=(s,n,l)=>n.fetchOptimistic(s).catch(()=>{l.clearReset()});function RE(s,n,l){const o=bE(),d=wE(),_=En(),w=_.defaultQueryOptions(s),c=_.getQueryCache().get(w.queryHash),h=s.subscribed!==!1;w._optimisticResults=o?"isRestoring":h?"optimistic":void 0,jE(w),CE(w,d,c),EE(d);const[y]=M.useState(()=>new n(_,w)),p=y.getOptimisticResult(w),f=!o&&h;if(M.useSyncExternalStore(M.useCallback(x=>{const C=f?y.subscribe(Wt.batchCalls(x)):gs;return y.updateResult(),C},[y,f]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),M.useEffect(()=>{y.setOptions(w)},[w,y]),TE(w,p))throw kE(w,y,d);if(NE({result:p,errorResetBoundary:d,throwOnError:w.throwOnError,query:c,suspense:w.suspense}))throw p.error;return w.notifyOnChangeProps?p:y.trackResult(p)}function ss(s,n){return RE(s,fE)}var st;(function(s){s.assertEqual=d=>{};function n(d){}s.assertIs=n;function l(d){throw new Error}s.assertNever=l,s.arrayToEnum=d=>{const _={};for(const w of d)_[w]=w;return _},s.getValidEnumValues=d=>{const _=s.objectKeys(d).filter(c=>typeof d[d[c]]!="number"),w={};for(const c of _)w[c]=d[c];return s.objectValues(w)},s.objectValues=d=>s.objectKeys(d).map(function(_){return d[_]}),s.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{const _=[];for(const w in d)Object.prototype.hasOwnProperty.call(d,w)&&_.push(w);return _},s.find=(d,_)=>{for(const w of d)if(_(w))return w},s.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&Number.isFinite(d)&&Math.floor(d)===d;function o(d,_=" | "){return d.map(w=>typeof w=="string"?`'${w}'`:w).join(_)}s.joinValues=o,s.jsonStringifyReplacer=(d,_)=>typeof _=="bigint"?_.toString():_})(st||(st={}));var vy;(function(s){s.mergeShapes=(n,l)=>({...n,...l})})(vy||(vy={}));const Ee=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yn=s=>{switch(typeof s){case"undefined":return Ee.undefined;case"string":return Ee.string;case"number":return Number.isNaN(s)?Ee.nan:Ee.number;case"boolean":return Ee.boolean;case"function":return Ee.function;case"bigint":return Ee.bigint;case"symbol":return Ee.symbol;case"object":return Array.isArray(s)?Ee.array:s===null?Ee.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?Ee.promise:typeof Map<"u"&&s instanceof Map?Ee.map:typeof Set<"u"&&s instanceof Set?Ee.set:typeof Date<"u"&&s instanceof Date?Ee.date:Ee.object;default:return Ee.unknown}},ye=st.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class zi extends Error{get errors(){return this.issues}constructor(n){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const l=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,l):this.__proto__=l,this.name="ZodError",this.issues=n}format(n){const l=n||function(_){return _.message},o={_errors:[]},d=_=>{for(const w of _.issues)if(w.code==="invalid_union")w.unionErrors.map(d);else if(w.code==="invalid_return_type")d(w.returnTypeError);else if(w.code==="invalid_arguments")d(w.argumentsError);else if(w.path.length===0)o._errors.push(l(w));else{let c=o,h=0;for(;h<w.path.length;){const y=w.path[h];h===w.path.length-1?(c[y]=c[y]||{_errors:[]},c[y]._errors.push(l(w))):c[y]=c[y]||{_errors:[]},c=c[y],h++}}};return d(this),o}static assert(n){if(!(n instanceof zi))throw new Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=l=>l.message){const l={},o=[];for(const d of this.issues)if(d.path.length>0){const _=d.path[0];l[_]=l[_]||[],l[_].push(n(d))}else o.push(n(d));return{formErrors:o,fieldErrors:l}}get formErrors(){return this.flatten()}}zi.create=s=>new zi(s);const bf=(s,n)=>{let l;switch(s.code){case ye.invalid_type:s.received===Ee.undefined?l="Required":l=`Expected ${s.expected}, received ${s.received}`;break;case ye.invalid_literal:l=`Invalid literal value, expected ${JSON.stringify(s.expected,st.jsonStringifyReplacer)}`;break;case ye.unrecognized_keys:l=`Unrecognized key(s) in object: ${st.joinValues(s.keys,", ")}`;break;case ye.invalid_union:l="Invalid input";break;case ye.invalid_union_discriminator:l=`Invalid discriminator value. Expected ${st.joinValues(s.options)}`;break;case ye.invalid_enum_value:l=`Invalid enum value. Expected ${st.joinValues(s.options)}, received '${s.received}'`;break;case ye.invalid_arguments:l="Invalid function arguments";break;case ye.invalid_return_type:l="Invalid function return type";break;case ye.invalid_date:l="Invalid date";break;case ye.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(l=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(l=`${l} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?l=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?l=`Invalid input: must end with "${s.validation.endsWith}"`:st.assertNever(s.validation):s.validation!=="regex"?l=`Invalid ${s.validation}`:l="Invalid";break;case ye.too_small:s.type==="array"?l=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?l=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?l=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?l=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?l=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:l="Invalid input";break;case ye.too_big:s.type==="array"?l=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?l=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?l=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?l=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?l=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:l="Invalid input";break;case ye.custom:l="Invalid input";break;case ye.invalid_intersection_types:l="Intersection results could not be merged";break;case ye.not_multiple_of:l=`Number must be a multiple of ${s.multipleOf}`;break;case ye.not_finite:l="Number must be finite";break;default:l=n.defaultError,st.assertNever(s)}return{message:l}};let DE=bf;function AE(){return DE}const OE=s=>{const{data:n,path:l,errorMaps:o,issueData:d}=s,_=[...l,...d.path||[]],w={...d,path:_};if(d.message!==void 0)return{...d,path:_,message:d.message};let c="";const h=o.filter(y=>!!y).slice().reverse();for(const y of h)c=y(w,{data:n,defaultError:c}).message;return{...d,path:_,message:c}};function xe(s,n){const l=AE(),o=OE({issueData:n,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,l,l===bf?void 0:bf].filter(d=>!!d)});s.common.issues.push(o)}class cs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(n,l){const o=[];for(const d of l){if(d.status==="aborted")return Oe;d.status==="dirty"&&n.dirty(),o.push(d.value)}return{status:n.value,value:o}}static async mergeObjectAsync(n,l){const o=[];for(const d of l){const _=await d.key,w=await d.value;o.push({key:_,value:w})}return cs.mergeObjectSync(n,o)}static mergeObjectSync(n,l){const o={};for(const d of l){const{key:_,value:w}=d;if(_.status==="aborted"||w.status==="aborted")return Oe;_.status==="dirty"&&n.dirty(),w.status==="dirty"&&n.dirty(),_.value!=="__proto__"&&(typeof w.value<"u"||d.alwaysSet)&&(o[_.value]=w.value)}return{status:n.value,value:o}}}const Oe=Object.freeze({status:"aborted"}),fl=s=>({status:"dirty",value:s}),Ks=s=>({status:"valid",value:s}),_y=s=>s.status==="aborted",yy=s=>s.status==="dirty",ia=s=>s.status==="valid",_c=s=>typeof Promise<"u"&&s instanceof Promise;var je;(function(s){s.errToObj=n=>typeof n=="string"?{message:n}:n||{},s.toString=n=>typeof n=="string"?n:n?.message})(je||(je={}));class yi{constructor(n,l,o,d){this._cachedPath=[],this.parent=n,this.data=l,this._path=o,this._key=d}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const by=(s,n)=>{if(ia(n))return{success:!0,data:n.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const l=new zi(s.common.issues);return this._error=l,this._error}}};function Pe(s){if(!s)return{};const{errorMap:n,invalid_type_error:l,required_error:o,description:d}=s;if(n&&(l||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return n?{errorMap:n,description:d}:{errorMap:(w,c)=>{const{message:h}=s;return w.code==="invalid_enum_value"?{message:h??c.defaultError}:typeof c.data>"u"?{message:h??o??c.defaultError}:w.code!=="invalid_type"?{message:c.defaultError}:{message:h??l??c.defaultError}},description:d}}class We{get description(){return this._def.description}_getType(n){return yn(n.data)}_getOrReturnCtx(n,l){return l||{common:n.parent.common,data:n.data,parsedType:yn(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new cs,ctx:{common:n.parent.common,data:n.data,parsedType:yn(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const l=this._parse(n);if(_c(l))throw new Error("Synchronous parse encountered promise.");return l}_parseAsync(n){const l=this._parse(n);return Promise.resolve(l)}parse(n,l){const o=this.safeParse(n,l);if(o.success)return o.data;throw o.error}safeParse(n,l){const o={common:{issues:[],async:l?.async??!1,contextualErrorMap:l?.errorMap},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:yn(n)},d=this._parseSync({data:n,path:o.path,parent:o});return by(o,d)}"~validate"(n){const l={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:yn(n)};if(!this["~standard"].async)try{const o=this._parseSync({data:n,path:[],parent:l});return ia(o)?{value:o.value}:{issues:l.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),l.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:l}).then(o=>ia(o)?{value:o.value}:{issues:l.common.issues})}async parseAsync(n,l){const o=await this.safeParseAsync(n,l);if(o.success)return o.data;throw o.error}async safeParseAsync(n,l){const o={common:{issues:[],contextualErrorMap:l?.errorMap,async:!0},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:yn(n)},d=this._parse({data:n,path:o.path,parent:o}),_=await(_c(d)?d:Promise.resolve(d));return by(o,_)}refine(n,l){const o=d=>typeof l=="string"||typeof l>"u"?{message:l}:typeof l=="function"?l(d):l;return this._refinement((d,_)=>{const w=n(d),c=()=>_.addIssue({code:ye.custom,...o(d)});return typeof Promise<"u"&&w instanceof Promise?w.then(h=>h?!0:(c(),!1)):w?!0:(c(),!1)})}refinement(n,l){return this._refinement((o,d)=>n(o)?!0:(d.addIssue(typeof l=="function"?l(o,d):l),!1))}_refinement(n){return new er({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:l=>this["~validate"](l)}}optional(){return Hi.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _i.create(this)}promise(){return Cc.create(this,this._def)}or(n){return bc.create([this,n],this._def)}and(n){return Sc.create(this,n,this._def)}transform(n){return new er({...Pe(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const l=typeof n=="function"?n:()=>n;return new Ec({...Pe(this._def),innerType:this,defaultValue:l,typeName:Le.ZodDefault})}brand(){return new y0({typeName:Le.ZodBranded,type:this,...Pe(this._def)})}catch(n){const l=typeof n=="function"?n:()=>n;return new Nc({...Pe(this._def),innerType:this,catchValue:l,typeName:Le.ZodCatch})}describe(n){const l=this.constructor;return new l({...this._def,description:n})}pipe(n){return cm.create(this,n)}readonly(){return jc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const LE=/^c[^\s-]{8,}$/i,ME=/^[0-9a-z]+$/,BE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IE=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,HE=/^[a-z0-9_-]{21}$/i,UE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zE=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,$E=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,PE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Rd;const FE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,VE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,KE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,GE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,YE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,g0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ZE=new RegExp(`^${g0}$`);function v0(s){let n="[0-5]\\d";s.precision?n=`${n}\\.\\d{${s.precision}}`:s.precision==null&&(n=`${n}(\\.\\d+)?`);const l=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${n})${l}`}function XE(s){return new RegExp(`^${v0(s)}$`)}function WE(s){let n=`${g0}T${v0(s)}`;const l=[];return l.push(s.local?"Z?":"Z"),s.offset&&l.push("([+-]\\d{2}:?\\d{2})"),n=`${n}(${l.join("|")})`,new RegExp(`^${n}$`)}function QE(s,n){return!!((n==="v4"||!n)&&FE.test(s)||(n==="v6"||!n)&&qE.test(s))}function JE(s,n){if(!UE.test(s))return!1;try{const[l]=s.split(".");if(!l)return!1;const o=l.replace(/-/g,"+").replace(/_/g,"/").padEnd(l.length+(4-l.length%4)%4,"="),d=JSON.parse(atob(o));return!(typeof d!="object"||d===null||"typ"in d&&d?.typ!=="JWT"||!d.alg||n&&d.alg!==n)}catch{return!1}}function e2(s,n){return!!((n==="v4"||!n)&&VE.test(s)||(n==="v6"||!n)&&KE.test(s))}class Ii extends We{_parse(n){if(this._def.coerce&&(n.data=String(n.data)),this._getType(n)!==Ee.string){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_type,expected:Ee.string,received:_.parsedType}),Oe}const o=new cs;let d;for(const _ of this._def.checks)if(_.kind==="min")n.data.length<_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_small,minimum:_.value,type:"string",inclusive:!0,exact:!1,message:_.message}),o.dirty());else if(_.kind==="max")n.data.length>_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_big,maximum:_.value,type:"string",inclusive:!0,exact:!1,message:_.message}),o.dirty());else if(_.kind==="length"){const w=n.data.length>_.value,c=n.data.length<_.value;(w||c)&&(d=this._getOrReturnCtx(n,d),w?xe(d,{code:ye.too_big,maximum:_.value,type:"string",inclusive:!0,exact:!0,message:_.message}):c&&xe(d,{code:ye.too_small,minimum:_.value,type:"string",inclusive:!0,exact:!0,message:_.message}),o.dirty())}else if(_.kind==="email")$E.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"email",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="emoji")Rd||(Rd=new RegExp(PE,"u")),Rd.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"emoji",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="uuid")IE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"uuid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="nanoid")HE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"nanoid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="cuid")LE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"cuid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="cuid2")ME.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"cuid2",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="ulid")BE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"ulid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="url")try{new URL(n.data)}catch{d=this._getOrReturnCtx(n,d),xe(d,{validation:"url",code:ye.invalid_string,message:_.message}),o.dirty()}else _.kind==="regex"?(_.regex.lastIndex=0,_.regex.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"regex",code:ye.invalid_string,message:_.message}),o.dirty())):_.kind==="trim"?n.data=n.data.trim():_.kind==="includes"?n.data.includes(_.value,_.position)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:{includes:_.value,position:_.position},message:_.message}),o.dirty()):_.kind==="toLowerCase"?n.data=n.data.toLowerCase():_.kind==="toUpperCase"?n.data=n.data.toUpperCase():_.kind==="startsWith"?n.data.startsWith(_.value)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:{startsWith:_.value},message:_.message}),o.dirty()):_.kind==="endsWith"?n.data.endsWith(_.value)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:{endsWith:_.value},message:_.message}),o.dirty()):_.kind==="datetime"?WE(_).test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:"datetime",message:_.message}),o.dirty()):_.kind==="date"?ZE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:"date",message:_.message}),o.dirty()):_.kind==="time"?XE(_).test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:"time",message:_.message}),o.dirty()):_.kind==="duration"?zE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"duration",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="ip"?QE(n.data,_.version)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"ip",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="jwt"?JE(n.data,_.alg)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"jwt",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="cidr"?e2(n.data,_.version)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"cidr",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="base64"?GE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"base64",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="base64url"?YE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"base64url",code:ye.invalid_string,message:_.message}),o.dirty()):st.assertNever(_);return{status:o.value,value:n.data}}_regex(n,l,o){return this.refinement(d=>n.test(d),{validation:l,code:ye.invalid_string,...je.errToObj(o)})}_addCheck(n){return new Ii({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",...je.errToObj(n)})}url(n){return this._addCheck({kind:"url",...je.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",...je.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",...je.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",...je.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",...je.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",...je.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",...je.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",...je.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",...je.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",...je.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",...je.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",...je.errToObj(n)})}datetime(n){return typeof n=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n}):this._addCheck({kind:"datetime",precision:typeof n?.precision>"u"?null:n?.precision,offset:n?.offset??!1,local:n?.local??!1,...je.errToObj(n?.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){return typeof n=="string"?this._addCheck({kind:"time",precision:null,message:n}):this._addCheck({kind:"time",precision:typeof n?.precision>"u"?null:n?.precision,...je.errToObj(n?.message)})}duration(n){return this._addCheck({kind:"duration",...je.errToObj(n)})}regex(n,l){return this._addCheck({kind:"regex",regex:n,...je.errToObj(l)})}includes(n,l){return this._addCheck({kind:"includes",value:n,position:l?.position,...je.errToObj(l?.message)})}startsWith(n,l){return this._addCheck({kind:"startsWith",value:n,...je.errToObj(l)})}endsWith(n,l){return this._addCheck({kind:"endsWith",value:n,...je.errToObj(l)})}min(n,l){return this._addCheck({kind:"min",value:n,...je.errToObj(l)})}max(n,l){return this._addCheck({kind:"max",value:n,...je.errToObj(l)})}length(n,l){return this._addCheck({kind:"length",value:n,...je.errToObj(l)})}nonempty(n){return this.min(1,je.errToObj(n))}trim(){return new Ii({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ii({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ii({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(n=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find(n=>n.kind==="date")}get isTime(){return!!this._def.checks.find(n=>n.kind==="time")}get isDuration(){return!!this._def.checks.find(n=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find(n=>n.kind==="email")}get isURL(){return!!this._def.checks.find(n=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find(n=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find(n=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(n=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(n=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(n=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find(n=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find(n=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find(n=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find(n=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find(n=>n.kind==="base64url")}get minLength(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n}get maxLength(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n}}Ii.create=s=>new Ii({checks:[],typeName:Le.ZodString,coerce:s?.coerce??!1,...Pe(s)});function t2(s,n){const l=(s.toString().split(".")[1]||"").length,o=(n.toString().split(".")[1]||"").length,d=l>o?l:o,_=Number.parseInt(s.toFixed(d).replace(".","")),w=Number.parseInt(n.toFixed(d).replace(".",""));return _%w/10**d}class na extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce&&(n.data=Number(n.data)),this._getType(n)!==Ee.number){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_type,expected:Ee.number,received:_.parsedType}),Oe}let o;const d=new cs;for(const _ of this._def.checks)_.kind==="int"?st.isInteger(n.data)||(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.invalid_type,expected:"integer",received:"float",message:_.message}),d.dirty()):_.kind==="min"?(_.inclusive?n.data<_.value:n.data<=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_small,minimum:_.value,type:"number",inclusive:_.inclusive,exact:!1,message:_.message}),d.dirty()):_.kind==="max"?(_.inclusive?n.data>_.value:n.data>=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_big,maximum:_.value,type:"number",inclusive:_.inclusive,exact:!1,message:_.message}),d.dirty()):_.kind==="multipleOf"?t2(n.data,_.value)!==0&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.not_multiple_of,multipleOf:_.value,message:_.message}),d.dirty()):_.kind==="finite"?Number.isFinite(n.data)||(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.not_finite,message:_.message}),d.dirty()):st.assertNever(_);return{status:d.value,value:n.data}}gte(n,l){return this.setLimit("min",n,!0,je.toString(l))}gt(n,l){return this.setLimit("min",n,!1,je.toString(l))}lte(n,l){return this.setLimit("max",n,!0,je.toString(l))}lt(n,l){return this.setLimit("max",n,!1,je.toString(l))}setLimit(n,l,o,d){return new na({...this._def,checks:[...this._def.checks,{kind:n,value:l,inclusive:o,message:je.toString(d)}]})}_addCheck(n){return new na({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:je.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:je.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:je.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:je.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:je.toString(n)})}multipleOf(n,l){return this._addCheck({kind:"multipleOf",value:n,message:je.toString(l)})}finite(n){return this._addCheck({kind:"finite",message:je.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:je.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:je.toString(n)})}get minValue(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n}get maxValue(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n}get isInt(){return!!this._def.checks.find(n=>n.kind==="int"||n.kind==="multipleOf"&&st.isInteger(n.value))}get isFinite(){let n=null,l=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(l===null||o.value>l)&&(l=o.value):o.kind==="max"&&(n===null||o.value<n)&&(n=o.value)}return Number.isFinite(l)&&Number.isFinite(n)}}na.create=s=>new na({checks:[],typeName:Le.ZodNumber,coerce:s?.coerce||!1,...Pe(s)});class gl extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch{return this._getInvalidInput(n)}if(this._getType(n)!==Ee.bigint)return this._getInvalidInput(n);let o;const d=new cs;for(const _ of this._def.checks)_.kind==="min"?(_.inclusive?n.data<_.value:n.data<=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_small,type:"bigint",minimum:_.value,inclusive:_.inclusive,message:_.message}),d.dirty()):_.kind==="max"?(_.inclusive?n.data>_.value:n.data>=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_big,type:"bigint",maximum:_.value,inclusive:_.inclusive,message:_.message}),d.dirty()):_.kind==="multipleOf"?n.data%_.value!==BigInt(0)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.not_multiple_of,multipleOf:_.value,message:_.message}),d.dirty()):st.assertNever(_);return{status:d.value,value:n.data}}_getInvalidInput(n){const l=this._getOrReturnCtx(n);return xe(l,{code:ye.invalid_type,expected:Ee.bigint,received:l.parsedType}),Oe}gte(n,l){return this.setLimit("min",n,!0,je.toString(l))}gt(n,l){return this.setLimit("min",n,!1,je.toString(l))}lte(n,l){return this.setLimit("max",n,!0,je.toString(l))}lt(n,l){return this.setLimit("max",n,!1,je.toString(l))}setLimit(n,l,o,d){return new gl({...this._def,checks:[...this._def.checks,{kind:n,value:l,inclusive:o,message:je.toString(d)}]})}_addCheck(n){return new gl({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:je.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:je.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:je.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:je.toString(n)})}multipleOf(n,l){return this._addCheck({kind:"multipleOf",value:n,message:je.toString(l)})}get minValue(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n}get maxValue(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n}}gl.create=s=>new gl({checks:[],typeName:Le.ZodBigInt,coerce:s?.coerce??!1,...Pe(s)});class Sf extends We{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==Ee.boolean){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.boolean,received:o.parsedType}),Oe}return Ks(n.data)}}Sf.create=s=>new Sf({typeName:Le.ZodBoolean,coerce:s?.coerce||!1,...Pe(s)});class yc extends We{_parse(n){if(this._def.coerce&&(n.data=new Date(n.data)),this._getType(n)!==Ee.date){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_type,expected:Ee.date,received:_.parsedType}),Oe}if(Number.isNaN(n.data.getTime())){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_date}),Oe}const o=new cs;let d;for(const _ of this._def.checks)_.kind==="min"?n.data.getTime()<_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_small,message:_.message,inclusive:!0,exact:!1,minimum:_.value,type:"date"}),o.dirty()):_.kind==="max"?n.data.getTime()>_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_big,message:_.message,inclusive:!0,exact:!1,maximum:_.value,type:"date"}),o.dirty()):st.assertNever(_);return{status:o.value,value:new Date(n.data.getTime())}}_addCheck(n){return new yc({...this._def,checks:[...this._def.checks,n]})}min(n,l){return this._addCheck({kind:"min",value:n.getTime(),message:je.toString(l)})}max(n,l){return this._addCheck({kind:"max",value:n.getTime(),message:je.toString(l)})}get minDate(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n!=null?new Date(n):null}get maxDate(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n!=null?new Date(n):null}}yc.create=s=>new yc({checks:[],coerce:s?.coerce||!1,typeName:Le.ZodDate,...Pe(s)});class Sy extends We{_parse(n){if(this._getType(n)!==Ee.symbol){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.symbol,received:o.parsedType}),Oe}return Ks(n.data)}}Sy.create=s=>new Sy({typeName:Le.ZodSymbol,...Pe(s)});class xf extends We{_parse(n){if(this._getType(n)!==Ee.undefined){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.undefined,received:o.parsedType}),Oe}return Ks(n.data)}}xf.create=s=>new xf({typeName:Le.ZodUndefined,...Pe(s)});class wf extends We{_parse(n){if(this._getType(n)!==Ee.null){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.null,received:o.parsedType}),Oe}return Ks(n.data)}}wf.create=s=>new wf({typeName:Le.ZodNull,...Pe(s)});class xy extends We{constructor(){super(...arguments),this._any=!0}_parse(n){return Ks(n.data)}}xy.create=s=>new xy({typeName:Le.ZodAny,...Pe(s)});class Cf extends We{constructor(){super(...arguments),this._unknown=!0}_parse(n){return Ks(n.data)}}Cf.create=s=>new Cf({typeName:Le.ZodUnknown,...Pe(s)});class wn extends We{_parse(n){const l=this._getOrReturnCtx(n);return xe(l,{code:ye.invalid_type,expected:Ee.never,received:l.parsedType}),Oe}}wn.create=s=>new wn({typeName:Le.ZodNever,...Pe(s)});class wy extends We{_parse(n){if(this._getType(n)!==Ee.undefined){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.void,received:o.parsedType}),Oe}return Ks(n.data)}}wy.create=s=>new wy({typeName:Le.ZodVoid,...Pe(s)});class _i extends We{_parse(n){const{ctx:l,status:o}=this._processInputParams(n),d=this._def;if(l.parsedType!==Ee.array)return xe(l,{code:ye.invalid_type,expected:Ee.array,received:l.parsedType}),Oe;if(d.exactLength!==null){const w=l.data.length>d.exactLength.value,c=l.data.length<d.exactLength.value;(w||c)&&(xe(l,{code:w?ye.too_big:ye.too_small,minimum:c?d.exactLength.value:void 0,maximum:w?d.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:d.exactLength.message}),o.dirty())}if(d.minLength!==null&&l.data.length<d.minLength.value&&(xe(l,{code:ye.too_small,minimum:d.minLength.value,type:"array",inclusive:!0,exact:!1,message:d.minLength.message}),o.dirty()),d.maxLength!==null&&l.data.length>d.maxLength.value&&(xe(l,{code:ye.too_big,maximum:d.maxLength.value,type:"array",inclusive:!0,exact:!1,message:d.maxLength.message}),o.dirty()),l.common.async)return Promise.all([...l.data].map((w,c)=>d.type._parseAsync(new yi(l,w,l.path,c)))).then(w=>cs.mergeArray(o,w));const _=[...l.data].map((w,c)=>d.type._parseSync(new yi(l,w,l.path,c)));return cs.mergeArray(o,_)}get element(){return this._def.type}min(n,l){return new _i({...this._def,minLength:{value:n,message:je.toString(l)}})}max(n,l){return new _i({...this._def,maxLength:{value:n,message:je.toString(l)}})}length(n,l){return new _i({...this._def,exactLength:{value:n,message:je.toString(l)}})}nonempty(n){return this.min(1,n)}}_i.create=(s,n)=>new _i({type:s,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...Pe(n)});function Qr(s){if(s instanceof Lt){const n={};for(const l in s.shape){const o=s.shape[l];n[l]=Hi.create(Qr(o))}return new Lt({...s._def,shape:()=>n})}else return s instanceof _i?new _i({...s._def,type:Qr(s.element)}):s instanceof Hi?Hi.create(Qr(s.unwrap())):s instanceof tr?tr.create(Qr(s.unwrap())):s instanceof Qn?Qn.create(s.items.map(n=>Qr(n))):s}class Lt extends We{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const n=this._def.shape(),l=st.objectKeys(n);return this._cached={shape:n,keys:l},this._cached}_parse(n){if(this._getType(n)!==Ee.object){const y=this._getOrReturnCtx(n);return xe(y,{code:ye.invalid_type,expected:Ee.object,received:y.parsedType}),Oe}const{status:o,ctx:d}=this._processInputParams(n),{shape:_,keys:w}=this._getCached(),c=[];if(!(this._def.catchall instanceof wn&&this._def.unknownKeys==="strip"))for(const y in d.data)w.includes(y)||c.push(y);const h=[];for(const y of w){const p=_[y],f=d.data[y];h.push({key:{status:"valid",value:y},value:p._parse(new yi(d,f,d.path,y)),alwaysSet:y in d.data})}if(this._def.catchall instanceof wn){const y=this._def.unknownKeys;if(y==="passthrough")for(const p of c)h.push({key:{status:"valid",value:p},value:{status:"valid",value:d.data[p]}});else if(y==="strict")c.length>0&&(xe(d,{code:ye.unrecognized_keys,keys:c}),o.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const p of c){const f=d.data[p];h.push({key:{status:"valid",value:p},value:y._parse(new yi(d,f,d.path,p)),alwaysSet:p in d.data})}}return d.common.async?Promise.resolve().then(async()=>{const y=[];for(const p of h){const f=await p.key,x=await p.value;y.push({key:f,value:x,alwaysSet:p.alwaysSet})}return y}).then(y=>cs.mergeObjectSync(o,y)):cs.mergeObjectSync(o,h)}get shape(){return this._def.shape()}strict(n){return je.errToObj,new Lt({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(l,o)=>{const d=this._def.errorMap?.(l,o).message??o.defaultError;return l.code==="unrecognized_keys"?{message:je.errToObj(n).message??d}:{message:d}}}:{}})}strip(){return new Lt({...this._def,unknownKeys:"strip"})}passthrough(){return new Lt({...this._def,unknownKeys:"passthrough"})}extend(n){return new Lt({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new Lt({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:Le.ZodObject})}setKey(n,l){return this.augment({[n]:l})}catchall(n){return new Lt({...this._def,catchall:n})}pick(n){const l={};for(const o of st.objectKeys(n))n[o]&&this.shape[o]&&(l[o]=this.shape[o]);return new Lt({...this._def,shape:()=>l})}omit(n){const l={};for(const o of st.objectKeys(this.shape))n[o]||(l[o]=this.shape[o]);return new Lt({...this._def,shape:()=>l})}deepPartial(){return Qr(this)}partial(n){const l={};for(const o of st.objectKeys(this.shape)){const d=this.shape[o];n&&!n[o]?l[o]=d:l[o]=d.optional()}return new Lt({...this._def,shape:()=>l})}required(n){const l={};for(const o of st.objectKeys(this.shape))if(n&&!n[o])l[o]=this.shape[o];else{let _=this.shape[o];for(;_ instanceof Hi;)_=_._def.innerType;l[o]=_}return new Lt({...this._def,shape:()=>l})}keyof(){return _0(st.objectKeys(this.shape))}}Lt.create=(s,n)=>new Lt({shape:()=>s,unknownKeys:"strip",catchall:wn.create(),typeName:Le.ZodObject,...Pe(n)});Lt.strictCreate=(s,n)=>new Lt({shape:()=>s,unknownKeys:"strict",catchall:wn.create(),typeName:Le.ZodObject,...Pe(n)});Lt.lazycreate=(s,n)=>new Lt({shape:s,unknownKeys:"strip",catchall:wn.create(),typeName:Le.ZodObject,...Pe(n)});class bc extends We{_parse(n){const{ctx:l}=this._processInputParams(n),o=this._def.options;function d(_){for(const c of _)if(c.result.status==="valid")return c.result;for(const c of _)if(c.result.status==="dirty")return l.common.issues.push(...c.ctx.common.issues),c.result;const w=_.map(c=>new zi(c.ctx.common.issues));return xe(l,{code:ye.invalid_union,unionErrors:w}),Oe}if(l.common.async)return Promise.all(o.map(async _=>{const w={...l,common:{...l.common,issues:[]},parent:null};return{result:await _._parseAsync({data:l.data,path:l.path,parent:w}),ctx:w}})).then(d);{let _;const w=[];for(const h of o){const y={...l,common:{...l.common,issues:[]},parent:null},p=h._parseSync({data:l.data,path:l.path,parent:y});if(p.status==="valid")return p;p.status==="dirty"&&!_&&(_={result:p,ctx:y}),y.common.issues.length&&w.push(y.common.issues)}if(_)return l.common.issues.push(..._.ctx.common.issues),_.result;const c=w.map(h=>new zi(h));return xe(l,{code:ye.invalid_union,unionErrors:c}),Oe}}get options(){return this._def.options}}bc.create=(s,n)=>new bc({options:s,typeName:Le.ZodUnion,...Pe(n)});const Bi=s=>s instanceof Nf?Bi(s.schema):s instanceof er?Bi(s.innerType()):s instanceof wc?[s.value]:s instanceof Jn?s.options:s instanceof jf?st.objectValues(s.enum):s instanceof Ec?Bi(s._def.innerType):s instanceof xf?[void 0]:s instanceof wf?[null]:s instanceof Hi?[void 0,...Bi(s.unwrap())]:s instanceof tr?[null,...Bi(s.unwrap())]:s instanceof y0||s instanceof jc?Bi(s.unwrap()):s instanceof Nc?Bi(s._def.innerType):[];class om extends We{_parse(n){const{ctx:l}=this._processInputParams(n);if(l.parsedType!==Ee.object)return xe(l,{code:ye.invalid_type,expected:Ee.object,received:l.parsedType}),Oe;const o=this.discriminator,d=l.data[o],_=this.optionsMap.get(d);return _?l.common.async?_._parseAsync({data:l.data,path:l.path,parent:l}):_._parseSync({data:l.data,path:l.path,parent:l}):(xe(l,{code:ye.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),Oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,l,o){const d=new Map;for(const _ of l){const w=Bi(_.shape[n]);if(!w.length)throw new Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(const c of w){if(d.has(c))throw new Error(`Discriminator property ${String(n)} has duplicate value ${String(c)}`);d.set(c,_)}}return new om({typeName:Le.ZodDiscriminatedUnion,discriminator:n,options:l,optionsMap:d,...Pe(o)})}}function Ef(s,n){const l=yn(s),o=yn(n);if(s===n)return{valid:!0,data:s};if(l===Ee.object&&o===Ee.object){const d=st.objectKeys(n),_=st.objectKeys(s).filter(c=>d.indexOf(c)!==-1),w={...s,...n};for(const c of _){const h=Ef(s[c],n[c]);if(!h.valid)return{valid:!1};w[c]=h.data}return{valid:!0,data:w}}else if(l===Ee.array&&o===Ee.array){if(s.length!==n.length)return{valid:!1};const d=[];for(let _=0;_<s.length;_++){const w=s[_],c=n[_],h=Ef(w,c);if(!h.valid)return{valid:!1};d.push(h.data)}return{valid:!0,data:d}}else return l===Ee.date&&o===Ee.date&&+s==+n?{valid:!0,data:s}:{valid:!1}}class Sc extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n),d=(_,w)=>{if(_y(_)||_y(w))return Oe;const c=Ef(_.value,w.value);return c.valid?((yy(_)||yy(w))&&l.dirty(),{status:l.value,value:c.data}):(xe(o,{code:ye.invalid_intersection_types}),Oe)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([_,w])=>d(_,w)):d(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}Sc.create=(s,n,l)=>new Sc({left:s,right:n,typeName:Le.ZodIntersection,...Pe(l)});class Qn extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.array)return xe(o,{code:ye.invalid_type,expected:Ee.array,received:o.parsedType}),Oe;if(o.data.length<this._def.items.length)return xe(o,{code:ye.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;!this._def.rest&&o.data.length>this._def.items.length&&(xe(o,{code:ye.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.dirty());const _=[...o.data].map((w,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new yi(o,w,o.path,c)):null}).filter(w=>!!w);return o.common.async?Promise.all(_).then(w=>cs.mergeArray(l,w)):cs.mergeArray(l,_)}get items(){return this._def.items}rest(n){return new Qn({...this._def,rest:n})}}Qn.create=(s,n)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qn({items:s,typeName:Le.ZodTuple,rest:null,...Pe(n)})};class xc extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.object)return xe(o,{code:ye.invalid_type,expected:Ee.object,received:o.parsedType}),Oe;const d=[],_=this._def.keyType,w=this._def.valueType;for(const c in o.data)d.push({key:_._parse(new yi(o,c,o.path,c)),value:w._parse(new yi(o,o.data[c],o.path,c)),alwaysSet:c in o.data});return o.common.async?cs.mergeObjectAsync(l,d):cs.mergeObjectSync(l,d)}get element(){return this._def.valueType}static create(n,l,o){return l instanceof We?new xc({keyType:n,valueType:l,typeName:Le.ZodRecord,...Pe(o)}):new xc({keyType:Ii.create(),valueType:n,typeName:Le.ZodRecord,...Pe(l)})}}class Cy extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.map)return xe(o,{code:ye.invalid_type,expected:Ee.map,received:o.parsedType}),Oe;const d=this._def.keyType,_=this._def.valueType,w=[...o.data.entries()].map(([c,h],y)=>({key:d._parse(new yi(o,c,o.path,[y,"key"])),value:_._parse(new yi(o,h,o.path,[y,"value"]))}));if(o.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of w){const y=await h.key,p=await h.value;if(y.status==="aborted"||p.status==="aborted")return Oe;(y.status==="dirty"||p.status==="dirty")&&l.dirty(),c.set(y.value,p.value)}return{status:l.value,value:c}})}else{const c=new Map;for(const h of w){const y=h.key,p=h.value;if(y.status==="aborted"||p.status==="aborted")return Oe;(y.status==="dirty"||p.status==="dirty")&&l.dirty(),c.set(y.value,p.value)}return{status:l.value,value:c}}}}Cy.create=(s,n,l)=>new Cy({valueType:n,keyType:s,typeName:Le.ZodMap,...Pe(l)});class vl extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.set)return xe(o,{code:ye.invalid_type,expected:Ee.set,received:o.parsedType}),Oe;const d=this._def;d.minSize!==null&&o.data.size<d.minSize.value&&(xe(o,{code:ye.too_small,minimum:d.minSize.value,type:"set",inclusive:!0,exact:!1,message:d.minSize.message}),l.dirty()),d.maxSize!==null&&o.data.size>d.maxSize.value&&(xe(o,{code:ye.too_big,maximum:d.maxSize.value,type:"set",inclusive:!0,exact:!1,message:d.maxSize.message}),l.dirty());const _=this._def.valueType;function w(h){const y=new Set;for(const p of h){if(p.status==="aborted")return Oe;p.status==="dirty"&&l.dirty(),y.add(p.value)}return{status:l.value,value:y}}const c=[...o.data.values()].map((h,y)=>_._parse(new yi(o,h,o.path,y)));return o.common.async?Promise.all(c).then(h=>w(h)):w(c)}min(n,l){return new vl({...this._def,minSize:{value:n,message:je.toString(l)}})}max(n,l){return new vl({...this._def,maxSize:{value:n,message:je.toString(l)}})}size(n,l){return this.min(n,l).max(n,l)}nonempty(n){return this.min(1,n)}}vl.create=(s,n)=>new vl({valueType:s,minSize:null,maxSize:null,typeName:Le.ZodSet,...Pe(n)});class Nf extends We{get schema(){return this._def.getter()}_parse(n){const{ctx:l}=this._processInputParams(n);return this._def.getter()._parse({data:l.data,path:l.path,parent:l})}}Nf.create=(s,n)=>new Nf({getter:s,typeName:Le.ZodLazy,...Pe(n)});class wc extends We{_parse(n){if(n.data!==this._def.value){const l=this._getOrReturnCtx(n);return xe(l,{received:l.data,code:ye.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:n.data}}get value(){return this._def.value}}wc.create=(s,n)=>new wc({value:s,typeName:Le.ZodLiteral,...Pe(n)});function _0(s,n){return new Jn({values:s,typeName:Le.ZodEnum,...Pe(n)})}class Jn extends We{_parse(n){if(typeof n.data!="string"){const l=this._getOrReturnCtx(n),o=this._def.values;return xe(l,{expected:st.joinValues(o),received:l.parsedType,code:ye.invalid_type}),Oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(n.data)){const l=this._getOrReturnCtx(n),o=this._def.values;return xe(l,{received:l.data,code:ye.invalid_enum_value,options:o}),Oe}return Ks(n.data)}get options(){return this._def.values}get enum(){const n={};for(const l of this._def.values)n[l]=l;return n}get Values(){const n={};for(const l of this._def.values)n[l]=l;return n}get Enum(){const n={};for(const l of this._def.values)n[l]=l;return n}extract(n,l=this._def){return Jn.create(n,{...this._def,...l})}exclude(n,l=this._def){return Jn.create(this.options.filter(o=>!n.includes(o)),{...this._def,...l})}}Jn.create=_0;class jf extends We{_parse(n){const l=st.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(n);if(o.parsedType!==Ee.string&&o.parsedType!==Ee.number){const d=st.objectValues(l);return xe(o,{expected:st.joinValues(d),received:o.parsedType,code:ye.invalid_type}),Oe}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const d=st.objectValues(l);return xe(o,{received:o.data,code:ye.invalid_enum_value,options:d}),Oe}return Ks(n.data)}get enum(){return this._def.values}}jf.create=(s,n)=>new jf({values:s,typeName:Le.ZodNativeEnum,...Pe(n)});class Cc extends We{unwrap(){return this._def.type}_parse(n){const{ctx:l}=this._processInputParams(n);if(l.parsedType!==Ee.promise&&l.common.async===!1)return xe(l,{code:ye.invalid_type,expected:Ee.promise,received:l.parsedType}),Oe;const o=l.parsedType===Ee.promise?l.data:Promise.resolve(l.data);return Ks(o.then(d=>this._def.type.parseAsync(d,{path:l.path,errorMap:l.common.contextualErrorMap})))}}Cc.create=(s,n)=>new Cc({type:s,typeName:Le.ZodPromise,...Pe(n)});class er extends We{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){const{status:l,ctx:o}=this._processInputParams(n),d=this._def.effect||null,_={addIssue:w=>{xe(o,w),w.fatal?l.abort():l.dirty()},get path(){return o.path}};if(_.addIssue=_.addIssue.bind(_),d.type==="preprocess"){const w=d.transform(o.data,_);if(o.common.async)return Promise.resolve(w).then(async c=>{if(l.value==="aborted")return Oe;const h=await this._def.schema._parseAsync({data:c,path:o.path,parent:o});return h.status==="aborted"?Oe:h.status==="dirty"||l.value==="dirty"?fl(h.value):h});{if(l.value==="aborted")return Oe;const c=this._def.schema._parseSync({data:w,path:o.path,parent:o});return c.status==="aborted"?Oe:c.status==="dirty"||l.value==="dirty"?fl(c.value):c}}if(d.type==="refinement"){const w=c=>{const h=d.refinement(c,_);if(o.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(o.common.async===!1){const c=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return c.status==="aborted"?Oe:(c.status==="dirty"&&l.dirty(),w(c.value),{status:l.value,value:c.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(c=>c.status==="aborted"?Oe:(c.status==="dirty"&&l.dirty(),w(c.value).then(()=>({status:l.value,value:c.value}))))}if(d.type==="transform")if(o.common.async===!1){const w=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!ia(w))return Oe;const c=d.transform(w.value,_);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:l.value,value:c}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(w=>ia(w)?Promise.resolve(d.transform(w.value,_)).then(c=>({status:l.value,value:c})):Oe);st.assertNever(d)}}er.create=(s,n,l)=>new er({schema:s,typeName:Le.ZodEffects,effect:n,...Pe(l)});er.createWithPreprocess=(s,n,l)=>new er({schema:n,effect:{type:"preprocess",transform:s},typeName:Le.ZodEffects,...Pe(l)});class Hi extends We{_parse(n){return this._getType(n)===Ee.undefined?Ks(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Hi.create=(s,n)=>new Hi({innerType:s,typeName:Le.ZodOptional,...Pe(n)});class tr extends We{_parse(n){return this._getType(n)===Ee.null?Ks(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}tr.create=(s,n)=>new tr({innerType:s,typeName:Le.ZodNullable,...Pe(n)});class Ec extends We{_parse(n){const{ctx:l}=this._processInputParams(n);let o=l.data;return l.parsedType===Ee.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:l.path,parent:l})}removeDefault(){return this._def.innerType}}Ec.create=(s,n)=>new Ec({innerType:s,typeName:Le.ZodDefault,defaultValue:typeof n.default=="function"?n.default:()=>n.default,...Pe(n)});class Nc extends We{_parse(n){const{ctx:l}=this._processInputParams(n),o={...l,common:{...l.common,issues:[]}},d=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return _c(d)?d.then(_=>({status:"valid",value:_.status==="valid"?_.value:this._def.catchValue({get error(){return new zi(o.common.issues)},input:o.data})})):{status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new zi(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Nc.create=(s,n)=>new Nc({innerType:s,typeName:Le.ZodCatch,catchValue:typeof n.catch=="function"?n.catch:()=>n.catch,...Pe(n)});class Ey extends We{_parse(n){if(this._getType(n)!==Ee.nan){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.nan,received:o.parsedType}),Oe}return{status:"valid",value:n.data}}}Ey.create=s=>new Ey({typeName:Le.ZodNaN,...Pe(s)});class y0 extends We{_parse(n){const{ctx:l}=this._processInputParams(n),o=l.data;return this._def.type._parse({data:o,path:l.path,parent:l})}unwrap(){return this._def.type}}class cm extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.common.async)return(async()=>{const _=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return _.status==="aborted"?Oe:_.status==="dirty"?(l.dirty(),fl(_.value)):this._def.out._parseAsync({data:_.value,path:o.path,parent:o})})();{const d=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return d.status==="aborted"?Oe:d.status==="dirty"?(l.dirty(),{status:"dirty",value:d.value}):this._def.out._parseSync({data:d.value,path:o.path,parent:o})}}static create(n,l){return new cm({in:n,out:l,typeName:Le.ZodPipeline})}}class jc extends We{_parse(n){const l=this._def.innerType._parse(n),o=d=>(ia(d)&&(d.value=Object.freeze(d.value)),d);return _c(l)?l.then(d=>o(d)):o(l)}unwrap(){return this._def.innerType}}jc.create=(s,n)=>new jc({innerType:s,typeName:Le.ZodReadonly,...Pe(n)});var Le;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(Le||(Le={}));const le=Ii.create,ke=na.create,Ve=Sf.create,Jr=Cf.create;wn.create;const vs=_i.create,fe=Lt.create,b0=bc.create,s2=om.create;Sc.create;Qn.create;const Dd=xc.create,_l=wc.create,Qt=Jn.create;Cc.create;Hi.create;tr.create;fe({id:ke().int().nonnegative(),method:le().min(1),params:Jr().optional()});const i2=fe({code:le(),message:le(),detail:le().optional()});b0([fe({id:ke(),result:Jr()}),fe({id:ke(),error:i2})]);fe({event:le(),data:Jr().optional()});const S0=s2("kind",[fe({kind:_l("key"),privateKey:le().min(1).max(64*1024),passphrase:le().max(1024).optional()}),fe({kind:_l("password"),password:le().max(1024)})]),x0=/^[a-z_][a-z0-9_-]{0,31}$/,w0=/^(\[[0-9a-fA-F:.]+\]|[0-9a-fA-F:.]+|[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*)$/,Tf=le().min(1).max(255).regex(w0,"Not an IP address or host name"),n2=le().regex(x0,"Not a valid user name"),et=fe({host:Tf,port:ke().int().min(1).max(65535),username:n2,auth:S0}),um=9922,r2="prisoner",yl=22,Ny="root",a2=9991,Vs={PassphraseRequired:"passphrase_required",BadPassphrase:"bad_passphrase",BadKey:"bad_key",KeyNotFound:"key_not_found",KeyServerUnreachable:"key_server_unreachable",Unreachable:"ssh_unreachable",AuthFailed:"ssh_auth_failed",Timeout:"ssh_timeout"},rc=le().min(1).max(255).regex(/^[\w.-]+$/,"Not a valid app id"),l2=fe({id:le(),title:le().optional(),version:le().optional(),type:le().optional(),vendor:le().optional(),folderPath:le().optional(),icon:le().optional(),systemApp:Ve().optional(),removable:Ve().optional(),visible:Ve().optional()}).passthrough(),kf="org.webosbrew.hbchannel",Rf=512*1024*1024,o2=4*1024*1024,c2=fe({opId:le(),stage:Qt(["upload","verify","install","remove","cleanup"]),percent:ke().min(0).max(100).optional(),text:le().optional()}),u2="op.progress",ac={InstallFailed:"install_failed",InsufficientSpace:"insufficient_space",ChecksumMismatch:"checksum_mismatch",Conflict:"app_conflict"},h2=fe({id:le(),phase:Qt(["start","end"]),target:le(),command:le(),kind:Qt(["exec","stream","sftp","tunnel","http"]),quiet:Ve().optional(),at:ke(),exitCode:ke().nullable().optional(),durationMs:ke().optional(),output:le().optional(),error:le().optional()}),d2="cmd.log",f2=fe({opId:le(),stream:Qt(["stdout","stderr"]),data:le()}),m2="cmd.output",p2=fe({host:le(),name:le().optional(),modelName:le().optional(),ports:fe({ssh22:Ve(),ssh9922:Ve(),keyServer:Ve(),webos:Ve()}),via:vs(Qt(["ssdp","sweep"]))}),ra=le().max(2048).refine(s=>{try{const n=new URL(s).protocol;return n==="https:"||n==="http:"}catch{return!1}},"Not an http(s) URL"),jy=fe({id:le(),version:le(),type:le().optional(),title:le().optional(),appDescription:le().optional(),sourceUrl:ra.optional(),rootRequired:b0([Ve(),_l("optional")]).optional(),ipkUrl:ra,ipkHash:fe({sha256:le().regex(/^[0-9a-f]{64}$/i)}).optional(),ipkSize:ke().nonnegative().optional()}),g2=fe({url:ra,caption:le().optional(),width:ke().optional(),height:ke().optional()}),v2=fe({id:le(),title:le(),iconUri:ra.optional(),detailIconUri:ra.optional(),shortDescription:le().optional(),featured:Ve().optional(),manifest:jy.optional(),manifestBeta:jy.optional(),requirements:fe({webosRelease:le().optional(),deviceSoC:vs(le()).optional()}).optional(),screenshots:vs(g2).optional(),hasDescription:Ve()}),Ty={Unreachable:"repo_unreachable",DownloadFailed:"download_failed"},Js=le().min(1).max(4096).refine(s=>s.startsWith("/")&&!s.split("/").includes("..")&&!s.includes("\0"),"Not an absolute path"),Ad=le().min(1).max(255).refine(s=>!s.includes("/")&&!s.includes("\0")&&s!=="."&&s!=="..","Not a valid file name"),_2=fe({name:le(),type:Qt(["d","-","l","c","b","p","s","?"]),mode:le(),size:ke(),mtime:ke(),user:le().optional(),group:le().optional(),link:fe({target:le().optional(),broken:Ve().optional(),type:Qt(["d","-","l","c","b","p","s","?"]).optional()}).optional(),access:fe({read:Ve(),write:Ve(),execute:Ve()}).optional()}),Df=4*1024*1024,Od=64*1024,y2=fe({shellId:le(),data:le(),stream:Qt(["stdout","stderr"]).optional()}),b2="shell.output",S2=fe({shellId:le(),code:ke().nullable().optional(),signal:le().optional(),error:le().optional()}),x2="shell.exit",w2=Qt(["syslog","dmesg","lsmonitor"]),C2=fe({opId:le(),lines:vs(le()),dropped:ke().int().optional()}),E2="logs.lines",N2=Qt(["none","debug","info","notice","warning","err","crit","alert","emerg"]),C0=le().min(1).max(128).regex(/^[\w.\-<>*]+$/,"Not a log context name"),j2=fe({name:le(),path:le(),size:ke(),mtime:ke().optional(),writable:Ve()}),T2="org.litefin.app",Af="https://github.com/MoazSalem/litefin/releases",k2=5,E0=le().min(1).max(64).regex(/^[A-Za-z0-9][\w.-]*$/,"Not a variant name"),R2=fe({variant:E0,name:le(),size:ke(),sha256:le().optional()}),D2=fe({tag:le(),version:le(),title:le(),publishedAt:le(),assets:vs(R2)}),A2={Unreachable:"litefin_unreachable"},O2=8,L2=le().regex(/^[A-Za-z0-9+/]*={0,2}$/,"Not base64"),Tc=5199;fe({token:le().min(1),protocolVersion:ke().int(),client:le().optional()}),fe({protocolVersion:ke().int(),bridgeVersion:le(),platform:le()}),fe({}).optional(),fe({now:ke()}),fe({host:Tf}),fe({ssh22:Ve(),ssh9922:Ve(),keyServer:Ve(),webos:Ve()}),fe({timeoutMs:ke().int().min(500).max(15e3).optional()}).optional(),fe({tvs:vs(p2)}),fe({host:Tf,passphrase:le().max(1024).optional()}),fe({privateKey:le(),fingerprint:le()}),fe({privateKey:le().min(1).max(64*1024),passphrase:le().max(1024).optional()}),fe({fingerprint:le(),type:le()}),fe({device:et}),fe({latencyMs:ke(),root:Ve()}),fe({device:et,quiet:Ve().optional()}),fe({modelName:le().optional(),osVersion:le().optional(),firmwareVersion:le().optional(),otaId:le().optional(),socName:le().optional()}),fe({device:et,path:Js.optional()}),fe({total:ke(),used:ke(),available:ke()}).nullable(),fe({comment:le().max(64).optional()}),fe({privateKey:le(),publicKey:le(),fingerprint:le()}),fe({device:et.optional()}),fe({closed:ke()}),fe({device:et,command:le().min(1).max(64*1024),stdin:le().max(4*1024*1024).optional(),timeoutMs:ke().int().min(100).max(6e5).optional()}),fe({stdout:le(),stderr:le(),exitCode:ke().nullable()}),fe({device:et,command:le().min(1).max(8192),opId:le().max(64)}),fe({exitCode:ke().nullable(),cancelled:Ve()}),fe({opId:le().max(64)}),fe({cancelled:Ve()}),fe({device:et,uri:le().regex(/^luna:\/\/[\w.\-/]+$/,"Not a luna:// URI"),params:Dd(Jr()).optional(),public:Ve().optional(),falseAsError:Ve().optional()}),Dd(Jr()),fe({device:et}),fe({apps:vs(l2)}),fe({device:et,id:rc,params:Dd(Jr()).optional()}),fe({}),fe({device:et,path:Js}),fe({mime:le(),base64:le()}),fe({device:et,id:rc,opId:le().max(64)}),fe({}),fe({device:et,uploadId:le().max(64),opId:le().max(64)}),fe({appId:le().optional(),via:Qt(["devmode","hbchannel"])}),fe({name:le().min(1).max(255),size:ke().int().min(1).max(Rf)}),fe({uploadId:le()}),fe({uploadId:le().max(64),offset:ke().int().min(0),data:L2.max(Math.ceil(o2/3)*4)}),fe({received:ke()}),fe({uploadId:le().max(64)}),fe({}),fe({device:et}),fe({token:le().optional(),remaining:le().optional(),problem:le().optional()}),fe({device:et}),fe({}),fe({device:et,method:Qt(["DISPLAY","VIDEO","GRAPHIC"]).default("DISPLAY")}),fe({mime:le(),base64:le()}),fe({device:et}),fe({path:le()}),fe({device:et,path:Js}),fe({path:le(),items:vs(_2)}),fe({device:et,path:Js}),fe({device:et,path:Js,offset:ke().int().min(0),length:ke().int().min(1).max(Df)}),fe({data:le(),eof:Ve()}),fe({device:et,path:Js,uploadId:le().max(64),opId:le().max(64),overwrite:Ve().optional()}),fe({size:ke()}),fe({device:et,parent:Js,name:Ad}),fe({path:le()}),fe({device:et,parent:Js,from:Ad,to:Ad}),fe({path:le()}),fe({device:et,path:Js}),fe({}),fe({device:et,rows:ke().int().min(2).max(500),cols:ke().int().min(10).max(1e3),pty:Ve().optional()}),fe({shellId:le(),pty:Ve(),title:le()}),fe({shellId:le().max(64),data:le().max(1024*1024)}),fe({}),fe({shellId:le().max(64),rows:ke().int().min(2).max(500),cols:ke().int().min(10).max(1e3)}),fe({}),fe({shellId:le().max(64),bytes:ke().int().min(0)}),fe({}),fe({shellId:le().max(64)}),fe({}),fe({refresh:Ve().optional()}),fe({packages:vs(v2),fetchedAt:ke()}),fe({url:ra}),fe({mime:le(),base64:le()}),fe({id:rc}),fe({html:le().nullable(),baseUrl:le().optional()}),fe({device:et,id:rc,channel:Qt(["stable","beta"]).default("stable"),opId:le().max(64)}),fe({appId:le(),version:le(),via:Qt(["devmode","hbchannel"])}),fe({device:et,quiet:Ve().optional()}),fe({installed:Ve(),root:Ve().optional()}),fe({device:et,source:w2,opId:le().min(1).max(64),lines:ke().int().min(0).max(5e3).optional()}),fe({exitCode:ke().nullable(),stopped:Ve()}),fe({opId:le().max(64)}),fe({stopped:Ve()}),fe({device:et,source:Qt(["syslog","dmesg"])}),fe({}),fe({device:et}),fe({contexts:vs(fe({name:le(),level:le()}))}),fe({device:et,context:C0,level:N2}),fe({changed:vs(le())}),fe({device:et}),fe({dir:le().nullable(),reports:vs(j2)}),fe({device:et,path:Js}),fe({text:le(),truncated:Ve()}),fe({refresh:Ve().optional()}).optional(),fe({releases:vs(D2),fetchedAt:ke(),stale:le().optional()}),fe({device:et,tag:le().min(1).max(100),variant:E0,opId:le().max(64)}),fe({appId:le(),version:le(),via:Qt(["devmode","hbchannel"])}),fe({device:et,path:Js}),fe({});const M2="https://lg.scoty.uk",B2=[M2],I2=["http://localhost:5173","http://127.0.0.1:5173"],N0="https://github.com/Scoty/lg-dev-manager";class yt extends Error{constructor(n,l,o){super(l),this.code=n,this.detail=o}code;detail;static from(n){return new yt(n.code,n.message,n.detail)}}class H2{constructor(n,l){this.url=n,this.token=l}url;token;ws;nextId=1;pending=new Map;listeners=new Map;onClose;async connect(n=8e3){return await new Promise((l,o)=>{let d;try{d=new WebSocket(this.url)}catch(w){o(new yt("bad_url",`Invalid bridge address: ${this.url}`,String(w)));return}this.ws=d;const _=setTimeout(()=>{d.close(),o(new yt("timeout","The bridge did not answer in time."))},n);d.onopen=()=>{clearTimeout(_),l()},d.onerror=()=>{clearTimeout(_),o(new yt("unreachable","Could not reach the bridge. Is it running, and is this site allowed?"))},d.onmessage=w=>this.handle(String(w.data)),d.onclose=w=>{const c=w.reason||(w.code===4401?"unauthorized":"closed");for(const h of this.pending.values())clearTimeout(h.timer),h.reject(new yt("disconnected","Connection to the bridge was lost."));this.pending.clear(),this.onClose?.(c)}}),this.call("system.hello",{token:this.token,protocolVersion:O2,client:"web"})}call(n,l,o=3e4){const d=this.ws;if(!d||d.readyState!==WebSocket.OPEN)return Promise.reject(new yt("disconnected","Not connected to the bridge."));const _=this.nextId++;return new Promise((w,c)=>{const h=setTimeout(()=>{this.pending.delete(_),c(new yt("timeout",`${n} timed out.`))},o);this.pending.set(_,{resolve:w,reject:c,timer:h}),d.send(JSON.stringify({id:_,method:n,params:l}))})}on(n,l){let o=this.listeners.get(n);return o||this.listeners.set(n,o=new Set),o.add(l),()=>o.delete(l)}close(){this.onClose=void 0,this.ws?.close()}handle(n){let l;try{l=JSON.parse(n)}catch{return}if(typeof l.id=="number"){const o=this.pending.get(l.id);if(!o)return;this.pending.delete(l.id),clearTimeout(o.timer),l.error?o.reject(yt.from(l.error)):o.resolve(l.result)}else l.event&&this.listeners.get(l.event)?.forEach(o=>o(l.data))}}const Of="lgdm-bridge",U2=new Set(["127.0.0.1","localhost"]),ky=`The bridge only runs on this computer, so its address must start with ws://127.0.0.1: or ws://localhost: (default ws://127.0.0.1:${Tc}/rpc).`;function hm(s){let n;try{n=new URL(s.trim())}catch{return`That isn’t a valid address. ${ky}`}return n.protocol!=="ws:"||!U2.has(n.hostname)||n.username||n.password?ky:null}function Ry(s=window.location){const n=s.hostname==="localhost"||s.hostname==="127.0.0.1";return s.protocol==="http:"&&n&&!["localhost:5173","127.0.0.1:5173"].includes(s.host)?`ws://${s.host}/rpc`:`ws://127.0.0.1:${Tc}/rpc`}function z2(){try{const s=localStorage.getItem(Of);if(!s)return null;const n=JSON.parse(s);return n.url&&n.token&&!hm(n.url)?{url:n.url,token:n.token}:null}catch{return null}}function Dy(s){try{s?localStorage.setItem(Of,JSON.stringify(s)):localStorage.removeItem(Of)}catch{}}const j0=M.createContext(null),Ay=[1e3,2e3,5e3,1e4];function $2({children:s}){const[n,l]=M.useState(()=>z2()),[o,d]=M.useState(n?{state:"connecting"}:{state:"unpaired"}),[_,w]=M.useState(null),c=M.useRef(0),h=M.useRef(void 0),y=M.useRef(0),p=M.useCallback(async C=>{const j=++y.current;clearTimeout(h.current),d({state:"connecting"});const E=new H2(C.url,C.token);try{const g=await E.connect();if(j!==y.current)return E.close();c.current=0,w(E),d({state:"connected",bridgeVersion:g.bridgeVersion,platform:g.platform}),E.onClose=b=>{if(j===y.current){if(w(null),b==="unauthorized"){d({state:"error",code:"unauthorized",message:"The bridge rejected the pairing token."});return}d({state:"error",code:"disconnected",message:"Lost connection to the bridge. Retrying…"}),f(C,j)}}}catch(g){if(E.close(),j!==y.current)return;const b=g instanceof yt?g:new yt("unknown",String(g));throw w(null),d({state:"error",code:b.code,message:b.message}),b.code!=="unauthorized"&&b.code!=="protocol_mismatch"&&f(C,j),b}},[]),f=M.useCallback((C,j)=>{const E=Ay[Math.min(c.current++,Ay.length-1)];h.current=setTimeout(()=>{j===y.current&&p(C).catch(()=>{})},E)},[p]);M.useEffect(()=>(n&&p(n).catch(()=>{}),()=>{y.current++,clearTimeout(h.current)}),[]);const x=M.useMemo(()=>({status:o,settings:n,client:_,pair:async C=>{const j=hm(C.url);if(j)throw new yt("bad_url",j);_?.close(),Dy(C),l(C),await p(C)},reconnect:()=>{c.current=0,n&&p(n).catch(()=>{})},forget:()=>{y.current++,clearTimeout(h.current),_?.close(),Dy(null),l(null),w(null),d({state:"unpaired"})}}),[o,n,_,p]);return r.jsx(j0.Provider,{value:x,children:s})}function Pi(){const s=M.useContext(j0);if(!s)throw new Error("useBridge must be used inside <BridgeProvider>");return s}const T0={apps:'<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>',store:'<path d="M3 9h18l-1.5 11a1 1 0 0 1-1 .9h-13a1 1 0 0 1-1-.9z"/><path d="M8 9V6a4 4 0 0 1 8 0v3"/>',files:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',terminal:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="m7 9 3 3-3 3M13 15h4"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',debug:'<path d="M8 2l1.5 2M16 2l-1.5 2"/><rect x="7" y="5" width="10" height="15" rx="5"/><path d="M3 12h4M17 12h4M4 7l3 2M20 7l-3 2M4 18l3-2M20 18l-3-2M12 10v7"/>',tv:'<rect x="3" y="5" width="18" height="12" rx="2"/><path d="M8 21h8M12 17v4"/>',plug:'<path d="M9 2v6M15 2v6"/><path d="M6 8h12v3a6 6 0 0 1-12 0z"/><path d="M12 17v5"/>',github:'<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/>',moon:'<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',search:'<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>',menu:'<line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/>',folder:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',folderPlus:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M12 10v6M9 13h6"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-5-5L5 21"/>',cog:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',chevLeft:'<path d="m15 18-6-6 6-6"/>',chevDown:'<path d="m6 9 6 6 6-6"/>',arrowUp:'<path d="M12 19V5M5 12l7-7 7 7"/>',home:'<path d="m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>',chevRight:'<path d="m9 18 6-6-6-6"/>',left:'<path d="m15 18-6-6 6-6"/>',right:'<path d="m9 18 6-6-6-6"/>',updown:'<path d="m7 9 5-5 5 5"/><path d="m7 15 5 5 5-5"/>',plus:'<path d="M12 5v14M5 12h14"/>',key:'<circle cx="7.5" cy="15.5" r="4.5"/><path d="m10.7 12.3 9.3-9.3M17 6l3 3M14 9l2 2"/>',wrench:'<path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2.4-.6-.6-2.4z"/>',play:'<path d="M7 4.5v15a.8.8 0 0 0 1.2.7l12-7.5a.8.8 0 0 0 0-1.4l-12-7.5A.8.8 0 0 0 7 4.5z"/>',trash:'<path d="M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/>',edit:'<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/>',refresh:'<path d="M21 12a9 9 0 1 1-2.6-6.4L21 8"/><path d="M21 3v5h-5"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5M12 15V3"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5M12 3v12"/>',check:'<path d="M20 6 9 17l-5-5"/>',x:'<path d="M18 6 6 18M6 6l12 12"/>',copy:'<rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',more:'<circle cx="12" cy="5" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="12" cy="19" r="1"/>',alert:'<path d="M12 9v4M12 17h.01"/><path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>',lock:'<rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',shield:'<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>',pulse:'<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>',link:'<path d="M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"/><path d="M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"/>',box:'<path d="M21 8 12 3 3 8v8l9 5 9-5z"/><path d="m3 8 9 5 9-5M12 13v8"/>',disk:'<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v14c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/>'};function ce({name:s,className:n,strokeWidth:l}){return r.jsx("svg",{viewBox:"0 0 24 24",className:n,fill:"none",stroke:"currentColor",strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",dangerouslySetInnerHTML:{__html:T0[s]}})}function si({open:s,onClose:n,title:l,children:o,footer:d,size:_="md",dismissible:w=!0}){const c=M.useRef(null),h=M.useId();return M.useEffect(()=>{const y=c.current;y&&(s&&!y.open&&y.showModal(),!s&&y.open&&y.close())},[s]),r.jsx("dialog",{ref:c,className:`modal modal--${_}`,"aria-labelledby":h,onCancel:y=>{y.preventDefault(),w&&n()},onMouseDown:y=>{w&&y.target===y.currentTarget&&n()},children:s&&r.jsxs("div",{className:"modal-card",children:[r.jsxs("div",{className:"modal-head",children:[r.jsx("h2",{className:"modal-title",id:h,children:l}),w&&r.jsx("button",{type:"button",className:"icon-btn icon-btn--sm",onClick:n,"aria-label":"Close",children:r.jsx(ce,{name:"x",strokeWidth:2})})]}),r.jsx("div",{className:"modal-body",children:o}),d&&r.jsx("div",{className:"modal-foot",children:d})]})})}const P2={success:'<path d="M20 6 9 17l-5-5"/>',danger:'<path d="M18 6 6 18M6 6l12 12"/>',warning:'<path d="M12 9v4M12 17h.01"/><path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',primary:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>'};function $e({kind:s,title:n,children:l,action:o}){return r.jsxs("div",{className:`alert ${s}`,role:s==="danger"?"alert":"status",children:[r.jsx("div",{className:"ico",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:P2[s]}})}),r.jsxs("div",{className:"body",children:[n&&r.jsx("div",{className:"title",children:n}),l]}),o??r.jsx("span",{})]})}const k0=M.createContext(null);function F2({children:s}){const[n,l]=M.useState(null),[o,d]=M.useState([]),_=M.useRef(1),w=M.useCallback(p=>new Promise(f=>{l({...p,resolve:f})}),[]),c=M.useCallback(p=>{const f=_.current++;d(x=>[...x.slice(-3),{...p,id:f}]),setTimeout(()=>d(x=>x.filter(C=>C.id!==f)),p.kind==="danger"?9e3:5e3)},[]),h=p=>{n?.resolve(p),l(null)},y=M.useMemo(()=>({confirm:w,toast:c}),[w,c]);return r.jsxs(k0.Provider,{value:y,children:[s,r.jsx(si,{open:!!n,onClose:()=>h(!1),title:n?.title??"",size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>h(!1),autoFocus:n?.danger,children:n?.cancelText??"Cancel"}),r.jsx("button",{type:"button",className:`btn ${n?.danger?"btn--danger":"btn--primary"}`,onClick:()=>h(!0),autoFocus:!n?.danger,children:n?.confirmText??"OK"})]}),children:n?.message}),r.jsx("div",{className:"toasts","aria-live":"polite",children:o.map(p=>r.jsx("div",{className:"toast",children:r.jsx($e,{kind:p.kind,title:p.title,action:r.jsx("button",{type:"button",className:"close","aria-label":"Dismiss",onClick:()=>d(f=>f.filter(x=>x.id!==p.id)),children:r.jsx("svg",{viewBox:"0 0 24 24",children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}),children:p.text})},p.id))})]})}function jt(){const s=M.useContext(k0);if(!s)throw new Error("useFeedback must be used inside <FeedbackProvider>");return s}function dm(s){const[n,l]=M.useState(()=>typeof matchMedia=="function"&&matchMedia(s).matches);return M.useEffect(()=>{if(typeof matchMedia!="function")return;const o=matchMedia(s),d=()=>l(o.matches);return d(),o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[s]),n}const R0="(min-width: 721px) and (max-width: 1100px)",fm=[{label:"Device",items:[{key:"apps",text:"Apps",icon:"apps",children:[{key:"apps-installed",text:"Installed",to:"/apps/installed"},{key:"apps-homebrew",text:"Homebrew repo",to:"/apps/homebrew"},{key:"apps-litefin",text:"Litefin repo",to:"/apps/litefin"}]},{key:"files",text:"Files",icon:"files",to:"/files"},{key:"terminal",text:"Terminal",icon:"terminal",to:"/terminal"},{key:"info",text:"Device info",icon:"info",to:"/info"},{key:"debug",text:"Debug",icon:"debug",children:[{key:"debug-logs",text:"System log",to:"/debug/logs"},{key:"debug-pmlog",text:"Log levels",to:"/debug/pmlog"},{key:"debug-dmesg",text:"Kernel log",to:"/debug/dmesg"},{key:"debug-crashes",text:"Crash reports",to:"/debug/crashes"},{key:"debug-luna",text:"Luna monitor",to:"/debug/luna"}]}]},{label:"Setup",items:[{key:"devices",text:"Devices",icon:"tv",to:"/devices"},{key:"bridge",text:"Bridge",icon:"plug",to:"/bridge"}]},{label:"Links",items:[{key:"homebrew-site",text:"webOS Homebrew",icon:"store",href:"https://www.webosbrew.org/"},{key:"source",text:"Source code",icon:"github",href:N0}]}];function V2(s){if(s.startsWith("/devices/new"))return["Setup","Devices","Add a TV"];for(const n of fm)for(const l of n.items){if(l.to&&s.startsWith(l.to))return[n.label,l.text];for(const o of l.children??[])if(s.startsWith(o.to))return[n.label,l.text,o.text]}return["LG Dev Manager"]}const D0="1.0.0",ml="1.0.0",lc=6,ul=8;function q2(){const n=document.querySelector(".console-dock")?.getBoundingClientRect().top;return n&&n>0?Math.min(n,window.innerHeight):window.innerHeight}function Ic({trigger:s,children:n,placement:l="down-right",className:o="",menuClassName:d="",label:_,floating:w=!1}){const[c,h]=M.useState(!1),y=M.useRef(null),p=M.useRef(null),[f,x]=M.useState(null),C=M.useCallback(()=>{const E=y.current?.getBoundingClientRect(),g=p.current;if(!E||!g)return;const b=g.offsetHeight,v=g.offsetWidth,N=q2()-E.bottom-lc,T=E.top-lc,O=b>N-ul&&T>N?Math.max(ul,E.top-lc-b):E.bottom+lc,k=l==="down-right"?Math.max(ul,E.right-v):Math.min(Math.max(ul,E.left),window.innerWidth-v-ul);x({top:O,left:k})},[l]);M.useLayoutEffect(()=>{if(w){if(!c)return x(null);C()}},[w,c,C]),M.useEffect(()=>{if(!c)return;const E=b=>{const v=b.target;!y.current?.contains(v)&&!p.current?.contains(v)&&h(!1)},g=b=>{b.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",g),w&&(window.addEventListener("scroll",C,!0),window.addEventListener("resize",C)),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",g),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[c,w,C]);const j=c&&n(()=>h(!1));return r.jsxs("div",{ref:y,className:`dd-wrap${c?" is-open":""} ${o}`,children:[s({open:c,toggle:()=>h(E=>!E),"aria-expanded":c,"aria-haspopup":"menu"}),w?c&&KC.createPortal(r.jsx("div",{ref:p,className:`dd-menu dd-menu--floating${f?" is-placed":""} ${d}`,role:"menu","aria-label":_,style:f??void 0,children:j}),document.body):r.jsx("div",{ref:p,className:`dd-menu dd-menu--${l} ${d}`,role:"menu","aria-label":_,children:j})]})}const Hc=s=>x0.test(s);function bl(s){const n=s.trim();return n?n.length>255||!w0.test(n)?"That doesn’t look like an IP address or host name.":null:"Enter the TV’s IP address."}const K2=s=>s===s.trim()&&bl(s)===null,A0=fe({modelName:le().max(64).optional(),osVersion:le().max(64).optional(),firmwareVersion:le().max(64).optional(),socName:le().max(64).optional(),from:le().max(300),at:ke(),v:ke().optional()}),O0=2;function Uc(s,n){const l=o=>o?o.slice(0,64):void 0;return A0.parse({...n.modelName?{modelName:l(n.modelName)}:{},...n.osVersion?{osVersion:l(n.osVersion)}:{},...n.firmwareVersion?{firmwareVersion:l(n.firmwareVersion)}:{},...n.socName?{socName:l(n.socName)}:{},from:`${s.host}:${s.port}`,at:Date.now(),v:O0})}const ua=fe({id:le(),name:le().min(1).max(64),mode:Qt(["devmode","rooted"]),host:le().min(1).max(255),port:ke().int().min(1).max(65535),username:le().min(1).max(64),auth:S0,description:le().max(200).optional(),info:A0.optional(),createdAt:ke(),updatedAt:ke()}),G2=ua.extend({host:le().trim().refine(s=>bl(s)===null,"Not a valid IP address or host name."),username:le().refine(Hc,"Not a valid user name.")}),Y2=fe({format:_l("lg-dev-manager/devices"),version:_l(1),exportedAt:ke(),devices:vs(G2).max(500)});class L0 extends Error{name="BackupError"}const Z2="That file is not an LG Dev Manager device backup.";function X2(s,n){const l=s.issues.find(h=>h.path[0]==="devices"&&typeof h.path[1]=="number");if(!l)return Z2;const o=l.path[1],d=n.devices?.[o]?.name,_=typeof d=="string"&&d.trim()?`“${d.trim().slice(0,64)}”`:`number ${o+1}`,w=l.path[2];return`Nothing was imported: TV ${_} in this backup ${w==="username"?"has a user name that isn’t allowed":w==="host"?"has an address that isn’t an IP address or host name":"has settings this app can’t use"}. Only import backups you made yourself.`}const W2="lgdm",Q2=2,aa="devices",As="screenshots",Lf="lgdm-active-device";function zc(s){return new Promise((n,l)=>{s.onsuccess=()=>n(s.result),s.onerror=()=>l(s.error)})}let oc=null;function ir(){return oc??=new Promise((s,n)=>{const l=indexedDB.open(W2,Q2);l.onupgradeneeded=()=>{const o=l.result;o.objectStoreNames.contains(aa)||o.createObjectStore(aa,{keyPath:"id"}),o.objectStoreNames.contains(As)||o.createObjectStore(As,{keyPath:"id"}).createIndex("deviceId","deviceId")},l.onsuccess=()=>{l.result.onversionchange=()=>{l.result.close(),oc=null},s(l.result)},l.onerror=()=>{oc=null,n(l.error)}}),oc}async function nr(s,n){const l=await ir();return zc(n(l.transaction(aa,s).objectStore(aa)))}async function J2(s){const n=await ir();await new Promise((l,o)=>{const d=n.transaction(As,"readwrite"),_=d.objectStore(As).index("deviceId").openKeyCursor(IDBKeyRange.only(s));_.onsuccess=()=>{const w=_.result;w&&(d.objectStore(As).delete(w.primaryKey),w.continue())},d.oncomplete=()=>l(),d.onerror=()=>o(d.error)}),Sl.forEach(l=>l())}async function eN(){const s=await ir();await zc(s.transaction(As,"readwrite").objectStore(As).clear()),Sl.forEach(n=>n())}const Sl=new Set,Mf=new Set,ha=()=>Mf.forEach(s=>s());function Oy(s){return Mf.add(s),()=>Mf.delete(s)}async function mm(){return(await nr("readonly",n=>n.getAll())).map(n=>ua.safeParse(n)).flatMap(n=>n.success?[n.data]:[]).sort((n,l)=>n.name.localeCompare(l.name))}async function M0(s){const n=await nr("readonly",o=>o.get(s)),l=ua.safeParse(n);return l.success?l.data:void 0}async function tN(s){const n=Date.now(),l=ua.parse({...s,id:crypto.randomUUID(),createdAt:n,updatedAt:n});return await nr("readwrite",o=>o.add(l)),$c()||Nn(l.id),ha(),l}async function sN(s,n){const l=await M0(s);if(!l)throw new Error("Device not found");const o=ua.parse({...l,...n,id:s,updatedAt:Date.now()});return await nr("readwrite",d=>d.put(o)),ha(),o}async function pm(s,n){const l=await M0(s);l&&(await nr("readwrite",o=>o.put(ua.parse({...l,info:n}))),ha())}async function iN(s){if(await nr("readwrite",n=>n.delete(s)),await J2(s).catch(()=>{}),$c()===s){const n=await mm();Nn(n[0]?.id??null)}ha()}function $c(){try{return localStorage.getItem(Lf)}catch{return null}}function Nn(s){try{s?localStorage.setItem(Lf,s):localStorage.removeItem(Lf)}catch{}ha()}function gt(s){return{host:s.host,port:s.port,username:s.username,auth:s.auth}}async function nN(){return{format:"lg-dev-manager/devices",version:1,exportedAt:Date.now(),devices:await mm()}}async function rN(s){const n=Y2.safeParse(s);if(!n.success)throw new L0(X2(n.error,s));const l=n.data,o=await ir();return await new Promise((d,_)=>{const w=o.transaction(aa,"readwrite");for(const c of l.devices)w.objectStore(aa).put(c);w.oncomplete=()=>d(),w.onerror=()=>_(w.error)}),!$c()&&l.devices[0]&&Nn(l.devices[0].id),ha(),l.devices.length}async function aN(){await nr("readwrite",s=>s.clear()),await eN().catch(()=>{}),Nn(null)}function Mt(){const[s,n]=M.useState(null),l=M.useSyncExternalStore(Oy,$c,()=>null);M.useEffect(()=>{let d=!0;const _=()=>mm().then(c=>d&&n(c)).catch(()=>d&&n([]));_();const w=Oy(_);return()=>{d=!1,w()}},[]);const o=s?.find(d=>d.id===l)??null;return{devices:s,active:o,activeId:l,loading:s===null}}const lN=[[/^OLED\d{2,3}([A-Z])([0-9X])/,s=>`${s[1]}${s[2]}`],[/^\d{2,3}(QNED\d{2}|NANO\d{2})/,s=>s[1]],[/^\d{2,3}((?:U[A-Z]|S[KM])\d{2})/,s=>s[1]],[/^\d{2}ART10/,()=>"StanbyME"]];function gm(s){const n=s?.trim().toUpperCase();if(n)for(const[l,o]of lN){const d=n.match(l);if(d)return o(d)}}function xl(s){const n=gm(s);return n?`LG ${n}`:s?.trim()||void 0}function Bf(s){const n=s?.trim();if(!n)return;const l=gm(n);return l?`LG ${l} · ${n}`:n}function oN(){const s=Cl(),{devices:n,active:l}=Mt();return r.jsx(Ic,{label:"Choose TV",placement:"up-left",className:"device-switcher",menuClassName:"dd-menu--compact",trigger:({toggle:o,...d})=>r.jsxs("button",{type:"button",className:"workspace",title:"Choose TV","aria-label":l?`Active TV: ${l.name}. Choose TV`:"Choose TV",onClick:o,...d,children:[r.jsx("div",{className:"workspace-avatar",children:r.jsx(ce,{name:"tv"})}),r.jsxs("div",{className:"workspace-text",children:[r.jsx("div",{className:"workspace-name",children:l?.name??"No TV selected"}),r.jsx("div",{className:"workspace-role",children:l?`${xl(l.info?.modelName)??l.host} · ${l.mode==="rooted"?"rooted":"Dev Mode"}`:n?.length?"choose a TV":"add a TV to start"})]}),r.jsx(ce,{name:"updown",className:"workspace-chev",strokeWidth:1.8})]}),children:o=>r.jsxs(r.Fragment,{children:[!!n?.length&&r.jsx("div",{className:"dd-section-label",children:"Your TVs"}),n?.map(d=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":d.id===l?.id,className:`dd-menu-item${d.id===l?.id?" is-active":""}`,onClick:()=>{Nn(d.id),o()},children:[r.jsx(ce,{name:"tv"}),r.jsxs("span",{className:"dd-menu-text",children:[r.jsx("span",{children:d.name}),r.jsx("span",{className:"dd-menu-sub mono",children:[xl(d.info?.modelName),d.host].filter(Boolean).join(" · ")})]}),d.id===l?.id&&r.jsx(ce,{name:"check",className:"dd-check",strokeWidth:2.4})]},d.id)),!!n?.length&&r.jsx("div",{className:"dd-divider"}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>(o(),s("/devices/new")),children:[r.jsx(ce,{name:"plus"})," Add a TV"]}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>(o(),s("/devices")),children:[r.jsx(ce,{name:"wrench"})," Manage devices"]})]})})}function cN({item:s,pathname:n}){const l=s.children.some(f=>n.startsWith(f.to)),[o,d]=M.useState(l),_=dm(R0),[w,c]=M.useState(null),h=M.useRef(null),y=_?!!w:o||l;M.useEffect(()=>c(null),[n,_]),M.useEffect(()=>{if(!w)return;const f=j=>!h.current?.contains(j.target)&&c(null),x=j=>j.key==="Escape"&&c(null),C=()=>c(null);return document.addEventListener("pointerdown",f),document.addEventListener("keydown",x),window.addEventListener("resize",C),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",x),window.removeEventListener("resize",C)}},[w]);const p=f=>{if(!_)return d(!y);if(w)return c(null);const x=f.currentTarget.getBoundingClientRect(),C=s.children.length*40+14;c({top:Math.max(8,Math.min(x.top,window.innerHeight-C-8)),left:x.right+10})};return r.jsxs("div",{ref:h,className:`nav-item-group${y?" is-open":""}`,children:[r.jsxs("button",{type:"button",className:`nav-link${_&&l?" is-active":""}`,"aria-expanded":y,"aria-label":_?s.text:void 0,title:_?s.text:void 0,onClick:p,children:[r.jsx(ce,{name:s.icon}),r.jsx("span",{children:s.text}),r.jsx(ce,{name:"chevRight",className:"chev",strokeWidth:1.8})]}),r.jsx("div",{className:"nav-submenu",style:_&&w?w:void 0,children:s.children.map(f=>r.jsx(sm,{to:f.to,className:({isActive:x})=>x?"is-active":void 0,children:f.text},f.key))})]})}function uN({item:s,pathname:n}){const l=dm(R0);if(s.children)return r.jsx(cN,{item:s,pathname:n});const o=l?{title:s.text,"aria-label":s.text}:{},d=r.jsxs(r.Fragment,{children:[r.jsx(ce,{name:s.icon}),r.jsx("span",{children:s.text}),s.badge&&r.jsx("span",{className:`nav-badge ${s.badge.kind}`,children:s.badge.text})]});return s.href?r.jsx("a",{className:"nav-link",href:s.href,target:"_blank",rel:"noopener noreferrer",...o,children:d}):r.jsx(sm,{to:s.to,className:({isActive:_})=>`nav-link${_?" is-active":""}`,...o,children:d})}function hN(){const{pathname:s}=_s();return r.jsxs("aside",{className:"d-sidebar",children:[r.jsxs(Jt,{to:"/",className:"brand",children:[r.jsx("div",{className:"brand-logo",children:r.jsx(ce,{name:"tv",strokeWidth:2})}),r.jsxs("div",{className:"brand-text",children:[r.jsx("div",{className:"brand-name",children:"LG Dev Manager"}),r.jsxs("div",{className:"brand-tag",children:["v",D0]})]})]}),fm.map(n=>r.jsxs("nav",{className:"nav-section",children:[r.jsx("div",{className:"nav-label",children:n.label}),n.items.map(l=>r.jsx(uN,{item:l,pathname:s},l.key))]},n.label)),r.jsx("div",{className:"sidebar-footer",children:r.jsx(oN,{})})]})}const dN="lgdm-theme";function B0(){return document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light"}function fN(s){document.documentElement.setAttribute("data-theme",s);try{localStorage.setItem(dN,s)}catch{}}function I0(){const s=B0()==="dark"?"light":"dark";return fN(s),s}function mN(){const{status:s}=Pi(),n={unpaired:{cls:"",text:"Bridge not set up"},connecting:{cls:" is-connecting",text:"Connecting…"},connected:{cls:" is-connected",text:"Bridge connected"},error:{cls:" is-error",text:"Bridge offline"}},{cls:l,text:o}=n[s.state];return r.jsxs(Jt,{to:"/bridge",className:`bridge-pill${l}`,title:s.state==="error"?s.message:o,children:[r.jsx("span",{className:"dot","aria-hidden":"true"}),r.jsx("span",{children:o})]})}function pN({onOpenDrawer:s,onOpenPalette:n}){const{pathname:l}=_s(),o=V2(l),[d,_]=M.useState(B0),w=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);return r.jsxs("header",{className:"d-topbar",children:[r.jsxs("div",{className:"crumbs",children:[r.jsx("button",{className:"hamburger",onClick:s,"aria-label":"Open navigation",children:r.jsx(ce,{name:"menu",strokeWidth:2})}),o.map((c,h)=>r.jsxs(M.Fragment,{children:[h>0&&r.jsx(ce,{name:"chevRight",className:"sep",strokeWidth:2}),r.jsx("span",{className:h===o.length-1?"current":void 0,children:c})]},h))]}),r.jsxs("div",{className:"topbar-actions",children:[r.jsxs("button",{className:"cmd",onClick:n,children:[r.jsx(ce,{name:"search"}),r.jsx("span",{children:"Search..."}),r.jsx("kbd",{className:"kbd",children:w?"⌘K":"Ctrl K"})]}),r.jsx(mN,{}),r.jsx("button",{className:"icon-btn","aria-label":`Switch to ${d==="dark"?"light":"dark"} theme`,onClick:()=>_(I0()),children:r.jsx(ce,{name:d==="dark"?"sun":"moon",strokeWidth:1.8})})]})]})}function gN(){const{status:s}=Pi();return r.jsxs("footer",{className:"d-footer",children:[r.jsxs("div",{children:["Based on"," ",r.jsx("a",{href:"https://github.com/webosbrew/dev-manager-desktop",target:"_blank",rel:"noopener noreferrer",children:"webOS Dev Manager"})," ","· design by"," ",r.jsx("a",{href:"https://github.com/puikinsh/adminator-admin-dashboard",target:"_blank",rel:"noopener noreferrer",children:"Adminator"}),r.jsx("div",{className:"d-footer-note",children:"Not affiliated with or endorsed by LG Electronics. LG and webOS are trademarks of LG Electronics."})]}),r.jsxs("div",{className:"d-footer-meta",children:[r.jsxs("span",{children:["web v",D0]}),r.jsx("span",{children:s.state==="connected"?`bridge v${s.bridgeVersion}`:"no bridge"})]})]})}function vN(s,n){if(!n)return 1;const l=s.label.toLowerCase();return l===n?100:l.startsWith(n)?50:l.includes(n)?20:s.section.toLowerCase().includes(n)?5:0}function _N({open:s,onClose:n}){const l=Cl(),[o,d]=M.useState(""),[_,w]=M.useState(0),c=M.useRef(null),{devices:h,activeId:y}=Mt(),p=M.useMemo(()=>{const C=[];for(const j of fm)for(const E of j.items)if(E.children)for(const g of E.children)C.push({label:g.text,section:`${j.label} › ${E.text}`,icon:E.icon,run:()=>l(g.to)});else E.to?C.push({label:E.text,section:j.label,icon:E.icon,run:()=>l(E.to)}):E.href&&C.push({label:E.text,section:"External",icon:E.icon,run:()=>window.open(E.href,"_blank","noopener")});C.push({label:"Toggle theme (light / dark)",section:"Action",icon:"sun",run:()=>I0()}),C.push({label:"Add a TV",section:"Action",icon:"plus",run:()=>l("/devices/new")}),C.push({label:"Install an IPK",section:"Action",icon:"upload",run:()=>l("/apps/installed")});for(const j of h??[])j.id!==y&&C.push({label:`Switch to ${j.name}`,section:"TV",icon:"tv",run:()=>Nn(j.id)});return C},[l,h,y]),f=M.useMemo(()=>{const C=o.trim().toLowerCase();return p.map(j=>({item:j,s:vN(j,C)})).filter(j=>j.s>0).sort((j,E)=>E.s-j.s).slice(0,12).map(j=>j.item)},[p,o]);if(M.useEffect(()=>(document.body.classList.toggle("has-palette-open",s),s&&(d(""),w(0),requestAnimationFrame(()=>c.current?.focus())),()=>document.body.classList.remove("has-palette-open")),[s]),M.useEffect(()=>w(0),[o]),!s)return null;const x=C=>{C&&(n(),C.run())};return r.jsx("div",{className:"palette-backdrop",onMouseDown:C=>C.target===C.currentTarget&&n(),children:r.jsxs("div",{className:"palette-modal",role:"dialog","aria-modal":"true","aria-label":"Command palette",onKeyDown:C=>{C.key==="Escape"?n():C.key==="ArrowDown"?(C.preventDefault(),w(j=>Math.min(j+1,f.length-1))):C.key==="ArrowUp"?(C.preventDefault(),w(j=>Math.max(j-1,0))):C.key==="Enter"&&(C.preventDefault(),x(f[_]))},children:[r.jsxs("div",{className:"palette-input-row",children:[r.jsxs("svg",{viewBox:"0 0 24 24",className:"palette-icon","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:2,children:[r.jsx("circle",{cx:"11",cy:"11",r:"7"}),r.jsx("path",{d:"m21 21-4.3-4.3"})]}),r.jsx("input",{ref:c,className:"palette-input",type:"text",placeholder:"Search pages, actions…",autoComplete:"off",spellCheck:!1,value:o,onChange:C=>d(C.target.value),"aria-label":"Search"}),r.jsx("kbd",{className:"palette-esc",children:"esc"})]}),r.jsx("div",{className:"palette-results",role:"listbox",children:f.length===0?r.jsx("div",{className:"palette-empty",children:"No results"}):f.map((C,j)=>r.jsxs("div",{className:`palette-result${j===_?" is-selected":""}`,role:"option","aria-selected":j===_,onMouseEnter:()=>w(j),onClick:()=>x(C),children:[r.jsx("span",{className:"palette-result-icon",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,dangerouslySetInnerHTML:{__html:T0[C.icon]}})}),r.jsx("span",{className:"palette-result-label",children:C.label}),r.jsx("span",{className:"palette-result-section",children:C.section})]},`${C.section}/${C.label}`))}),r.jsxs("div",{className:"palette-foot",children:[r.jsxs("span",{children:[r.jsx("kbd",{children:"↑"}),r.jsx("kbd",{children:"↓"})," navigate"]}),r.jsxs("span",{children:[r.jsx("kbd",{children:"↵"})," select"]}),r.jsxs("span",{children:[r.jsx("kbd",{children:"esc"})," close"]})]})]})})}function ut(){const{client:s,status:n}=Pi(),l=n.state==="connected"&&!!s,o=M.useCallback((d,_,w)=>s?s.call(d,_,w):Promise.reject(new yt("disconnected","The bridge is not connected.")),[s]);return{ready:l,call:o,client:s}}function pc(s,n,l){return s.on(u2,o=>{const d=c2.safeParse(o);d.success&&d.data.opId===n&&l(d.data)})}const ea=()=>crypto.randomUUID(),Ld=1024*1024;function yN(s){return new Promise((n,l)=>{const o=new FileReader;o.onload=()=>{const d=String(o.result);n(d.slice(d.indexOf(",")+1))},o.onerror=()=>l(o.error??new Error("Could not read the file.")),o.readAsDataURL(s)})}async function H0(s,n,l,o){const{uploadId:d}=await s.call("upload.begin",{name:n.name,size:n.size});try{for(let _=0;_<n.size;_+=Ld){if(o?.aborted)throw new yt("cancelled","Cancelled.");const w=await yN(n.slice(_,_+Ld));await s.call("upload.chunk",{uploadId:d,offset:_,data:w},6e4),l?.(Math.min(n.size,_+Ld),n.size)}return d}catch(_){throw s.call("upload.discard",{uploadId:d}).catch(()=>{}),_}}function xt(s){return s instanceof yt?{code:s.code,message:s.message,detail:s.detail}:s instanceof Error?{code:"error",message:s.message}:{code:"error",message:String(s)}}function Nt({error:s,title:n,hint:l,action:o}){const{code:d,message:_,detail:w}=xt(s);return r.jsxs($e,{kind:"danger",title:n,action:o,children:[r.jsx("div",{children:_}),l&&r.jsx("div",{className:"alert-hint",children:l}),r.jsxs("details",{className:"error-details",children:[r.jsx("summary",{children:"Technical details"}),r.jsx("pre",{children:[`code: ${d}`,w].filter(Boolean).join(`
12
- `)})]})]})}const Ly=400;class bN{entries=[];listeners=new Set;subscribe=n=>(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.entries;set(n){this.entries=n.length>Ly?n.slice(n.length-Ly):n,this.listeners.forEach(l=>l())}update(n,l){const o=this.entries.findIndex(_=>_.id===n);if(o<0)return;const d=this.entries.slice();d[o]={...d[o],...l(d[o])},this.set(d)}log(n){n.phase==="start"?this.set([...this.entries,{id:n.id,source:"bridge",target:n.target,command:n.command,kind:n.kind,quiet:!!n.quiet,startedAt:n.at,output:"",running:!0}]):this.update(n.id,()=>({running:!1,durationMs:n.durationMs,exitCode:n.exitCode,output:n.output??"",error:n.error}))}startManual(n,l,o){this.set([...this.entries,{id:n,source:"manual",target:l,command:o,kind:"stream",quiet:!1,startedAt:Date.now(),output:"",running:!0}])}appendManual(n,l){this.update(n,o=>({output:(o.output+l).slice(-262144)}))}finishManual(n,l){this.update(n,o=>({running:!1,durationMs:Date.now()-o.startedAt,...l}))}clear(){this.set(this.entries.filter(n=>n.running))}}const bn=new bN;class SN{value=null;listeners=new Set;subscribe=n=>(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.value;set(n){this.value=n,this.listeners.forEach(l=>l())}}const kc=new SN,U0="lgdm-console",My=140,By=300;function xN(){try{const s=JSON.parse(localStorage.getItem(U0)??"{}");return{open:!!s.open,height:Number(s.height)||By,showQuiet:!!s.showQuiet}}catch{return{open:!1,height:By,showQuiet:!1}}}function wN(s){try{localStorage.setItem(U0,JSON.stringify(s))}catch{}}function CN(){const{client:s}=Pi();M.useEffect(()=>{if(!s)return;const n=s.on(d2,o=>{const d=h2.safeParse(o);d.success&&bn.log(d.data)}),l=s.on(m2,o=>{const d=f2.safeParse(o);d.success&&bn.appendManual(d.data.opId,d.data.data)});return()=>{n(),l()}},[s])}const EN=s=>new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),NN=s=>s===void 0?"":s<1e3?`${s} ms`:`${(s/1e3).toFixed(1)} s`;function jN({e:s}){return s.running?r.jsxs("span",{className:"cons-status is-running",children:[r.jsx("span",{className:"spinner sm"})," running"]}):s.cancelled?r.jsx("span",{className:"cons-status is-warn",children:"stopped"}):s.error?r.jsx("span",{className:"cons-status is-err",title:s.error,children:"failed"}):s.exitCode===0||s.exitCode===void 0&&!s.error?r.jsx("span",{className:"cons-status is-ok",children:s.exitCode===0?"exit 0":"done"}):s.exitCode===null?r.jsx("span",{className:"cons-status",children:"closed"}):r.jsxs("span",{className:"cons-status is-err",children:["exit ",s.exitCode]})}function TN({e:s,expanded:n,onToggle:l}){const o=!!(s.output||s.error),d=s.source==="manual"||n;return r.jsxs("div",{className:`cons-entry is-${s.source}${s.running?" is-running":""}`,children:[r.jsxs("button",{type:"button",className:"cons-line",onClick:l,"aria-expanded":o?d:void 0,disabled:!o,children:[r.jsx("span",{className:"cons-time",children:EN(s.startedAt)}),r.jsx("span",{className:"cons-target",children:s.target}),r.jsxs("span",{className:"cons-cmd",children:[r.jsx("span",{className:"cons-prompt",children:s.kind==="sftp"||s.kind==="tunnel"||s.kind==="http"?"⇄":"$"})," ",s.command]}),r.jsxs("span",{className:"cons-meta",children:[!o&&!s.running&&s.kind!=="sftp"&&s.kind!=="tunnel"&&s.kind!=="http"&&r.jsx("span",{className:"cons-nooutput",children:"no output"}),r.jsx(jN,{e:s}),r.jsx("span",{className:"cons-dur",children:NN(s.durationMs)})]})]}),d&&o&&r.jsxs("pre",{className:"cons-output",children:[s.output,s.error&&r.jsxs("span",{className:"cons-error",children:[s.output?`
13
- `:"",s.error]})]})]})}function kN(){CN();const s=M.useSyncExternalStore(bn.subscribe,bn.getSnapshot),{ready:n,client:l}=ut(),{active:o}=Mt(),d=M.useSyncExternalStore(kc.subscribe,kc.getSnapshot),_=M.useMemo(()=>d?{name:d.name,host:d.host,port:d.port,username:d.username,target:d.device}:o?{name:o.name,host:o.host,port:o.port,username:o.username,target:gt(o)}:null,[d,o]),[w,c]=M.useState(xN),[h,y]=M.useState(!1),[p,f]=M.useState(""),[x,C]=M.useState([]),[j,E]=M.useState(-1),[g,b]=M.useState(null),[v,S]=M.useState(new Set),N=M.useRef(null),T=M.useRef(null),D=M.useRef(!0),O=I=>c(A=>{const B={...A,...I};return wN(B),B}),k=M.useMemo(()=>s.filter(I=>w.showQuiet||!I.quiet),[s,w.showQuiet]),L=s.filter(I=>I.running),V=k[k.length-1];M.useLayoutEffect(()=>{const I=N.current;I&&D.current&&(I.scrollTop=I.scrollHeight)},[k,w.open]),M.useEffect(()=>{h&&w.open&&T.current?.focus()},[h,w.open]),M.useEffect(()=>{document.documentElement.style.setProperty("--console-h",`${w.open?w.height+44:44}px`)},[w.open,w.height]);const q=_?`${_.username}@${_.name}`:"no TV",Y=h&&n&&!!_&&!g,P=async()=>{const I=p.trim();if(!I||!l||!_||g)return;const A=ea();f(""),C(B=>[...B.filter(F=>F!==I),I].slice(-100)),E(-1),D.current=!0,bn.startManual(A,`${_.username}@${_.host}:${_.port}`,I),b(A);try{const B=await l.call("cmd.stream",{device:_.target,command:I,opId:A},18e5);bn.finishManual(A,B)}catch(B){bn.finishManual(A,{error:xt(B).message})}finally{b(null),requestAnimationFrame(()=>T.current?.focus())}},Q=()=>{g&&l&&l.call("cmd.cancel",{opId:g}).catch(()=>{})},he=I=>{if(I.key==="Enter")I.preventDefault(),P();else if(I.key==="ArrowUp"&&x.length){I.preventDefault();const A=j<0?x.length-1:Math.max(0,j-1);E(A),f(x[A])}else if(I.key==="ArrowDown"&&j>=0){I.preventDefault();const A=j+1;A>=x.length?(E(-1),f("")):(E(A),f(x[A]))}},ne=I=>{I.key==="c"&&I.ctrlKey&&g&&(I.preventDefault(),Q())},W=I=>{I.preventDefault();const A=I.clientY,B=w.height,F=Math.max(My,window.innerHeight-160),$=z=>O({height:Math.min(F,Math.max(My,B+A-z.clientY))}),J=()=>{window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",J)};window.addEventListener("pointermove",$),window.addEventListener("pointerup",J)};return r.jsxs("section",{className:`console-dock${w.open?" is-open":""}`,"aria-label":"Console",onKeyDown:ne,children:[w.open&&r.jsx("div",{className:"cons-resize",onPointerDown:W,role:"separator","aria-orientation":"horizontal","aria-label":"Resize console"}),r.jsxs("div",{className:"cons-bar",children:[r.jsxs("button",{type:"button",className:"cons-toggle",onClick:()=>O({open:!w.open}),"aria-expanded":w.open,children:[r.jsx(ce,{name:"terminal"}),r.jsx("span",{className:"cons-title",children:"Console"}),L.length>0?r.jsxs("span",{className:"badge primary dot",children:[L.length," running"]}):r.jsx("span",{className:"cons-count",children:k.length}),!w.open&&V&&r.jsxs("span",{className:"cons-last mono",children:["$ ",V.command]}),r.jsx(ce,{name:"chevRight",className:`cons-chev${w.open?" is-open":""}`,strokeWidth:2})]}),r.jsxs("div",{className:"cons-tools",children:[r.jsxs("label",{className:"check",title:"Type commands and run them on the active TV",children:[r.jsx("input",{type:"checkbox",checked:h,onChange:I=>{y(I.target.checked),I.target.checked&&!w.open&&O({open:!0})}}),r.jsx("span",{className:"box"}),r.jsx("span",{className:"cons-check-label",children:"Send commands"})]}),w.open&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"check cons-quiet",title:"Show routine background reads such as app icons",children:[r.jsx("input",{type:"checkbox",checked:w.showQuiet,onChange:I=>O({showQuiet:I.target.checked})}),r.jsx("span",{className:"box"}),r.jsx("span",{className:"cons-check-label",children:"Background reads"})]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>bn.clear(),disabled:!s.length,children:"Clear"})]})]})]}),w.open&&r.jsxs("div",{className:"cons-body",style:{height:w.height},children:[r.jsx("div",{className:"cons-list",ref:N,onScroll:I=>{const A=I.currentTarget;D.current=A.scrollHeight-A.scrollTop-A.clientHeight<24},children:k.length===0?r.jsxs("div",{className:"cons-empty",children:["Commands the bridge runs on your TV appear here — listing apps, installs, file transfers. Tick ",r.jsx("b",{children:"Send commands"})," to type your own."]}):k.map(I=>r.jsx(TN,{e:I,expanded:v.has(I.id)||!!I.error&&!I.quiet,onToggle:()=>S(A=>{const B=new Set(A);return B.has(I.id)?B.delete(I.id):B.add(I.id),B})},I.id))}),h&&r.jsx("div",{className:"cons-input-row",children:!n||!_?r.jsx("span",{className:"cons-hint",children:n?"Choose a TV to send commands to.":"Connect the bridge to send commands."}):r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"cons-ps1 mono",htmlFor:"console-input",children:[q," $"]}),r.jsx("input",{id:"console-input",ref:T,className:"cons-input mono",value:p,onChange:I=>f(I.target.value),onKeyDown:he,disabled:!Y,placeholder:g?"Running… (Ctrl+C to stop)":"Type a command and press Enter — e.g. uname -a",autoComplete:"off",spellCheck:!1,"aria-label":`Command to run on ${_.name}`}),g?r.jsx("button",{type:"button",className:"btn btn--sm btn--soft-danger",onClick:Q,children:"Stop"}):r.jsx("button",{type:"button",className:"btn btn--sm btn--soft-primary",onClick:P,disabled:!p.trim(),children:"Run"})]})}),h&&n&&_&&r.jsxs("div",{className:"cons-warning",children:["Commands run directly on ",_.name," as ",r.jsx("span",{className:"mono",children:_.username}),". There is no undo."]})]})]})}const RN=1440*60*1e3;function DN(){const{ready:s,call:n}=ut(),{active:l}=Mt(),o=M.useRef(new Set);M.useEffect(()=>{if(!s||!l)return;const d=`${l.host}:${l.port}`,_=l.info&&l.info.from===d&&l.info.v===O0&&Date.now()-l.info.at<RN,w=`${l.id}@${d}`;_||o.current.has(w)||(o.current.add(w),n("device.info",{device:gt(l),quiet:!0},4e4).then(c=>pm(l.id,Uc(l,c))).catch(()=>{}))},[s,l,n])}function AN(s=navigator){return s.userAgentData?.mobile||/Android|iPhone|iPad|iPod|Mobile|Silk|Kindle|Opera Mini/i.test(s.userAgent)?!0:/Macintosh/.test(s.userAgent)&&s.maxTouchPoints>1}const Iy="lgdm-phone-notice-dismissed";function z0({always:s=!1}){const[n,l]=M.useState(()=>{try{return sessionStorage.getItem(Iy)==="1"}catch{return!1}});if(!AN()||n&&!s)return null;const o=()=>{l(!0);try{sessionStorage.setItem(Iy,"1")}catch{}};return r.jsx("div",{className:"phone-notice",children:r.jsx($e,{kind:"warning",title:"Use a computer for this",action:s?void 0:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:o,children:"Got it"}),children:"LG Dev Manager talks to your TV through the bridge, a small program that has to run on the same computer as this browser. Phones and tablets can’t run it, and the workarounds — running it in a terminal app on the phone, or opening a bridge to your Wi-Fi — are risky: the bridge holds your TV’s keys and passwords and can do anything on the TV, including as root. Please open this page on a desktop or laptop instead."})})}var Md,Hy;function Pc(){if(Hy)return Md;Hy=1;var s={};return Md=typeof process=="object"&&s&&s.NODE_DEBUG&&/\bsemver\b/i.test(s.NODE_DEBUG)?(...l)=>console.error("SEMVER",...l):()=>{},Md}var Bd,Uy;function vm(){if(Uy)return Bd;Uy=1;const s="2.0.0",n=256,l=Number.MAX_SAFE_INTEGER||9007199254740991,o=16,d=n-6;return Bd={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:o,MAX_SAFE_BUILD_LENGTH:d,MAX_SAFE_INTEGER:l,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:s,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Bd}var cc={exports:{}},zy;function Fc(){return zy||(zy=1,(function(s,n){const{MAX_SAFE_COMPONENT_LENGTH:l,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:d}=vm(),_=Pc();n=s.exports={};const w=n.re=[],c=n.safeRe=[],h=n.src=[],y=n.safeSrc=[],p=n.t={};let f=0;const x="[a-zA-Z0-9-]",C=[["\\s",1],["\\d",d],[x,o]],j=g=>{for(const[b,v]of C)g=g.split(`${b}*`).join(`${b}{0,${v}}`).split(`${b}+`).join(`${b}{1,${v}}`);return g},E=(g,b,v)=>{const S=j(b),N=f++;_(g,N,b),p[g]=N,h[N]=b,y[N]=S,w[N]=new RegExp(b,v?"g":void 0),c[N]=new RegExp(S,v?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*"),E("NUMERICIDENTIFIERLOOSE","\\d+"),E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${x}*`),E("MAINVERSION",`(${h[p.NUMERICIDENTIFIER]})\\.(${h[p.NUMERICIDENTIFIER]})\\.(${h[p.NUMERICIDENTIFIER]})`),E("MAINVERSIONLOOSE",`(${h[p.NUMERICIDENTIFIERLOOSE]})\\.(${h[p.NUMERICIDENTIFIERLOOSE]})\\.(${h[p.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASEIDENTIFIER",`(?:${h[p.NONNUMERICIDENTIFIER]}|${h[p.NUMERICIDENTIFIER]})`),E("PRERELEASEIDENTIFIERLOOSE",`(?:${h[p.NONNUMERICIDENTIFIER]}|${h[p.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASE",`(?:-(${h[p.PRERELEASEIDENTIFIER]}(?:\\.${h[p.PRERELEASEIDENTIFIER]})*))`),E("PRERELEASELOOSE",`(?:-?(${h[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${h[p.PRERELEASEIDENTIFIERLOOSE]})*))`),E("BUILDIDENTIFIER",`${x}+`),E("BUILD",`(?:\\+(${h[p.BUILDIDENTIFIER]}(?:\\.${h[p.BUILDIDENTIFIER]})*))`),E("FULLPLAIN",`v?${h[p.MAINVERSION]}${h[p.PRERELEASE]}?${h[p.BUILD]}?`),E("FULL",`^${h[p.FULLPLAIN]}$`),E("LOOSEPLAIN",`[v=\\s]*${h[p.MAINVERSIONLOOSE]}${h[p.PRERELEASELOOSE]}?${h[p.BUILD]}?`),E("LOOSE",`^${h[p.LOOSEPLAIN]}$`),E("GTLT","((?:<|>)?=?)"),E("XRANGEIDENTIFIERLOOSE",`${h[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),E("XRANGEIDENTIFIER",`${h[p.NUMERICIDENTIFIER]}|x|X|\\*`),E("XRANGEPLAIN",`[v=\\s]*(${h[p.XRANGEIDENTIFIER]})(?:\\.(${h[p.XRANGEIDENTIFIER]})(?:\\.(${h[p.XRANGEIDENTIFIER]})(?:${h[p.PRERELEASE]})?${h[p.BUILD]}?)?)?`),E("XRANGEPLAINLOOSE",`[v=\\s]*(${h[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${h[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${h[p.XRANGEIDENTIFIERLOOSE]})(?:${h[p.PRERELEASELOOSE]})?${h[p.BUILD]}?)?)?`),E("XRANGE",`^${h[p.GTLT]}\\s*${h[p.XRANGEPLAIN]}$`),E("XRANGELOOSE",`^${h[p.GTLT]}\\s*${h[p.XRANGEPLAINLOOSE]}$`),E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${l}})(?:\\.(\\d{1,${l}}))?(?:\\.(\\d{1,${l}}))?`),E("COERCE",`${h[p.COERCEPLAIN]}(?:$|[^\\d])`),E("COERCEFULL",h[p.COERCEPLAIN]+`(?:${h[p.PRERELEASE]})?(?:${h[p.BUILD]})?(?:$|[^\\d])`),E("COERCERTL",h[p.COERCE],!0),E("COERCERTLFULL",h[p.COERCEFULL],!0),E("LONETILDE","(?:~>?)"),E("TILDETRIM",`(\\s*)${h[p.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",E("TILDE",`^${h[p.LONETILDE]}${h[p.XRANGEPLAIN]}$`),E("TILDELOOSE",`^${h[p.LONETILDE]}${h[p.XRANGEPLAINLOOSE]}$`),E("LONECARET","(?:\\^)"),E("CARETTRIM",`(\\s*)${h[p.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",E("CARET",`^${h[p.LONECARET]}${h[p.XRANGEPLAIN]}$`),E("CARETLOOSE",`^${h[p.LONECARET]}${h[p.XRANGEPLAINLOOSE]}$`),E("COMPARATORLOOSE",`^${h[p.GTLT]}\\s*(${h[p.LOOSEPLAIN]})$|^$`),E("COMPARATOR",`^${h[p.GTLT]}\\s*(${h[p.FULLPLAIN]})$|^$`),E("COMPARATORTRIM",`(\\s*)${h[p.GTLT]}\\s*(${h[p.LOOSEPLAIN]}|${h[p.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",E("HYPHENRANGE",`^\\s*(${h[p.XRANGEPLAIN]})\\s+-\\s+(${h[p.XRANGEPLAIN]})\\s*$`),E("HYPHENRANGELOOSE",`^\\s*(${h[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${h[p.XRANGEPLAINLOOSE]})\\s*$`),E("STAR","(<|>)?=?\\s*\\*"),E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(cc,cc.exports)),cc.exports}var Id,$y;function _m(){if($y)return Id;$y=1;const s=Object.freeze({loose:!0}),n=Object.freeze({});return Id=o=>o?typeof o!="object"?s:o:n,Id}var Hd,Py;function ON(){if(Py)return Hd;Py=1;const s=/^[0-9]+$/,n=(o,d)=>{if(typeof o=="number"&&typeof d=="number")return o===d?0:o<d?-1:1;const _=s.test(o),w=s.test(d);return _&&w&&(o=+o,d=+d),o===d?0:_&&!w?-1:w&&!_?1:o<d?-1:1};return Hd={compareIdentifiers:n,rcompareIdentifiers:(o,d)=>n(d,o)},Hd}var Ud,Fy;function jl(){if(Fy)return Ud;Fy=1;const s=Pc(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:l}=vm(),{safeRe:o,t:d}=Fc(),_=_m(),{compareIdentifiers:w}=ON(),c=(y,p)=>{const f=p.split(".");if(f.length>y.length)return!1;for(let x=0;x<f.length;x++)if(w(y[x],f[x])!==0)return!1;return!0};class h{constructor(p,f){if(f=_(f),p instanceof h){if(p.loose===!!f.loose&&p.includePrerelease===!!f.includePrerelease)return p;p=p.version}else if(typeof p!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof p}".`);if(p.length>n)throw new TypeError(`version is longer than ${n} characters`);s("SemVer",p,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const x=p.trim().match(f.loose?o[d.LOOSE]:o[d.FULL]);if(!x)throw new TypeError(`Invalid Version: ${p}`);if(this.raw=p,this.major=+x[1],this.minor=+x[2],this.patch=+x[3],this.major>l||this.major<0)throw new TypeError("Invalid major version");if(this.minor>l||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>l||this.patch<0)throw new TypeError("Invalid patch version");x[4]?this.prerelease=x[4].split(".").map(C=>{if(/^[0-9]+$/.test(C)){const j=+C;if(j>=0&&j<l)return j}return C}):this.prerelease=[],this.build=x[5]?x[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(p){if(s("SemVer.compare",this.version,this.options,p),!(p instanceof h)){if(typeof p=="string"&&p===this.version)return 0;p=new h(p,this.options)}return p.version===this.version?0:this.compareMain(p)||this.comparePre(p)}compareMain(p){return p instanceof h||(p=new h(p,this.options)),this.major<p.major?-1:this.major>p.major?1:this.minor<p.minor?-1:this.minor>p.minor?1:this.patch<p.patch?-1:this.patch>p.patch?1:0}comparePre(p){if(p instanceof h||(p=new h(p,this.options)),this.prerelease.length&&!p.prerelease.length)return-1;if(!this.prerelease.length&&p.prerelease.length)return 1;if(!this.prerelease.length&&!p.prerelease.length)return 0;let f=0;do{const x=this.prerelease[f],C=p.prerelease[f];if(s("prerelease compare",f,x,C),x===void 0&&C===void 0)return 0;if(C===void 0)return 1;if(x===void 0)return-1;if(x===C)continue;return w(x,C)}while(++f)}compareBuild(p){p instanceof h||(p=new h(p,this.options));let f=0;do{const x=this.build[f],C=p.build[f];if(s("build compare",f,x,C),x===void 0&&C===void 0)return 0;if(C===void 0)return 1;if(x===void 0)return-1;if(x===C)continue;return w(x,C)}while(++f)}inc(p,f,x){if(p.startsWith("pre")){if(!f&&x===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const C=`-${f}`.match(this.options.loose?o[d.PRERELEASELOOSE]:o[d.PRERELEASE]);if(!C||C[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(p){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,x);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,x);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,x),this.inc("pre",f,x);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,x),this.inc("pre",f,x);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const C=Number(x)?1:0;if(this.prerelease.length===0)this.prerelease=[C];else{let j=this.prerelease.length;for(;--j>=0;)typeof this.prerelease[j]=="number"&&(this.prerelease[j]++,j=-2);if(j===-1){if(f===this.prerelease.join(".")&&x===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(C)}}if(f){let j=[f,C];if(x===!1&&(j=[f]),c(this.prerelease,f)){const E=this.prerelease[f.split(".").length];isNaN(E)&&(this.prerelease=j)}else this.prerelease=j}break}default:throw new Error(`invalid increment argument: ${p}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ud=h,Ud}var zd,Vy;function da(){if(Vy)return zd;Vy=1;const s=jl();return zd=(l,o,d)=>new s(l,d).compare(new s(o,d)),zd}var $d,qy;function $0(){if(qy)return $d;qy=1;const s=da();return $d=(l,o,d)=>s(l,o,d)>0,$d}var LN=$0();const If=la(LN);var Pd,Ky;function P0(){if(Ky)return Pd;Ky=1;const s=jl();return Pd=(l,o,d=!1)=>{if(l instanceof s)return l;try{return new s(l,o)}catch(_){if(!d)return null;throw _}},Pd}var Fd,Gy;function MN(){if(Gy)return Fd;Gy=1;const s=P0();return Fd=(l,o)=>{const d=s(l,o);return d?d.version:null},Fd}var BN=MN();const Yy=la(BN),Zy="lgdm-bridge-update-dismissed";function IN(s,n=ml){return!!Yy(s)&&!!Yy(n)&&If(n,s)}function F0({always:s=!1}){const{status:n}=Pi(),[l,o]=M.useState(()=>{try{return sessionStorage.getItem(Zy)}catch{return null}});if(n.state!=="connected"||!IN(n.bridgeVersion)||!s&&l===ml)return null;const d=()=>{o(ml);try{sessionStorage.setItem(Zy,ml)}catch{}};return r.jsx("div",{className:"page-notice",children:r.jsxs($e,{kind:"info",title:`Bridge v${ml} is available`,action:s?void 0:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:d,children:"Later"}),children:["Yours is v",n.bridgeVersion,". Stop it (Ctrl+C) and start it again with"," ",r.jsx("span",{className:"mono",children:"npx lg-dev-manager-bridge@latest"})," — or, if you run it from the repository,"," ",r.jsx("span",{className:"mono",children:"git pull"}),", ",r.jsx("span",{className:"mono",children:"pnpm install"}),", ",r.jsx("span",{className:"mono",children:"pnpm build"})," and"," ",r.jsx("span",{className:"mono",children:"pnpm bridge"}),". Your pairing stays the same."]})})}function $i({eyebrow:s,title:n,action:l,className:o="col-12",children:d}){return r.jsxs("section",{className:`card ${o}`,children:[r.jsxs("div",{className:"card-head",children:[r.jsxs("div",{className:"card-title-wrap",children:[s&&r.jsx("span",{className:"eyebrow",children:s}),r.jsx("h2",{className:"card-title",children:n})]}),l]}),d]})}class V0 extends M.Component{state={error:null,key:this.props.resetKey};static getDerivedStateFromError(n){return{error:n instanceof Error?n:new Error(String(n))}}static getDerivedStateFromProps(n,l){return Object.is(n.resetKey,l.key)?null:{error:null,key:n.resetKey}}componentDidCatch(n,l){console.error("Page error",n,l.componentStack)}render(){const{error:n}=this.state;if(!n)return this.props.children;const l=r.jsx($i,{eyebrow:"Something went wrong",title:"This page hit an error",className:"col-12 page-error",children:r.jsxs("div",{className:"stack",children:[r.jsx($e,{kind:"danger",title:"Error",children:r.jsx("span",{className:"mono",children:n.message.slice(0,500)||n.name})}),r.jsx("p",{className:"muted",style:{margin:0,fontSize:13},children:"Your saved TVs are safe. Reload the page to try again, or pick another page from the menu."}),r.jsx("div",{className:"row",children:r.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>window.location.reload(),children:"Reload"})})]})});return this.props.fullPage?r.jsx("div",{className:"standalone-notice",children:l}):r.jsx("div",{className:"grid",children:l})}}function HN(){const[s,n]=M.useState(!1),[l,o]=M.useState(!1),{pathname:d}=_s();DN(),M.useEffect(()=>{document.body.classList.toggle("has-drawer-open",s)},[s]),M.useEffect(()=>n(!1),[d]);const _=M.useCallback(w=>{const c=w.target,h=!!c&&(c.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(c.tagName));(w.metaKey||w.ctrlKey)&&w.key.toLowerCase()==="k"?(w.preventDefault(),o(y=>!y)):w.key==="/"&&!h?(w.preventDefault(),o(!0)):w.key==="Escape"&&n(!1)},[]);return M.useEffect(()=>(window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)),[_]),r.jsxs("div",{className:"shell",children:[r.jsx(hN,{}),r.jsx("div",{className:"drawer-backdrop",onClick:()=>n(!1)}),r.jsxs("div",{className:"main",children:[r.jsx(pN,{onOpenDrawer:()=>n(!0),onOpenPalette:()=>o(!0)}),r.jsxs("main",{className:"content",children:[!d.startsWith("/bridge")&&r.jsxs(r.Fragment,{children:[r.jsx(z0,{}),r.jsx(F0,{})]}),r.jsx(V0,{resetKey:d,children:r.jsx(hC,{})})]}),r.jsx(gN,{}),r.jsx(kN,{})]}),r.jsx(_N,{open:l,onClose:()=>o(!1)})]})}function ys({eyebrow:s,title:n,accent:l,sub:o,actions:d}){return r.jsxs("section",{className:"hero",children:[r.jsxs("div",{className:"hero-text",children:[r.jsx("span",{className:"eyebrow",children:s}),r.jsxs("h1",{className:"hero-title",children:[n," ",l&&r.jsx("span",{className:"accent",children:l})]}),o&&r.jsx("p",{className:"hero-sub",children:o})]}),d&&r.jsx("div",{className:"hero-actions",children:d})]})}function UN(){const{status:s,reconnect:n}=Pi();switch(s.state){case"connected":return r.jsxs($e,{kind:"success",title:"Connected",children:["Bridge v",s.bridgeVersion," on ",s.platform,"."]});case"connecting":return r.jsx($e,{kind:"info",title:"Connecting…",children:"Trying to reach the bridge."});case"error":return r.jsx($e,{kind:"danger",title:"Not connected",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:n,children:"Retry"}),children:s.message});default:return r.jsx($e,{kind:"warning",title:"Not paired yet",children:"Start the bridge, then paste its pairing token below."})}}function zN(){const{settings:s,pair:n,forget:l,status:o}=Pi(),[d,_]=M.useState(s?.url??Ry()),[w,c]=M.useState(s?.token??""),[h,y]=M.useState(!1),[p,f]=M.useState(!1),[x,C]=M.useState(null),j=async g=>{g.preventDefault(),C(null);const b=hm(d);if(b){C(new yt("bad_url",b));return}f(!0);try{await n({url:d.trim(),token:w.trim()})}catch(v){C(v instanceof yt?v:new yt("unknown",String(v)))}finally{f(!1)}},E=window.location.origin;return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Setup",title:"Connect the",accent:"bridge",sub:"Browsers can't open SSH connections to your TV, so a small helper runs on your computer and does it for this page. It only accepts this website and needs a pairing token."}),r.jsx(z0,{always:!0}),r.jsx(F0,{always:!0}),r.jsxs("div",{className:"grid",children:[r.jsx($i,{eyebrow:"Step 1",title:"Run the bridge",className:"col-6",children:r.jsxs("div",{className:"stack",children:[r.jsxs("div",{children:[r.jsx("div",{className:"eyebrow",children:"In a terminal on this computer (Node.js 22 or newer)"}),r.jsx("div",{className:"codeblock",children:"npx lg-dev-manager-bridge@latest"})]}),r.jsxs("p",{className:"muted",style:{margin:0,fontSize:13},children:["It prints a ",r.jsx("strong",{children:"pairing token"})," — paste it below. Keep the terminal open while you use the app; Ctrl+C stops the bridge. It also serves this app at ",r.jsxs("span",{className:"mono",children:["http://localhost:",Tc]})," if you’d rather not use the website."]}),r.jsxs("p",{className:"muted",style:{margin:0,fontSize:13},children:["On macOS, the first time the bridge looks for or connects to your TV, the system asks whether your terminal app may find devices on your local network — choose ",r.jsx("strong",{children:"Allow"}),"."]}),r.jsxs("details",{className:"muted bridge-from-repo",children:[r.jsx("summary",{children:"Run it from the source code instead"}),r.jsx("div",{className:"codeblock",children:`git clone ${N0}.git
11
+ Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let p=_s(),f;if(n){let g=typeof n=="string"?sr(n):n;bt(h==="/"||g.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${g.pathname}" was given in the \`location\` prop.`),f=g}else f=p;let x=f.pathname||"/",C=x;if(h!=="/"){let g=h.replace(/^\//,"").split("/");C="/"+x.replace(/^\//,"").split("/").slice(g.length).join("/")}let j=l&&l.state.matches.length?l.state.matches.map(g=>Object.assign(g,{route:l.manifest[g.route.id]||g.route})):Pb(s,{pathname:C});qs(y||j!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),qs(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=nC(j&&j.map(g=>Object.assign({},g,{params:Object.assign({},w,g.params),pathname:ti([h,o.encodeLocation?o.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?h:ti([h,o.encodeLocation?o.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),d,l);return n&&E?M.createElement(wl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...f},navigationType:"POP"}},E):E}function eC(){let s=cC(),n=Bw(s)?`${s.status} ${s.statusText}`:s instanceof Error?s.message:JSON.stringify(s),l=s instanceof Error?s.stack:null,o="rgba(200,200,200, 0.5)",d={padding:"0.5rem",backgroundColor:o},_={padding:"2px 4px",backgroundColor:o},w=null;return console.error("Error handled by React Router default ErrorBoundary:",s),w=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:_},"ErrorBoundary")," or"," ",M.createElement("code",{style:_},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},n),l?M.createElement("pre",{style:d},l):null,w)}var tC=M.createElement(eC,null),i0=class extends M.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){this.props.onError?this.props.onError(s,n):console.error("React Router caught the following error during render",s)}render(){let s=this.state.error;if(this.context&&typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){const l=Yw(s.digest);l&&(s=l)}let n=s!==void 0?M.createElement(ni.Provider,{value:this.props.routeContext},M.createElement(Wf.Provider,{value:s,children:this.props.component})):this.props.children;return this.context?M.createElement(sC,{error:s},n):n}};i0.contextType=Wb;var jd=new WeakMap;function sC({children:s,error:n}){let{basename:l,navigator:o}=M.useContext(Os);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let d=Gw(n.digest);if(d){let _=jd.get(n);if(_)throw _;let w=Zb(d.location,l),c=w.absoluteURL||w.to;if(Xf(d.location,c,Zf(o),"allow-explicit"),$w(c))throw new Error("Invalid redirect location");if(Yb&&!jd.get(n))if(w.isExternal||d.reloadDocument)window.location.href=c;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(w.to,{replace:d.replace}));throw jd.set(n,h),h}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return s}function iC({routeContext:s,match:n,children:l}){let o=M.useContext(oa);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),M.createElement(ni.Provider,{value:s},l)}function nC(s,n=[],l){let o=l?.state;if(s==null){if(!o)return null;if(o.errors)s=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)s=o.matches;else return null}let d=s,_=o?.errors;if(_!=null){let p=d.findIndex(f=>f.route.id&&_?.[f.route.id]!==void 0);bt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(_).join(",")}`),d=d.slice(0,Math.min(d.length,p+1))}let w=!1,c=-1;if(l&&o){w=o.renderFallback;for(let p=0;p<d.length;p++){let f=d[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(c=p),f.route.id){let{loaderData:x,errors:C}=o,j=f.route.loader&&!x.hasOwnProperty(f.route.id)&&(!C||C[f.route.id]===void 0);if(f.route.lazy||j){l.isStatic&&(w=!0),c>=0?d=d.slice(0,c+1):d=[d[0]];break}}}}let h=l?.onError,y=o&&h?(p,f)=>{h(p,{location:o.location,params:o.matches?.[0]?.params??{},pattern:Iw(o.matches),errorInfo:f})}:void 0;return d.reduceRight((p,f,x)=>{let C,j=!1,E=null,g=null;o&&(C=_&&f.route.id?_[f.route.id]:void 0,E=f.route.errorElement||tC,w&&(c<0&&x===0?(n0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,g=null):c===x&&(j=!0,g=f.route.hydrateFallbackElement||null)));let b=n.concat(d.slice(0,x+1)),v=()=>{let S;return C?S=E:j?S=g:f.route.Component?S=M.createElement(f.route.Component,null):f.route.element?S=f.route.element:S=p,M.createElement(iC,{match:f,routeContext:{outlet:p,matches:b,isDataRoute:o!=null},children:S})};return o&&(f.route.ErrorBoundary||f.route.errorElement||x===0)?M.createElement(i0,{location:o.location,revalidation:o.revalidation,component:E,error:C,children:v(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:y}):v()},null)}function Qf(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rC(s){let n=M.useContext(oa);return bt(n,Qf(s)),n}function aC(s){let n=M.useContext(Lc);return bt(n,Qf(s)),n}function lC(s){let n=M.useContext(ni);return bt(n,Qf(s)),n}function Jf(s){let n=lC(s),l=n.matches[n.matches.length-1];return bt(l.route.id,`${s} can only be used on routes that contain a unique "id"`),l.route.id}function oC(){return Jf("useRouteId")}function cC(){let s=M.useContext(Wf),n=aC("useRouteError"),l=Jf("useRouteError");return s!==void 0?s:n.errors?.[l]}function uC(){let{router:s}=rC("useNavigate"),n=Jf("useNavigate"),l=M.useRef(!1);return t0(()=>{l.current=!0}),M.useCallback(async(d,_={})=>{qs(l.current,e0),l.current&&(typeof d=="number"?await s.navigate(d):await s.navigate(d,{fromRouteId:n,..._}))},[s,n])}var oy={};function n0(s,n,l){!n&&!oy[s]&&(oy[s]=!0,qs(!1,l))}M.memo(hC);function hC({routes:s,manifest:n,future:l,state:o,isStatic:d,onError:_}){return s0(s,void 0,{manifest:n,state:o,isStatic:d,onError:_})}function dc({to:s,replace:n,state:l,relative:o}){bt(ca(),"<Navigate> may be used only in the context of a <Router> component.");let{static:d,navigator:_}=M.useContext(Os);qs(!d,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:w}=M.useContext(ni),{pathname:c}=_s(),h=Cl(),y=Oc(s,Yf(w),c,o==="path");Xf(typeof s=="string"?s:Wn(s),_.createHref(y),Zf(_),"reject");let p=JSON.stringify(y);return M.useEffect(()=>{h(JSON.parse(p),{replace:n,state:l,relative:o})},[h,p,o,n,l]),null}function dC(s){return Qw(s.context)}function Ot(s){bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function fC({basename:s="/",children:n=null,location:l,navigationType:o="POP",navigator:d,static:_=!1,useTransitions:w}){bt(!ca(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=s.replace(/^\/*/,"/"),h=M.useMemo(()=>({basename:c,navigator:d,static:_,useTransitions:w,future:{}}),[c,d,_,w]);typeof l=="string"&&(l=sr(l));let{pathname:y="/",search:p="",hash:f="",state:x=null,key:C="default",mask:j}=l,E=M.useMemo(()=>{let g=Ui(y,c);return g==null?null:{location:{pathname:g,search:p,hash:f,state:x,key:C,mask:j},navigationType:o}},[c,y,p,f,x,C,o,j]);return qs(E!=null,`<Router basename="${c}"> is not able to match the URL "${y}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:M.createElement(Os.Provider,{value:h},M.createElement(wl.Provider,{children:n,value:E}))}function mC({children:s,location:n}){return Jw(pf(s),n)}function pf(s,n=[]){let l=[];return M.Children.forEach(s,(o,d)=>{if(!M.isValidElement(o))return;let _=[...n,d];if(o.type===M.Fragment){l.push.apply(l,pf(o.props.children,_));return}bt(o.type===Ot,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),bt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let w={id:o.props.id||_.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(w.children=pf(o.props.children,_)),l.push(w)}),l}var fc="get",mc="application/x-www-form-urlencoded";function Mc(s){return typeof HTMLElement<"u"&&s instanceof HTMLElement}function pC(s){return Mc(s)&&s.tagName.toLowerCase()==="button"}function gC(s){return Mc(s)&&s.tagName.toLowerCase()==="form"}function vC(s){return Mc(s)&&s.tagName.toLowerCase()==="input"}function _C(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function yC(s,n){return s.button===0&&(!n||n==="_self")&&!_C(s)}var ic=null;function bC(){if(ic===null)try{new FormData(document.createElement("form"),0),ic=!1}catch{ic=!0}return ic}var SC=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Td(s){return s!=null&&!SC.has(s)?(qs(!1,`"${s}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mc}"`),null):s}function xC(s,n){let l,o,d,_,w;if(gC(s)){let c=s.getAttribute("action");o=c?Ui(c,n):null,l=s.getAttribute("method")||fc,d=Td(s.getAttribute("enctype"))||mc,_=new FormData(s)}else if(pC(s)||vC(s)&&(s.type==="submit"||s.type==="image")){let c=s.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=s.getAttribute("formaction")||c.getAttribute("action");if(o=h?Ui(h,n):null,l=s.getAttribute("formmethod")||c.getAttribute("method")||fc,d=Td(s.getAttribute("formenctype"))||Td(c.getAttribute("enctype"))||mc,_=new FormData(c,s),!bC()){let{name:y,type:p,value:f}=s;if(p==="image"){let x=y?`${y}.`:"";_.append(`${x}x`,"0"),_.append(`${x}y`,"0")}else y&&_.append(y,f)}}else{if(Mc(s))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');l=fc,o=null,d=mc,w=s}return _&&d==="text/plain"&&(w=_,_=void 0),{action:o,method:l.toLowerCase(),encType:d,formData:_,body:w}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function em(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function r0(s,n,l,o){let d=typeof s=="string"?new URL(s,typeof window>"u"?"server://singlefetch/":window.location.origin):s;return l?d.pathname.endsWith("/")?d.pathname=`${d.pathname}_.${o}`:d.pathname=`${d.pathname}.${o}`:d.pathname==="/"?d.pathname=`_root.${o}`:n&&Ui(d.pathname,n)==="/"?d.pathname=`${ta(n)}/_root.${o}`:d.pathname=`${ta(d.pathname)}.${o}`,d}async function wC(s,n){if(s.id in n)return n[s.id];try{let l=await import(s.module);return n[s.id]=l,l}catch(l){return console.error(`Error loading route module \`${s.module}\`, reloading page...`),console.error(l),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function CC(s){return s==null?!1:s.href==null?s.rel==="preload"&&typeof s.imageSrcSet=="string"&&typeof s.imageSizes=="string":typeof s.rel=="string"&&typeof s.href=="string"}async function EC(s,n,l){let o=await Promise.all(s.map(async d=>{let _=n.routes[d.route.id];if(_){let w=await wC(_,l);return w.links?w.links():[]}return[]}));return kC(o.flat(1).filter(CC).filter(d=>d.rel==="stylesheet"||d.rel==="preload").map(d=>d.rel==="stylesheet"?{...d,rel:"prefetch",as:"style"}:{...d,rel:"prefetch"}))}function cy(s,n,l,o,d,_){let w=(h,y)=>l[y]?h.route.id!==l[y].route.id:!0,c=(h,y)=>l[y].pathname!==h.pathname||l[y].route.path?.endsWith("*")&&l[y].params["*"]!==h.params["*"];return _==="assets"?n.filter((h,y)=>w(h,y)||c(h,y)):_==="data"?n.filter((h,y)=>{let p=o.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(w(h,y)||c(h,y))return!0;if(h.route.shouldRevalidate){let f=h.route.shouldRevalidate({currentUrl:new URL(d.pathname+d.search+d.hash,window.origin),currentParams:l[0]?.params||{},nextUrl:new URL(s,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function NC(s,n,{includeHydrateFallback:l}={}){return jC(s.map(o=>{let d=n.routes[o.route.id];if(!d)return[];let _=[d.module];return d.clientActionModule&&(_=_.concat(d.clientActionModule)),d.clientLoaderModule&&(_=_.concat(d.clientLoaderModule)),l&&d.hydrateFallbackModule&&(_=_.concat(d.hydrateFallbackModule)),d.imports&&(_=_.concat(d.imports)),_}).flat(1))}function jC(s){return[...new Set(s)]}function TC(s){let n={},l=Object.keys(s).sort();for(let o of l)n[o]=s[o];return n}function kC(s,n){let l=new Set;return new Set(n),s.reduce((o,d)=>{let _=JSON.stringify(TC(d));return l.has(_)||(l.add(_),o.push({key:_,link:d})),o},[])}function tm(){let s=M.useContext(oa);return em(s,"You must render this element inside a <DataRouterContext.Provider> element"),s}function RC(){let s=M.useContext(Lc);return em(s,"You must render this element inside a <DataRouterStateContext.Provider> element"),s}var sm=M.createContext(void 0);sm.displayName="FrameworkContext";function Bc(){let s=M.useContext(sm);return em(s,"You must render this element inside a <HydratedRouter> element"),s}function DC(s,n){let l=M.useContext(sm),[o,d]=M.useState(!1),[_,w]=M.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:y,onMouseLeave:p,onTouchStart:f}=n,x=M.useRef(null);M.useEffect(()=>{if(s==="render"&&w(!0),s==="viewport"){let E=b=>{b.forEach(v=>{w(v.isIntersecting)})},g=new IntersectionObserver(E,{threshold:.5});return x.current&&g.observe(x.current),()=>{g.disconnect()}}},[s]),M.useEffect(()=>{if(o){let E=setTimeout(()=>{w(!0)},100);return()=>{clearTimeout(E)}}},[o]);let C=()=>{d(!0)},j=()=>{d(!1),w(!1)};return l?s!=="intent"?[_,x,{}]:[_,x,{onFocus:cl(c,C),onBlur:cl(h,j),onMouseEnter:cl(y,C),onMouseLeave:cl(p,j),onTouchStart:cl(f,C)}]:[!1,x,{}]}function cl(s,n){return l=>{s&&s(l),l.defaultPrevented||n(l)}}function AC({page:s,...n}){let l=Pw(),{nonce:o}=Bc(),{router:d}=tm(),_=M.useMemo(()=>Pb(d.routes,s,d.basename),[d.routes,s,d.basename]);return _?(n.nonce==null&&o&&(n={...n,nonce:o}),l?M.createElement(LC,{page:s,matches:_,...n}):M.createElement(MC,{page:s,matches:_,...n})):null}function OC(s){let{manifest:n,routeModules:l}=Bc(),[o,d]=M.useState([]);return M.useEffect(()=>{let _=!1;return EC(s,n,l).then(w=>{_||d(w)}),()=>{_=!0}},[s,n,l]),o}function LC({page:s,matches:n,...l}){let o=_s(),{future:d}=Bc(),{basename:_}=tm(),w=M.useMemo(()=>{if(s===o.pathname+o.search+o.hash)return[];let c=r0(s,_,d.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,y=[];for(let p of n)typeof p.route.shouldRevalidate=="function"?h=!0:y.push(p.route.id);return h&&y.length>0&&c.searchParams.set("_routes",y.join(",")),[c.pathname+c.search]},[_,d.v8_trailingSlashAwareDataRequests,s,o,n]);return M.createElement(M.Fragment,null,w.map(c=>M.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...l})))}function MC({page:s,matches:n,...l}){let o=_s(),{future:d,manifest:_,routeModules:w}=Bc(),{basename:c}=tm(),{loaderData:h,matches:y}=RC(),p=M.useMemo(()=>cy(s,n,y,_,o,"data"),[s,n,y,_,o]),f=M.useMemo(()=>cy(s,n,y,_,o,"assets"),[s,n,y,_,o]),x=M.useMemo(()=>{if(s===o.pathname+o.search+o.hash)return[];let E=new Set,g=!1;if(n.forEach(v=>{let S=_.routes[v.route.id];!S||!S.hasLoader||(!p.some(N=>N.route.id===v.route.id)&&v.route.id in h&&w[v.route.id]?.shouldRevalidate||S.hasClientLoader?g=!0:E.add(v.route.id))}),E.size===0)return[];let b=r0(s,c,d.v8_trailingSlashAwareDataRequests,"data");return g&&E.size>0&&b.searchParams.set("_routes",n.filter(v=>E.has(v.route.id)).map(v=>v.route.id).join(",")),[b.pathname+b.search]},[c,d.v8_trailingSlashAwareDataRequests,h,o,_,p,n,s,w]),C=M.useMemo(()=>NC(f,_),[f,_]),j=OC(f);return M.createElement(M.Fragment,null,x.map(E=>M.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...l})),C.map(E=>M.createElement("link",{key:E,rel:"modulepreload",href:E,...l})),j.map(({key:E,link:g})=>M.createElement("link",{key:E,nonce:l.nonce,...g,crossOrigin:g.crossOrigin??l.crossOrigin})))}function BC(...s){return n=>{s.forEach(l=>{typeof l=="function"?l(n):l!=null&&(l.current=n)})}}var IC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{IC&&(window.__reactRouterVersion="7.18.4")}catch{}function HC({basename:s,children:n,useTransitions:l,window:o}){let d=M.useRef();d.current==null&&(d.current=fw({window:o,v5Compat:!0}));let _=d.current,[w,c]=M.useState({action:_.action,location:_.location}),h=M.useCallback(y=>{l===!1?c(y):M.startTransition(()=>c(y))},[l]);return M.useLayoutEffect(()=>_.listen(h),[_,h]),M.createElement(fC,{basename:s,children:n,location:w.location,navigationType:w.action,navigator:_,useTransitions:l})}var Jt=M.forwardRef(function({onClick:n,discover:l="render",prefetch:o="none",relative:d,reloadDocument:_,replace:w,mask:c,state:h,target:y,to:p,preventScrollReset:f,viewTransition:x,defaultShouldRevalidate:C,...j},E){let{basename:g,navigator:b,useTransitions:v}=M.useContext(Os),S=typeof p=="string"&&Gf.test(p),N=Zb(p,g);p=N.to;let T=Zw(p,{relative:d}),D=_s(),O=null;if(c){let he=Oc(c,[],D.mask?D.mask.pathname:"/",!0);g!=="/"&&(he.pathname=he.pathname==="/"?g:ti([g,he.pathname])),O=b.createHref(he)}let[k,L,V]=DC(o,j),q=$C(p,{replace:w,mask:c,state:h,target:y,preventScrollReset:f,relative:d,viewTransition:x,defaultShouldRevalidate:C,useTransitions:v});function Y(he){n&&n(he),he.defaultPrevented||q(he)}let P=!(N.isExternal||_),Q=M.createElement("a",{...j,...V,href:(P?O:void 0)||N.absoluteURL||T,onClick:P?Y:n,ref:BC(E,L),target:y,"data-discover":!S&&l==="render"?"true":void 0});return k&&!S?M.createElement(M.Fragment,null,Q,M.createElement(AC,{page:T})):Q});Jt.displayName="Link";var im=M.forwardRef(function({"aria-current":n="page",caseSensitive:l=!1,className:o="",end:d=!1,style:_,to:w,viewTransition:c,children:h,...y},p){let f=El(w,{relative:y.relative}),x=_s(),C=M.useContext(Lc),{navigator:j,basename:E}=M.useContext(Os),g=C!=null&&KC(f)&&c===!0,b=j.encodeLocation?j.encodeLocation(f).pathname:f.pathname,v=x.pathname,S=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;l||(v=v.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase()),S&&E&&(S=Ui(S,E)||S);const N=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let T=v===b||!d&&v.startsWith(b)&&v.charAt(N)==="/",D=S!=null&&(S===b||!d&&S.startsWith(b)&&S.charAt(b.length)==="/"),O={isActive:T,isPending:D,isTransitioning:g},k=T?n:void 0,L;typeof o=="function"?L=o(O):L=[o,T?"active":null,D?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let V=typeof _=="function"?_(O):_;return M.createElement(Jt,{...y,"aria-current":k,className:L,ref:p,style:V,to:w,viewTransition:c},typeof h=="function"?h(O):h)});im.displayName="NavLink";var UC=M.forwardRef(({discover:s="render",fetcherKey:n,navigate:l,reloadDocument:o,replace:d,state:_,method:w=fc,action:c,onSubmit:h,relative:y,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:x,...C},j)=>{let{useTransitions:E}=M.useContext(Os),g=VC(),b=qC(c,{relative:y}),v=w.toLowerCase()==="get"?"get":"post",S=typeof c=="string"&&Gf.test(c),N=T=>{if(h&&h(T),T.defaultPrevented)return;T.preventDefault();let D=T.nativeEvent.submitter,O=D?.getAttribute("formmethod")||w,k=()=>g(D||T.currentTarget,{fetcherKey:n,method:O,navigate:l,replace:d,state:_,relative:y,preventScrollReset:p,viewTransition:f,defaultShouldRevalidate:x});E&&l!==!1?M.startTransition(()=>k()):k()};return M.createElement("form",{ref:j,method:v,action:b,onSubmit:o?h:N,...C,"data-discover":!S&&s==="render"?"true":void 0})});UC.displayName="Form";function zC(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function a0(s){let n=M.useContext(oa);return bt(n,zC(s)),n}function $C(s,{target:n,replace:l,mask:o,state:d,preventScrollReset:_,relative:w,viewTransition:c,defaultShouldRevalidate:h,useTransitions:y}={}){let p=Cl(),f=_s(),x=El(s,{relative:w});return M.useCallback(C=>{if(yC(C,n)){C.preventDefault();let j=l!==void 0?l:Wn(f)===Wn(x),E=()=>p(s,{replace:j,mask:o,state:d,preventScrollReset:_,relative:w,viewTransition:c,defaultShouldRevalidate:h});y?M.startTransition(()=>E()):E()}},[f,p,x,l,o,d,n,s,_,w,c,h,y])}var PC=0,FC=()=>`__${String(++PC)}__`;function VC(){let{router:s}=a0("useSubmit"),{basename:n}=M.useContext(Os),l=oC(),o=s.fetch,d=s.navigate;return M.useCallback(async(_,w={})=>{let{action:c,method:h,encType:y,formData:p,body:f}=xC(_,n);if(w.navigate===!1){let x=w.fetcherKey||FC();await o(x,l,w.action||c,{defaultShouldRevalidate:w.defaultShouldRevalidate,preventScrollReset:w.preventScrollReset,formData:p,body:f,formMethod:w.method||h,formEncType:w.encType||y,flushSync:w.flushSync})}else await d(w.action||c,{defaultShouldRevalidate:w.defaultShouldRevalidate,preventScrollReset:w.preventScrollReset,formData:p,body:f,formMethod:w.method||h,formEncType:w.encType||y,replace:w.replace,state:w.state,fromRouteId:l,flushSync:w.flushSync,viewTransition:w.viewTransition})},[o,d,n,l])}function qC(s,{relative:n}={}){let{basename:l}=M.useContext(Os),o=M.useContext(ni);bt(o,"useFormAction must be used inside a RouteContext");let[d]=o.matches.slice(-1),_={...El(s||".",{relative:n})},w=_s();if(s==null){_.search=w.search;let c=new URLSearchParams(_.search),h=c.getAll("index");if(h.some(p=>p==="")){c.delete("index"),h.filter(f=>f).forEach(f=>c.append("index",f));let p=c.toString();_.search=p?`?${p}`:""}}return(!s||s===".")&&d.route.index&&(_.search=_.search?_.search.replace(/^\?/,"?index&"):"?index"),l!=="/"&&(_.pathname=_.pathname==="/"?l:ti([l,_.pathname])),Wn(_)}function KC(s,{relative:n}={}){let l=M.useContext(Qb);bt(l!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=a0("useViewTransitionState"),d=El(s,{relative:n});if(!l.isTransitioning)return!1;let _=Ui(l.currentLocation.pathname,o)||l.currentLocation.pathname,w=Ui(l.nextLocation.pathname,o)||l.nextLocation.pathname;return gc(d.pathname,w)!=null||gc(d.pathname,_)!=null}var GC=zb();const l0=M.createContext(void 0),En=s=>{const n=M.useContext(l0);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},YC=({client:s,children:n})=>(M.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),r.jsx(l0.Provider,{value:s,children:n})),ZC={setTimeout:(s,n)=>setTimeout(s,n),clearTimeout:s=>clearTimeout(s),setInterval:(s,n)=>setInterval(s,n),clearInterval:s=>clearInterval(s)};var XC=class{#e=ZC;#t=!1;setTimeoutProvider(s){this.#e=s}setTimeout(s,n){return this.#e.setTimeout(s,n)}clearTimeout(s){this.#e.clearTimeout(s)}setInterval(s,n){return this.#e.setInterval(s,n)}clearInterval(s){this.#e.clearInterval(s)}};const Xn=new XC;function WC(s){setTimeout(s,0)}const QC=typeof window>"u"||"Deno"in globalThis;function gs(){}function JC(s,n){return typeof s=="function"?s(n):s}function o0(s){return typeof s=="number"&&s>=0&&s!==1/0}function c0(s,n){return Math.max(s+(n||0)-Date.now(),0)}function _t(s,n){return typeof s=="function"?s(n):s}function uy(s,n){const{type:l="all",exact:o,fetchStatus:d,predicate:_,queryKey:w,stale:c}=s;if(w){if(o){if(n.queryHash!==nm(w,n.options))return!1}else if(!sa(n.queryKey,w))return!1}if(l!=="all"){const h=n.isActive();if(l==="active"&&!h||l==="inactive"&&h)return!1}return!(typeof c=="boolean"&&n.isStale()!==c||d&&d!==n.state.fetchStatus||_&&!_(n))}function hy(s,n){const{exact:l,status:o,predicate:d,mutationKey:_}=s;if(_){if(!n.options.mutationKey)return!1;if(l){if(pl(n.options.mutationKey)!==pl(_))return!1}else if(!sa(n.options.mutationKey,_))return!1}return!(o&&n.state.status!==o||d&&!d(n))}function nm(s,n){return(n?.queryKeyHashFn||pl)(s)}function pl(s){return JSON.stringify(s,(n,l)=>gf(l)?Object.keys(l).sort().reduce((o,d)=>(o[d]=l[d],o),{}):l)}function sa(s,n){if(s===n)return!0;if(typeof s!=typeof n)return!1;if(s&&n&&typeof s=="object"&&typeof n=="object"){if(Array.isArray(s)&&Array.isArray(n)){if(n.length>s.length)return!1;for(let o=0;o<n.length;o++)if(!sa(s[o],n[o]))return!1;return!0}const l=Object.keys(n);for(const o of l)if(!sa(s[o],n[o]))return!1;return!0}return!1}const eE=Object.prototype.hasOwnProperty;function u0(s,n,l=0){if(s===n)return s;if(l>500)return n;const o=dy(s)&&dy(n);if(!o&&!(gf(s)&&gf(n)))return n;const d=(o?s:Object.keys(s)).length,_=o?n:Object.keys(n),w=_.length,c=o?new Array(w):{};let h=0;for(let y=0;y<w;y++){const p=o?y:_[y],f=s[p],x=n[p];if(f===x){c[p]=f,(o?y<d:eE.call(s,p))&&h++;continue}if(f===null||x===null||typeof f!="object"||typeof x!="object"){c[p]=x;continue}const C=u0(f,x,l+1);c[p]=C,C===f&&h++}return d===w&&h===d?s:c}function kd(s,n){if(!n||Object.keys(s).length!==Object.keys(n).length)return!1;for(const l in s)if(s[l]!==n[l])return!1;return!0}function dy(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function gf(s){if(!fy(s))return!1;const n=Object.getPrototypeOf(s),l=n?.constructor;if(l===void 0)return!0;if(typeof l!="function")return!1;const o=l.prototype;return!(!fy(o)||!o.hasOwnProperty("isPrototypeOf")||n!==Object.prototype)}function fy(s){return Object.prototype.toString.call(s)==="[object Object]"}function tE(s){return new Promise(n=>{Xn.setTimeout(n,s)})}function vf(s,n,l){return typeof l.structuralSharing=="function"?l.structuralSharing(s,n):l.structuralSharing!==!1?u0(s,n):n}function sE(s,n,l=0){const o=[...s,n];return l&&o.length>l?o.slice(1):o}function iE(s,n,l=0){const o=[n,...s];return l&&o.length>l?o.slice(0,-1):o}const rm=Symbol();function h0(s,n){return!s.queryFn&&n?.initialPromise?()=>n.initialPromise:!s.queryFn||s.queryFn===rm?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function d0(s,n){return typeof s=="function"?s(...n):!!s}function nE(s,n,l){let o=!1,d;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(d??=n(),o||(o=!0,d.aborted?l():d.addEventListener("abort",l,{once:!0})),d)}),s}let rE=()=>QC;const am=()=>rE();var Nl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},aE=class extends Nl{#e;#t;#s;constructor(){super(),this.#s=s=>{if(typeof window<"u"&&window.addEventListener){const n=()=>s();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(s){this.#s=s,this.#t?.(),this.#t=s(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(s){this.#e!==s&&(this.#e=s,this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(n=>{n(s)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const lm=new aE,lE=WC;function oE(){let s=[],n=0,l=c=>{c()},o=c=>{c()},d=lE;const _=c=>{n?s.push(c):d(()=>{l(c)})},w=()=>{const c=s;s=[],c.length&&d(()=>{o(()=>{c.forEach(h=>{l(h)})})})};return{batch:c=>{let h;n++;try{h=c()}finally{n--,n||w()}return h},batchCalls:c=>(...h)=>{_(()=>{c(...h)})},schedule:_,setNotifyFunction:c=>{l=c},setBatchNotifyFunction:c=>{o=c},setScheduler:c=>{d=c}}}const Qt=oE();var cE=class extends Nl{#e=!0;#t;#s;constructor(){super(),this.#s=s=>{if(typeof window<"u"&&window.addEventListener){const n=()=>s(!0),l=()=>s(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",l)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(s){this.#s=s,this.#t?.(),this.#t=s(this.setOnline.bind(this))}setOnline(s){this.#e!==s&&(this.#e=s,this.listeners.forEach(n=>{n(s)}))}isOnline(){return this.#e}};const vc=new cE;function uE(s){return Math.min(1e3*2**s,3e4)}function f0(s){return(s??"online")==="online"?vc.isOnline():!0}var _f=class extends Error{constructor(s){super("CancelledError"),this.revert=s?.revert,this.silent=s?.silent}};function m0(s){let n=!1,l=0,o,d="pending",_,w;const c=new Promise((v,S)=>{_=v,w=S});c.catch(gs);const h=()=>d!=="pending",y=v=>{if(!h()){const S=new _f(v);E(S),s.onCancel?.(S)}},p=()=>{n=!0},f=()=>{n=!1},x=()=>lm.isFocused()&&(s.networkMode==="always"||vc.isOnline())&&s.canRun(),C=()=>f0(s.networkMode)&&s.canRun(),j=v=>{h()||(o?.(),d="resolved",_(v))},E=v=>{h()||(o?.(),d="rejected",w(v))},g=()=>new Promise(v=>{o=S=>{(h()||x())&&v(S)},s.onPause?.()}).then(()=>{o=void 0,h()||s.onContinue?.()}),b=()=>{if(h())return;let v;const S=l===0?s.initialPromise:void 0;try{v=S??s.fn()}catch(N){v=Promise.reject(N)}Promise.resolve(v).then(j).catch(N=>{if(h())return;const T=s.retry??(am()?0:3),D=s.retryDelay??uE,O=typeof D=="function"?D(l,N):D,k=T===!0||typeof T=="number"&&l<T||typeof T=="function"&&T(l,N);if(n||!k){E(N);return}l++,s.onFail?.(l,N),tE(O).then(()=>x()?void 0:g()).then(()=>{n?E(N):b()})})};return{promise:c,status:()=>d,cancel:y,continue:()=>(o?.(),c),cancelRetry:p,continueRetry:f,canStart:C,start:()=>(C()?b():g().then(b),c)}}var p0=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),o0(this.gcTime)&&(this.#e=Xn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(am()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Xn.clearTimeout(this.#e),this.#e=void 0)}};function hE(s){return{onFetch:(n,l)=>{const o=n.options,d=n.fetchOptions?.meta?.fetchMore?.direction,_=n.state.data?.pages||[],w=n.state.data?.pageParams||[];let c={pages:[],pageParams:[]},h=0;const y=async()=>{let p=!1;const f=j=>{nE(j,()=>n.signal,()=>p=!0)},x=h0(n.options,n.fetchOptions),C=async(j,E,g)=>{if(p)return Promise.reject(n.signal.reason);if(E==null&&j.pages.length)return Promise.resolve(j);const v=(()=>{const D={client:n.client,queryKey:n.queryKey,pageParam:E,direction:g?"backward":"forward",meta:n.options.meta};return f(D),D})(),S=await x(v),{maxPages:N}=n.options,T=g?iE:sE;return{pages:T(j.pages,S,N),pageParams:T(j.pageParams,E,N)}};if(d&&_.length){const j=d==="backward",E=j?dE:my,g={pages:_,pageParams:w};c=await C(g,E(o,g),j)}else{const j=s??_.length;do{const E=h===0?w[0]??o.initialPageParam:my(o,c);if(h>0&&E==null)break;c=await C(c,E),h++}while(h<j)}return c};n.options.persister?n.fetchFn=()=>n.options.persister?.(y,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},l):n.fetchFn=y}}}function my(s,{pages:n,pageParams:l}){const o=n.length-1;return n.length>0?s.getNextPageParam(n[o],n,l[o],l):void 0}function dE(s,{pages:n,pageParams:l}){return n.length>0?s.getPreviousPageParam?.(n[0],n,l[0],l):void 0}var fE=class extends p0{#e;#t;#s;#i;#r;#n;#a;#o;constructor(s){super(),this.#o=!1,this.#a=s.defaultOptions,this.setOptions(s.options),this.observers=[],this.#r=s.client,this.#i=this.#r.getQueryCache(),this.queryKey=s.queryKey,this.queryHash=s.queryHash,this.#t=gy(this.options),this.state=s.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#n?.promise}setOptions(s){if(this.options={...this.#a,...s},s?._type&&(this.#e=s._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=gy(this.options);n.data!==void 0&&(this.setState(py(n.data,n.dataUpdatedAt)),this.#t=n)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(s,n){const l=vf(this.state.data,s,this.options);return this.#l({data:l,type:"success",dataUpdatedAt:n?.updatedAt,manual:n?.manual}),l}setState(s){this.#l({type:"setState",state:s})}cancel(s){const n=this.#n?.promise;return this.#n?.cancel(s),n?n.then(gs).catch(gs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(s=>_t(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>_t(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!c0(this.state.dataUpdatedAt,s)}onFocus(){this.observers.find(s=>s.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(s=>s.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){const n=this.observers.indexOf(s);n!==-1&&(this.observers.splice(n,1),this.observers.length||(this.#n&&(this.#o||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(s,n){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(s&&this.setOptions(s),!this.options.queryFn){const h=this.observers.find(y=>y.options.queryFn);h&&this.setOptions(h.options)}const l=new AbortController,o=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(this.#o=!0,l.signal)})},d=()=>{const h=h0(this.options,n),p=(()=>{const f={client:this.#r,queryKey:this.queryKey,meta:this.meta};return o(f),f})();return this.#o=!1,this.options.persister?this.options.persister(h,p,this):h(p)},w=(()=>{const h={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:d};return o(h),h})();(this.#e==="infinite"?hE(this.options.pages):this.options.behavior)?.onFetch(w,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==w.fetchOptions?.meta)&&this.#l({type:"fetch",meta:w.fetchOptions?.meta});const c=this.#n=m0({initialPromise:n?.initialPromise,fn:w.fetchFn,onCancel:h=>{h instanceof _f&&h.revert&&this.setState({...this.#s,fetchStatus:"idle"}),l.abort()},onFail:(h,y)=>{this.#l({type:"failed",failureCount:h,error:y})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:w.options.retry,retryDelay:w.options.retryDelay,networkMode:w.options.networkMode,canRun:()=>!0});try{const h=await c.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#i.config.onSuccess?.(h,this),this.#i.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof _f){if(h.silent)return this.#n.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#l({type:"error",error:h}),this.#i.config.onError?.(h,this),this.#i.config.onSettled?.(this.state.data,h,this),h}finally{this.#n===c&&(this.#n=void 0),this.scheduleGc()}}#l(s){const n=l=>{switch(s.type){case"failed":return{...l,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...g0(l.data,this.options),fetchMeta:s.meta??null};case"success":const o={...l,...py(s.data,s.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=s.manual?o:void 0,o;case"error":const d=s.error;return{...l,error:d,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:d,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...s.state}}};this.state=n(this.state),Qt.batch(()=>{this.observers.slice().forEach(l=>{l.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:s})})}};function g0(s,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:f0(n.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function py(s,n){return{data:s,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function gy(s){const n=typeof s.initialData=="function"?s.initialData():s.initialData,l=n!==void 0,o=l?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:l?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:l?"success":"pending",fetchStatus:"idle"}}var mE=class extends Nl{#e;#t=void 0;#s=void 0;#i=void 0;#r;#n;#a;#o;#l;#f;#u;#h;#c;#m=new Set;constructor(s,n){super(),this.options=n,this.#e=s,this.#a=null,this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),vy(this.#t,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return yf(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return yf(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#S(),this.#t.removeObserver(this)}setOptions(s){const n=this.options,l=this.#t;if(this.options=this.#e.defaultQueryOptions(s),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof _t(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#t.setOptions(this.options),n._defaulted&&!kd(this.options,n)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const o=this.hasListeners();o&&_y(this.#t,l,this.options,n)&&this.#d(),this.updateResult(),o&&(this.#t!==l||_t(this.options.enabled,this.#t)!==_t(n.enabled,this.#t)||_t(this.options.staleTime,this.#t)!==_t(n.staleTime,this.#t))&&this.#g();const d=this.#v();o&&(this.#t!==l||_t(this.options.enabled,this.#t)!==_t(n.enabled,this.#t)||d!==this.#c)&&this.#_(d)}getOptimisticResult(s){const n=this.#e.getQueryCache().build(this.#e,s),l=this.createResult(n,s);return kd(this.getCurrentResult(),l)||(this.#i=l,this.#n=this.options,this.#r=this.#t.state),l}getCurrentResult(){return this.#i}trackResult(s,n){return new Proxy(s,{get:(l,o)=>(this.trackProp(o),n?.(o),Reflect.get(l,o))})}trackProp(s){this.#m.add(s)}getCurrentQuery(){return this.#t}refetch({...s}={}){return this.fetch({...s})}fetchOptimistic(s){const n=this.#e.defaultQueryOptions(s),l=this.#e.getQueryCache().build(this.#e,n);let o=()=>{},d;const _=new Promise(w=>{d=w,o=this.#e.getQueryCache().subscribe(c=>{c.type==="updated"&&c.query.queryHash===l.queryHash&&l.state.data!==void 0&&(o(),w(this.createResult(l,n)))})});return Promise.race([l.fetch().then(()=>{const w=this.createResult(l,n);return d?.(w),w}).finally(()=>{o()}),_])}fetch(s){return this.#d({...s,cancelRefetch:s.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(s){this.#x();let n=this.#t.fetch(this.options,s);return s?.throwOnError||(n=n.catch(gs)),n}#p(s){return!am()&&_t(this.options.enabled,this.#t)!==!1&&o0(s)}#g(){this.#b();const s=_t(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#p(s))return;const n=c0(this.#i.dataUpdatedAt,s)+1;this.#u=Xn.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#v(){return _t(this.options.refetchInterval,this.#t)??!1}#_(s){this.#S(),this.#c=s,!(this.#c===0||!this.#p(this.#c))&&(this.#h=Xn.setInterval(()=>{(this.options.refetchIntervalInBackground||lm.isFocused())&&this.#d()},this.#c))}#y(){this.#g(),this.#_(this.#v())}#b(){this.#u!==void 0&&(Xn.clearTimeout(this.#u),this.#u=void 0)}#S(){this.#h!==void 0&&(Xn.clearInterval(this.#h),this.#h=void 0)}createResult(s,n){const l=this.#t,o=this.options,d=this.#i,_=this.#r,w=this.#n,c=s!==l?s.state:this.#s,{state:h}=s;let y={...h},p=!1,f;if(n._optimisticResults){const T=this.hasListeners(),D=!T&&vy(s,n),O=T&&_y(s,l,n,o);(D||O)&&(y={...y,...g0(h.data,s.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:C,status:j}=y;f=y.data;let E=!1;if(n.placeholderData!==void 0&&f===void 0&&j==="pending"){let T;d?.isPlaceholderData&&n.placeholderData===w?.placeholderData?(T=d.data,E=!0):T=typeof n.placeholderData=="function"?n.placeholderData(this.#f?.state.data,this.#f):n.placeholderData,T!==void 0&&(j="success",f=vf(d?.data,T,n),p=!0)}if(n.select&&f!==void 0&&!E)if(d&&f===_?.data&&n.select===this.#o)f=this.#l;else try{this.#o=n.select,f=n.select(f),f=vf(d?.data,f,n),this.#l=f,this.#a=null}catch(T){this.#a=T}else f===void 0&&(this.#a=null);this.#a&&(x=this.#a,f=this.#l,C=Date.now(),j="error",p=!1);const g=y.fetchStatus==="fetching",b=j==="pending",v=j==="error",S=b&&g,N=f!==void 0;return{status:j,fetchStatus:y.fetchStatus,isPending:b,isSuccess:j==="success",isError:v,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:C,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:s.isFetched(),isFetchedAfterMount:y.dataUpdateCount>c.dataUpdateCount||y.errorUpdateCount>c.errorUpdateCount,isFetching:g,isRefetching:g&&!b,isLoadingError:v&&!N,isPaused:y.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:v&&N,isStale:om(s,n),refetch:this.refetch,isEnabled:_t(n.enabled,s)!==!1}}updateResult(){const s=this.#i,n=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#n=this.options,this.#r.data!==void 0&&(this.#f=this.#t),kd(n,s))return;this.#i=n;const o=(()=>{if(!s)return!0;const{notifyOnChangeProps:d}=this.options,_=typeof d=="function"?d():d;if(_==="all"||!_&&!this.#m.size)return!0;const w=new Set(_??this.#m);return this.options.throwOnError&&w.add("error"),Object.keys(this.#i).some(c=>{const h=c;return this.#i[h]!==s[h]&&w.has(h)})})();Qt.batch(()=>{o&&this.listeners.forEach(d=>{d(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#x(){const s=this.#e.getQueryCache().build(this.#e,this.options);if(s===this.#t)return;const n=this.#t;this.#t=s,this.#s=s.state,this.hasListeners()&&(n?.removeObserver(this),s.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function pE(s,n){return _t(n.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&_t(n.retryOnMount,s)===!1)}function vy(s,n){return pE(s,n)||s.state.data!==void 0&&yf(s,n,n.refetchOnMount)}function yf(s,n,l){if(_t(n.enabled,s)!==!1&&_t(n.staleTime,s)!=="static"){const o=_t(l,s);return o==="always"||o!==!1&&om(s,n)}return!1}function _y(s,n,l,o){return(s!==n||_t(o.enabled,s)===!1)&&(!l.suspense||s.state.status!=="error")&&om(s,l)}function om(s,n){return _t(n.enabled,s)!==!1&&s.isStaleByTime(_t(n.staleTime,s))}var gE=class extends p0{#e;#t;#s;#i;constructor(s){super(),this.#e=s.client,this.mutationId=s.mutationId,this.#s=s.mutationCache,this.#t=[],this.state=s.state||vE(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){this.#t.includes(s)||(this.#t.push(s),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){this.#t=this.#t.filter(n=>n!==s),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(s){const n=()=>{this.#r({type:"continue"})},l={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},o=this.#i=m0({fn:()=>this.options.mutationFn?this.options.mutationFn(s,l):Promise.reject(new Error("No mutationFn found")),onFail:(w,c)=>{this.#r({type:"failed",failureCount:w,error:c})},onPause:()=>{this.#r({type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)}),d=this.state.status==="pending",_=!o.canStart();try{if(d)n();else{this.#r({type:"pending",variables:s,isPaused:_}),this.#s.config.onMutate&&await this.#s.config.onMutate(s,this,l);const c=await this.options.onMutate?.(s,l);c!==this.state.context&&this.#r({type:"pending",context:c,variables:s,isPaused:_})}const w=await o.start();return await this.#s.config.onSuccess?.(w,s,this.state.context,this,l),await this.options.onSuccess?.(w,s,this.state.context,l),await this.#s.config.onSettled?.(w,null,this.state.variables,this.state.context,this,l),await this.options.onSettled?.(w,null,s,this.state.context,l),this.#r({type:"success",data:w}),w}catch(w){try{await this.#s.config.onError?.(w,s,this.state.context,this,l)}catch(c){Promise.reject(c)}try{await this.options.onError?.(w,s,this.state.context,l)}catch(c){Promise.reject(c)}try{await this.#s.config.onSettled?.(void 0,w,this.state.variables,this.state.context,this,l)}catch(c){Promise.reject(c)}try{await this.options.onSettled?.(void 0,w,s,this.state.context,l)}catch(c){Promise.reject(c)}throw this.#r({type:"error",error:w}),w}finally{this.#i===o&&(this.#i=void 0),this.#s.runNext(this)}}#r(s){const n=l=>{switch(s.type){case"failed":return{...l,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...l,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:s.error,failureCount:l.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Qt.batch(()=>{this.#t.forEach(l=>{l.onMutationUpdate(s)}),this.#s.notify({mutation:this,type:"updated",action:s})})}};function vE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _E=class extends Nl{#e;#t;#s;constructor(s={}){super(),this.config=s,this.#e=new Set,this.#t=new Map,this.#s=0}build(s,n,l){const o=new gE({client:s,mutationCache:this,mutationId:++this.#s,options:s.defaultMutationOptions(n),state:l});return this.add(o),o}add(s){this.#e.add(s);const n=nc(s);if(typeof n=="string"){const l=this.#t.get(n);l?l.push(s):this.#t.set(n,[s])}this.notify({type:"added",mutation:s})}remove(s){if(this.#e.delete(s)){const n=nc(s);if(typeof n=="string"){const l=this.#t.get(n);if(l)if(l.length>1){const o=l.indexOf(s);o!==-1&&l.splice(o,1)}else l[0]===s&&this.#t.delete(n)}}this.notify({type:"removed",mutation:s})}canRun(s){const n=nc(s);if(typeof n=="string"){const l=this.#t.get(n)?.find(o=>o.state.status==="pending");return!l||l===s}else return!0}runNext(s){const n=nc(s);return typeof n=="string"?this.#t.get(n)?.find(l=>l!==s&&l.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Qt.batch(()=>{this.#e.forEach(s=>{this.notify({type:"removed",mutation:s})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(s){const n={exact:!0,...s};return this.getAll().find(l=>hy(n,l))}findAll(s={}){return this.getAll().filter(n=>hy(s,n))}notify(s){Qt.batch(()=>{this.listeners.forEach(n=>{n(s)})})}resumePausedMutations(){const s=this.getAll().filter(n=>n.state.isPaused);return Qt.batch(()=>Promise.all(s.map(n=>n.continue().catch(gs))))}};function nc(s){return s.options.scope?.id}var yE=class extends Nl{#e;constructor(s={}){super(),this.config=s,this.#e=new Map}build(s,n,l){const o=n.queryKey,d=n.queryHash??nm(o,n);let _=this.get(d);return _||(_=new fE({client:s,queryKey:o,queryHash:d,options:s.defaultQueryOptions(n),state:l,defaultOptions:s.getQueryDefaults(o)}),this.add(_)),_}add(s){this.#e.has(s.queryHash)||(this.#e.set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){this.#e.get(s.queryHash)===s&&(s.destroy(),this.#e.delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){Qt.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return this.#e.get(s)}getAll(){return[...this.#e.values()]}find(s){const n={exact:!0,...s};return this.getAll().find(l=>uy(n,l))}findAll(s={}){const n=this.getAll();return Object.keys(s).length>0?n.filter(l=>uy(s,l)):n}notify(s){Qt.batch(()=>{this.listeners.forEach(n=>{n(s)})})}onFocus(){Qt.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){Qt.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},bE=class{#e;#t;#s;#i;#r;#n;#a;#o;constructor(s={}){this.#e=s.queryCache||new yE,this.#t=s.mutationCache||new _E,this.#s=s.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#a=lm.subscribe(async s=>{s&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=vc.subscribe(async s=>{s&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(s){return this.#e.findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return this.#t.findAll({...s,status:"pending"}).length}getQueryData(s){const n=this.defaultQueryOptions({queryKey:s});return this.#e.get(n.queryHash)?.state.data}ensureQueryData(s){const n=this.defaultQueryOptions(s),l=this.#e.build(this,n),o=l.state.data;return o===void 0?this.fetchQuery(s):(s.revalidateIfStale&&l.isStaleByTime(_t(n.staleTime,l))&&this.prefetchQuery(n),Promise.resolve(o))}getQueriesData(s){return this.#e.findAll(s).map(({queryKey:n,state:l})=>[n,l.data])}setQueryData(s,n,l){const o=this.defaultQueryOptions({queryKey:s}),d=this.#e.get(o.queryHash)?.state.data,_=JC(n,d);if(_!==void 0)return this.#e.build(this,o).setData(_,{...l,manual:!0})}setQueriesData(s,n,l){return Qt.batch(()=>this.#e.findAll(s).map(({queryKey:o})=>[o,this.setQueryData(o,n,l)]))}getQueryState(s){const n=this.defaultQueryOptions({queryKey:s});return this.#e.get(n.queryHash)?.state}removeQueries(s){const n=this.#e;Qt.batch(()=>{n.findAll(s).forEach(l=>{n.remove(l)})})}resetQueries(s,n){const l=this.#e;return Qt.batch(()=>{const o=l.findAll(s),d=new Set(o);return o.forEach(_=>{_.reset()}),this.refetchQueries({type:"active",predicate:_=>d.has(_)},n)})}cancelQueries(s,n={}){const l={revert:!0,...n},o=Qt.batch(()=>this.#e.findAll(s).map(d=>d.cancel(l)));return Promise.all(o).then(gs).catch(gs)}invalidateQueries(s,n={}){return Qt.batch(()=>(this.#e.findAll(s).forEach(l=>{l.invalidate()}),s?.refetchType==="none"?Promise.resolve():this.refetchQueries({...s,type:s?.refetchType??s?.type??"active"},n)))}refetchQueries(s,n={}){const l={...n,cancelRefetch:n.cancelRefetch??!0},o=Qt.batch(()=>this.#e.findAll(s).filter(d=>!d.isDisabled()&&!d.isStatic()).map(d=>{let _=d.fetch(void 0,l);return l.throwOnError||(_=_.catch(gs)),d.state.fetchStatus==="paused"?Promise.resolve():_}));return Promise.all(o).then(gs)}async query(s){const n=this.defaultQueryOptions(s);n.retry===void 0&&(n.retry=!1);const l=this.#e.build(this,n),o=l.isStaleByTime(_t(n.staleTime,l))?await l.fetch(n):l.state.data,d=n.select;return d?d(o):o}fetchQuery(s){const n=this.defaultQueryOptions(s);n.retry===void 0&&(n.retry=!1);const l=this.#e.build(this,n);return l.isStaleByTime(_t(n.staleTime,l))?l.fetch(n):Promise.resolve(l.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(gs).catch(gs)}infiniteQuery(s){return s._type="infinite",this.query(s)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(gs).catch(gs)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return vc.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(s){this.#s=s}setQueryDefaults(s,n){this.#i.set(pl(s),{queryKey:s,defaultOptions:n})}getQueryDefaults(s){const n=[...this.#i.values()],l={};return n.forEach(o=>{sa(s,o.queryKey)&&Object.assign(l,o.defaultOptions)}),l}setMutationDefaults(s,n){this.#r.set(pl(s),{mutationKey:s,defaultOptions:n})}getMutationDefaults(s){const n=[...this.#r.values()],l={};return n.forEach(o=>{sa(s,o.mutationKey)&&Object.assign(l,o.defaultOptions)}),l}defaultQueryOptions(s){if(s._defaulted)return s;const n={...this.#s.queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return n.queryHash||(n.queryHash=nm(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===rm&&(n.enabled=!1),n}defaultMutationOptions(s){return s?._defaulted?s:{...this.#s.mutations,...s?.mutationKey&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const v0=M.createContext(!1),SE=()=>M.useContext(v0);v0.Provider;function xE(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}const wE=M.createContext(xE()),CE=()=>M.useContext(wE),EE=(s,n,l)=>{const o=l?.state.error&&typeof s.throwOnError=="function"?d0(s.throwOnError,[l.state.error,l]):s.throwOnError;(s.suspense||o)&&(n.isReset()||(s.retryOnMount=!1))},NE=s=>{M.useEffect(()=>{s.clearReset()},[s])},jE=({result:s,errorResetBoundary:n,throwOnError:l,query:o,suspense:d})=>s.isError&&!n.isReset()&&!s.isFetching&&o&&(d&&s.data===void 0||d0(l,[s.error,o])),TE=s=>{if(s.suspense){const l=d=>d==="static"?d:Math.max(d??1e3,1e3),o=s.staleTime;s.staleTime=typeof o=="function"?(...d)=>l(o(...d)):l(o),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},kE=(s,n)=>s?.suspense&&n.isPending,RE=(s,n,l)=>n.fetchOptimistic(s).catch(()=>{l.clearReset()});function DE(s,n,l){const o=SE(),d=CE(),_=En(),w=_.defaultQueryOptions(s),c=_.getQueryCache().get(w.queryHash),h=s.subscribed!==!1;w._optimisticResults=o?"isRestoring":h?"optimistic":void 0,TE(w),EE(w,d,c),NE(d);const[y]=M.useState(()=>new n(_,w)),p=y.getOptimisticResult(w),f=!o&&h;if(M.useSyncExternalStore(M.useCallback(x=>{const C=f?y.subscribe(Qt.batchCalls(x)):gs;return y.updateResult(),C},[y,f]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),M.useEffect(()=>{y.setOptions(w)},[w,y]),kE(w,p))throw RE(w,y,d);if(jE({result:p,errorResetBoundary:d,throwOnError:w.throwOnError,query:c,suspense:w.suspense}))throw p.error;return w.notifyOnChangeProps?p:y.trackResult(p)}function ss(s,n){return DE(s,mE)}var st;(function(s){s.assertEqual=d=>{};function n(d){}s.assertIs=n;function l(d){throw new Error}s.assertNever=l,s.arrayToEnum=d=>{const _={};for(const w of d)_[w]=w;return _},s.getValidEnumValues=d=>{const _=s.objectKeys(d).filter(c=>typeof d[d[c]]!="number"),w={};for(const c of _)w[c]=d[c];return s.objectValues(w)},s.objectValues=d=>s.objectKeys(d).map(function(_){return d[_]}),s.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{const _=[];for(const w in d)Object.prototype.hasOwnProperty.call(d,w)&&_.push(w);return _},s.find=(d,_)=>{for(const w of d)if(_(w))return w},s.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&Number.isFinite(d)&&Math.floor(d)===d;function o(d,_=" | "){return d.map(w=>typeof w=="string"?`'${w}'`:w).join(_)}s.joinValues=o,s.jsonStringifyReplacer=(d,_)=>typeof _=="bigint"?_.toString():_})(st||(st={}));var yy;(function(s){s.mergeShapes=(n,l)=>({...n,...l})})(yy||(yy={}));const Ee=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yn=s=>{switch(typeof s){case"undefined":return Ee.undefined;case"string":return Ee.string;case"number":return Number.isNaN(s)?Ee.nan:Ee.number;case"boolean":return Ee.boolean;case"function":return Ee.function;case"bigint":return Ee.bigint;case"symbol":return Ee.symbol;case"object":return Array.isArray(s)?Ee.array:s===null?Ee.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?Ee.promise:typeof Map<"u"&&s instanceof Map?Ee.map:typeof Set<"u"&&s instanceof Set?Ee.set:typeof Date<"u"&&s instanceof Date?Ee.date:Ee.object;default:return Ee.unknown}},ye=st.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class zi extends Error{get errors(){return this.issues}constructor(n){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const l=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,l):this.__proto__=l,this.name="ZodError",this.issues=n}format(n){const l=n||function(_){return _.message},o={_errors:[]},d=_=>{for(const w of _.issues)if(w.code==="invalid_union")w.unionErrors.map(d);else if(w.code==="invalid_return_type")d(w.returnTypeError);else if(w.code==="invalid_arguments")d(w.argumentsError);else if(w.path.length===0)o._errors.push(l(w));else{let c=o,h=0;for(;h<w.path.length;){const y=w.path[h];h===w.path.length-1?(c[y]=c[y]||{_errors:[]},c[y]._errors.push(l(w))):c[y]=c[y]||{_errors:[]},c=c[y],h++}}};return d(this),o}static assert(n){if(!(n instanceof zi))throw new Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=l=>l.message){const l={},o=[];for(const d of this.issues)if(d.path.length>0){const _=d.path[0];l[_]=l[_]||[],l[_].push(n(d))}else o.push(n(d));return{formErrors:o,fieldErrors:l}}get formErrors(){return this.flatten()}}zi.create=s=>new zi(s);const bf=(s,n)=>{let l;switch(s.code){case ye.invalid_type:s.received===Ee.undefined?l="Required":l=`Expected ${s.expected}, received ${s.received}`;break;case ye.invalid_literal:l=`Invalid literal value, expected ${JSON.stringify(s.expected,st.jsonStringifyReplacer)}`;break;case ye.unrecognized_keys:l=`Unrecognized key(s) in object: ${st.joinValues(s.keys,", ")}`;break;case ye.invalid_union:l="Invalid input";break;case ye.invalid_union_discriminator:l=`Invalid discriminator value. Expected ${st.joinValues(s.options)}`;break;case ye.invalid_enum_value:l=`Invalid enum value. Expected ${st.joinValues(s.options)}, received '${s.received}'`;break;case ye.invalid_arguments:l="Invalid function arguments";break;case ye.invalid_return_type:l="Invalid function return type";break;case ye.invalid_date:l="Invalid date";break;case ye.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(l=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(l=`${l} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?l=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?l=`Invalid input: must end with "${s.validation.endsWith}"`:st.assertNever(s.validation):s.validation!=="regex"?l=`Invalid ${s.validation}`:l="Invalid";break;case ye.too_small:s.type==="array"?l=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?l=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?l=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?l=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?l=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:l="Invalid input";break;case ye.too_big:s.type==="array"?l=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?l=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?l=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?l=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?l=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:l="Invalid input";break;case ye.custom:l="Invalid input";break;case ye.invalid_intersection_types:l="Intersection results could not be merged";break;case ye.not_multiple_of:l=`Number must be a multiple of ${s.multipleOf}`;break;case ye.not_finite:l="Number must be finite";break;default:l=n.defaultError,st.assertNever(s)}return{message:l}};let AE=bf;function OE(){return AE}const LE=s=>{const{data:n,path:l,errorMaps:o,issueData:d}=s,_=[...l,...d.path||[]],w={...d,path:_};if(d.message!==void 0)return{...d,path:_,message:d.message};let c="";const h=o.filter(y=>!!y).slice().reverse();for(const y of h)c=y(w,{data:n,defaultError:c}).message;return{...d,path:_,message:c}};function xe(s,n){const l=OE(),o=LE({issueData:n,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,l,l===bf?void 0:bf].filter(d=>!!d)});s.common.issues.push(o)}class cs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(n,l){const o=[];for(const d of l){if(d.status==="aborted")return Oe;d.status==="dirty"&&n.dirty(),o.push(d.value)}return{status:n.value,value:o}}static async mergeObjectAsync(n,l){const o=[];for(const d of l){const _=await d.key,w=await d.value;o.push({key:_,value:w})}return cs.mergeObjectSync(n,o)}static mergeObjectSync(n,l){const o={};for(const d of l){const{key:_,value:w}=d;if(_.status==="aborted"||w.status==="aborted")return Oe;_.status==="dirty"&&n.dirty(),w.status==="dirty"&&n.dirty(),_.value!=="__proto__"&&(typeof w.value<"u"||d.alwaysSet)&&(o[_.value]=w.value)}return{status:n.value,value:o}}}const Oe=Object.freeze({status:"aborted"}),fl=s=>({status:"dirty",value:s}),Ks=s=>({status:"valid",value:s}),by=s=>s.status==="aborted",Sy=s=>s.status==="dirty",ia=s=>s.status==="valid",_c=s=>typeof Promise<"u"&&s instanceof Promise;var je;(function(s){s.errToObj=n=>typeof n=="string"?{message:n}:n||{},s.toString=n=>typeof n=="string"?n:n?.message})(je||(je={}));class yi{constructor(n,l,o,d){this._cachedPath=[],this.parent=n,this.data=l,this._path=o,this._key=d}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const xy=(s,n)=>{if(ia(n))return{success:!0,data:n.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const l=new zi(s.common.issues);return this._error=l,this._error}}};function Pe(s){if(!s)return{};const{errorMap:n,invalid_type_error:l,required_error:o,description:d}=s;if(n&&(l||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return n?{errorMap:n,description:d}:{errorMap:(w,c)=>{const{message:h}=s;return w.code==="invalid_enum_value"?{message:h??c.defaultError}:typeof c.data>"u"?{message:h??o??c.defaultError}:w.code!=="invalid_type"?{message:c.defaultError}:{message:h??l??c.defaultError}},description:d}}class We{get description(){return this._def.description}_getType(n){return yn(n.data)}_getOrReturnCtx(n,l){return l||{common:n.parent.common,data:n.data,parsedType:yn(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new cs,ctx:{common:n.parent.common,data:n.data,parsedType:yn(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const l=this._parse(n);if(_c(l))throw new Error("Synchronous parse encountered promise.");return l}_parseAsync(n){const l=this._parse(n);return Promise.resolve(l)}parse(n,l){const o=this.safeParse(n,l);if(o.success)return o.data;throw o.error}safeParse(n,l){const o={common:{issues:[],async:l?.async??!1,contextualErrorMap:l?.errorMap},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:yn(n)},d=this._parseSync({data:n,path:o.path,parent:o});return xy(o,d)}"~validate"(n){const l={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:yn(n)};if(!this["~standard"].async)try{const o=this._parseSync({data:n,path:[],parent:l});return ia(o)?{value:o.value}:{issues:l.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),l.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:l}).then(o=>ia(o)?{value:o.value}:{issues:l.common.issues})}async parseAsync(n,l){const o=await this.safeParseAsync(n,l);if(o.success)return o.data;throw o.error}async safeParseAsync(n,l){const o={common:{issues:[],contextualErrorMap:l?.errorMap,async:!0},path:l?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:yn(n)},d=this._parse({data:n,path:o.path,parent:o}),_=await(_c(d)?d:Promise.resolve(d));return xy(o,_)}refine(n,l){const o=d=>typeof l=="string"||typeof l>"u"?{message:l}:typeof l=="function"?l(d):l;return this._refinement((d,_)=>{const w=n(d),c=()=>_.addIssue({code:ye.custom,...o(d)});return typeof Promise<"u"&&w instanceof Promise?w.then(h=>h?!0:(c(),!1)):w?!0:(c(),!1)})}refinement(n,l){return this._refinement((o,d)=>n(o)?!0:(d.addIssue(typeof l=="function"?l(o,d):l),!1))}_refinement(n){return new er({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:l=>this["~validate"](l)}}optional(){return Hi.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _i.create(this)}promise(){return Cc.create(this,this._def)}or(n){return bc.create([this,n],this._def)}and(n){return Sc.create(this,n,this._def)}transform(n){return new er({...Pe(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const l=typeof n=="function"?n:()=>n;return new Ec({...Pe(this._def),innerType:this,defaultValue:l,typeName:Le.ZodDefault})}brand(){return new S0({typeName:Le.ZodBranded,type:this,...Pe(this._def)})}catch(n){const l=typeof n=="function"?n:()=>n;return new Nc({...Pe(this._def),innerType:this,catchValue:l,typeName:Le.ZodCatch})}describe(n){const l=this.constructor;return new l({...this._def,description:n})}pipe(n){return um.create(this,n)}readonly(){return jc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ME=/^c[^\s-]{8,}$/i,BE=/^[0-9a-z]+$/,IE=/^[0-9A-HJKMNP-TV-Z]{26}$/i,HE=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,UE=/^[a-z0-9_-]{21}$/i,zE=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$E=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,PE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,FE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Rd;const VE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,qE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,KE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,GE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,YE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ZE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",XE=new RegExp(`^${_0}$`);function y0(s){let n="[0-5]\\d";s.precision?n=`${n}\\.\\d{${s.precision}}`:s.precision==null&&(n=`${n}(\\.\\d+)?`);const l=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${n})${l}`}function WE(s){return new RegExp(`^${y0(s)}$`)}function QE(s){let n=`${_0}T${y0(s)}`;const l=[];return l.push(s.local?"Z?":"Z"),s.offset&&l.push("([+-]\\d{2}:?\\d{2})"),n=`${n}(${l.join("|")})`,new RegExp(`^${n}$`)}function JE(s,n){return!!((n==="v4"||!n)&&VE.test(s)||(n==="v6"||!n)&&KE.test(s))}function e2(s,n){if(!zE.test(s))return!1;try{const[l]=s.split(".");if(!l)return!1;const o=l.replace(/-/g,"+").replace(/_/g,"/").padEnd(l.length+(4-l.length%4)%4,"="),d=JSON.parse(atob(o));return!(typeof d!="object"||d===null||"typ"in d&&d?.typ!=="JWT"||!d.alg||n&&d.alg!==n)}catch{return!1}}function t2(s,n){return!!((n==="v4"||!n)&&qE.test(s)||(n==="v6"||!n)&&GE.test(s))}class Ii extends We{_parse(n){if(this._def.coerce&&(n.data=String(n.data)),this._getType(n)!==Ee.string){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_type,expected:Ee.string,received:_.parsedType}),Oe}const o=new cs;let d;for(const _ of this._def.checks)if(_.kind==="min")n.data.length<_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_small,minimum:_.value,type:"string",inclusive:!0,exact:!1,message:_.message}),o.dirty());else if(_.kind==="max")n.data.length>_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_big,maximum:_.value,type:"string",inclusive:!0,exact:!1,message:_.message}),o.dirty());else if(_.kind==="length"){const w=n.data.length>_.value,c=n.data.length<_.value;(w||c)&&(d=this._getOrReturnCtx(n,d),w?xe(d,{code:ye.too_big,maximum:_.value,type:"string",inclusive:!0,exact:!0,message:_.message}):c&&xe(d,{code:ye.too_small,minimum:_.value,type:"string",inclusive:!0,exact:!0,message:_.message}),o.dirty())}else if(_.kind==="email")PE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"email",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="emoji")Rd||(Rd=new RegExp(FE,"u")),Rd.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"emoji",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="uuid")HE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"uuid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="nanoid")UE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"nanoid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="cuid")ME.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"cuid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="cuid2")BE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"cuid2",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="ulid")IE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"ulid",code:ye.invalid_string,message:_.message}),o.dirty());else if(_.kind==="url")try{new URL(n.data)}catch{d=this._getOrReturnCtx(n,d),xe(d,{validation:"url",code:ye.invalid_string,message:_.message}),o.dirty()}else _.kind==="regex"?(_.regex.lastIndex=0,_.regex.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"regex",code:ye.invalid_string,message:_.message}),o.dirty())):_.kind==="trim"?n.data=n.data.trim():_.kind==="includes"?n.data.includes(_.value,_.position)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:{includes:_.value,position:_.position},message:_.message}),o.dirty()):_.kind==="toLowerCase"?n.data=n.data.toLowerCase():_.kind==="toUpperCase"?n.data=n.data.toUpperCase():_.kind==="startsWith"?n.data.startsWith(_.value)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:{startsWith:_.value},message:_.message}),o.dirty()):_.kind==="endsWith"?n.data.endsWith(_.value)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:{endsWith:_.value},message:_.message}),o.dirty()):_.kind==="datetime"?QE(_).test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:"datetime",message:_.message}),o.dirty()):_.kind==="date"?XE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:"date",message:_.message}),o.dirty()):_.kind==="time"?WE(_).test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.invalid_string,validation:"time",message:_.message}),o.dirty()):_.kind==="duration"?$E.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"duration",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="ip"?JE(n.data,_.version)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"ip",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="jwt"?e2(n.data,_.alg)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"jwt",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="cidr"?t2(n.data,_.version)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"cidr",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="base64"?YE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"base64",code:ye.invalid_string,message:_.message}),o.dirty()):_.kind==="base64url"?ZE.test(n.data)||(d=this._getOrReturnCtx(n,d),xe(d,{validation:"base64url",code:ye.invalid_string,message:_.message}),o.dirty()):st.assertNever(_);return{status:o.value,value:n.data}}_regex(n,l,o){return this.refinement(d=>n.test(d),{validation:l,code:ye.invalid_string,...je.errToObj(o)})}_addCheck(n){return new Ii({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",...je.errToObj(n)})}url(n){return this._addCheck({kind:"url",...je.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",...je.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",...je.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",...je.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",...je.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",...je.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",...je.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",...je.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",...je.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",...je.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",...je.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",...je.errToObj(n)})}datetime(n){return typeof n=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n}):this._addCheck({kind:"datetime",precision:typeof n?.precision>"u"?null:n?.precision,offset:n?.offset??!1,local:n?.local??!1,...je.errToObj(n?.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){return typeof n=="string"?this._addCheck({kind:"time",precision:null,message:n}):this._addCheck({kind:"time",precision:typeof n?.precision>"u"?null:n?.precision,...je.errToObj(n?.message)})}duration(n){return this._addCheck({kind:"duration",...je.errToObj(n)})}regex(n,l){return this._addCheck({kind:"regex",regex:n,...je.errToObj(l)})}includes(n,l){return this._addCheck({kind:"includes",value:n,position:l?.position,...je.errToObj(l?.message)})}startsWith(n,l){return this._addCheck({kind:"startsWith",value:n,...je.errToObj(l)})}endsWith(n,l){return this._addCheck({kind:"endsWith",value:n,...je.errToObj(l)})}min(n,l){return this._addCheck({kind:"min",value:n,...je.errToObj(l)})}max(n,l){return this._addCheck({kind:"max",value:n,...je.errToObj(l)})}length(n,l){return this._addCheck({kind:"length",value:n,...je.errToObj(l)})}nonempty(n){return this.min(1,je.errToObj(n))}trim(){return new Ii({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ii({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ii({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(n=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find(n=>n.kind==="date")}get isTime(){return!!this._def.checks.find(n=>n.kind==="time")}get isDuration(){return!!this._def.checks.find(n=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find(n=>n.kind==="email")}get isURL(){return!!this._def.checks.find(n=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find(n=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find(n=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(n=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(n=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(n=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find(n=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find(n=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find(n=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find(n=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find(n=>n.kind==="base64url")}get minLength(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n}get maxLength(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n}}Ii.create=s=>new Ii({checks:[],typeName:Le.ZodString,coerce:s?.coerce??!1,...Pe(s)});function s2(s,n){const l=(s.toString().split(".")[1]||"").length,o=(n.toString().split(".")[1]||"").length,d=l>o?l:o,_=Number.parseInt(s.toFixed(d).replace(".","")),w=Number.parseInt(n.toFixed(d).replace(".",""));return _%w/10**d}class na extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce&&(n.data=Number(n.data)),this._getType(n)!==Ee.number){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_type,expected:Ee.number,received:_.parsedType}),Oe}let o;const d=new cs;for(const _ of this._def.checks)_.kind==="int"?st.isInteger(n.data)||(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.invalid_type,expected:"integer",received:"float",message:_.message}),d.dirty()):_.kind==="min"?(_.inclusive?n.data<_.value:n.data<=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_small,minimum:_.value,type:"number",inclusive:_.inclusive,exact:!1,message:_.message}),d.dirty()):_.kind==="max"?(_.inclusive?n.data>_.value:n.data>=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_big,maximum:_.value,type:"number",inclusive:_.inclusive,exact:!1,message:_.message}),d.dirty()):_.kind==="multipleOf"?s2(n.data,_.value)!==0&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.not_multiple_of,multipleOf:_.value,message:_.message}),d.dirty()):_.kind==="finite"?Number.isFinite(n.data)||(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.not_finite,message:_.message}),d.dirty()):st.assertNever(_);return{status:d.value,value:n.data}}gte(n,l){return this.setLimit("min",n,!0,je.toString(l))}gt(n,l){return this.setLimit("min",n,!1,je.toString(l))}lte(n,l){return this.setLimit("max",n,!0,je.toString(l))}lt(n,l){return this.setLimit("max",n,!1,je.toString(l))}setLimit(n,l,o,d){return new na({...this._def,checks:[...this._def.checks,{kind:n,value:l,inclusive:o,message:je.toString(d)}]})}_addCheck(n){return new na({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:je.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:je.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:je.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:je.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:je.toString(n)})}multipleOf(n,l){return this._addCheck({kind:"multipleOf",value:n,message:je.toString(l)})}finite(n){return this._addCheck({kind:"finite",message:je.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:je.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:je.toString(n)})}get minValue(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n}get maxValue(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n}get isInt(){return!!this._def.checks.find(n=>n.kind==="int"||n.kind==="multipleOf"&&st.isInteger(n.value))}get isFinite(){let n=null,l=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(l===null||o.value>l)&&(l=o.value):o.kind==="max"&&(n===null||o.value<n)&&(n=o.value)}return Number.isFinite(l)&&Number.isFinite(n)}}na.create=s=>new na({checks:[],typeName:Le.ZodNumber,coerce:s?.coerce||!1,...Pe(s)});class gl extends We{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch{return this._getInvalidInput(n)}if(this._getType(n)!==Ee.bigint)return this._getInvalidInput(n);let o;const d=new cs;for(const _ of this._def.checks)_.kind==="min"?(_.inclusive?n.data<_.value:n.data<=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_small,type:"bigint",minimum:_.value,inclusive:_.inclusive,message:_.message}),d.dirty()):_.kind==="max"?(_.inclusive?n.data>_.value:n.data>=_.value)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.too_big,type:"bigint",maximum:_.value,inclusive:_.inclusive,message:_.message}),d.dirty()):_.kind==="multipleOf"?n.data%_.value!==BigInt(0)&&(o=this._getOrReturnCtx(n,o),xe(o,{code:ye.not_multiple_of,multipleOf:_.value,message:_.message}),d.dirty()):st.assertNever(_);return{status:d.value,value:n.data}}_getInvalidInput(n){const l=this._getOrReturnCtx(n);return xe(l,{code:ye.invalid_type,expected:Ee.bigint,received:l.parsedType}),Oe}gte(n,l){return this.setLimit("min",n,!0,je.toString(l))}gt(n,l){return this.setLimit("min",n,!1,je.toString(l))}lte(n,l){return this.setLimit("max",n,!0,je.toString(l))}lt(n,l){return this.setLimit("max",n,!1,je.toString(l))}setLimit(n,l,o,d){return new gl({...this._def,checks:[...this._def.checks,{kind:n,value:l,inclusive:o,message:je.toString(d)}]})}_addCheck(n){return new gl({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:je.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:je.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:je.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:je.toString(n)})}multipleOf(n,l){return this._addCheck({kind:"multipleOf",value:n,message:je.toString(l)})}get minValue(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n}get maxValue(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n}}gl.create=s=>new gl({checks:[],typeName:Le.ZodBigInt,coerce:s?.coerce??!1,...Pe(s)});class Sf extends We{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==Ee.boolean){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.boolean,received:o.parsedType}),Oe}return Ks(n.data)}}Sf.create=s=>new Sf({typeName:Le.ZodBoolean,coerce:s?.coerce||!1,...Pe(s)});class yc extends We{_parse(n){if(this._def.coerce&&(n.data=new Date(n.data)),this._getType(n)!==Ee.date){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_type,expected:Ee.date,received:_.parsedType}),Oe}if(Number.isNaN(n.data.getTime())){const _=this._getOrReturnCtx(n);return xe(_,{code:ye.invalid_date}),Oe}const o=new cs;let d;for(const _ of this._def.checks)_.kind==="min"?n.data.getTime()<_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_small,message:_.message,inclusive:!0,exact:!1,minimum:_.value,type:"date"}),o.dirty()):_.kind==="max"?n.data.getTime()>_.value&&(d=this._getOrReturnCtx(n,d),xe(d,{code:ye.too_big,message:_.message,inclusive:!0,exact:!1,maximum:_.value,type:"date"}),o.dirty()):st.assertNever(_);return{status:o.value,value:new Date(n.data.getTime())}}_addCheck(n){return new yc({...this._def,checks:[...this._def.checks,n]})}min(n,l){return this._addCheck({kind:"min",value:n.getTime(),message:je.toString(l)})}max(n,l){return this._addCheck({kind:"max",value:n.getTime(),message:je.toString(l)})}get minDate(){let n=null;for(const l of this._def.checks)l.kind==="min"&&(n===null||l.value>n)&&(n=l.value);return n!=null?new Date(n):null}get maxDate(){let n=null;for(const l of this._def.checks)l.kind==="max"&&(n===null||l.value<n)&&(n=l.value);return n!=null?new Date(n):null}}yc.create=s=>new yc({checks:[],coerce:s?.coerce||!1,typeName:Le.ZodDate,...Pe(s)});class wy extends We{_parse(n){if(this._getType(n)!==Ee.symbol){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.symbol,received:o.parsedType}),Oe}return Ks(n.data)}}wy.create=s=>new wy({typeName:Le.ZodSymbol,...Pe(s)});class xf extends We{_parse(n){if(this._getType(n)!==Ee.undefined){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.undefined,received:o.parsedType}),Oe}return Ks(n.data)}}xf.create=s=>new xf({typeName:Le.ZodUndefined,...Pe(s)});class wf extends We{_parse(n){if(this._getType(n)!==Ee.null){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.null,received:o.parsedType}),Oe}return Ks(n.data)}}wf.create=s=>new wf({typeName:Le.ZodNull,...Pe(s)});class Cy extends We{constructor(){super(...arguments),this._any=!0}_parse(n){return Ks(n.data)}}Cy.create=s=>new Cy({typeName:Le.ZodAny,...Pe(s)});class Cf extends We{constructor(){super(...arguments),this._unknown=!0}_parse(n){return Ks(n.data)}}Cf.create=s=>new Cf({typeName:Le.ZodUnknown,...Pe(s)});class wn extends We{_parse(n){const l=this._getOrReturnCtx(n);return xe(l,{code:ye.invalid_type,expected:Ee.never,received:l.parsedType}),Oe}}wn.create=s=>new wn({typeName:Le.ZodNever,...Pe(s)});class Ey extends We{_parse(n){if(this._getType(n)!==Ee.undefined){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.void,received:o.parsedType}),Oe}return Ks(n.data)}}Ey.create=s=>new Ey({typeName:Le.ZodVoid,...Pe(s)});class _i extends We{_parse(n){const{ctx:l,status:o}=this._processInputParams(n),d=this._def;if(l.parsedType!==Ee.array)return xe(l,{code:ye.invalid_type,expected:Ee.array,received:l.parsedType}),Oe;if(d.exactLength!==null){const w=l.data.length>d.exactLength.value,c=l.data.length<d.exactLength.value;(w||c)&&(xe(l,{code:w?ye.too_big:ye.too_small,minimum:c?d.exactLength.value:void 0,maximum:w?d.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:d.exactLength.message}),o.dirty())}if(d.minLength!==null&&l.data.length<d.minLength.value&&(xe(l,{code:ye.too_small,minimum:d.minLength.value,type:"array",inclusive:!0,exact:!1,message:d.minLength.message}),o.dirty()),d.maxLength!==null&&l.data.length>d.maxLength.value&&(xe(l,{code:ye.too_big,maximum:d.maxLength.value,type:"array",inclusive:!0,exact:!1,message:d.maxLength.message}),o.dirty()),l.common.async)return Promise.all([...l.data].map((w,c)=>d.type._parseAsync(new yi(l,w,l.path,c)))).then(w=>cs.mergeArray(o,w));const _=[...l.data].map((w,c)=>d.type._parseSync(new yi(l,w,l.path,c)));return cs.mergeArray(o,_)}get element(){return this._def.type}min(n,l){return new _i({...this._def,minLength:{value:n,message:je.toString(l)}})}max(n,l){return new _i({...this._def,maxLength:{value:n,message:je.toString(l)}})}length(n,l){return new _i({...this._def,exactLength:{value:n,message:je.toString(l)}})}nonempty(n){return this.min(1,n)}}_i.create=(s,n)=>new _i({type:s,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...Pe(n)});function Qr(s){if(s instanceof Lt){const n={};for(const l in s.shape){const o=s.shape[l];n[l]=Hi.create(Qr(o))}return new Lt({...s._def,shape:()=>n})}else return s instanceof _i?new _i({...s._def,type:Qr(s.element)}):s instanceof Hi?Hi.create(Qr(s.unwrap())):s instanceof tr?tr.create(Qr(s.unwrap())):s instanceof Qn?Qn.create(s.items.map(n=>Qr(n))):s}class Lt extends We{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const n=this._def.shape(),l=st.objectKeys(n);return this._cached={shape:n,keys:l},this._cached}_parse(n){if(this._getType(n)!==Ee.object){const y=this._getOrReturnCtx(n);return xe(y,{code:ye.invalid_type,expected:Ee.object,received:y.parsedType}),Oe}const{status:o,ctx:d}=this._processInputParams(n),{shape:_,keys:w}=this._getCached(),c=[];if(!(this._def.catchall instanceof wn&&this._def.unknownKeys==="strip"))for(const y in d.data)w.includes(y)||c.push(y);const h=[];for(const y of w){const p=_[y],f=d.data[y];h.push({key:{status:"valid",value:y},value:p._parse(new yi(d,f,d.path,y)),alwaysSet:y in d.data})}if(this._def.catchall instanceof wn){const y=this._def.unknownKeys;if(y==="passthrough")for(const p of c)h.push({key:{status:"valid",value:p},value:{status:"valid",value:d.data[p]}});else if(y==="strict")c.length>0&&(xe(d,{code:ye.unrecognized_keys,keys:c}),o.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const p of c){const f=d.data[p];h.push({key:{status:"valid",value:p},value:y._parse(new yi(d,f,d.path,p)),alwaysSet:p in d.data})}}return d.common.async?Promise.resolve().then(async()=>{const y=[];for(const p of h){const f=await p.key,x=await p.value;y.push({key:f,value:x,alwaysSet:p.alwaysSet})}return y}).then(y=>cs.mergeObjectSync(o,y)):cs.mergeObjectSync(o,h)}get shape(){return this._def.shape()}strict(n){return je.errToObj,new Lt({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(l,o)=>{const d=this._def.errorMap?.(l,o).message??o.defaultError;return l.code==="unrecognized_keys"?{message:je.errToObj(n).message??d}:{message:d}}}:{}})}strip(){return new Lt({...this._def,unknownKeys:"strip"})}passthrough(){return new Lt({...this._def,unknownKeys:"passthrough"})}extend(n){return new Lt({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new Lt({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:Le.ZodObject})}setKey(n,l){return this.augment({[n]:l})}catchall(n){return new Lt({...this._def,catchall:n})}pick(n){const l={};for(const o of st.objectKeys(n))n[o]&&this.shape[o]&&(l[o]=this.shape[o]);return new Lt({...this._def,shape:()=>l})}omit(n){const l={};for(const o of st.objectKeys(this.shape))n[o]||(l[o]=this.shape[o]);return new Lt({...this._def,shape:()=>l})}deepPartial(){return Qr(this)}partial(n){const l={};for(const o of st.objectKeys(this.shape)){const d=this.shape[o];n&&!n[o]?l[o]=d:l[o]=d.optional()}return new Lt({...this._def,shape:()=>l})}required(n){const l={};for(const o of st.objectKeys(this.shape))if(n&&!n[o])l[o]=this.shape[o];else{let _=this.shape[o];for(;_ instanceof Hi;)_=_._def.innerType;l[o]=_}return new Lt({...this._def,shape:()=>l})}keyof(){return b0(st.objectKeys(this.shape))}}Lt.create=(s,n)=>new Lt({shape:()=>s,unknownKeys:"strip",catchall:wn.create(),typeName:Le.ZodObject,...Pe(n)});Lt.strictCreate=(s,n)=>new Lt({shape:()=>s,unknownKeys:"strict",catchall:wn.create(),typeName:Le.ZodObject,...Pe(n)});Lt.lazycreate=(s,n)=>new Lt({shape:s,unknownKeys:"strip",catchall:wn.create(),typeName:Le.ZodObject,...Pe(n)});class bc extends We{_parse(n){const{ctx:l}=this._processInputParams(n),o=this._def.options;function d(_){for(const c of _)if(c.result.status==="valid")return c.result;for(const c of _)if(c.result.status==="dirty")return l.common.issues.push(...c.ctx.common.issues),c.result;const w=_.map(c=>new zi(c.ctx.common.issues));return xe(l,{code:ye.invalid_union,unionErrors:w}),Oe}if(l.common.async)return Promise.all(o.map(async _=>{const w={...l,common:{...l.common,issues:[]},parent:null};return{result:await _._parseAsync({data:l.data,path:l.path,parent:w}),ctx:w}})).then(d);{let _;const w=[];for(const h of o){const y={...l,common:{...l.common,issues:[]},parent:null},p=h._parseSync({data:l.data,path:l.path,parent:y});if(p.status==="valid")return p;p.status==="dirty"&&!_&&(_={result:p,ctx:y}),y.common.issues.length&&w.push(y.common.issues)}if(_)return l.common.issues.push(..._.ctx.common.issues),_.result;const c=w.map(h=>new zi(h));return xe(l,{code:ye.invalid_union,unionErrors:c}),Oe}}get options(){return this._def.options}}bc.create=(s,n)=>new bc({options:s,typeName:Le.ZodUnion,...Pe(n)});const Bi=s=>s instanceof Nf?Bi(s.schema):s instanceof er?Bi(s.innerType()):s instanceof wc?[s.value]:s instanceof Jn?s.options:s instanceof jf?st.objectValues(s.enum):s instanceof Ec?Bi(s._def.innerType):s instanceof xf?[void 0]:s instanceof wf?[null]:s instanceof Hi?[void 0,...Bi(s.unwrap())]:s instanceof tr?[null,...Bi(s.unwrap())]:s instanceof S0||s instanceof jc?Bi(s.unwrap()):s instanceof Nc?Bi(s._def.innerType):[];class cm extends We{_parse(n){const{ctx:l}=this._processInputParams(n);if(l.parsedType!==Ee.object)return xe(l,{code:ye.invalid_type,expected:Ee.object,received:l.parsedType}),Oe;const o=this.discriminator,d=l.data[o],_=this.optionsMap.get(d);return _?l.common.async?_._parseAsync({data:l.data,path:l.path,parent:l}):_._parseSync({data:l.data,path:l.path,parent:l}):(xe(l,{code:ye.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),Oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,l,o){const d=new Map;for(const _ of l){const w=Bi(_.shape[n]);if(!w.length)throw new Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(const c of w){if(d.has(c))throw new Error(`Discriminator property ${String(n)} has duplicate value ${String(c)}`);d.set(c,_)}}return new cm({typeName:Le.ZodDiscriminatedUnion,discriminator:n,options:l,optionsMap:d,...Pe(o)})}}function Ef(s,n){const l=yn(s),o=yn(n);if(s===n)return{valid:!0,data:s};if(l===Ee.object&&o===Ee.object){const d=st.objectKeys(n),_=st.objectKeys(s).filter(c=>d.indexOf(c)!==-1),w={...s,...n};for(const c of _){const h=Ef(s[c],n[c]);if(!h.valid)return{valid:!1};w[c]=h.data}return{valid:!0,data:w}}else if(l===Ee.array&&o===Ee.array){if(s.length!==n.length)return{valid:!1};const d=[];for(let _=0;_<s.length;_++){const w=s[_],c=n[_],h=Ef(w,c);if(!h.valid)return{valid:!1};d.push(h.data)}return{valid:!0,data:d}}else return l===Ee.date&&o===Ee.date&&+s==+n?{valid:!0,data:s}:{valid:!1}}class Sc extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n),d=(_,w)=>{if(by(_)||by(w))return Oe;const c=Ef(_.value,w.value);return c.valid?((Sy(_)||Sy(w))&&l.dirty(),{status:l.value,value:c.data}):(xe(o,{code:ye.invalid_intersection_types}),Oe)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([_,w])=>d(_,w)):d(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}Sc.create=(s,n,l)=>new Sc({left:s,right:n,typeName:Le.ZodIntersection,...Pe(l)});class Qn extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.array)return xe(o,{code:ye.invalid_type,expected:Ee.array,received:o.parsedType}),Oe;if(o.data.length<this._def.items.length)return xe(o,{code:ye.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;!this._def.rest&&o.data.length>this._def.items.length&&(xe(o,{code:ye.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.dirty());const _=[...o.data].map((w,c)=>{const h=this._def.items[c]||this._def.rest;return h?h._parse(new yi(o,w,o.path,c)):null}).filter(w=>!!w);return o.common.async?Promise.all(_).then(w=>cs.mergeArray(l,w)):cs.mergeArray(l,_)}get items(){return this._def.items}rest(n){return new Qn({...this._def,rest:n})}}Qn.create=(s,n)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qn({items:s,typeName:Le.ZodTuple,rest:null,...Pe(n)})};class xc extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.object)return xe(o,{code:ye.invalid_type,expected:Ee.object,received:o.parsedType}),Oe;const d=[],_=this._def.keyType,w=this._def.valueType;for(const c in o.data)d.push({key:_._parse(new yi(o,c,o.path,c)),value:w._parse(new yi(o,o.data[c],o.path,c)),alwaysSet:c in o.data});return o.common.async?cs.mergeObjectAsync(l,d):cs.mergeObjectSync(l,d)}get element(){return this._def.valueType}static create(n,l,o){return l instanceof We?new xc({keyType:n,valueType:l,typeName:Le.ZodRecord,...Pe(o)}):new xc({keyType:Ii.create(),valueType:n,typeName:Le.ZodRecord,...Pe(l)})}}class Ny extends We{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.map)return xe(o,{code:ye.invalid_type,expected:Ee.map,received:o.parsedType}),Oe;const d=this._def.keyType,_=this._def.valueType,w=[...o.data.entries()].map(([c,h],y)=>({key:d._parse(new yi(o,c,o.path,[y,"key"])),value:_._parse(new yi(o,h,o.path,[y,"value"]))}));if(o.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const h of w){const y=await h.key,p=await h.value;if(y.status==="aborted"||p.status==="aborted")return Oe;(y.status==="dirty"||p.status==="dirty")&&l.dirty(),c.set(y.value,p.value)}return{status:l.value,value:c}})}else{const c=new Map;for(const h of w){const y=h.key,p=h.value;if(y.status==="aborted"||p.status==="aborted")return Oe;(y.status==="dirty"||p.status==="dirty")&&l.dirty(),c.set(y.value,p.value)}return{status:l.value,value:c}}}}Ny.create=(s,n,l)=>new Ny({valueType:n,keyType:s,typeName:Le.ZodMap,...Pe(l)});class vl extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.parsedType!==Ee.set)return xe(o,{code:ye.invalid_type,expected:Ee.set,received:o.parsedType}),Oe;const d=this._def;d.minSize!==null&&o.data.size<d.minSize.value&&(xe(o,{code:ye.too_small,minimum:d.minSize.value,type:"set",inclusive:!0,exact:!1,message:d.minSize.message}),l.dirty()),d.maxSize!==null&&o.data.size>d.maxSize.value&&(xe(o,{code:ye.too_big,maximum:d.maxSize.value,type:"set",inclusive:!0,exact:!1,message:d.maxSize.message}),l.dirty());const _=this._def.valueType;function w(h){const y=new Set;for(const p of h){if(p.status==="aborted")return Oe;p.status==="dirty"&&l.dirty(),y.add(p.value)}return{status:l.value,value:y}}const c=[...o.data.values()].map((h,y)=>_._parse(new yi(o,h,o.path,y)));return o.common.async?Promise.all(c).then(h=>w(h)):w(c)}min(n,l){return new vl({...this._def,minSize:{value:n,message:je.toString(l)}})}max(n,l){return new vl({...this._def,maxSize:{value:n,message:je.toString(l)}})}size(n,l){return this.min(n,l).max(n,l)}nonempty(n){return this.min(1,n)}}vl.create=(s,n)=>new vl({valueType:s,minSize:null,maxSize:null,typeName:Le.ZodSet,...Pe(n)});class Nf extends We{get schema(){return this._def.getter()}_parse(n){const{ctx:l}=this._processInputParams(n);return this._def.getter()._parse({data:l.data,path:l.path,parent:l})}}Nf.create=(s,n)=>new Nf({getter:s,typeName:Le.ZodLazy,...Pe(n)});class wc extends We{_parse(n){if(n.data!==this._def.value){const l=this._getOrReturnCtx(n);return xe(l,{received:l.data,code:ye.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:n.data}}get value(){return this._def.value}}wc.create=(s,n)=>new wc({value:s,typeName:Le.ZodLiteral,...Pe(n)});function b0(s,n){return new Jn({values:s,typeName:Le.ZodEnum,...Pe(n)})}class Jn extends We{_parse(n){if(typeof n.data!="string"){const l=this._getOrReturnCtx(n),o=this._def.values;return xe(l,{expected:st.joinValues(o),received:l.parsedType,code:ye.invalid_type}),Oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(n.data)){const l=this._getOrReturnCtx(n),o=this._def.values;return xe(l,{received:l.data,code:ye.invalid_enum_value,options:o}),Oe}return Ks(n.data)}get options(){return this._def.values}get enum(){const n={};for(const l of this._def.values)n[l]=l;return n}get Values(){const n={};for(const l of this._def.values)n[l]=l;return n}get Enum(){const n={};for(const l of this._def.values)n[l]=l;return n}extract(n,l=this._def){return Jn.create(n,{...this._def,...l})}exclude(n,l=this._def){return Jn.create(this.options.filter(o=>!n.includes(o)),{...this._def,...l})}}Jn.create=b0;class jf extends We{_parse(n){const l=st.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(n);if(o.parsedType!==Ee.string&&o.parsedType!==Ee.number){const d=st.objectValues(l);return xe(o,{expected:st.joinValues(d),received:o.parsedType,code:ye.invalid_type}),Oe}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const d=st.objectValues(l);return xe(o,{received:o.data,code:ye.invalid_enum_value,options:d}),Oe}return Ks(n.data)}get enum(){return this._def.values}}jf.create=(s,n)=>new jf({values:s,typeName:Le.ZodNativeEnum,...Pe(n)});class Cc extends We{unwrap(){return this._def.type}_parse(n){const{ctx:l}=this._processInputParams(n);if(l.parsedType!==Ee.promise&&l.common.async===!1)return xe(l,{code:ye.invalid_type,expected:Ee.promise,received:l.parsedType}),Oe;const o=l.parsedType===Ee.promise?l.data:Promise.resolve(l.data);return Ks(o.then(d=>this._def.type.parseAsync(d,{path:l.path,errorMap:l.common.contextualErrorMap})))}}Cc.create=(s,n)=>new Cc({type:s,typeName:Le.ZodPromise,...Pe(n)});class er extends We{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){const{status:l,ctx:o}=this._processInputParams(n),d=this._def.effect||null,_={addIssue:w=>{xe(o,w),w.fatal?l.abort():l.dirty()},get path(){return o.path}};if(_.addIssue=_.addIssue.bind(_),d.type==="preprocess"){const w=d.transform(o.data,_);if(o.common.async)return Promise.resolve(w).then(async c=>{if(l.value==="aborted")return Oe;const h=await this._def.schema._parseAsync({data:c,path:o.path,parent:o});return h.status==="aborted"?Oe:h.status==="dirty"||l.value==="dirty"?fl(h.value):h});{if(l.value==="aborted")return Oe;const c=this._def.schema._parseSync({data:w,path:o.path,parent:o});return c.status==="aborted"?Oe:c.status==="dirty"||l.value==="dirty"?fl(c.value):c}}if(d.type==="refinement"){const w=c=>{const h=d.refinement(c,_);if(o.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(o.common.async===!1){const c=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return c.status==="aborted"?Oe:(c.status==="dirty"&&l.dirty(),w(c.value),{status:l.value,value:c.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(c=>c.status==="aborted"?Oe:(c.status==="dirty"&&l.dirty(),w(c.value).then(()=>({status:l.value,value:c.value}))))}if(d.type==="transform")if(o.common.async===!1){const w=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!ia(w))return Oe;const c=d.transform(w.value,_);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:l.value,value:c}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(w=>ia(w)?Promise.resolve(d.transform(w.value,_)).then(c=>({status:l.value,value:c})):Oe);st.assertNever(d)}}er.create=(s,n,l)=>new er({schema:s,typeName:Le.ZodEffects,effect:n,...Pe(l)});er.createWithPreprocess=(s,n,l)=>new er({schema:n,effect:{type:"preprocess",transform:s},typeName:Le.ZodEffects,...Pe(l)});class Hi extends We{_parse(n){return this._getType(n)===Ee.undefined?Ks(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Hi.create=(s,n)=>new Hi({innerType:s,typeName:Le.ZodOptional,...Pe(n)});class tr extends We{_parse(n){return this._getType(n)===Ee.null?Ks(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}tr.create=(s,n)=>new tr({innerType:s,typeName:Le.ZodNullable,...Pe(n)});class Ec extends We{_parse(n){const{ctx:l}=this._processInputParams(n);let o=l.data;return l.parsedType===Ee.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:l.path,parent:l})}removeDefault(){return this._def.innerType}}Ec.create=(s,n)=>new Ec({innerType:s,typeName:Le.ZodDefault,defaultValue:typeof n.default=="function"?n.default:()=>n.default,...Pe(n)});class Nc extends We{_parse(n){const{ctx:l}=this._processInputParams(n),o={...l,common:{...l.common,issues:[]}},d=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return _c(d)?d.then(_=>({status:"valid",value:_.status==="valid"?_.value:this._def.catchValue({get error(){return new zi(o.common.issues)},input:o.data})})):{status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new zi(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Nc.create=(s,n)=>new Nc({innerType:s,typeName:Le.ZodCatch,catchValue:typeof n.catch=="function"?n.catch:()=>n.catch,...Pe(n)});class jy extends We{_parse(n){if(this._getType(n)!==Ee.nan){const o=this._getOrReturnCtx(n);return xe(o,{code:ye.invalid_type,expected:Ee.nan,received:o.parsedType}),Oe}return{status:"valid",value:n.data}}}jy.create=s=>new jy({typeName:Le.ZodNaN,...Pe(s)});class S0 extends We{_parse(n){const{ctx:l}=this._processInputParams(n),o=l.data;return this._def.type._parse({data:o,path:l.path,parent:l})}unwrap(){return this._def.type}}class um extends We{_parse(n){const{status:l,ctx:o}=this._processInputParams(n);if(o.common.async)return(async()=>{const _=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return _.status==="aborted"?Oe:_.status==="dirty"?(l.dirty(),fl(_.value)):this._def.out._parseAsync({data:_.value,path:o.path,parent:o})})();{const d=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return d.status==="aborted"?Oe:d.status==="dirty"?(l.dirty(),{status:"dirty",value:d.value}):this._def.out._parseSync({data:d.value,path:o.path,parent:o})}}static create(n,l){return new um({in:n,out:l,typeName:Le.ZodPipeline})}}class jc extends We{_parse(n){const l=this._def.innerType._parse(n),o=d=>(ia(d)&&(d.value=Object.freeze(d.value)),d);return _c(l)?l.then(d=>o(d)):o(l)}unwrap(){return this._def.innerType}}jc.create=(s,n)=>new jc({innerType:s,typeName:Le.ZodReadonly,...Pe(n)});var Le;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(Le||(Le={}));const le=Ii.create,ke=na.create,Ve=Sf.create,Jr=Cf.create;wn.create;const vs=_i.create,fe=Lt.create,x0=bc.create,i2=cm.create;Sc.create;Qn.create;const Dd=xc.create,_l=wc.create,Ft=Jn.create;Cc.create;Hi.create;tr.create;fe({id:ke().int().nonnegative(),method:le().min(1),params:Jr().optional()});const n2=fe({code:le(),message:le(),detail:le().optional()});x0([fe({id:ke(),result:Jr()}),fe({id:ke(),error:n2})]);fe({event:le(),data:Jr().optional()});const w0=i2("kind",[fe({kind:_l("key"),privateKey:le().min(1).max(64*1024),passphrase:le().max(1024).optional()}),fe({kind:_l("password"),password:le().max(1024)})]),C0=/^[a-z_][a-z0-9_-]{0,31}$/,E0=/^(\[[0-9a-fA-F:.]+\]|[0-9a-fA-F:.]+|[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)*)$/,Tf=le().min(1).max(255).regex(E0,"Not an IP address or host name"),r2=le().regex(C0,"Not a valid user name"),et=fe({host:Tf,port:ke().int().min(1).max(65535),username:r2,auth:w0}),hm=9922,a2="prisoner",yl=22,Ty="root",l2=9991,Vs={PassphraseRequired:"passphrase_required",BadPassphrase:"bad_passphrase",BadKey:"bad_key",KeyNotFound:"key_not_found",KeyServerUnreachable:"key_server_unreachable",Unreachable:"ssh_unreachable",AuthFailed:"ssh_auth_failed",Timeout:"ssh_timeout"},rc=le().min(1).max(255).regex(/^[\w.-]+$/,"Not a valid app id"),o2=fe({id:le(),title:le().optional(),version:le().optional(),type:le().optional(),vendor:le().optional(),folderPath:le().optional(),icon:le().optional(),systemApp:Ve().optional(),removable:Ve().optional(),visible:Ve().optional()}).passthrough(),kf="org.webosbrew.hbchannel",Rf=512*1024*1024,c2=4*1024*1024,u2=fe({opId:le(),stage:Ft(["upload","verify","install","remove","cleanup"]),percent:ke().min(0).max(100).optional(),text:le().optional()}),h2="op.progress",ac={InstallFailed:"install_failed",InsufficientSpace:"insufficient_space",ChecksumMismatch:"checksum_mismatch",Conflict:"app_conflict"},d2=fe({id:le(),phase:Ft(["start","end"]),target:le(),command:le(),kind:Ft(["exec","stream","sftp","tunnel","http"]),quiet:Ve().optional(),at:ke(),exitCode:ke().nullable().optional(),durationMs:ke().optional(),output:le().optional(),error:le().optional()}),f2="cmd.log",m2=fe({opId:le(),stream:Ft(["stdout","stderr"]),data:le()}),p2="cmd.output",g2=fe({host:le(),name:le().optional(),modelName:le().optional(),ports:fe({ssh22:Ve(),ssh9922:Ve(),keyServer:Ve(),webos:Ve()}),via:vs(Ft(["ssdp","sweep"]))}),ra=le().max(2048).refine(s=>{try{const n=new URL(s).protocol;return n==="https:"||n==="http:"}catch{return!1}},"Not an http(s) URL"),ky=fe({id:le(),version:le(),type:le().optional(),title:le().optional(),appDescription:le().optional(),sourceUrl:ra.optional(),rootRequired:x0([Ve(),_l("optional")]).optional(),ipkUrl:ra,ipkHash:fe({sha256:le().regex(/^[0-9a-f]{64}$/i)}).optional(),ipkSize:ke().nonnegative().optional()}),v2=fe({url:ra,caption:le().optional(),width:ke().optional(),height:ke().optional()}),_2=fe({id:le(),title:le(),iconUri:ra.optional(),detailIconUri:ra.optional(),shortDescription:le().optional(),featured:Ve().optional(),manifest:ky.optional(),manifestBeta:ky.optional(),requirements:fe({webosRelease:le().optional(),deviceSoC:vs(le()).optional()}).optional(),screenshots:vs(v2).optional(),hasDescription:Ve()}),Ry={Unreachable:"repo_unreachable",DownloadFailed:"download_failed"},Js=le().min(1).max(4096).refine(s=>s.startsWith("/")&&!s.split("/").includes("..")&&!s.includes("\0"),"Not an absolute path"),Ad=le().min(1).max(255).refine(s=>!s.includes("/")&&!s.includes("\0")&&s!=="."&&s!=="..","Not a valid file name"),y2=fe({name:le(),type:Ft(["d","-","l","c","b","p","s","?"]),mode:le(),size:ke(),mtime:ke(),user:le().optional(),group:le().optional(),link:fe({target:le().optional(),broken:Ve().optional(),type:Ft(["d","-","l","c","b","p","s","?"]).optional()}).optional(),access:fe({read:Ve(),write:Ve(),execute:Ve()}).optional()}),Df=4*1024*1024,Od=64*1024,b2=fe({shellId:le(),data:le(),stream:Ft(["stdout","stderr"]).optional()}),S2="shell.output",x2=fe({shellId:le(),code:ke().nullable().optional(),signal:le().optional(),error:le().optional()}),w2="shell.exit",C2=Ft(["syslog","dmesg","lsmonitor"]),E2=fe({opId:le(),lines:vs(le()),dropped:ke().int().optional()}),N2="logs.lines",j2=Ft(["none","debug","info","notice","warning","err","crit","alert","emerg"]),N0=le().min(1).max(128).regex(/^[\w.\-<>*]+$/,"Not a log context name"),T2=fe({name:le(),path:le(),size:ke(),mtime:ke().optional(),writable:Ve()}),k2="org.litefin.app",Af="https://github.com/MoazSalem/litefin/releases",R2=5,j0=le().min(1).max(64).regex(/^[A-Za-z0-9][\w.-]*$/,"Not a variant name"),D2=fe({variant:j0,name:le(),size:ke(),sha256:le().optional()}),A2=fe({tag:le(),version:le(),title:le(),publishedAt:le(),assets:vs(D2)}),O2={Unreachable:"litefin_unreachable"},L2=8,M2=le().regex(/^[A-Za-z0-9+/]*={0,2}$/,"Not base64"),Tc=5199;fe({token:le().min(1),protocolVersion:ke().int(),client:le().optional()}),fe({protocolVersion:ke().int(),bridgeVersion:le(),platform:le(),distribution:Ft(["app","npm","source"]).optional()}),fe({}).optional(),fe({now:ke()}),fe({host:Tf}),fe({ssh22:Ve(),ssh9922:Ve(),keyServer:Ve(),webos:Ve()}),fe({timeoutMs:ke().int().min(500).max(15e3).optional()}).optional(),fe({tvs:vs(g2)}),fe({host:Tf,passphrase:le().max(1024).optional()}),fe({privateKey:le(),fingerprint:le()}),fe({privateKey:le().min(1).max(64*1024),passphrase:le().max(1024).optional()}),fe({fingerprint:le(),type:le()}),fe({device:et}),fe({latencyMs:ke(),root:Ve()}),fe({device:et,quiet:Ve().optional()}),fe({modelName:le().optional(),osVersion:le().optional(),firmwareVersion:le().optional(),otaId:le().optional(),socName:le().optional()}),fe({device:et,path:Js.optional()}),fe({total:ke(),used:ke(),available:ke()}).nullable(),fe({comment:le().max(64).optional()}),fe({privateKey:le(),publicKey:le(),fingerprint:le()}),fe({device:et.optional()}),fe({closed:ke()}),fe({device:et,command:le().min(1).max(64*1024),stdin:le().max(4*1024*1024).optional(),timeoutMs:ke().int().min(100).max(6e5).optional()}),fe({stdout:le(),stderr:le(),exitCode:ke().nullable()}),fe({device:et,command:le().min(1).max(8192),opId:le().max(64)}),fe({exitCode:ke().nullable(),cancelled:Ve()}),fe({opId:le().max(64)}),fe({cancelled:Ve()}),fe({device:et,uri:le().regex(/^luna:\/\/[\w.\-/]+$/,"Not a luna:// URI"),params:Dd(Jr()).optional(),public:Ve().optional(),falseAsError:Ve().optional()}),Dd(Jr()),fe({device:et}),fe({apps:vs(o2)}),fe({device:et,id:rc,params:Dd(Jr()).optional()}),fe({}),fe({device:et,path:Js}),fe({mime:le(),base64:le()}),fe({device:et,id:rc,opId:le().max(64)}),fe({}),fe({device:et,uploadId:le().max(64),opId:le().max(64)}),fe({appId:le().optional(),via:Ft(["devmode","hbchannel"])}),fe({name:le().min(1).max(255),size:ke().int().min(1).max(Rf)}),fe({uploadId:le()}),fe({uploadId:le().max(64),offset:ke().int().min(0),data:M2.max(Math.ceil(c2/3)*4)}),fe({received:ke()}),fe({uploadId:le().max(64)}),fe({}),fe({device:et}),fe({token:le().optional(),remaining:le().optional(),problem:le().optional()}),fe({device:et}),fe({}),fe({device:et,method:Ft(["DISPLAY","VIDEO","GRAPHIC"]).default("DISPLAY")}),fe({mime:le(),base64:le()}),fe({device:et}),fe({path:le()}),fe({device:et,path:Js}),fe({path:le(),items:vs(y2)}),fe({device:et,path:Js}),fe({device:et,path:Js,offset:ke().int().min(0),length:ke().int().min(1).max(Df)}),fe({data:le(),eof:Ve()}),fe({device:et,path:Js,uploadId:le().max(64),opId:le().max(64),overwrite:Ve().optional()}),fe({size:ke()}),fe({device:et,parent:Js,name:Ad}),fe({path:le()}),fe({device:et,parent:Js,from:Ad,to:Ad}),fe({path:le()}),fe({device:et,path:Js}),fe({}),fe({device:et,rows:ke().int().min(2).max(500),cols:ke().int().min(10).max(1e3),pty:Ve().optional()}),fe({shellId:le(),pty:Ve(),title:le()}),fe({shellId:le().max(64),data:le().max(1024*1024)}),fe({}),fe({shellId:le().max(64),rows:ke().int().min(2).max(500),cols:ke().int().min(10).max(1e3)}),fe({}),fe({shellId:le().max(64),bytes:ke().int().min(0)}),fe({}),fe({shellId:le().max(64)}),fe({}),fe({refresh:Ve().optional()}),fe({packages:vs(_2),fetchedAt:ke()}),fe({url:ra}),fe({mime:le(),base64:le()}),fe({id:rc}),fe({html:le().nullable(),baseUrl:le().optional()}),fe({device:et,id:rc,channel:Ft(["stable","beta"]).default("stable"),opId:le().max(64)}),fe({appId:le(),version:le(),via:Ft(["devmode","hbchannel"])}),fe({device:et,quiet:Ve().optional()}),fe({installed:Ve(),root:Ve().optional()}),fe({device:et,source:C2,opId:le().min(1).max(64),lines:ke().int().min(0).max(5e3).optional()}),fe({exitCode:ke().nullable(),stopped:Ve()}),fe({opId:le().max(64)}),fe({stopped:Ve()}),fe({device:et,source:Ft(["syslog","dmesg"])}),fe({}),fe({device:et}),fe({contexts:vs(fe({name:le(),level:le()}))}),fe({device:et,context:N0,level:j2}),fe({changed:vs(le())}),fe({device:et}),fe({dir:le().nullable(),reports:vs(T2)}),fe({device:et,path:Js}),fe({text:le(),truncated:Ve()}),fe({refresh:Ve().optional()}).optional(),fe({releases:vs(A2),fetchedAt:ke(),stale:le().optional()}),fe({device:et,tag:le().min(1).max(100),variant:j0,opId:le().max(64)}),fe({appId:le(),version:le(),via:Ft(["devmode","hbchannel"])}),fe({device:et,path:Js}),fe({});const B2="https://lg.scoty.uk",I2=[B2],H2=["http://localhost:5173","http://127.0.0.1:5173"],dm="https://github.com/Scoty/lg-dev-manager",Of=`${dm}/releases/latest`;class yt extends Error{constructor(n,l,o){super(l),this.code=n,this.detail=o}code;detail;static from(n){return new yt(n.code,n.message,n.detail)}}class U2{constructor(n,l){this.url=n,this.token=l}url;token;ws;nextId=1;pending=new Map;listeners=new Map;onClose;async connect(n=8e3){return await new Promise((l,o)=>{let d;try{d=new WebSocket(this.url)}catch(w){o(new yt("bad_url",`Invalid bridge address: ${this.url}`,String(w)));return}this.ws=d;const _=setTimeout(()=>{d.close(),o(new yt("timeout","The bridge did not answer in time."))},n);d.onopen=()=>{clearTimeout(_),l()},d.onerror=()=>{clearTimeout(_),o(new yt("unreachable","Could not reach the bridge. Is it running, and is this site allowed?"))},d.onmessage=w=>this.handle(String(w.data)),d.onclose=w=>{const c=w.reason||(w.code===4401?"unauthorized":"closed");for(const h of this.pending.values())clearTimeout(h.timer),h.reject(new yt("disconnected","Connection to the bridge was lost."));this.pending.clear(),this.onClose?.(c)}}),this.call("system.hello",{token:this.token,protocolVersion:L2,client:"web"})}call(n,l,o=3e4){const d=this.ws;if(!d||d.readyState!==WebSocket.OPEN)return Promise.reject(new yt("disconnected","Not connected to the bridge."));const _=this.nextId++;return new Promise((w,c)=>{const h=setTimeout(()=>{this.pending.delete(_),c(new yt("timeout",`${n} timed out.`))},o);this.pending.set(_,{resolve:w,reject:c,timer:h}),d.send(JSON.stringify({id:_,method:n,params:l}))})}on(n,l){let o=this.listeners.get(n);return o||this.listeners.set(n,o=new Set),o.add(l),()=>o.delete(l)}close(){this.onClose=void 0,this.ws?.close()}handle(n){let l;try{l=JSON.parse(n)}catch{return}if(typeof l.id=="number"){const o=this.pending.get(l.id);if(!o)return;this.pending.delete(l.id),clearTimeout(o.timer),l.error?o.reject(yt.from(l.error)):o.resolve(l.result)}else l.event&&this.listeners.get(l.event)?.forEach(o=>o(l.data))}}const Lf="lgdm-bridge",z2=new Set(["127.0.0.1","localhost"]),Dy=`The bridge only runs on this computer, so its address must start with ws://127.0.0.1: or ws://localhost: (default ws://127.0.0.1:${Tc}/rpc).`;function fm(s){let n;try{n=new URL(s.trim())}catch{return`That isn’t a valid address. ${Dy}`}return n.protocol!=="ws:"||!z2.has(n.hostname)||n.username||n.password?Dy:null}function Ay(s=window.location){const n=s.hostname==="localhost"||s.hostname==="127.0.0.1";return s.protocol==="http:"&&n&&!["localhost:5173","127.0.0.1:5173"].includes(s.host)?`ws://${s.host}/rpc`:`ws://127.0.0.1:${Tc}/rpc`}function $2(){try{const s=localStorage.getItem(Lf);if(!s)return null;const n=JSON.parse(s);return n.url&&n.token&&!fm(n.url)?{url:n.url,token:n.token}:null}catch{return null}}function Oy(s){try{s?localStorage.setItem(Lf,JSON.stringify(s)):localStorage.removeItem(Lf)}catch{}}const T0=M.createContext(null),Ly=[1e3,2e3,5e3,1e4];function P2({children:s}){const[n,l]=M.useState(()=>$2()),[o,d]=M.useState(n?{state:"connecting"}:{state:"unpaired"}),[_,w]=M.useState(null),c=M.useRef(0),h=M.useRef(void 0),y=M.useRef(0),p=M.useCallback(async C=>{const j=++y.current;clearTimeout(h.current),d({state:"connecting"});const E=new U2(C.url,C.token);try{const g=await E.connect();if(j!==y.current)return E.close();c.current=0,w(E),d({state:"connected",bridgeVersion:g.bridgeVersion,platform:g.platform,distribution:g.distribution}),E.onClose=b=>{if(j===y.current){if(w(null),b==="unauthorized"){d({state:"error",code:"unauthorized",message:"The bridge rejected the pairing token."});return}d({state:"error",code:"disconnected",message:"Lost connection to the bridge. Retrying…"}),f(C,j)}}}catch(g){if(E.close(),j!==y.current)return;const b=g instanceof yt?g:new yt("unknown",String(g));throw w(null),d({state:"error",code:b.code,message:b.message}),b.code!=="unauthorized"&&b.code!=="protocol_mismatch"&&f(C,j),b}},[]),f=M.useCallback((C,j)=>{const E=Ly[Math.min(c.current++,Ly.length-1)];h.current=setTimeout(()=>{j===y.current&&p(C).catch(()=>{})},E)},[p]);M.useEffect(()=>(n&&p(n).catch(()=>{}),()=>{y.current++,clearTimeout(h.current)}),[]);const x=M.useMemo(()=>({status:o,settings:n,client:_,pair:async C=>{const j=fm(C.url);if(j)throw new yt("bad_url",j);_?.close(),Oy(C),l(C),await p(C)},reconnect:()=>{c.current=0,n&&p(n).catch(()=>{})},forget:()=>{y.current++,clearTimeout(h.current),_?.close(),Oy(null),l(null),w(null),d({state:"unpaired"})}}),[o,n,_,p]);return r.jsx(T0.Provider,{value:x,children:s})}function Pi(){const s=M.useContext(T0);if(!s)throw new Error("useBridge must be used inside <BridgeProvider>");return s}const k0={apps:'<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>',store:'<path d="M3 9h18l-1.5 11a1 1 0 0 1-1 .9h-13a1 1 0 0 1-1-.9z"/><path d="M8 9V6a4 4 0 0 1 8 0v3"/>',files:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',terminal:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="m7 9 3 3-3 3M13 15h4"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',debug:'<path d="M8 2l1.5 2M16 2l-1.5 2"/><rect x="7" y="5" width="10" height="15" rx="5"/><path d="M3 12h4M17 12h4M4 7l3 2M20 7l-3 2M4 18l3-2M20 18l-3-2M12 10v7"/>',tv:'<rect x="3" y="5" width="18" height="12" rx="2"/><path d="M8 21h8M12 17v4"/>',plug:'<path d="M9 2v6M15 2v6"/><path d="M6 8h12v3a6 6 0 0 1-12 0z"/><path d="M12 17v5"/>',github:'<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/>',moon:'<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',search:'<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>',menu:'<line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/>',folder:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',folderPlus:'<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M12 10v6M9 13h6"/>',file:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-5-5L5 21"/>',cog:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',chevLeft:'<path d="m15 18-6-6 6-6"/>',chevDown:'<path d="m6 9 6 6 6-6"/>',arrowUp:'<path d="M12 19V5M5 12l7-7 7 7"/>',home:'<path d="m3 10 9-7 9 7v10a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>',chevRight:'<path d="m9 18 6-6-6-6"/>',left:'<path d="m15 18-6-6 6-6"/>',right:'<path d="m9 18 6-6-6-6"/>',updown:'<path d="m7 9 5-5 5 5"/><path d="m7 15 5 5 5-5"/>',plus:'<path d="M12 5v14M5 12h14"/>',key:'<circle cx="7.5" cy="15.5" r="4.5"/><path d="m10.7 12.3 9.3-9.3M17 6l3 3M14 9l2 2"/>',wrench:'<path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2.4-.6-.6-2.4z"/>',play:'<path d="M7 4.5v15a.8.8 0 0 0 1.2.7l12-7.5a.8.8 0 0 0 0-1.4l-12-7.5A.8.8 0 0 0 7 4.5z"/>',trash:'<path d="M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/>',edit:'<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/>',refresh:'<path d="M21 12a9 9 0 1 1-2.6-6.4L21 8"/><path d="M21 3v5h-5"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5M12 15V3"/>',upload:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5M12 3v12"/>',check:'<path d="M20 6 9 17l-5-5"/>',x:'<path d="M18 6 6 18M6 6l12 12"/>',copy:'<rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',more:'<circle cx="12" cy="5" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="12" cy="19" r="1"/>',alert:'<path d="M12 9v4M12 17h.01"/><path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>',lock:'<rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',shield:'<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>',pulse:'<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>',link:'<path d="M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"/><path d="M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"/>',external:'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"/>',box:'<path d="M21 8 12 3 3 8v8l9 5 9-5z"/><path d="m3 8 9 5 9-5M12 13v8"/>',disk:'<ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v14c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/>'};function ce({name:s,className:n,strokeWidth:l}){return r.jsx("svg",{viewBox:"0 0 24 24",className:n,fill:"none",stroke:"currentColor",strokeWidth:l,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",dangerouslySetInnerHTML:{__html:k0[s]}})}function si({open:s,onClose:n,title:l,children:o,footer:d,size:_="md",dismissible:w=!0}){const c=M.useRef(null),h=M.useId();return M.useEffect(()=>{const y=c.current;y&&(s&&!y.open&&y.showModal(),!s&&y.open&&y.close())},[s]),r.jsx("dialog",{ref:c,className:`modal modal--${_}`,"aria-labelledby":h,onCancel:y=>{y.preventDefault(),w&&n()},onMouseDown:y=>{w&&y.target===y.currentTarget&&n()},children:s&&r.jsxs("div",{className:"modal-card",children:[r.jsxs("div",{className:"modal-head",children:[r.jsx("h2",{className:"modal-title",id:h,children:l}),w&&r.jsx("button",{type:"button",className:"icon-btn icon-btn--sm",onClick:n,"aria-label":"Close",children:r.jsx(ce,{name:"x",strokeWidth:2})})]}),r.jsx("div",{className:"modal-body",children:o}),d&&r.jsx("div",{className:"modal-foot",children:d})]})})}const F2={success:'<path d="M20 6 9 17l-5-5"/>',danger:'<path d="M18 6 6 18M6 6l12 12"/>',warning:'<path d="M12 9v4M12 17h.01"/><path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',primary:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>'};function $e({kind:s,title:n,children:l,action:o}){return r.jsxs("div",{className:`alert ${s}`,role:s==="danger"?"alert":"status",children:[r.jsx("div",{className:"ico",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F2[s]}})}),r.jsxs("div",{className:"body",children:[n&&r.jsx("div",{className:"title",children:n}),l]}),o??r.jsx("span",{})]})}const R0=M.createContext(null);function V2({children:s}){const[n,l]=M.useState(null),[o,d]=M.useState([]),_=M.useRef(1),w=M.useCallback(p=>new Promise(f=>{l({...p,resolve:f})}),[]),c=M.useCallback(p=>{const f=_.current++;d(x=>[...x.slice(-3),{...p,id:f}]),setTimeout(()=>d(x=>x.filter(C=>C.id!==f)),p.kind==="danger"?9e3:5e3)},[]),h=p=>{n?.resolve(p),l(null)},y=M.useMemo(()=>({confirm:w,toast:c}),[w,c]);return r.jsxs(R0.Provider,{value:y,children:[s,r.jsx(si,{open:!!n,onClose:()=>h(!1),title:n?.title??"",size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>h(!1),autoFocus:n?.danger,children:n?.cancelText??"Cancel"}),r.jsx("button",{type:"button",className:`btn ${n?.danger?"btn--danger":"btn--primary"}`,onClick:()=>h(!0),autoFocus:!n?.danger,children:n?.confirmText??"OK"})]}),children:n?.message}),r.jsx("div",{className:"toasts","aria-live":"polite",children:o.map(p=>r.jsx("div",{className:"toast",children:r.jsx($e,{kind:p.kind,title:p.title,action:r.jsx("button",{type:"button",className:"close","aria-label":"Dismiss",onClick:()=>d(f=>f.filter(x=>x.id!==p.id)),children:r.jsx("svg",{viewBox:"0 0 24 24",children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}),children:p.text})},p.id))})]})}function jt(){const s=M.useContext(R0);if(!s)throw new Error("useFeedback must be used inside <FeedbackProvider>");return s}function mm(s){const[n,l]=M.useState(()=>typeof matchMedia=="function"&&matchMedia(s).matches);return M.useEffect(()=>{if(typeof matchMedia!="function")return;const o=matchMedia(s),d=()=>l(o.matches);return d(),o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[s]),n}const D0="(min-width: 721px) and (max-width: 1100px)",pm=[{label:"Device",items:[{key:"apps",text:"Apps",icon:"apps",children:[{key:"apps-installed",text:"Installed",to:"/apps/installed"},{key:"apps-homebrew",text:"Homebrew repo",to:"/apps/homebrew"},{key:"apps-litefin",text:"Litefin repo",to:"/apps/litefin"}]},{key:"files",text:"Files",icon:"files",to:"/files"},{key:"terminal",text:"Terminal",icon:"terminal",to:"/terminal"},{key:"info",text:"Device info",icon:"info",to:"/info"},{key:"debug",text:"Debug",icon:"debug",children:[{key:"debug-logs",text:"System log",to:"/debug/logs"},{key:"debug-pmlog",text:"Log levels",to:"/debug/pmlog"},{key:"debug-dmesg",text:"Kernel log",to:"/debug/dmesg"},{key:"debug-crashes",text:"Crash reports",to:"/debug/crashes"},{key:"debug-luna",text:"Luna monitor",to:"/debug/luna"}]}]},{label:"Setup",items:[{key:"devices",text:"Devices",icon:"tv",to:"/devices"},{key:"bridge",text:"Bridge",icon:"plug",to:"/bridge"}]},{label:"Links",items:[{key:"homebrew-site",text:"webOS Homebrew",icon:"store",href:"https://www.webosbrew.org/"},{key:"source",text:"Source code",icon:"github",href:dm}]}];function q2(s){if(s.startsWith("/devices/new"))return["Setup","Devices","Add a TV"];for(const n of pm)for(const l of n.items){if(l.to&&s.startsWith(l.to))return[n.label,l.text];for(const o of l.children??[])if(s.startsWith(o.to))return[n.label,l.text,o.text]}return["LG Dev Manager"]}const A0="1.0.2",ml="1.0.2",lc=6,ul=8;function K2(){const n=document.querySelector(".console-dock")?.getBoundingClientRect().top;return n&&n>0?Math.min(n,window.innerHeight):window.innerHeight}function Ic({trigger:s,children:n,placement:l="down-right",className:o="",menuClassName:d="",label:_,floating:w=!1}){const[c,h]=M.useState(!1),y=M.useRef(null),p=M.useRef(null),[f,x]=M.useState(null),C=M.useCallback(()=>{const E=y.current?.getBoundingClientRect(),g=p.current;if(!E||!g)return;const b=g.offsetHeight,v=g.offsetWidth,N=K2()-E.bottom-lc,T=E.top-lc,O=b>N-ul&&T>N?Math.max(ul,E.top-lc-b):E.bottom+lc,k=l==="down-right"?Math.max(ul,E.right-v):Math.min(Math.max(ul,E.left),window.innerWidth-v-ul);x({top:O,left:k})},[l]);M.useLayoutEffect(()=>{if(w){if(!c)return x(null);C()}},[w,c,C]),M.useEffect(()=>{if(!c)return;const E=b=>{const v=b.target;!y.current?.contains(v)&&!p.current?.contains(v)&&h(!1)},g=b=>{b.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",g),w&&(window.addEventListener("scroll",C,!0),window.addEventListener("resize",C)),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",g),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[c,w,C]);const j=c&&n(()=>h(!1));return r.jsxs("div",{ref:y,className:`dd-wrap${c?" is-open":""} ${o}`,children:[s({open:c,toggle:()=>h(E=>!E),"aria-expanded":c,"aria-haspopup":"menu"}),w?c&&GC.createPortal(r.jsx("div",{ref:p,className:`dd-menu dd-menu--floating${f?" is-placed":""} ${d}`,role:"menu","aria-label":_,style:f??void 0,children:j}),document.body):r.jsx("div",{ref:p,className:`dd-menu dd-menu--${l} ${d}`,role:"menu","aria-label":_,children:j})]})}const Hc=s=>C0.test(s);function bl(s){const n=s.trim();return n?n.length>255||!E0.test(n)?"That doesn’t look like an IP address or host name.":null:"Enter the TV’s IP address."}const G2=s=>s===s.trim()&&bl(s)===null,O0=fe({modelName:le().max(64).optional(),osVersion:le().max(64).optional(),firmwareVersion:le().max(64).optional(),socName:le().max(64).optional(),from:le().max(300),at:ke(),v:ke().optional()}),L0=2;function Uc(s,n){const l=o=>o?o.slice(0,64):void 0;return O0.parse({...n.modelName?{modelName:l(n.modelName)}:{},...n.osVersion?{osVersion:l(n.osVersion)}:{},...n.firmwareVersion?{firmwareVersion:l(n.firmwareVersion)}:{},...n.socName?{socName:l(n.socName)}:{},from:`${s.host}:${s.port}`,at:Date.now(),v:L0})}const ua=fe({id:le(),name:le().min(1).max(64),mode:Ft(["devmode","rooted"]),host:le().min(1).max(255),port:ke().int().min(1).max(65535),username:le().min(1).max(64),auth:w0,description:le().max(200).optional(),info:O0.optional(),createdAt:ke(),updatedAt:ke()}),Y2=ua.extend({host:le().trim().refine(s=>bl(s)===null,"Not a valid IP address or host name."),username:le().refine(Hc,"Not a valid user name.")}),Z2=fe({format:_l("lg-dev-manager/devices"),version:_l(1),exportedAt:ke(),devices:vs(Y2).max(500)});class M0 extends Error{name="BackupError"}const X2="That file is not an LG Dev Manager device backup.";function W2(s,n){const l=s.issues.find(h=>h.path[0]==="devices"&&typeof h.path[1]=="number");if(!l)return X2;const o=l.path[1],d=n.devices?.[o]?.name,_=typeof d=="string"&&d.trim()?`“${d.trim().slice(0,64)}”`:`number ${o+1}`,w=l.path[2];return`Nothing was imported: TV ${_} in this backup ${w==="username"?"has a user name that isn’t allowed":w==="host"?"has an address that isn’t an IP address or host name":"has settings this app can’t use"}. Only import backups you made yourself.`}const Q2="lgdm",J2=2,aa="devices",As="screenshots",Mf="lgdm-active-device";function zc(s){return new Promise((n,l)=>{s.onsuccess=()=>n(s.result),s.onerror=()=>l(s.error)})}let oc=null;function ir(){return oc??=new Promise((s,n)=>{const l=indexedDB.open(Q2,J2);l.onupgradeneeded=()=>{const o=l.result;o.objectStoreNames.contains(aa)||o.createObjectStore(aa,{keyPath:"id"}),o.objectStoreNames.contains(As)||o.createObjectStore(As,{keyPath:"id"}).createIndex("deviceId","deviceId")},l.onsuccess=()=>{l.result.onversionchange=()=>{l.result.close(),oc=null},s(l.result)},l.onerror=()=>{oc=null,n(l.error)}}),oc}async function nr(s,n){const l=await ir();return zc(n(l.transaction(aa,s).objectStore(aa)))}async function eN(s){const n=await ir();await new Promise((l,o)=>{const d=n.transaction(As,"readwrite"),_=d.objectStore(As).index("deviceId").openKeyCursor(IDBKeyRange.only(s));_.onsuccess=()=>{const w=_.result;w&&(d.objectStore(As).delete(w.primaryKey),w.continue())},d.oncomplete=()=>l(),d.onerror=()=>o(d.error)}),Sl.forEach(l=>l())}async function tN(){const s=await ir();await zc(s.transaction(As,"readwrite").objectStore(As).clear()),Sl.forEach(n=>n())}const Sl=new Set,Bf=new Set,ha=()=>Bf.forEach(s=>s());function My(s){return Bf.add(s),()=>Bf.delete(s)}async function gm(){return(await nr("readonly",n=>n.getAll())).map(n=>ua.safeParse(n)).flatMap(n=>n.success?[n.data]:[]).sort((n,l)=>n.name.localeCompare(l.name))}async function B0(s){const n=await nr("readonly",o=>o.get(s)),l=ua.safeParse(n);return l.success?l.data:void 0}async function sN(s){const n=Date.now(),l=ua.parse({...s,id:crypto.randomUUID(),createdAt:n,updatedAt:n});return await nr("readwrite",o=>o.add(l)),$c()||Nn(l.id),ha(),l}async function iN(s,n){const l=await B0(s);if(!l)throw new Error("Device not found");const o=ua.parse({...l,...n,id:s,updatedAt:Date.now()});return await nr("readwrite",d=>d.put(o)),ha(),o}async function vm(s,n){const l=await B0(s);l&&(await nr("readwrite",o=>o.put(ua.parse({...l,info:n}))),ha())}async function nN(s){if(await nr("readwrite",n=>n.delete(s)),await eN(s).catch(()=>{}),$c()===s){const n=await gm();Nn(n[0]?.id??null)}ha()}function $c(){try{return localStorage.getItem(Mf)}catch{return null}}function Nn(s){try{s?localStorage.setItem(Mf,s):localStorage.removeItem(Mf)}catch{}ha()}function gt(s){return{host:s.host,port:s.port,username:s.username,auth:s.auth}}async function rN(){return{format:"lg-dev-manager/devices",version:1,exportedAt:Date.now(),devices:await gm()}}async function aN(s){const n=Z2.safeParse(s);if(!n.success)throw new M0(W2(n.error,s));const l=n.data,o=await ir();return await new Promise((d,_)=>{const w=o.transaction(aa,"readwrite");for(const c of l.devices)w.objectStore(aa).put(c);w.oncomplete=()=>d(),w.onerror=()=>_(w.error)}),!$c()&&l.devices[0]&&Nn(l.devices[0].id),ha(),l.devices.length}async function lN(){await nr("readwrite",s=>s.clear()),await tN().catch(()=>{}),Nn(null)}function Mt(){const[s,n]=M.useState(null),l=M.useSyncExternalStore(My,$c,()=>null);M.useEffect(()=>{let d=!0;const _=()=>gm().then(c=>d&&n(c)).catch(()=>d&&n([]));_();const w=My(_);return()=>{d=!1,w()}},[]);const o=s?.find(d=>d.id===l)??null;return{devices:s,active:o,activeId:l,loading:s===null}}const oN=[[/^OLED\d{2,3}([A-Z])([0-9X])/,s=>`${s[1]}${s[2]}`],[/^\d{2,3}(QNED\d{2}|NANO\d{2})/,s=>s[1]],[/^\d{2,3}((?:U[A-Z]|S[KM])\d{2})/,s=>s[1]],[/^\d{2}ART10/,()=>"StanbyME"]];function _m(s){const n=s?.trim().toUpperCase();if(n)for(const[l,o]of oN){const d=n.match(l);if(d)return o(d)}}function xl(s){const n=_m(s);return n?`LG ${n}`:s?.trim()||void 0}function If(s){const n=s?.trim();if(!n)return;const l=_m(n);return l?`LG ${l} · ${n}`:n}function cN(){const s=Cl(),{devices:n,active:l}=Mt();return r.jsx(Ic,{label:"Choose TV",placement:"up-left",className:"device-switcher",menuClassName:"dd-menu--compact",trigger:({toggle:o,...d})=>r.jsxs("button",{type:"button",className:"workspace",title:"Choose TV","aria-label":l?`Active TV: ${l.name}. Choose TV`:"Choose TV",onClick:o,...d,children:[r.jsx("div",{className:"workspace-avatar",children:r.jsx(ce,{name:"tv"})}),r.jsxs("div",{className:"workspace-text",children:[r.jsx("div",{className:"workspace-name",children:l?.name??"No TV selected"}),r.jsx("div",{className:"workspace-role",children:l?`${xl(l.info?.modelName)??l.host} · ${l.mode==="rooted"?"rooted":"Dev Mode"}`:n?.length?"choose a TV":"add a TV to start"})]}),r.jsx(ce,{name:"updown",className:"workspace-chev",strokeWidth:1.8})]}),children:o=>r.jsxs(r.Fragment,{children:[!!n?.length&&r.jsx("div",{className:"dd-section-label",children:"Your TVs"}),n?.map(d=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":d.id===l?.id,className:`dd-menu-item${d.id===l?.id?" is-active":""}`,onClick:()=>{Nn(d.id),o()},children:[r.jsx(ce,{name:"tv"}),r.jsxs("span",{className:"dd-menu-text",children:[r.jsx("span",{children:d.name}),r.jsx("span",{className:"dd-menu-sub mono",children:[xl(d.info?.modelName),d.host].filter(Boolean).join(" · ")})]}),d.id===l?.id&&r.jsx(ce,{name:"check",className:"dd-check",strokeWidth:2.4})]},d.id)),!!n?.length&&r.jsx("div",{className:"dd-divider"}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>(o(),s("/devices/new")),children:[r.jsx(ce,{name:"plus"})," Add a TV"]}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>(o(),s("/devices")),children:[r.jsx(ce,{name:"wrench"})," Manage devices"]})]})})}function uN({item:s,pathname:n}){const l=s.children.some(f=>n.startsWith(f.to)),[o,d]=M.useState(l),_=mm(D0),[w,c]=M.useState(null),h=M.useRef(null),y=_?!!w:o||l;M.useEffect(()=>c(null),[n,_]),M.useEffect(()=>{if(!w)return;const f=j=>!h.current?.contains(j.target)&&c(null),x=j=>j.key==="Escape"&&c(null),C=()=>c(null);return document.addEventListener("pointerdown",f),document.addEventListener("keydown",x),window.addEventListener("resize",C),()=>{document.removeEventListener("pointerdown",f),document.removeEventListener("keydown",x),window.removeEventListener("resize",C)}},[w]);const p=f=>{if(!_)return d(!y);if(w)return c(null);const x=f.currentTarget.getBoundingClientRect(),C=s.children.length*40+14;c({top:Math.max(8,Math.min(x.top,window.innerHeight-C-8)),left:x.right+10})};return r.jsxs("div",{ref:h,className:`nav-item-group${y?" is-open":""}`,children:[r.jsxs("button",{type:"button",className:`nav-link${_&&l?" is-active":""}`,"aria-expanded":y,"aria-label":_?s.text:void 0,title:_?s.text:void 0,onClick:p,children:[r.jsx(ce,{name:s.icon}),r.jsx("span",{children:s.text}),r.jsx(ce,{name:"chevRight",className:"chev",strokeWidth:1.8})]}),r.jsx("div",{className:"nav-submenu",style:_&&w?w:void 0,children:s.children.map(f=>r.jsx(im,{to:f.to,className:({isActive:x})=>x?"is-active":void 0,children:f.text},f.key))})]})}function hN({item:s,pathname:n}){const l=mm(D0);if(s.children)return r.jsx(uN,{item:s,pathname:n});const o=l?{title:s.text,"aria-label":s.text}:{},d=r.jsxs(r.Fragment,{children:[r.jsx(ce,{name:s.icon}),r.jsx("span",{children:s.text}),s.badge&&r.jsx("span",{className:`nav-badge ${s.badge.kind}`,children:s.badge.text})]});return s.href?r.jsx("a",{className:"nav-link",href:s.href,target:"_blank",rel:"noopener noreferrer",...o,children:d}):r.jsx(im,{to:s.to,className:({isActive:_})=>`nav-link${_?" is-active":""}`,...o,children:d})}function dN(){const{pathname:s}=_s();return r.jsxs("aside",{className:"d-sidebar",children:[r.jsxs(Jt,{to:"/",className:"brand",children:[r.jsx("div",{className:"brand-logo",children:r.jsx(ce,{name:"tv",strokeWidth:2})}),r.jsxs("div",{className:"brand-text",children:[r.jsx("div",{className:"brand-name",children:"LG Dev Manager"}),r.jsxs("div",{className:"brand-tag",children:["v",A0]})]})]}),r.jsx("div",{className:"sidebar-scroll",children:pm.map(n=>r.jsxs("nav",{className:"nav-section",children:[r.jsx("div",{className:"nav-label",children:n.label}),n.items.map(l=>r.jsx(hN,{item:l,pathname:s},l.key))]},n.label))}),r.jsx("div",{className:"sidebar-footer",children:r.jsx(cN,{})})]})}const fN="lgdm-theme";function I0(){return document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light"}function mN(s){document.documentElement.setAttribute("data-theme",s);try{localStorage.setItem(fN,s)}catch{}}function H0(){const s=I0()==="dark"?"light":"dark";return mN(s),s}function pN(){const{status:s}=Pi(),n={unpaired:{cls:"",text:"Bridge not set up"},connecting:{cls:" is-connecting",text:"Connecting…"},connected:{cls:" is-connected",text:"Bridge connected"},error:{cls:" is-error",text:"Bridge offline"}},{cls:l,text:o}=n[s.state];return r.jsxs(Jt,{to:"/bridge",className:`bridge-pill${l}`,title:s.state==="error"?s.message:o,children:[r.jsx("span",{className:"dot","aria-hidden":"true"}),r.jsx("span",{children:o})]})}function gN({onOpenDrawer:s,onOpenPalette:n}){const{pathname:l}=_s(),o=q2(l),[d,_]=M.useState(I0),w=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);return r.jsxs("header",{className:"d-topbar",children:[r.jsxs("div",{className:"crumbs",children:[r.jsx("button",{className:"hamburger",onClick:s,"aria-label":"Open navigation",children:r.jsx(ce,{name:"menu",strokeWidth:2})}),o.map((c,h)=>r.jsxs(M.Fragment,{children:[h>0&&r.jsx(ce,{name:"chevRight",className:"sep",strokeWidth:2}),r.jsx("span",{className:h===o.length-1?"current":void 0,children:c})]},h))]}),r.jsxs("div",{className:"topbar-actions",children:[r.jsxs("button",{className:"cmd",onClick:n,children:[r.jsx(ce,{name:"search"}),r.jsx("span",{children:"Search..."}),r.jsx("kbd",{className:"kbd",children:w?"⌘K":"Ctrl K"})]}),r.jsx(pN,{}),r.jsx("button",{className:"icon-btn","aria-label":`Switch to ${d==="dark"?"light":"dark"} theme`,onClick:()=>_(H0()),children:r.jsx(ce,{name:d==="dark"?"sun":"moon",strokeWidth:1.8})})]})]})}function vN(){const{status:s}=Pi();return r.jsxs("footer",{className:"d-footer",children:[r.jsxs("div",{children:["Based on"," ",r.jsx("a",{href:"https://github.com/webosbrew/dev-manager-desktop",target:"_blank",rel:"noopener noreferrer",children:"webOS Dev Manager"})," ","· design by"," ",r.jsx("a",{href:"https://github.com/puikinsh/adminator-admin-dashboard",target:"_blank",rel:"noopener noreferrer",children:"Adminator"}),r.jsx("div",{className:"d-footer-note",children:"Not affiliated with or endorsed by LG Electronics. LG and webOS are trademarks of LG Electronics."})]}),r.jsxs("div",{className:"d-footer-meta",children:[r.jsxs("span",{children:["web v",A0]}),r.jsx("span",{children:s.state==="connected"?`bridge v${s.bridgeVersion}`:"no bridge"})]})]})}function _N(s,n){if(!n)return 1;const l=s.label.toLowerCase();return l===n?100:l.startsWith(n)?50:l.includes(n)?20:s.section.toLowerCase().includes(n)?5:0}function yN({open:s,onClose:n}){const l=Cl(),[o,d]=M.useState(""),[_,w]=M.useState(0),c=M.useRef(null),{devices:h,activeId:y}=Mt(),p=M.useMemo(()=>{const C=[];for(const j of pm)for(const E of j.items)if(E.children)for(const g of E.children)C.push({label:g.text,section:`${j.label} › ${E.text}`,icon:E.icon,run:()=>l(g.to)});else E.to?C.push({label:E.text,section:j.label,icon:E.icon,run:()=>l(E.to)}):E.href&&C.push({label:E.text,section:"External",icon:E.icon,run:()=>window.open(E.href,"_blank","noopener")});C.push({label:"Toggle theme (light / dark)",section:"Action",icon:"sun",run:()=>H0()}),C.push({label:"Add a TV",section:"Action",icon:"plus",run:()=>l("/devices/new")}),C.push({label:"Install an IPK",section:"Action",icon:"upload",run:()=>l("/apps/installed")});for(const j of h??[])j.id!==y&&C.push({label:`Switch to ${j.name}`,section:"TV",icon:"tv",run:()=>Nn(j.id)});return C},[l,h,y]),f=M.useMemo(()=>{const C=o.trim().toLowerCase();return p.map(j=>({item:j,s:_N(j,C)})).filter(j=>j.s>0).sort((j,E)=>E.s-j.s).slice(0,12).map(j=>j.item)},[p,o]);if(M.useEffect(()=>(document.body.classList.toggle("has-palette-open",s),s&&(d(""),w(0),requestAnimationFrame(()=>c.current?.focus())),()=>document.body.classList.remove("has-palette-open")),[s]),M.useEffect(()=>w(0),[o]),!s)return null;const x=C=>{C&&(n(),C.run())};return r.jsx("div",{className:"palette-backdrop",onMouseDown:C=>C.target===C.currentTarget&&n(),children:r.jsxs("div",{className:"palette-modal",role:"dialog","aria-modal":"true","aria-label":"Command palette",onKeyDown:C=>{C.key==="Escape"?n():C.key==="ArrowDown"?(C.preventDefault(),w(j=>Math.min(j+1,f.length-1))):C.key==="ArrowUp"?(C.preventDefault(),w(j=>Math.max(j-1,0))):C.key==="Enter"&&(C.preventDefault(),x(f[_]))},children:[r.jsxs("div",{className:"palette-input-row",children:[r.jsxs("svg",{viewBox:"0 0 24 24",className:"palette-icon","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:2,children:[r.jsx("circle",{cx:"11",cy:"11",r:"7"}),r.jsx("path",{d:"m21 21-4.3-4.3"})]}),r.jsx("input",{ref:c,className:"palette-input",type:"text",placeholder:"Search pages, actions…",autoComplete:"off",spellCheck:!1,value:o,onChange:C=>d(C.target.value),"aria-label":"Search"}),r.jsx("kbd",{className:"palette-esc",children:"esc"})]}),r.jsx("div",{className:"palette-results",role:"listbox",children:f.length===0?r.jsx("div",{className:"palette-empty",children:"No results"}):f.map((C,j)=>r.jsxs("div",{className:`palette-result${j===_?" is-selected":""}`,role:"option","aria-selected":j===_,onMouseEnter:()=>w(j),onClick:()=>x(C),children:[r.jsx("span",{className:"palette-result-icon",children:r.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,dangerouslySetInnerHTML:{__html:k0[C.icon]}})}),r.jsx("span",{className:"palette-result-label",children:C.label}),r.jsx("span",{className:"palette-result-section",children:C.section})]},`${C.section}/${C.label}`))}),r.jsxs("div",{className:"palette-foot",children:[r.jsxs("span",{children:[r.jsx("kbd",{children:"↑"}),r.jsx("kbd",{children:"↓"})," navigate"]}),r.jsxs("span",{children:[r.jsx("kbd",{children:"↵"})," select"]}),r.jsxs("span",{children:[r.jsx("kbd",{children:"esc"})," close"]})]})]})})}function ut(){const{client:s,status:n}=Pi(),l=n.state==="connected"&&!!s,o=M.useCallback((d,_,w)=>s?s.call(d,_,w):Promise.reject(new yt("disconnected","The bridge is not connected.")),[s]);return{ready:l,call:o,client:s}}function pc(s,n,l){return s.on(h2,o=>{const d=u2.safeParse(o);d.success&&d.data.opId===n&&l(d.data)})}const ea=()=>crypto.randomUUID(),Ld=1024*1024;function bN(s){return new Promise((n,l)=>{const o=new FileReader;o.onload=()=>{const d=String(o.result);n(d.slice(d.indexOf(",")+1))},o.onerror=()=>l(o.error??new Error("Could not read the file.")),o.readAsDataURL(s)})}async function U0(s,n,l,o){const{uploadId:d}=await s.call("upload.begin",{name:n.name,size:n.size});try{for(let _=0;_<n.size;_+=Ld){if(o?.aborted)throw new yt("cancelled","Cancelled.");const w=await bN(n.slice(_,_+Ld));await s.call("upload.chunk",{uploadId:d,offset:_,data:w},6e4),l?.(Math.min(n.size,_+Ld),n.size)}return d}catch(_){throw s.call("upload.discard",{uploadId:d}).catch(()=>{}),_}}function xt(s){return s instanceof yt?{code:s.code,message:s.message,detail:s.detail}:s instanceof Error?{code:"error",message:s.message}:{code:"error",message:String(s)}}function Nt({error:s,title:n,hint:l,action:o}){const{code:d,message:_,detail:w}=xt(s);return r.jsxs($e,{kind:"danger",title:n,action:o,children:[r.jsx("div",{children:_}),l&&r.jsx("div",{className:"alert-hint",children:l}),r.jsxs("details",{className:"error-details",children:[r.jsx("summary",{children:"Technical details"}),r.jsx("pre",{children:[`code: ${d}`,w].filter(Boolean).join(`
12
+ `)})]})]})}const By=400;class SN{entries=[];listeners=new Set;subscribe=n=>(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.entries;set(n){this.entries=n.length>By?n.slice(n.length-By):n,this.listeners.forEach(l=>l())}update(n,l){const o=this.entries.findIndex(_=>_.id===n);if(o<0)return;const d=this.entries.slice();d[o]={...d[o],...l(d[o])},this.set(d)}log(n){n.phase==="start"?this.set([...this.entries,{id:n.id,source:"bridge",target:n.target,command:n.command,kind:n.kind,quiet:!!n.quiet,startedAt:n.at,output:"",running:!0}]):this.update(n.id,()=>({running:!1,durationMs:n.durationMs,exitCode:n.exitCode,output:n.output??"",error:n.error}))}startManual(n,l,o){this.set([...this.entries,{id:n,source:"manual",target:l,command:o,kind:"stream",quiet:!1,startedAt:Date.now(),output:"",running:!0}])}appendManual(n,l){this.update(n,o=>({output:(o.output+l).slice(-262144)}))}finishManual(n,l){this.update(n,o=>({running:!1,durationMs:Date.now()-o.startedAt,...l}))}clear(){this.set(this.entries.filter(n=>n.running))}}const bn=new SN;class xN{value=null;listeners=new Set;subscribe=n=>(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.value;set(n){this.value=n,this.listeners.forEach(l=>l())}}const kc=new xN,z0="lgdm-console",Iy=140,Hy=300;function wN(){try{const s=JSON.parse(localStorage.getItem(z0)??"{}");return{open:!!s.open,height:Number(s.height)||Hy,showQuiet:!!s.showQuiet}}catch{return{open:!1,height:Hy,showQuiet:!1}}}function CN(s){try{localStorage.setItem(z0,JSON.stringify(s))}catch{}}function EN(){const{client:s}=Pi();M.useEffect(()=>{if(!s)return;const n=s.on(f2,o=>{const d=d2.safeParse(o);d.success&&bn.log(d.data)}),l=s.on(p2,o=>{const d=m2.safeParse(o);d.success&&bn.appendManual(d.data.opId,d.data.data)});return()=>{n(),l()}},[s])}const NN=s=>new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),jN=s=>s===void 0?"":s<1e3?`${s} ms`:`${(s/1e3).toFixed(1)} s`;function TN({e:s}){return s.running?r.jsxs("span",{className:"cons-status is-running",children:[r.jsx("span",{className:"spinner sm"})," running"]}):s.cancelled?r.jsx("span",{className:"cons-status is-warn",children:"stopped"}):s.error?r.jsx("span",{className:"cons-status is-err",title:s.error,children:"failed"}):s.exitCode===0||s.exitCode===void 0&&!s.error?r.jsx("span",{className:"cons-status is-ok",children:s.exitCode===0?"exit 0":"done"}):s.exitCode===null?r.jsx("span",{className:"cons-status",children:"closed"}):r.jsxs("span",{className:"cons-status is-err",children:["exit ",s.exitCode]})}function kN({e:s,expanded:n,onToggle:l}){const o=!!(s.output||s.error),d=s.source==="manual"||n;return r.jsxs("div",{className:`cons-entry is-${s.source}${s.running?" is-running":""}`,children:[r.jsxs("button",{type:"button",className:"cons-line",onClick:l,"aria-expanded":o?d:void 0,disabled:!o,children:[r.jsx("span",{className:"cons-time",children:NN(s.startedAt)}),r.jsx("span",{className:"cons-target",children:s.target}),r.jsxs("span",{className:"cons-cmd",children:[r.jsx("span",{className:"cons-prompt",children:s.kind==="sftp"||s.kind==="tunnel"||s.kind==="http"?"⇄":"$"})," ",s.command]}),r.jsxs("span",{className:"cons-meta",children:[!o&&!s.running&&s.kind!=="sftp"&&s.kind!=="tunnel"&&s.kind!=="http"&&r.jsx("span",{className:"cons-nooutput",children:"no output"}),r.jsx(TN,{e:s}),r.jsx("span",{className:"cons-dur",children:jN(s.durationMs)})]})]}),d&&o&&r.jsxs("pre",{className:"cons-output",children:[s.output,s.error&&r.jsxs("span",{className:"cons-error",children:[s.output?`
13
+ `:"",s.error]})]})]})}function RN(){EN();const s=M.useSyncExternalStore(bn.subscribe,bn.getSnapshot),{ready:n,client:l}=ut(),{active:o}=Mt(),d=M.useSyncExternalStore(kc.subscribe,kc.getSnapshot),_=M.useMemo(()=>d?{name:d.name,host:d.host,port:d.port,username:d.username,target:d.device}:o?{name:o.name,host:o.host,port:o.port,username:o.username,target:gt(o)}:null,[d,o]),[w,c]=M.useState(wN),[h,y]=M.useState(!1),[p,f]=M.useState(""),[x,C]=M.useState([]),[j,E]=M.useState(-1),[g,b]=M.useState(null),[v,S]=M.useState(new Set),N=M.useRef(null),T=M.useRef(null),D=M.useRef(!0),O=I=>c(A=>{const B={...A,...I};return CN(B),B}),k=M.useMemo(()=>s.filter(I=>w.showQuiet||!I.quiet),[s,w.showQuiet]),L=s.filter(I=>I.running),V=k[k.length-1];M.useLayoutEffect(()=>{const I=N.current;I&&D.current&&(I.scrollTop=I.scrollHeight)},[k,w.open]),M.useEffect(()=>{h&&w.open&&T.current?.focus()},[h,w.open]),M.useEffect(()=>{document.documentElement.style.setProperty("--console-h",`${w.open?w.height+44:44}px`)},[w.open,w.height]);const q=_?`${_.username}@${_.name}`:"no TV",Y=h&&n&&!!_&&!g,P=async()=>{const I=p.trim();if(!I||!l||!_||g)return;const A=ea();f(""),C(B=>[...B.filter(F=>F!==I),I].slice(-100)),E(-1),D.current=!0,bn.startManual(A,`${_.username}@${_.host}:${_.port}`,I),b(A);try{const B=await l.call("cmd.stream",{device:_.target,command:I,opId:A},18e5);bn.finishManual(A,B)}catch(B){bn.finishManual(A,{error:xt(B).message})}finally{b(null),requestAnimationFrame(()=>T.current?.focus())}},Q=()=>{g&&l&&l.call("cmd.cancel",{opId:g}).catch(()=>{})},he=I=>{if(I.key==="Enter")I.preventDefault(),P();else if(I.key==="ArrowUp"&&x.length){I.preventDefault();const A=j<0?x.length-1:Math.max(0,j-1);E(A),f(x[A])}else if(I.key==="ArrowDown"&&j>=0){I.preventDefault();const A=j+1;A>=x.length?(E(-1),f("")):(E(A),f(x[A]))}},ne=I=>{I.key==="c"&&I.ctrlKey&&g&&(I.preventDefault(),Q())},W=I=>{I.preventDefault();const A=I.clientY,B=w.height,F=Math.max(Iy,window.innerHeight-160),$=z=>O({height:Math.min(F,Math.max(Iy,B+A-z.clientY))}),J=()=>{window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",J)};window.addEventListener("pointermove",$),window.addEventListener("pointerup",J)};return r.jsxs("section",{className:`console-dock${w.open?" is-open":""}`,"aria-label":"Console",onKeyDown:ne,children:[w.open&&r.jsx("div",{className:"cons-resize",onPointerDown:W,role:"separator","aria-orientation":"horizontal","aria-label":"Resize console"}),r.jsxs("div",{className:"cons-bar",children:[r.jsxs("button",{type:"button",className:"cons-toggle",onClick:()=>O({open:!w.open}),"aria-expanded":w.open,children:[r.jsx(ce,{name:"terminal"}),r.jsx("span",{className:"cons-title",children:"Console"}),L.length>0?r.jsxs("span",{className:"badge primary dot",children:[L.length," running"]}):r.jsx("span",{className:"cons-count",children:k.length}),!w.open&&V&&r.jsxs("span",{className:"cons-last mono",children:["$ ",V.command]}),r.jsx(ce,{name:"chevRight",className:`cons-chev${w.open?" is-open":""}`,strokeWidth:2})]}),r.jsxs("div",{className:"cons-tools",children:[r.jsxs("label",{className:"check",title:"Type commands and run them on the active TV",children:[r.jsx("input",{type:"checkbox",checked:h,onChange:I=>{y(I.target.checked),I.target.checked&&!w.open&&O({open:!0})}}),r.jsx("span",{className:"box"}),r.jsx("span",{className:"cons-check-label",children:"Send commands"})]}),w.open&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"check cons-quiet",title:"Show routine background reads such as app icons",children:[r.jsx("input",{type:"checkbox",checked:w.showQuiet,onChange:I=>O({showQuiet:I.target.checked})}),r.jsx("span",{className:"box"}),r.jsx("span",{className:"cons-check-label",children:"Background reads"})]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>bn.clear(),disabled:!s.length,children:"Clear"})]})]})]}),w.open&&r.jsxs("div",{className:"cons-body",style:{height:w.height},children:[r.jsx("div",{className:"cons-list",ref:N,onScroll:I=>{const A=I.currentTarget;D.current=A.scrollHeight-A.scrollTop-A.clientHeight<24},children:k.length===0?r.jsxs("div",{className:"cons-empty",children:["Commands the bridge runs on your TV appear here — listing apps, installs, file transfers. Tick ",r.jsx("b",{children:"Send commands"})," to type your own."]}):k.map(I=>r.jsx(kN,{e:I,expanded:v.has(I.id)||!!I.error&&!I.quiet,onToggle:()=>S(A=>{const B=new Set(A);return B.has(I.id)?B.delete(I.id):B.add(I.id),B})},I.id))}),h&&r.jsx("div",{className:"cons-input-row",children:!n||!_?r.jsx("span",{className:"cons-hint",children:n?"Choose a TV to send commands to.":"Connect the bridge to send commands."}):r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"cons-ps1 mono",htmlFor:"console-input",children:[q," $"]}),r.jsx("input",{id:"console-input",ref:T,className:"cons-input mono",value:p,onChange:I=>f(I.target.value),onKeyDown:he,disabled:!Y,placeholder:g?"Running… (Ctrl+C to stop)":"Type a command and press Enter — e.g. uname -a",autoComplete:"off",spellCheck:!1,"aria-label":`Command to run on ${_.name}`}),g?r.jsx("button",{type:"button",className:"btn btn--sm btn--soft-danger",onClick:Q,children:"Stop"}):r.jsx("button",{type:"button",className:"btn btn--sm btn--soft-primary",onClick:P,disabled:!p.trim(),children:"Run"})]})}),h&&n&&_&&r.jsxs("div",{className:"cons-warning",children:["Commands run directly on ",_.name," as ",r.jsx("span",{className:"mono",children:_.username}),". There is no undo."]})]})]})}const DN=1440*60*1e3;function AN(){const{ready:s,call:n}=ut(),{active:l}=Mt(),o=M.useRef(new Set);M.useEffect(()=>{if(!s||!l)return;const d=`${l.host}:${l.port}`,_=l.info&&l.info.from===d&&l.info.v===L0&&Date.now()-l.info.at<DN,w=`${l.id}@${d}`;_||o.current.has(w)||(o.current.add(w),n("device.info",{device:gt(l),quiet:!0},4e4).then(c=>vm(l.id,Uc(l,c))).catch(()=>{}))},[s,l,n])}function ON(s=navigator){return s.userAgentData?.mobile||/Android|iPhone|iPad|iPod|Mobile|Silk|Kindle|Opera Mini/i.test(s.userAgent)?!0:/Macintosh/.test(s.userAgent)&&s.maxTouchPoints>1}const Uy="lgdm-phone-notice-dismissed";function $0({always:s=!1}){const[n,l]=M.useState(()=>{try{return sessionStorage.getItem(Uy)==="1"}catch{return!1}});if(!ON()||n&&!s)return null;const o=()=>{l(!0);try{sessionStorage.setItem(Uy,"1")}catch{}};return r.jsx("div",{className:"phone-notice",children:r.jsx($e,{kind:"warning",title:"Use a computer for this",action:s?void 0:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:o,children:"Got it"}),children:"LG Dev Manager talks to your TV through the bridge, a small program that has to run on the same computer as this browser. Phones and tablets can’t run it, and the workarounds — running it in a terminal app on the phone, or opening a bridge to your Wi-Fi — are risky: the bridge holds your TV’s keys and passwords and can do anything on the TV, including as root. Please open this page on a desktop or laptop instead."})})}var Md,zy;function Pc(){if(zy)return Md;zy=1;var s={};return Md=typeof process=="object"&&s&&s.NODE_DEBUG&&/\bsemver\b/i.test(s.NODE_DEBUG)?(...l)=>console.error("SEMVER",...l):()=>{},Md}var Bd,$y;function ym(){if($y)return Bd;$y=1;const s="2.0.0",n=256,l=Number.MAX_SAFE_INTEGER||9007199254740991,o=16,d=n-6;return Bd={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:o,MAX_SAFE_BUILD_LENGTH:d,MAX_SAFE_INTEGER:l,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:s,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Bd}var cc={exports:{}},Py;function Fc(){return Py||(Py=1,(function(s,n){const{MAX_SAFE_COMPONENT_LENGTH:l,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:d}=ym(),_=Pc();n=s.exports={};const w=n.re=[],c=n.safeRe=[],h=n.src=[],y=n.safeSrc=[],p=n.t={};let f=0;const x="[a-zA-Z0-9-]",C=[["\\s",1],["\\d",d],[x,o]],j=g=>{for(const[b,v]of C)g=g.split(`${b}*`).join(`${b}{0,${v}}`).split(`${b}+`).join(`${b}{1,${v}}`);return g},E=(g,b,v)=>{const S=j(b),N=f++;_(g,N,b),p[g]=N,h[N]=b,y[N]=S,w[N]=new RegExp(b,v?"g":void 0),c[N]=new RegExp(S,v?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*"),E("NUMERICIDENTIFIERLOOSE","\\d+"),E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${x}*`),E("MAINVERSION",`(${h[p.NUMERICIDENTIFIER]})\\.(${h[p.NUMERICIDENTIFIER]})\\.(${h[p.NUMERICIDENTIFIER]})`),E("MAINVERSIONLOOSE",`(${h[p.NUMERICIDENTIFIERLOOSE]})\\.(${h[p.NUMERICIDENTIFIERLOOSE]})\\.(${h[p.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASEIDENTIFIER",`(?:${h[p.NONNUMERICIDENTIFIER]}|${h[p.NUMERICIDENTIFIER]})`),E("PRERELEASEIDENTIFIERLOOSE",`(?:${h[p.NONNUMERICIDENTIFIER]}|${h[p.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASE",`(?:-(${h[p.PRERELEASEIDENTIFIER]}(?:\\.${h[p.PRERELEASEIDENTIFIER]})*))`),E("PRERELEASELOOSE",`(?:-?(${h[p.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${h[p.PRERELEASEIDENTIFIERLOOSE]})*))`),E("BUILDIDENTIFIER",`${x}+`),E("BUILD",`(?:\\+(${h[p.BUILDIDENTIFIER]}(?:\\.${h[p.BUILDIDENTIFIER]})*))`),E("FULLPLAIN",`v?${h[p.MAINVERSION]}${h[p.PRERELEASE]}?${h[p.BUILD]}?`),E("FULL",`^${h[p.FULLPLAIN]}$`),E("LOOSEPLAIN",`[v=\\s]*${h[p.MAINVERSIONLOOSE]}${h[p.PRERELEASELOOSE]}?${h[p.BUILD]}?`),E("LOOSE",`^${h[p.LOOSEPLAIN]}$`),E("GTLT","((?:<|>)?=?)"),E("XRANGEIDENTIFIERLOOSE",`${h[p.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),E("XRANGEIDENTIFIER",`${h[p.NUMERICIDENTIFIER]}|x|X|\\*`),E("XRANGEPLAIN",`[v=\\s]*(${h[p.XRANGEIDENTIFIER]})(?:\\.(${h[p.XRANGEIDENTIFIER]})(?:\\.(${h[p.XRANGEIDENTIFIER]})(?:${h[p.PRERELEASE]})?${h[p.BUILD]}?)?)?`),E("XRANGEPLAINLOOSE",`[v=\\s]*(${h[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${h[p.XRANGEIDENTIFIERLOOSE]})(?:\\.(${h[p.XRANGEIDENTIFIERLOOSE]})(?:${h[p.PRERELEASELOOSE]})?${h[p.BUILD]}?)?)?`),E("XRANGE",`^${h[p.GTLT]}\\s*${h[p.XRANGEPLAIN]}$`),E("XRANGELOOSE",`^${h[p.GTLT]}\\s*${h[p.XRANGEPLAINLOOSE]}$`),E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${l}})(?:\\.(\\d{1,${l}}))?(?:\\.(\\d{1,${l}}))?`),E("COERCE",`${h[p.COERCEPLAIN]}(?:$|[^\\d])`),E("COERCEFULL",h[p.COERCEPLAIN]+`(?:${h[p.PRERELEASE]})?(?:${h[p.BUILD]})?(?:$|[^\\d])`),E("COERCERTL",h[p.COERCE],!0),E("COERCERTLFULL",h[p.COERCEFULL],!0),E("LONETILDE","(?:~>?)"),E("TILDETRIM",`(\\s*)${h[p.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",E("TILDE",`^${h[p.LONETILDE]}${h[p.XRANGEPLAIN]}$`),E("TILDELOOSE",`^${h[p.LONETILDE]}${h[p.XRANGEPLAINLOOSE]}$`),E("LONECARET","(?:\\^)"),E("CARETTRIM",`(\\s*)${h[p.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",E("CARET",`^${h[p.LONECARET]}${h[p.XRANGEPLAIN]}$`),E("CARETLOOSE",`^${h[p.LONECARET]}${h[p.XRANGEPLAINLOOSE]}$`),E("COMPARATORLOOSE",`^${h[p.GTLT]}\\s*(${h[p.LOOSEPLAIN]})$|^$`),E("COMPARATOR",`^${h[p.GTLT]}\\s*(${h[p.FULLPLAIN]})$|^$`),E("COMPARATORTRIM",`(\\s*)${h[p.GTLT]}\\s*(${h[p.LOOSEPLAIN]}|${h[p.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",E("HYPHENRANGE",`^\\s*(${h[p.XRANGEPLAIN]})\\s+-\\s+(${h[p.XRANGEPLAIN]})\\s*$`),E("HYPHENRANGELOOSE",`^\\s*(${h[p.XRANGEPLAINLOOSE]})\\s+-\\s+(${h[p.XRANGEPLAINLOOSE]})\\s*$`),E("STAR","(<|>)?=?\\s*\\*"),E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(cc,cc.exports)),cc.exports}var Id,Fy;function bm(){if(Fy)return Id;Fy=1;const s=Object.freeze({loose:!0}),n=Object.freeze({});return Id=o=>o?typeof o!="object"?s:o:n,Id}var Hd,Vy;function LN(){if(Vy)return Hd;Vy=1;const s=/^[0-9]+$/,n=(o,d)=>{if(typeof o=="number"&&typeof d=="number")return o===d?0:o<d?-1:1;const _=s.test(o),w=s.test(d);return _&&w&&(o=+o,d=+d),o===d?0:_&&!w?-1:w&&!_?1:o<d?-1:1};return Hd={compareIdentifiers:n,rcompareIdentifiers:(o,d)=>n(d,o)},Hd}var Ud,qy;function jl(){if(qy)return Ud;qy=1;const s=Pc(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:l}=ym(),{safeRe:o,t:d}=Fc(),_=bm(),{compareIdentifiers:w}=LN(),c=(y,p)=>{const f=p.split(".");if(f.length>y.length)return!1;for(let x=0;x<f.length;x++)if(w(y[x],f[x])!==0)return!1;return!0};class h{constructor(p,f){if(f=_(f),p instanceof h){if(p.loose===!!f.loose&&p.includePrerelease===!!f.includePrerelease)return p;p=p.version}else if(typeof p!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof p}".`);if(p.length>n)throw new TypeError(`version is longer than ${n} characters`);s("SemVer",p,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const x=p.trim().match(f.loose?o[d.LOOSE]:o[d.FULL]);if(!x)throw new TypeError(`Invalid Version: ${p}`);if(this.raw=p,this.major=+x[1],this.minor=+x[2],this.patch=+x[3],this.major>l||this.major<0)throw new TypeError("Invalid major version");if(this.minor>l||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>l||this.patch<0)throw new TypeError("Invalid patch version");x[4]?this.prerelease=x[4].split(".").map(C=>{if(/^[0-9]+$/.test(C)){const j=+C;if(j>=0&&j<l)return j}return C}):this.prerelease=[],this.build=x[5]?x[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(p){if(s("SemVer.compare",this.version,this.options,p),!(p instanceof h)){if(typeof p=="string"&&p===this.version)return 0;p=new h(p,this.options)}return p.version===this.version?0:this.compareMain(p)||this.comparePre(p)}compareMain(p){return p instanceof h||(p=new h(p,this.options)),this.major<p.major?-1:this.major>p.major?1:this.minor<p.minor?-1:this.minor>p.minor?1:this.patch<p.patch?-1:this.patch>p.patch?1:0}comparePre(p){if(p instanceof h||(p=new h(p,this.options)),this.prerelease.length&&!p.prerelease.length)return-1;if(!this.prerelease.length&&p.prerelease.length)return 1;if(!this.prerelease.length&&!p.prerelease.length)return 0;let f=0;do{const x=this.prerelease[f],C=p.prerelease[f];if(s("prerelease compare",f,x,C),x===void 0&&C===void 0)return 0;if(C===void 0)return 1;if(x===void 0)return-1;if(x===C)continue;return w(x,C)}while(++f)}compareBuild(p){p instanceof h||(p=new h(p,this.options));let f=0;do{const x=this.build[f],C=p.build[f];if(s("build compare",f,x,C),x===void 0&&C===void 0)return 0;if(C===void 0)return 1;if(x===void 0)return-1;if(x===C)continue;return w(x,C)}while(++f)}inc(p,f,x){if(p.startsWith("pre")){if(!f&&x===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const C=`-${f}`.match(this.options.loose?o[d.PRERELEASELOOSE]:o[d.PRERELEASE]);if(!C||C[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(p){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,x);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,x);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,x),this.inc("pre",f,x);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,x),this.inc("pre",f,x);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const C=Number(x)?1:0;if(this.prerelease.length===0)this.prerelease=[C];else{let j=this.prerelease.length;for(;--j>=0;)typeof this.prerelease[j]=="number"&&(this.prerelease[j]++,j=-2);if(j===-1){if(f===this.prerelease.join(".")&&x===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(C)}}if(f){let j=[f,C];if(x===!1&&(j=[f]),c(this.prerelease,f)){const E=this.prerelease[f.split(".").length];isNaN(E)&&(this.prerelease=j)}else this.prerelease=j}break}default:throw new Error(`invalid increment argument: ${p}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ud=h,Ud}var zd,Ky;function da(){if(Ky)return zd;Ky=1;const s=jl();return zd=(l,o,d)=>new s(l,d).compare(new s(o,d)),zd}var $d,Gy;function P0(){if(Gy)return $d;Gy=1;const s=da();return $d=(l,o,d)=>s(l,o,d)>0,$d}var MN=P0();const Hf=la(MN);var Pd,Yy;function F0(){if(Yy)return Pd;Yy=1;const s=jl();return Pd=(l,o,d=!1)=>{if(l instanceof s)return l;try{return new s(l,o)}catch(_){if(!d)return null;throw _}},Pd}var Fd,Zy;function BN(){if(Zy)return Fd;Zy=1;const s=F0();return Fd=(l,o)=>{const d=s(l,o);return d?d.version:null},Fd}var IN=BN();const Xy=la(IN),Wy="lgdm-bridge-update-dismissed";function HN(s,n=ml){return!!Xy(s)&&!!Xy(n)&&Hf(n,s)}function V0({always:s=!1}){const{status:n}=Pi(),[l,o]=M.useState(()=>{try{return sessionStorage.getItem(Wy)}catch{return null}});if(n.state!=="connected"||!HN(n.bridgeVersion)||!s&&l===ml)return null;const d=()=>{o(ml);try{sessionStorage.setItem(Wy,ml)}catch{}};return r.jsx("div",{className:"page-notice",children:r.jsxs($e,{kind:"info",title:`Bridge v${ml} is available`,action:s?void 0:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:d,children:"Later"}),children:["Yours is v",n.bridgeVersion,"."," ",n.distribution==="app"?r.jsxs(r.Fragment,{children:["Close it, download the new version from the"," ",r.jsx("a",{href:Of,target:"_blank",rel:"noopener noreferrer",children:"releases page"})," ","and start that one instead."]}):n.distribution==="source"?r.jsxs(r.Fragment,{children:["In the repository run ",r.jsx("span",{className:"mono",children:"git pull"}),", ",r.jsx("span",{className:"mono",children:"pnpm install"}),","," ",r.jsx("span",{className:"mono",children:"pnpm build"})," and ",r.jsx("span",{className:"mono",children:"pnpm bridge"}),"."]}):n.distribution==="npm"?r.jsxs(r.Fragment,{children:["Stop it (Ctrl+C) and start it again with ",r.jsx("span",{className:"mono",children:"npx lg-dev-manager-bridge@latest"}),"."]}):r.jsxs(r.Fragment,{children:["Stop it (Ctrl+C) and start it again with ",r.jsx("span",{className:"mono",children:"npx lg-dev-manager-bridge@latest"})," — or, if you run it from the repository, ",r.jsx("span",{className:"mono",children:"git pull"}),", ",r.jsx("span",{className:"mono",children:"pnpm install"}),","," ",r.jsx("span",{className:"mono",children:"pnpm build"})," and ",r.jsx("span",{className:"mono",children:"pnpm bridge"}),"; if you use the app, download the new version from the"," ",r.jsx("a",{href:Of,target:"_blank",rel:"noopener noreferrer",children:"releases page"}),"."]})," ","Your pairing stays the same."]})})}function $i({eyebrow:s,title:n,action:l,className:o="col-12",children:d}){return r.jsxs("section",{className:`card ${o}`,children:[r.jsxs("div",{className:"card-head",children:[r.jsxs("div",{className:"card-title-wrap",children:[s&&r.jsx("span",{className:"eyebrow",children:s}),r.jsx("h2",{className:"card-title",children:n})]}),l]}),d]})}class q0 extends M.Component{state={error:null,key:this.props.resetKey};static getDerivedStateFromError(n){return{error:n instanceof Error?n:new Error(String(n))}}static getDerivedStateFromProps(n,l){return Object.is(n.resetKey,l.key)?null:{error:null,key:n.resetKey}}componentDidCatch(n,l){console.error("Page error",n,l.componentStack)}render(){const{error:n}=this.state;if(!n)return this.props.children;const l=r.jsx($i,{eyebrow:"Something went wrong",title:"This page hit an error",className:"col-12 page-error",children:r.jsxs("div",{className:"stack",children:[r.jsx($e,{kind:"danger",title:"Error",children:r.jsx("span",{className:"mono",children:n.message.slice(0,500)||n.name})}),r.jsx("p",{className:"muted",style:{margin:0,fontSize:13},children:"Your saved TVs are safe. Reload the page to try again, or pick another page from the menu."}),r.jsx("div",{className:"row",children:r.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>window.location.reload(),children:"Reload"})})]})});return this.props.fullPage?r.jsx("div",{className:"standalone-notice",children:l}):r.jsx("div",{className:"grid",children:l})}}function UN(){const[s,n]=M.useState(!1),[l,o]=M.useState(!1),{pathname:d}=_s();AN(),M.useEffect(()=>{document.body.classList.toggle("has-drawer-open",s)},[s]),M.useEffect(()=>n(!1),[d]);const _=M.useCallback(w=>{const c=w.target,h=!!c&&(c.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(c.tagName));(w.metaKey||w.ctrlKey)&&w.key.toLowerCase()==="k"?(w.preventDefault(),o(y=>!y)):w.key==="/"&&!h?(w.preventDefault(),o(!0)):w.key==="Escape"&&n(!1)},[]);return M.useEffect(()=>(window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)),[_]),r.jsxs("div",{className:"shell",children:[r.jsx(dN,{}),r.jsx("div",{className:"drawer-backdrop",onClick:()=>n(!1)}),r.jsxs("div",{className:"main",children:[r.jsx(gN,{onOpenDrawer:()=>n(!0),onOpenPalette:()=>o(!0)}),r.jsxs("main",{className:"content",children:[!d.startsWith("/bridge")&&r.jsxs(r.Fragment,{children:[r.jsx($0,{}),r.jsx(V0,{})]}),r.jsx(q0,{resetKey:d,children:r.jsx(dC,{})})]}),r.jsx(vN,{}),r.jsx(RN,{})]}),r.jsx(yN,{open:l,onClose:()=>o(!1)})]})}function ys({eyebrow:s,title:n,accent:l,sub:o,actions:d}){return r.jsxs("section",{className:"hero",children:[r.jsxs("div",{className:"hero-text",children:[r.jsx("span",{className:"eyebrow",children:s}),r.jsxs("h1",{className:"hero-title",children:[n," ",l&&r.jsx("span",{className:"accent",children:l})]}),o&&r.jsx("p",{className:"hero-sub",children:o})]}),d&&r.jsx("div",{className:"hero-actions",children:d})]})}function zN(){const{status:s,reconnect:n}=Pi();switch(s.state){case"connected":return r.jsxs($e,{kind:"success",title:"Connected",children:["Bridge v",s.bridgeVersion," on ",s.platform,"."]});case"connecting":return r.jsx($e,{kind:"info",title:"Connecting…",children:"Trying to reach the bridge."});case"error":return r.jsx($e,{kind:"danger",title:"Not connected",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:n,children:"Retry"}),children:s.message});default:return r.jsx($e,{kind:"warning",title:"Not paired yet",children:"Start the bridge, then paste its pairing token below."})}}function $N(){const{settings:s,pair:n,forget:l,status:o}=Pi(),[d,_]=M.useState(s?.url??Ay()),[w,c]=M.useState(s?.token??""),[h,y]=M.useState(!1),[p,f]=M.useState(!1),[x,C]=M.useState(null),j=async g=>{g.preventDefault(),C(null);const b=fm(d);if(b){C(new yt("bad_url",b));return}f(!0);try{await n({url:d.trim(),token:w.trim()})}catch(v){C(v instanceof yt?v:new yt("unknown",String(v)))}finally{f(!1)}},E=window.location.origin;return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Setup",title:"Connect the",accent:"bridge",sub:"Browsers can't open SSH connections to your TV, so a small helper runs on your computer and does it for this page. It only accepts this website and needs a pairing token."}),r.jsx($0,{always:!0}),r.jsx(V0,{always:!0}),r.jsxs("div",{className:"grid",children:[r.jsx($i,{eyebrow:"Step 1",title:"Run the bridge",className:"col-6",children:r.jsxs("div",{className:"stack",children:[r.jsxs("div",{children:[r.jsx("div",{className:"eyebrow",children:"In a terminal on this computer (Node.js 22.12 or newer)"}),r.jsx("div",{className:"codeblock",children:"npx lg-dev-manager-bridge@latest"})]}),r.jsxs("p",{className:"muted",style:{margin:0,fontSize:13},children:["It prints a ",r.jsx("strong",{children:"pairing token"})," — paste it below. Keep the terminal open while you use the app; Ctrl+C stops the bridge. It also serves this app at ",r.jsxs("span",{className:"mono",children:["http://localhost:",Tc]})," if you’d rather not use the website."]}),r.jsxs("div",{className:"bridge-app",children:[r.jsx("div",{className:"eyebrow",children:"No Node.js? Download the app instead"}),r.jsx("p",{className:"muted",style:{margin:0,fontSize:13},children:"The same bridge as one file for Windows, macOS and Linux — nothing else to install. Open it: a window shows the token."}),r.jsxs("a",{className:"btn btn--sm btn--ghost",href:Of,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"download"})," Download the app"]})]}),r.jsxs("p",{className:"muted",style:{margin:0,fontSize:13},children:["On macOS, the first time the bridge looks for or connects to your TV, the system asks whether your terminal app may find devices on your local network — choose ",r.jsx("strong",{children:"Allow"}),"."]}),r.jsxs("details",{className:"muted bridge-from-repo",children:[r.jsx("summary",{children:"Run it from the source code instead"}),r.jsx("div",{className:"codeblock",children:`git clone ${dm}.git
14
14
  cd lg-dev-manager
15
15
  corepack enable # once, for pnpm
16
16
  pnpm install
17
17
  pnpm build
18
- pnpm bridge`}),r.jsxs("p",{style:{margin:0},children:["Needs Node.js 24. To update later: ",r.jsx("span",{className:"mono",children:"git pull"}),", ",r.jsx("span",{className:"mono",children:"pnpm install"}),","," ",r.jsx("span",{className:"mono",children:"pnpm build"}),", then ",r.jsx("span",{className:"mono",children:"pnpm bridge"})," again."]})]}),o.state!=="connected"&&![...B2,...I2].includes(E)&&!E.endsWith(`:${Tc}`)&&r.jsxs($e,{kind:"warning",children:["This page is served from ",r.jsx("span",{className:"mono",children:E}),". Start the bridge with"," ",r.jsxs("span",{className:"mono",children:["--allow-origin ",E]})," so it accepts this site."]})]})}),r.jsx($i,{eyebrow:"Step 2",title:"Pair this browser",className:"col-6",children:r.jsxs("form",{className:"stack",onSubmit:j,children:[r.jsx(UN,{}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"bridge-url",children:"Bridge address"}),r.jsx("input",{id:"bridge-url",className:"input mono",value:d,onChange:g=>_(g.target.value),"aria-invalid":x?.code==="bad_url"||void 0,"aria-describedby":"bridge-url-help",required:!0}),r.jsxs("span",{className:"field-help",id:"bridge-url-help",children:["Default: ",Ry(),". Always on this computer (ws://127.0.0.1 or ws://localhost)."]})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"bridge-token",children:"Pairing token"}),r.jsxs("div",{className:"input-group",children:[r.jsx("input",{id:"bridge-token",className:"input mono",type:h?"text":"password",value:w,onChange:g=>c(g.target.value),placeholder:"Printed by the bridge on startup",autoComplete:"off",spellCheck:!1,required:!0}),r.jsx("button",{type:"button",className:"addon addon--btn",onClick:()=>y(g=>!g),"aria-pressed":h,children:h?"Hide":"Show"})]})]}),x&&r.jsx($e,{kind:"danger",title:"Pairing failed",children:x.message}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{className:"btn btn--primary",disabled:p,type:"submit",children:[r.jsx(ce,{name:"key"})," ",p?"Pairing…":"Pair"]}),s&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:l,children:"Forget this bridge"})]})]})})]})]})}function Rc(s){if(!s)return;const n=Number(/^(\d+)\./.exec(s)?.[1]);return n>=7?`${n+15} (${s})`:s}function $N(s){const n=atob(s),l=new Uint8Array(n.length);for(let o=0;o<n.length;o++)l[o]=n.charCodeAt(o);return l}async function Vd(s,n,l,o={}){const d=[];let _=0;const w=o.limit??1/0;for(;;){if(o.signal?.aborted)throw new yt("cancelled","Cancelled.");const c=w-_,h=Number.isFinite(c)?Math.min(Df,Math.max(Od,Math.ceil(c/Od)*Od)):Df,y=await s.call("files.read",{device:n,path:l,offset:_,length:h},12e4),p=$N(y.data);if(d.push(p),_+=p.length,o.onProgress?.(_),y.eof||p.length===0)return{parts:d,size:_,truncated:!1};if(_>=w)return{parts:d,size:_,truncated:!0}}}function Cn(s,n){const l=URL.createObjectURL(s),o=document.createElement("a");o.href=l,o.download=n,o.rel="noopener",document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(l),6e4)}function PN(){const{devices:s}=Mt(),{confirm:n}=jt(),l=M.useRef(null),[o,d]=M.useState(null),_=async()=>{if(!await n({title:"Download a backup?",message:"The backup file contains your TVs’ private keys and passwords. Keep it somewhere safe and don’t share it.",confirmText:"Download"}))return;const y=new Blob([JSON.stringify(await nN(),null,2)],{type:"application/json"});Cn(y,`lg-dev-manager-devices-${new Date().toISOString().slice(0,10)}.json`)},w=async h=>{try{const y=await rN(JSON.parse(await h.text()));d({kind:"success",text:`Imported ${y} device${y===1?"":"s"}.`})}catch(y){d({kind:"danger",text:y instanceof L0?y.message:"That file is not an LG Dev Manager device backup."})}},c=async()=>{await n({title:"Remove all TVs from this browser?",message:"Every saved TV, key and password is deleted from this browser. Nothing on the TVs changes. This can’t be undone.",confirmText:"Remove all",danger:!0})&&(await aN(),d({kind:"success",text:"All device settings were removed from this browser."}))};return r.jsx($i,{eyebrow:"Privacy",title:"Your device settings stay in this browser",className:"col-12",children:r.jsxs("div",{className:"stack",children:[r.jsxs("p",{className:"muted",style:{margin:0,fontSize:13,lineHeight:1.6},children:["TV names, addresses, keys and passwords are saved only in this browser's storage for"," ",r.jsx("span",{className:"mono",children:window.location.host}),". They are never uploaded to this website. They are sent only to your paired bridge when it connects to a TV, and the bridge keeps them in memory, never on disk. Other browsers and other copies of this app (for example the one the bridge serves at localhost:5199) have their own separate list — use export and import to move it."]}),o&&r.jsx($e,{kind:o.kind,children:o.text}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{className:"btn btn--ghost",onClick:_,disabled:!s?.length,children:[r.jsx(ce,{name:"files"})," Export backup"]}),r.jsxs("button",{className:"btn btn--ghost",onClick:()=>l.current?.click(),children:[r.jsx(ce,{name:"plus"})," Import backup"]}),r.jsx("button",{className:"btn btn--outline-danger",onClick:c,disabled:!s?.length,children:"Remove all from this browser"}),r.jsx("input",{ref:l,type:"file",accept:"application/json,.json",hidden:!0,onChange:h=>{const y=h.target.files?.[0];y&&w(y),h.target.value=""}})]})]})})}const Zr={devmode:{port:um,username:r2,fixed:!0},rooted:{port:yl,username:Ny,fixed:!0},manual:{port:yl,username:Ny,fixed:!1}},FN={devkey:"Dev Mode key (passphrase)",password:"Password",key:"Private key",generated:"New key made for this TV",keep:"Keep the current login"};function q0(s){switch(s){case"devkey":return{kind:s,passphrase:""};case"password":return{kind:s,password:""};case"key":return{kind:s,privateKey:"",passphrase:""};case"generated":return{kind:s,privateKey:"",publicKey:"",fingerprint:""};case"keep":return{kind:s}}}function ym(s){switch(s.kind){case"devkey":return s.passphrase.trim()?{}:{passphrase:"Enter the passphrase shown in the Developer Mode app."};case"password":return s.password?{}:{password:"Enter the SSH password."};case"key":return s.privateKey.trim()?{}:{privateKey:"Paste a private key or choose a key file."};case"generated":return s.privateKey?{}:{privateKey:"Make a key first."};case"keep":return{}}}function K0(s){switch(s.kind){case"password":return{kind:"password",password:s.password};case"key":return{kind:"key",privateKey:s.privateKey.trim()+`
19
- `,...s.passphrase?{passphrase:s.passphrase}:{}};case"generated":return{kind:"key",privateKey:s.privateKey};default:return null}}function Hf(s){return s.kind==="password"?"password":s.passphrase?"key + passphrase":"private key"}const VN=64*1024;function qN(s,n){const{ready:l,call:o}=ut(),[d,_]=M.useState({state:"idle"});return M.useEffect(()=>{if(!s.trim())return _({state:"idle"});if(!l)return _({state:"offline"});let w=!0;_({state:"checking"});const c=setTimeout(()=>{o("device.verifyKey",{privateKey:s.trim()+`
20
- `,passphrase:n||void 0}).then(h=>w&&_({state:"ok",type:h.type,fingerprint:h.fingerprint})).catch(h=>{if(!w)return;const y=h instanceof yt?h.code:"";y===Vs.PassphraseRequired?_({state:"needs-passphrase"}):y===Vs.BadPassphrase?_({state:"bad-passphrase"}):y===Vs.BadKey?_({state:"bad-key"}):_({state:"offline"})})},350);return()=>{w=!1,clearTimeout(c)}},[s,n,l,o]),d}function KN(s){return s.state==="ok"||s.state==="offline"}function G0({value:s,onChange:n,kinds:l,username:o,showErrors:d,onKeyCheck:_,rootedHint:w}){const c=M.useId(),h=d?ym(s):{},[y,p]=M.useState(!1);return r.jsxs("div",{className:"stack auth-fields",children:[l.length>1&&r.jsxs("div",{className:"field",children:[r.jsx("span",{className:"field-label",id:`${c}-kind`,children:"Log in with"}),r.jsx("div",{className:"tabs pills",role:"radiogroup","aria-labelledby":`${c}-kind`,children:l.map(f=>r.jsx("button",{type:"button",role:"radio","aria-checked":s.kind===f,className:`tab${s.kind===f?" is-active":""}`,onClick:()=>s.kind!==f&&n(q0(f)),children:FN[f]},f))})]}),s.kind==="devkey"&&r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:`${c}-pp`,children:["Passphrase ",r.jsx("span",{className:"req",children:"*"})]}),r.jsx("input",{id:`${c}-pp`,className:`input mono passphrase-input${h.passphrase?" is-invalid":""}`,value:s.passphrase,onChange:f=>n({...s,passphrase:f.target.value.trim()}),placeholder:"e.g. 1A2B3C",autoComplete:"off",spellCheck:!1,maxLength:32}),h.passphrase?r.jsx("span",{className:"field-error",children:h.passphrase}):r.jsxs("span",{className:"field-help",children:["Open the ",r.jsx("b",{children:"Developer Mode"})," app on the TV, turn on ",r.jsx("b",{children:"Key Server"}),", and type the passphrase it shows (usually 6 characters, case-sensitive). The private key is fetched from the TV when you continue."]})]}),s.kind==="password"&&r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:`${c}-pw`,children:["Password for ",r.jsx("span",{className:"mono",children:o})," ",r.jsx("span",{className:"req",children:"*"})]}),r.jsxs("div",{className:"input-group",children:[r.jsx("input",{id:`${c}-pw`,className:`input${h.password?" is-invalid":""}`,type:y?"text":"password",value:s.password,onChange:f=>n({...s,password:f.target.value}),autoComplete:"off"}),r.jsx("button",{type:"button",className:"addon addon--btn",onClick:()=>p(f=>!f),children:y?"Hide":"Show"})]}),h.password?r.jsx("span",{className:"field-error",children:h.password}):w&&r.jsxs("span",{className:"field-help",children:["Homebrew Channel sets root’s password to ",r.jsx("span",{className:"mono",children:"alpine"})," until you add an SSH key to"," ",r.jsx("span",{className:"mono",children:"/home/root/.ssh/authorized_keys"})," — after that only the key works. A key is safer."]})]}),s.kind==="key"&&r.jsx(GN,{value:s,onChange:n,problem:h.privateKey,onKeyCheck:_}),s.kind==="generated"&&r.jsx(ZN,{value:s,onChange:n,username:o,problem:h.privateKey})]})}function GN({value:s,onChange:n,problem:l,onKeyCheck:o}){const d=M.useId(),_=M.useRef(null),w=qN(s.privateKey,s.passphrase),[c,h]=M.useState(null),y=w.state==="needs-passphrase"||w.state==="bad-passphrase"||!!s.passphrase;M.useEffect(()=>o?.(KN(w)),[w,o]);const p=async f=>{if(h(null),f.size>VN)return h("That file is too big to be a private key.");const x=await f.text();n({...s,privateKey:x,fileName:f.name})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"field",children:[r.jsxs("div",{className:"field-label-row",children:[r.jsxs("label",{className:"field-label",htmlFor:`${d}-key`,children:["Private key ",r.jsx("span",{className:"req",children:"*"})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>_.current?.click(),children:[r.jsx(ce,{name:"files"})," Choose key file…"]}),r.jsx("input",{ref:_,type:"file",hidden:!0,onChange:f=>{const x=f.target.files?.[0];x&&p(x),f.target.value=""}})]}),r.jsx("textarea",{id:`${d}-key`,className:`textarea mono key-textarea${l||w.state==="bad-key"?" is-invalid":""}`,value:s.privateKey,onChange:f=>n({...s,privateKey:f.target.value,fileName:void 0}),placeholder:`-----BEGIN OPENSSH PRIVATE KEY-----
18
+ pnpm bridge`}),r.jsxs("p",{style:{margin:0},children:["Needs Node.js 22.12 or newer. To update later: ",r.jsx("span",{className:"mono",children:"git pull"}),", ",r.jsx("span",{className:"mono",children:"pnpm install"}),","," ",r.jsx("span",{className:"mono",children:"pnpm build"}),", then ",r.jsx("span",{className:"mono",children:"pnpm bridge"})," again."]})]}),o.state!=="connected"&&![...I2,...H2].includes(E)&&!E.endsWith(`:${Tc}`)&&r.jsxs($e,{kind:"warning",children:["This page is served from ",r.jsx("span",{className:"mono",children:E}),". Start the bridge with"," ",r.jsxs("span",{className:"mono",children:["--allow-origin ",E]})," so it accepts this site."]})]})}),r.jsx($i,{eyebrow:"Step 2",title:"Pair this browser",className:"col-6",children:r.jsxs("form",{className:"stack",onSubmit:j,children:[r.jsx(zN,{}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"bridge-url",children:"Bridge address"}),r.jsx("input",{id:"bridge-url",className:"input mono",value:d,onChange:g=>_(g.target.value),"aria-invalid":x?.code==="bad_url"||void 0,"aria-describedby":"bridge-url-help",required:!0}),r.jsxs("span",{className:"field-help",id:"bridge-url-help",children:["Default: ",Ay(),". Always on this computer (ws://127.0.0.1 or ws://localhost)."]})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"bridge-token",children:"Pairing token"}),r.jsxs("div",{className:"input-group",children:[r.jsx("input",{id:"bridge-token",className:"input mono",type:h?"text":"password",value:w,onChange:g=>c(g.target.value),placeholder:"Printed by the bridge on startup",autoComplete:"off",spellCheck:!1,required:!0}),r.jsx("button",{type:"button",className:"addon addon--btn",onClick:()=>y(g=>!g),"aria-pressed":h,children:h?"Hide":"Show"})]})]}),x&&r.jsx($e,{kind:"danger",title:"Pairing failed",children:x.message}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{className:"btn btn--primary",disabled:p,type:"submit",children:[r.jsx(ce,{name:"key"})," ",p?"Pairing…":"Pair"]}),s&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:l,children:"Forget this bridge"})]})]})})]})]})}function Rc(s){if(!s)return;const n=Number(/^(\d+)\./.exec(s)?.[1]);return n>=7?`${n+15} (${s})`:s}function PN(s){const n=atob(s),l=new Uint8Array(n.length);for(let o=0;o<n.length;o++)l[o]=n.charCodeAt(o);return l}async function Vd(s,n,l,o={}){const d=[];let _=0;const w=o.limit??1/0;for(;;){if(o.signal?.aborted)throw new yt("cancelled","Cancelled.");const c=w-_,h=Number.isFinite(c)?Math.min(Df,Math.max(Od,Math.ceil(c/Od)*Od)):Df,y=await s.call("files.read",{device:n,path:l,offset:_,length:h},12e4),p=PN(y.data);if(d.push(p),_+=p.length,o.onProgress?.(_),y.eof||p.length===0)return{parts:d,size:_,truncated:!1};if(_>=w)return{parts:d,size:_,truncated:!0}}}function Cn(s,n){const l=URL.createObjectURL(s),o=document.createElement("a");o.href=l,o.download=n,o.rel="noopener",document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(l),6e4)}function FN(){const{devices:s}=Mt(),{confirm:n}=jt(),l=M.useRef(null),[o,d]=M.useState(null),_=async()=>{if(!await n({title:"Download a backup?",message:"The backup file contains your TVs’ private keys and passwords. Keep it somewhere safe and don’t share it.",confirmText:"Download"}))return;const y=new Blob([JSON.stringify(await rN(),null,2)],{type:"application/json"});Cn(y,`lg-dev-manager-devices-${new Date().toISOString().slice(0,10)}.json`)},w=async h=>{try{const y=await aN(JSON.parse(await h.text()));d({kind:"success",text:`Imported ${y} device${y===1?"":"s"}.`})}catch(y){d({kind:"danger",text:y instanceof M0?y.message:"That file is not an LG Dev Manager device backup."})}},c=async()=>{await n({title:"Remove all TVs from this browser?",message:"Every saved TV, key and password is deleted from this browser. Nothing on the TVs changes. This can’t be undone.",confirmText:"Remove all",danger:!0})&&(await lN(),d({kind:"success",text:"All device settings were removed from this browser."}))};return r.jsx($i,{eyebrow:"Privacy",title:"Your device settings stay in this browser",className:"col-12",children:r.jsxs("div",{className:"stack",children:[r.jsxs("p",{className:"muted",style:{margin:0,fontSize:13,lineHeight:1.6},children:["TV names, addresses, keys and passwords are saved only in this browser's storage for"," ",r.jsx("span",{className:"mono",children:window.location.host}),". They are never uploaded to this website. They are sent only to your paired bridge when it connects to a TV, and the bridge keeps them in memory, never on disk. Other browsers and other copies of this app (for example the one the bridge serves at localhost:5199) have their own separate list — use export and import to move it."]}),o&&r.jsx($e,{kind:o.kind,children:o.text}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{className:"btn btn--ghost",onClick:_,disabled:!s?.length,children:[r.jsx(ce,{name:"files"})," Export backup"]}),r.jsxs("button",{className:"btn btn--ghost",onClick:()=>l.current?.click(),children:[r.jsx(ce,{name:"plus"})," Import backup"]}),r.jsx("button",{className:"btn btn--outline-danger",onClick:c,disabled:!s?.length,children:"Remove all from this browser"}),r.jsx("input",{ref:l,type:"file",accept:"application/json,.json",hidden:!0,onChange:h=>{const y=h.target.files?.[0];y&&w(y),h.target.value=""}})]})]})})}const Zr={devmode:{port:hm,username:a2,fixed:!0},rooted:{port:yl,username:Ty,fixed:!0},manual:{port:yl,username:Ty,fixed:!1}},VN={devkey:"Dev Mode key (passphrase)",password:"Password",key:"Private key",generated:"New key made for this TV",keep:"Keep the current login"};function K0(s){switch(s){case"devkey":return{kind:s,passphrase:""};case"password":return{kind:s,password:""};case"key":return{kind:s,privateKey:"",passphrase:""};case"generated":return{kind:s,privateKey:"",publicKey:"",fingerprint:""};case"keep":return{kind:s}}}function Sm(s){switch(s.kind){case"devkey":return s.passphrase.trim()?{}:{passphrase:"Enter the passphrase shown in the Developer Mode app."};case"password":return s.password?{}:{password:"Enter the SSH password."};case"key":return s.privateKey.trim()?{}:{privateKey:"Paste a private key or choose a key file."};case"generated":return s.privateKey?{}:{privateKey:"Make a key first."};case"keep":return{}}}function G0(s){switch(s.kind){case"password":return{kind:"password",password:s.password};case"key":return{kind:"key",privateKey:s.privateKey.trim()+`
19
+ `,...s.passphrase?{passphrase:s.passphrase}:{}};case"generated":return{kind:"key",privateKey:s.privateKey};default:return null}}function Uf(s){return s.kind==="password"?"password":s.passphrase?"key + passphrase":"private key"}const qN=64*1024;function KN(s,n){const{ready:l,call:o}=ut(),[d,_]=M.useState({state:"idle"});return M.useEffect(()=>{if(!s.trim())return _({state:"idle"});if(!l)return _({state:"offline"});let w=!0;_({state:"checking"});const c=setTimeout(()=>{o("device.verifyKey",{privateKey:s.trim()+`
20
+ `,passphrase:n||void 0}).then(h=>w&&_({state:"ok",type:h.type,fingerprint:h.fingerprint})).catch(h=>{if(!w)return;const y=h instanceof yt?h.code:"";y===Vs.PassphraseRequired?_({state:"needs-passphrase"}):y===Vs.BadPassphrase?_({state:"bad-passphrase"}):y===Vs.BadKey?_({state:"bad-key"}):_({state:"offline"})})},350);return()=>{w=!1,clearTimeout(c)}},[s,n,l,o]),d}function GN(s){return s.state==="ok"||s.state==="offline"}function Y0({value:s,onChange:n,kinds:l,username:o,showErrors:d,onKeyCheck:_,rootedHint:w}){const c=M.useId(),h=d?Sm(s):{},[y,p]=M.useState(!1);return r.jsxs("div",{className:"stack auth-fields",children:[l.length>1&&r.jsxs("div",{className:"field",children:[r.jsx("span",{className:"field-label",id:`${c}-kind`,children:"Log in with"}),r.jsx("div",{className:"tabs pills",role:"radiogroup","aria-labelledby":`${c}-kind`,children:l.map(f=>r.jsx("button",{type:"button",role:"radio","aria-checked":s.kind===f,className:`tab${s.kind===f?" is-active":""}`,onClick:()=>s.kind!==f&&n(K0(f)),children:VN[f]},f))})]}),s.kind==="devkey"&&r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:`${c}-pp`,children:["Passphrase ",r.jsx("span",{className:"req",children:"*"})]}),r.jsx("input",{id:`${c}-pp`,className:`input mono passphrase-input${h.passphrase?" is-invalid":""}`,value:s.passphrase,onChange:f=>n({...s,passphrase:f.target.value.trim()}),placeholder:"e.g. 1A2B3C",autoComplete:"off",spellCheck:!1,maxLength:32}),h.passphrase?r.jsx("span",{className:"field-error",children:h.passphrase}):r.jsxs("span",{className:"field-help",children:["Open the ",r.jsx("b",{children:"Developer Mode"})," app on the TV, turn on ",r.jsx("b",{children:"Key Server"}),", and type the passphrase it shows (usually 6 characters, case-sensitive). The private key is fetched from the TV when you continue."]})]}),s.kind==="password"&&r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:`${c}-pw`,children:["Password for ",r.jsx("span",{className:"mono",children:o})," ",r.jsx("span",{className:"req",children:"*"})]}),r.jsxs("div",{className:"input-group",children:[r.jsx("input",{id:`${c}-pw`,className:`input${h.password?" is-invalid":""}`,type:y?"text":"password",value:s.password,onChange:f=>n({...s,password:f.target.value}),autoComplete:"off"}),r.jsx("button",{type:"button",className:"addon addon--btn",onClick:()=>p(f=>!f),children:y?"Hide":"Show"})]}),h.password?r.jsx("span",{className:"field-error",children:h.password}):w&&r.jsxs("span",{className:"field-help",children:["Homebrew Channel sets root’s password to ",r.jsx("span",{className:"mono",children:"alpine"})," until you add an SSH key to"," ",r.jsx("span",{className:"mono",children:"/home/root/.ssh/authorized_keys"})," — after that only the key works. A key is safer."]})]}),s.kind==="key"&&r.jsx(YN,{value:s,onChange:n,problem:h.privateKey,onKeyCheck:_}),s.kind==="generated"&&r.jsx(XN,{value:s,onChange:n,username:o,problem:h.privateKey})]})}function YN({value:s,onChange:n,problem:l,onKeyCheck:o}){const d=M.useId(),_=M.useRef(null),w=KN(s.privateKey,s.passphrase),[c,h]=M.useState(null),y=w.state==="needs-passphrase"||w.state==="bad-passphrase"||!!s.passphrase;M.useEffect(()=>o?.(GN(w)),[w,o]);const p=async f=>{if(h(null),f.size>qN)return h("That file is too big to be a private key.");const x=await f.text();n({...s,privateKey:x,fileName:f.name})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"field",children:[r.jsxs("div",{className:"field-label-row",children:[r.jsxs("label",{className:"field-label",htmlFor:`${d}-key`,children:["Private key ",r.jsx("span",{className:"req",children:"*"})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>_.current?.click(),children:[r.jsx(ce,{name:"files"})," Choose key file…"]}),r.jsx("input",{ref:_,type:"file",hidden:!0,onChange:f=>{const x=f.target.files?.[0];x&&p(x),f.target.value=""}})]}),r.jsx("textarea",{id:`${d}-key`,className:`textarea mono key-textarea${l||w.state==="bad-key"?" is-invalid":""}`,value:s.privateKey,onChange:f=>n({...s,privateKey:f.target.value,fileName:void 0}),placeholder:`-----BEGIN OPENSSH PRIVATE KEY-----
21
21
  …
22
- -----END OPENSSH PRIVATE KEY-----`,spellCheck:!1,autoComplete:"off",rows:5}),l&&r.jsx("span",{className:"field-error",children:l}),c&&r.jsx("span",{className:"field-error",children:c}),!l&&!c&&r.jsxs("span",{className:"field-help",children:[s.fileName?r.jsxs(r.Fragment,{children:["Loaded from ",r.jsx("span",{className:"mono",children:s.fileName}),". "]}):null,"Usually ",r.jsx("span",{className:"mono",children:"~/.ssh/id_ed25519"})," or ",r.jsx("span",{className:"mono",children:"id_rsa"})," on your computer. It is saved only in this browser."]}),r.jsx(YN,{check:w})]}),y&&r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:`${d}-kpp`,children:"Key passphrase"}),r.jsx("input",{id:`${d}-kpp`,className:`input${w.state==="bad-passphrase"?" is-invalid":""}`,type:"password",value:s.passphrase,onChange:f=>n({...s,passphrase:f.target.value}),autoComplete:"off"})]})]})}function YN({check:s}){switch(s.state){case"checking":return r.jsxs("span",{className:"field-help",children:[r.jsx("span",{className:"spinner sm"})," Checking key…"]});case"ok":return r.jsxs("span",{className:"field-ok",children:[r.jsx(ce,{name:"check",strokeWidth:2.4})," ",s.type," key · ",r.jsx("span",{className:"mono",children:s.fingerprint})]});case"needs-passphrase":return r.jsx("span",{className:"field-error",children:"This key is protected. Enter its passphrase below."});case"bad-passphrase":return r.jsx("span",{className:"field-error",children:"Wrong passphrase for this key."});case"bad-key":return r.jsx("span",{className:"field-error",children:"This doesn’t look like a private key (unsupported format)."});case"offline":return r.jsx("span",{className:"field-help",children:"Connect the bridge to check this key."});default:return null}}function ZN({value:s,onChange:n,username:l,problem:o}){const{ready:d,call:_}=ut(),{toast:w}=jt(),[c,h]=M.useState(!1),y=async()=>{h(!0);try{const f=await _("device.generateKey",{comment:"lg-dev-manager"});n({kind:"generated",...f})}catch(f){w({kind:"danger",title:"Could not make a key",text:f.message})}finally{h(!1)}},p=l==="root"?"/home/root/.ssh/authorized_keys":"~/.ssh/authorized_keys";return s.privateKey?r.jsxs("div",{className:"field",children:[r.jsx("span",{className:"field-label",children:"Public key — add this line to the TV"}),r.jsx("div",{className:"codeblock codeblock--wrap",children:s.publicKey}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>navigator.clipboard.writeText(s.publicKey).then(()=>w({kind:"success",title:"Public key copied"}),()=>w({kind:"warning",title:"Copy failed",text:"Select the key and copy it by hand."})),children:[r.jsx(ce,{name:"copy"})," Copy"]}),r.jsxs("span",{className:"field-help",children:["Append it to ",r.jsx("span",{className:"mono",children:p})," on the TV (for example from an SSH session that still uses the password), then continue."]})]})]}):r.jsxs("div",{className:"field",children:[r.jsx("span",{className:"field-help",children:"The bridge makes a new ed25519 key pair. The private key is saved only in this browser; you add the public key to the TV once."}),r.jsx("div",{children:r.jsxs("button",{type:"button",className:"btn btn--soft-primary",onClick:y,disabled:!d||c,children:[r.jsx(ce,{name:"key"})," ",c?"Making key…":"Make a new key"]})}),o&&r.jsx("span",{className:"field-error",children:o})]})}function XN({device:s,onClose:n}){const{call:l,ready:o}=ut(),{devices:d}=Mt(),{toast:_}=jt(),[w,c]=M.useState(""),[h,y]=M.useState(""),[p,f]=M.useState(""),[x,C]=M.useState(0),[j,E]=M.useState(""),[g,b]=M.useState({kind:"keep"}),[v,S]=M.useState(!0),[N,T]=M.useState(!1),[D,O]=M.useState(!1),[k,L]=M.useState(null);M.useEffect(()=>{s&&(c(s.name),y(s.description??""),f(s.host),C(s.port),E(s.username),b({kind:"keep"}),T(!1),L(null))},[s]);const V=M.useMemo(()=>["keep",...s?.mode==="devmode"?["devkey"]:[],"password","key","generated"],[s?.mode]),q=M.useCallback(I=>S(I),[]);if(!s)return r.jsx(si,{open:!1,onClose:n,title:"",children:null});const Y=w.trim()?d?.some(I=>I.id!==s.id&&I.name===w.trim())?"You already have a TV with this name.":null:"Give the TV a name.",P=bl(p),Q=!Number.isInteger(x)||x<1||x>65535?"Port must be 1–65535.":null,he=Hc(j)?null:"Not a valid user name.",ne=!Y&&!P&&!Q&&!he&&Object.keys(ym(g)).length===0&&(g.kind!=="key"||v),W=async I=>{if(I.preventDefault(),T(!0),!!ne){O(!0),L(null);try{let A=g.kind==="keep"?s.auth:K0(g);if(g.kind==="devkey"){const{privateKey:F}=await l("device.fetchKey",{host:p.trim(),passphrase:g.passphrase},3e4);A={kind:"key",privateKey:F,passphrase:g.passphrase}}const B=p.trim()!==s.host||x!==s.port||j!==s.username||g.kind!=="keep";o&&B&&l("device.disconnect",{device:{host:s.host,port:s.port,username:s.username,auth:s.auth}}).catch(()=>{}),await sN(s.id,{name:w.trim(),description:h.trim()||void 0,host:p.trim(),port:x,username:j,mode:j==="root"?"rooted":"devmode",auth:A}),_({kind:"success",title:`Saved ${w.trim()}`}),n()}catch(A){L(A)}finally{O(!1)}}};return r.jsx(si,{open:!0,onClose:n,dismissible:!D,size:"lg",title:`Edit ${s.name}`,footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:n,disabled:D,children:"Cancel"}),r.jsx("button",{type:"submit",form:"edit-device",className:"btn btn--primary",disabled:D,children:D?"Saving…":"Save"})]}),children:r.jsxs("form",{id:"edit-device",className:"stack",onSubmit:W,noValidate:!0,children:[r.jsxs("div",{className:"form-grid",children:[r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-name",children:"Name"}),r.jsx("input",{id:"ed-name",className:`input${N&&Y?" is-invalid":""}`,value:w,onChange:I=>c(I.target.value),maxLength:64}),N&&Y&&r.jsx("span",{className:"field-error",children:Y})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-host",children:"IP address"}),r.jsx("input",{id:"ed-host",className:`input mono${N&&P?" is-invalid":""}`,value:p,onChange:I=>f(I.target.value),spellCheck:!1}),N&&P&&r.jsx("span",{className:"field-error",children:P})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-user",children:"User"}),r.jsx("input",{id:"ed-user",className:`input mono${N&&he?" is-invalid":""}`,value:j,onChange:I=>E(I.target.value.trim()),spellCheck:!1}),N&&he&&r.jsx("span",{className:"field-error",children:he})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-port",children:"SSH port"}),r.jsx("input",{id:"ed-port",className:`input mono${N&&Q?" is-invalid":""}`,type:"number",value:Number.isNaN(x)?"":x,onChange:I=>C(I.target.valueAsNumber)}),N&&Q&&r.jsx("span",{className:"field-error",children:Q})]}),r.jsxs("div",{className:"field span-2",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-desc",children:"Description"}),r.jsx("input",{id:"ed-desc",className:"input",value:h,onChange:I=>y(I.target.value),maxLength:200})]}),r.jsxs("div",{className:"span-2",children:[r.jsx(G0,{value:g,onChange:b,kinds:V,username:j,showErrors:N,onKeyCheck:q,rootedHint:s.mode==="rooted"}),g.kind==="keep"&&r.jsxs("p",{className:"field-help",style:{margin:"8px 0 0"},children:["Currently: ",Hf(s.auth),"."]})]})]}),k!==null&&r.jsx(Nt,{error:k,title:"Couldn’t save"})]})})}function WN(){const{devices:s,activeId:n}=Mt(),{ready:l,call:o}=ut(),{confirm:d,toast:_}=jt(),[w,c]=M.useState(null),[h,y]=M.useState(null),p=async x=>{y(x.id);try{const C=gt(x),j=await o("device.test",{device:C},4e4),E=await o("device.info",{device:C},4e4).catch(()=>null);E&&pm(x.id,Uc(x,E)).catch(()=>{}),_({kind:"success",title:`${x.name} is reachable`,text:[Bf(E?.modelName),E?.osVersion&&`webOS ${Rc(E.osVersion)}`,`${j.latencyMs} ms`,j.root?"root":null].filter(Boolean).join(" · ")})}catch(C){_({kind:"danger",title:`Couldn’t reach ${x.name}`,text:xt(C).message})}finally{y(null)}},f=async x=>{await d({title:`Remove ${x.name}?`,message:r.jsxs(r.Fragment,{children:["This removes ",r.jsx("b",{children:x.name})," and its saved ",Hf(x.auth)," from this browser. Nothing on the TV changes, and you can add it again later."]}),confirmText:"Remove",danger:!0})&&(l&&o("device.disconnect",{device:gt(x)}).catch(()=>{}),await iN(x.id),_({kind:"success",title:`Removed ${x.name}`}))};return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Setup",title:"Devices",sub:"The TVs this browser knows about. The active TV is the one the Apps, Files and Terminal pages work with.",actions:r.jsxs(Jt,{to:"/devices/new",className:"btn btn--primary",children:[r.jsx(ce,{name:"plus"})," Add a TV"]})}),r.jsxs("div",{className:"grid",children:[!l&&(s?.length??0)>0&&r.jsx("div",{className:"col-12",children:r.jsx($e,{kind:"info",title:"The bridge isn’t connected",action:r.jsx(Jt,{to:"/bridge",className:"btn btn--sm btn--ghost",children:"Bridge"}),children:"You can rename or remove TVs, but testing them needs the bridge."})}),r.jsx("section",{className:"card col-12",children:s===null?r.jsx("div",{className:"empty-state",children:r.jsx("span",{className:"spinner"})}):s.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"tv"})}),r.jsx("h3",{children:"No TVs yet"}),r.jsx("p",{children:"Add your LG TV in Developer Mode or a rooted TV. The wizard checks the connection and fetches the login key for you."}),r.jsxs(Jt,{to:"/devices/new",className:"btn btn--primary",children:[r.jsx(ce,{name:"plus"})," Add a TV"]})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table devices-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Name"}),r.jsx("th",{className:"hide-sm",children:"Address"}),r.jsx("th",{className:"hide-sm",children:"Type"}),r.jsx("th",{className:"hide-sm",children:"Login"}),r.jsx("th",{"aria-label":"Status"}),r.jsx("th",{"aria-label":"Actions"})]})}),r.jsx("tbody",{children:s.map(x=>{const C=x.id===n;return r.jsxs("tr",{className:C?"is-selected":void 0,children:[r.jsx("td",{children:r.jsxs("div",{className:"data-cell-user",children:[r.jsx("span",{className:"device-av",children:r.jsx(ce,{name:"tv"})}),r.jsxs("div",{className:"data-cell-user-meta",children:[r.jsx("div",{className:"data-cell-user-name",children:x.name}),x.info?.modelName&&r.jsxs("div",{className:"cell-sub",title:x.info.firmwareVersion?`Firmware ${x.info.firmwareVersion}`:void 0,children:[Bf(x.info.modelName),x.info.osVersion&&r.jsxs(r.Fragment,{children:[" · webOS ",Rc(x.info.osVersion)]})]}),x.description&&r.jsx("div",{className:"cell-sub",children:x.description}),r.jsxs("div",{className:"cell-sub mono show-sm",children:[x.host,":",x.port]})]})]})}),r.jsxs("td",{className:"data-cell-mono hide-sm",children:[x.host,":",x.port]}),r.jsx("td",{className:"hide-sm",children:r.jsx("span",{className:`badge ${x.mode==="rooted"?"purple":"info"}`,children:x.mode==="rooted"?"Rooted":"Dev Mode"})}),r.jsxs("td",{className:"data-cell-mono hide-sm",children:[x.username," · ",Hf(x.auth)]}),r.jsx("td",{children:C?r.jsx("span",{className:"badge success dot",children:"Active"}):r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>Nn(x.id),children:"Make active"})}),r.jsx("td",{children:r.jsxs("div",{className:"data-cell-actions",children:[r.jsx("button",{type:"button",className:"btn btn--icon",title:"Test connection","aria-label":`Test connection to ${x.name}`,onClick:()=>p(x),disabled:!l||h===x.id,children:h===x.id?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"pulse"})}),r.jsx("button",{type:"button",className:"btn btn--icon",title:"Edit","aria-label":`Edit ${x.name}`,onClick:()=>c(x),children:r.jsx(ce,{name:"edit"})}),r.jsx(Ic,{label:`More actions for ${x.name}`,menuClassName:"dd-menu--compact",floating:!0,trigger:({toggle:j,...E})=>r.jsx("button",{type:"button",className:"btn btn--icon","aria-label":`More actions for ${x.name}`,onClick:j,...E,children:r.jsx(ce,{name:"more"})}),children:j=>r.jsx(r.Fragment,{children:r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item danger",onClick:()=>{j(),f(x)},children:[r.jsx(ce,{name:"trash"})," Remove from this browser"]})})})]})})]},x.id)})})]})})}),r.jsx(PN,{})]}),r.jsx(XN,{device:w,onClose:()=>c(null)})]})}const QN=[{key:"webos",label:"webOS TV",port:3e3},{key:"ssh22",label:"Root SSH",port:yl},{key:"ssh9922",label:"Dev Mode SSH",port:um},{key:"keyServer",label:"Key server",port:a2}];function Uf(){return r.jsxs($e,{kind:"warning",title:"This is an LG TV, but its SSH server is off",children:[r.jsxs("ol",{className:"hint-steps",children:[r.jsxs("li",{children:["On the TV, open ",r.jsx("b",{children:"Homebrew Channel"})," and go to ",r.jsx("b",{children:"Settings"}),"."]}),r.jsxs("li",{children:["Turn on ",r.jsx("b",{children:"SSH Server"}),"."]}),r.jsxs("li",{children:["On the same screen, select ",r.jsx("b",{children:"System reboot"})," — Homebrew Channel’s settings only take effect after a reboot."]}),r.jsxs("li",{children:["When the TV is back on, press ",r.jsx("b",{children:"Check"})," here again."]})]}),"If Homebrew Channel isn’t installed, the TV isn’t rooted — choose ",r.jsx("b",{children:"Developer Mode"})," instead."]})}function JN({result:s,checking:n,mode:l,port:o}){return!s&&!n?null:r.jsxs("div",{className:"stack",style:{gap:10},children:[r.jsx("div",{className:"port-chips","aria-live":"polite",children:QN.map(d=>{const _=s?.[d.key],w=n?"is-checking":_?"is-open":"is-closed";return r.jsxs("span",{className:`port-chip ${w}`,children:[r.jsx("span",{className:"dot","aria-hidden":"true"}),d.label," ",r.jsx("span",{className:"mono",children:d.port}),r.jsx("span",{className:"sr-only",children:n?"checking":_?"open":"closed"})]},d.key)})}),s&&!n&&r.jsx(ej,{result:s,mode:l,port:o})]})}function ej({result:s,mode:n,port:l}){return s.ssh22||s.ssh9922||s.keyServer||s.webos?n==="devmode"?s.ssh9922?s.keyServer?r.jsx($e,{kind:"success",title:"Ready",children:"Developer Mode SSH and the key server both answer."}):r.jsxs($e,{kind:"warning",title:"Key Server is off",children:["Turn on ",r.jsx("b",{children:"Key Server"})," in the Developer Mode app while adding the TV. If it is already on, try turning it off and on again."]}):r.jsxs($e,{kind:"warning",title:"Developer Mode SSH isn’t answering",children:["Open the Developer Mode app and check that ",r.jsx("b",{children:"Dev Mode Status"})," is ON. The TV restarts when you turn it on."]}):n==="rooted"&&!s.ssh22?s.webos?r.jsx(Uf,{}):r.jsxs($e,{kind:"warning",title:"SSH on port 22 isn’t answering",children:["In Homebrew Channel → ",r.jsx("b",{children:"Settings"}),", turn on ",r.jsx("b",{children:"SSH Server"}),", then select ",r.jsx("b",{children:"System reboot"})," on the same screen."]}):n==="rooted"?r.jsx($e,{kind:"success",title:"Ready",children:"Homebrew Channel’s SSH server answers on port 22."}):n==="manual"&&l===yl&&!s.ssh22&&s.webos?r.jsx(Uf,{}):n==="manual"&&l!==yl&&l!==um?r.jsxs($e,{kind:"info",children:["Port ",l," isn’t one of the usual ones, so it wasn’t checked. Continue to test the login."]}):null:r.jsxs($e,{kind:"warning",title:"The TV didn’t answer",children:["Check the address, make sure the TV is on and on the same network as this computer",n==="devmode"?", and that Developer Mode is installed and turned on.":"."]})}function zf(s){return s.name?.replace(/^\[LG\]\s*/i,"").replace(/^webOS TV\s*/i,"").trim()||s.modelName||"LG TV"}const tj=(s,n)=>s.trim().replace(/^\[|\]$/g,"").toLowerCase()===n.trim().replace(/^\[|\]$/g,"").toLowerCase(),$f=(s,n)=>s.filter(l=>tj(l.host,n));function sj({selected:s,onPick:n,saved:l}){const{ready:o,call:d}=ut(),[_,w]=M.useState(null),[c,h]=M.useState(!1),[y,p]=M.useState(null),f=M.useRef(!1),x=async()=>{h(!0),p(null);try{w((await d("device.scan",{timeoutMs:3e3},3e4)).tvs)}catch(C){p(xt(C).message)}finally{h(!1)}};return M.useEffect(()=>{o&&!f.current&&(f.current=!0,x())},[o]),r.jsxs("div",{className:"scan-panel",children:[r.jsxs("div",{className:"scan-head",children:[r.jsxs("div",{children:[r.jsx("div",{className:"scan-title",children:"TVs on your network"}),r.jsx("div",{className:"field-help",children:c?"Looking for LG TVs…":_?.length?"Pick your TV, or type its address below.":_?"No LG TVs found. Make sure the TV is on and on the same network, or type its address below.":"The bridge can look for LG TVs that are switched on."})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:x,disabled:!o||c,children:[c?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"search"})," ",_?"Scan again":"Scan"]})]}),y&&r.jsx("div",{className:"field-error",children:y}),!!_?.length&&r.jsx("div",{className:"scan-list",role:"listbox","aria-label":"TVs found on your network",children:_.map(C=>{const j=$f(l,C.host),E=r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"device-av",children:r.jsx(ce,{name:"tv"})}),r.jsxs("span",{className:"scan-item-text",children:[r.jsx("span",{className:"scan-item-name",children:zf(C)}),r.jsxs("span",{className:"scan-item-sub mono",children:[C.host,C.modelName&&zf(C)!==C.modelName?` · ${C.modelName}`:""]}),j.length>0&&r.jsxs("span",{className:"scan-item-added",children:["Already added as ",r.jsx("b",{children:j.map(g=>g.name).join(", ")})]})]})]});return r.jsxs("button",{type:"button",role:"option","aria-selected":s===C.host,className:`scan-item${s===C.host?" is-selected":""}${j.length?" is-added":""}`,onClick:()=>n(C),children:[E,r.jsxs("span",{className:"scan-badges",children:[j.length>0&&r.jsxs("span",{className:"badge success",children:[r.jsx(ce,{name:"check"})," Added"]}),r.jsx("span",{className:`badge ${C.ports.ssh22?"success":""}`,children:C.ports.ssh22?"Root SSH on":"Root SSH off"}),C.ports.ssh9922&&r.jsx("span",{className:"badge info",children:"Dev Mode"}),C.ports.keyServer&&r.jsx("span",{className:"badge info",children:"Key server"})]})]},C.host)})}),_?.some(C=>$f(l,C.host).length)&&r.jsxs("div",{className:"field-help",children:["TVs marked “Added” are already in ",r.jsx(Jt,{to:"/devices",children:"Devices"}),". You can still pick one to add it again with another login, e.g. as root after rooting it."]})]})}const Xy={key:"Fetch the Dev Mode key from the TV",login:"Log in over SSH",info:"Read model and webOS version"};async function ij(s,n,l){const o={steps:{key:"pending",login:"pending",info:"pending"}},d=()=>l({...o,steps:{...o.steps}}),_=async(w,c)=>{o.steps[w]="running",d();try{const h=await c();return o.steps[w]="done",d(),h}catch(h){throw o.steps[w]="failed",o.error=h,o.failedAt=w,d(),h}};try{if(n.auth.kind==="devkey"){const c=n.auth.passphrase,{privateKey:h}=await _("key",()=>s("device.fetchKey",{host:n.host,passphrase:c},3e4));o.auth={kind:"key",privateKey:h,passphrase:c}}else o.steps.key="skipped",o.auth=n.auth.kind==="keep"?n.currentAuth:K0(n.auth)??void 0,d();const w={host:n.host,port:n.port,username:n.username,auth:o.auth};o.login=await _("login",()=>s("device.test",{device:w},4e4)),o.info=await _("info",()=>s("device.info",{device:w},4e4))}catch{}return d(),o}const nj=[{id:"rooted",icon:"shield",title:"Rooted (Homebrew Channel)",text:"For rooted TVs with Homebrew Channel’s SSH server turned on. Logs in as root on port 22 — full access, no session to renew.",badge:"Recommended"},{id:"devmode",icon:"tv",title:"Developer Mode",text:"For TVs that aren’t rooted. Uses the Developer Mode app: SSH on port 9922 and the key from its key server."},{id:"manual",icon:"wrench",title:"Set up manually",text:"Choose the port, user and login yourself — password, your own key, or a new key."}],Y0={devmode:["devkey"],rooted:["password","key","generated"],manual:["key","password","generated","devkey"]},Wy=[{title:"Prepare an LG developer account",body:r.jsxs(r.Fragment,{children:["Developer Mode needs a free LG developer account. Create one at"," ",r.jsx("a",{href:"https://webostv.developer.lge.com/",target:"_blank",rel:"noopener noreferrer",children:"webostv.developer.lge.com"}),"."]})},{title:"Install the Developer Mode app",body:r.jsxs("ol",{children:[r.jsx("li",{children:"Open the LG Content Store on the TV"}),r.jsx("li",{children:"Search for “Developer Mode”"}),r.jsx("li",{children:"Select Install"})]})},{title:"Turn on Developer Mode",body:r.jsxs("ol",{children:[r.jsx("li",{children:"Launch the Developer Mode app"}),r.jsx("li",{children:"Log in with your developer account"}),r.jsx("li",{children:"Turn on Dev Mode Status and wait for the TV to restart"})]})},{title:"Get ready to connect",body:r.jsxs("ol",{children:[r.jsx("li",{children:"Launch the Developer Mode app again"}),r.jsx("li",{children:"Make sure Dev Mode Status is ON"}),r.jsx("li",{children:"Turn on Key Server — it hands this app the login key"})]})}],rj="alpine";function Qy(s){return s==="rooted"?{kind:"password",password:rj}:q0(Y0[s][0])}function aj({steps:s,current:n}){const l=s.findIndex(o=>o.id===n);return r.jsx("ol",{className:"stepper","aria-label":"Progress",children:s.map((o,d)=>r.jsxs("li",{className:d<l?"is-done":d===l?"is-current":void 0,"aria-current":d===l?"step":void 0,children:[r.jsx("span",{className:"stepper-num",children:d<l?r.jsx(ce,{name:"check",strokeWidth:2.6}):d+1}),r.jsx("span",{className:"stepper-label",children:o.label})]},o.id))})}function Jy(s){const n="LG TV";if(!s.includes(n))return n;for(let l=2;;l++)if(!s.includes(`${n} ${l}`))return`${n} ${l}`}function lj(){const s=Cl(),{ready:n,call:l}=ut(),{devices:o}=Mt(),{toast:d}=jt(),_=M.useMemo(()=>(o??[]).map(G=>G.name),[o]),[w,c]=M.useState("mode"),[h,y]=M.useState("rooted"),[p,f]=M.useState(Wy.map(()=>!1)),[x,C]=M.useState(0),[j,E]=M.useState(""),[g,b]=M.useState(""),[v,S]=M.useState(Zr.rooted.port),[N,T]=M.useState(Zr.rooted.username),[D,O]=M.useState(""),[k,L]=M.useState(Qy("rooted")),[V,q]=M.useState(!0),[Y,P]=M.useState(!1),[Q,he]=M.useState(null),[ne,W]=M.useState(""),[I,A]=M.useState(!1),[B,F]=M.useState(null),[$,J]=M.useState(!1),[z,ee]=M.useState(null),de=M.useMemo(()=>[{id:"mode",label:"Connection"},...h==="devmode"?[{id:"prepare",label:"Prepare TV"}]:[],{id:"details",label:"Details"},{id:"verify",label:"Verify"}],[h]),Z=G=>{y(G),S(Zr[G].port),T(Zr[G].username),L(Qy(G)),he(null)},U=M.useCallback(G=>q(G),[]),ue=G=>{b(G.host),!j.trim()&&(G.name||G.modelName)&&E(zf(G).slice(0,64)),he({ssh22:G.ports.ssh22,ssh9922:G.ports.ssh9922,keyServer:G.ports.keyServer,webos:G.ports.webos}),W(G.host)},pe=(j||Jy(_)).trim(),me=pe?pe.length>64?"Keep the name under 64 characters.":_.includes(pe)?"You already have a TV with this name.":null:"Give the TV a name.",ge=bl(g),Re=g.trim()&&!ge?$f(o??[],g):[],tt=!Number.isInteger(v)||v<1||v>65535?"Port must be 1–65535.":null,qe=Hc(N)?null:"Not a valid user name.",at=!me&&!ge&&!tt&&!qe&&Object.keys(ym(k)).length===0&&(k.kind!=="key"||V),we=async()=>{const G=g.trim();if(!(bl(G)||!n)){A(!0),W(G);try{he(await l("device.checkConnection",{host:G},2e4))}catch(Se){he(null),d({kind:"danger",title:"Port check failed",text:xt(Se).message})}finally{A(!1)}}},Ke=async()=>{E(pe),c("verify"),J(!0),ee(null);try{const G=await ij(l,{host:g.trim(),port:v,username:N,auth:k},F);G.error?G.failedAt==="login"&&we():await Bt(G)}catch(G){d({kind:"danger",title:"Could not save the TV",text:xt(G).message})}finally{J(!1)}},Bt=async G=>{if(!G.auth)return;const Se=await tN({name:pe,mode:h==="manual"?N==="root"?"rooted":"devmode":h,host:g.trim(),port:v,username:N,auth:G.auth,...D.trim()?{description:D.trim()}:{},...G.info?{info:Uc({host:g.trim(),port:v},G.info)}:{}});Nn(Se.id),ee(Se.id)},bs=G=>{G.preventDefault(),P(!0),at&&Ke()},es=B?.failedAt==="login"&&[Vs.Unreachable,Vs.Timeout].includes(xt(B.error).code)&&h!=="devmode"&&v===22&&ne===g.trim()&&!!Q?.webos&&!Q.ssh22&&!I,wt=!!B?.login&&!!B.auth&&!z;M.useEffect(()=>{if(!(!wt||!B?.auth))return kc.set({name:pe,host:g.trim(),port:v,username:N,device:{host:g.trim(),port:v,username:N,auth:B.auth}}),()=>kc.set(null)},[wt,B?.auth]);const It=()=>{const G=de.findIndex(Se=>Se.id===w);G>0&&c(de[G-1].id)};return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Setup",title:"Add a",accent:"TV",sub:"Connect this browser to an LG TV in Developer Mode or a rooted TV."}),r.jsx("div",{className:"grid",children:r.jsxs("section",{className:"card col-12 wizard",children:[r.jsx(aj,{steps:de,current:w}),!n&&w!=="verify"&&r.jsx($e,{kind:"warning",title:"The bridge isn’t connected",action:r.jsx(Jt,{to:"/bridge",className:"btn btn--sm btn--ghost",children:"Set up the bridge"}),children:"Adding a TV needs the bridge running on this computer: it checks the ports, fetches the key and tests the login."}),w==="mode"&&r.jsxs("div",{className:"wizard-body",children:[r.jsx("p",{className:"muted wizard-lead",children:"If your TV is rooted with Homebrew Channel, choose Rooted. If it isn’t rooted, or you’re not sure, choose Developer Mode."}),r.jsx("div",{className:"choice-grid",role:"radiogroup","aria-label":"Connection type",children:nj.map(G=>r.jsxs("button",{type:"button",role:"radio","aria-checked":h===G.id,className:`choice${h===G.id?" is-selected":""}`,onClick:()=>Z(G.id),onDoubleClick:()=>c(G.id==="devmode"?"prepare":"details"),children:[r.jsx("span",{className:"choice-icon",children:r.jsx(ce,{name:G.icon})}),r.jsxs("span",{className:"choice-title",children:[G.title," ",G.badge&&r.jsx("span",{className:"badge primary",children:G.badge})]}),r.jsx("span",{className:"choice-text",children:G.text})]},G.id))}),r.jsxs("div",{className:"form-actions",children:[r.jsx(Jt,{to:"/devices",className:"btn btn--ghost",children:"Cancel"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>c(h==="devmode"?"prepare":"details"),children:["Next ",r.jsx(ce,{name:"chevRight"})]})]})]}),w==="prepare"&&r.jsxs("div",{className:"wizard-body",children:[r.jsx("p",{className:"muted wizard-lead",children:"Do these on the TV first. Tick each one off — or skip if your TV is already set up."}),r.jsx("div",{className:"accordion",children:Wy.map((G,Se)=>r.jsxs("div",{className:`accordion-item${x===Se?" is-open":""}${p[Se]?" is-done":""}`,children:[r.jsxs("div",{className:"accordion-trigger-row",children:[r.jsxs("label",{className:"check",title:"Done",children:[r.jsx("input",{type:"checkbox",checked:p[Se],onChange:Ie=>{const Qe=p.map((He,Be)=>Be===Se?Ie.target.checked:He);f(Qe),Ie.target.checked&&C(Qe.findIndex(He=>!He))}}),r.jsx("span",{className:"box"}),r.jsxs("span",{className:"sr-only",children:["Mark “",G.title,"” done"]})]}),r.jsxs("button",{type:"button",className:"accordion-trigger","aria-expanded":x===Se,onClick:()=>C(x===Se?-1:Se),children:[r.jsxs("span",{children:[Se+1,". ",G.title]}),r.jsx("span",{className:"chev",children:r.jsx("svg",{viewBox:"0 0 24 24",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})})]})]}),r.jsx("div",{className:"accordion-body",children:r.jsx("div",{className:"accordion-body-inner",children:G.body})})]},G.title))}),r.jsxs("div",{className:"form-actions",children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:It,children:"Back"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>c("details"),children:[p.every(Boolean)?"Next":"Skip"," ",r.jsx(ce,{name:"chevRight"})]})]})]}),w==="details"&&r.jsxs("form",{className:"wizard-body",onSubmit:bs,noValidate:!0,children:[r.jsx(sj,{selected:g.trim(),onPick:ue,saved:o??[]}),r.jsxs("div",{className:"form-grid",children:[r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:"dev-name",children:["Name ",r.jsx("span",{className:"req",children:"*"})]}),r.jsx("input",{id:"dev-name",className:`input${Y&&me?" is-invalid":""}`,value:j,placeholder:Jy(_),onChange:G=>E(G.target.value),maxLength:64,autoComplete:"off"}),Y&&me?r.jsx("span",{className:"field-error",children:me}):r.jsx("span",{className:"field-help",children:"Shown in the device switcher."})]}),r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:"dev-host",children:["IP address ",r.jsx("span",{className:"req",children:"*"})]}),r.jsxs("div",{className:"input-row",children:[r.jsx("input",{id:"dev-host",className:`input mono${Y&&ge?" is-invalid":""}`,value:g,placeholder:"192.168.1.20",onChange:G=>b(G.target.value),onBlur:()=>g.trim()!==ne&&we(),autoComplete:"off",spellCheck:!1,inputMode:"url"}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:we,disabled:!n||!!ge||I,children:[I?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"pulse"})," Check"]})]}),Y&&ge?r.jsx("span",{className:"field-error",children:ge}):Re.length?r.jsxs("span",{className:"field-warning",role:"status",children:[r.jsx(ce,{name:"alert"}),r.jsxs("span",{children:["This TV is already added as ",r.jsx("b",{children:Re.map(G=>G.name).join(", ")}),". You can still add it again, e.g. with another login."]})]}):r.jsx("span",{className:"field-help",children:"On the TV: Settings → General → Network → Wi-Fi / Wired → Advanced."})]}),r.jsx("div",{className:"span-2",children:r.jsx(JN,{result:Q,checking:I,mode:h,port:v})}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"dev-user",children:"User"}),r.jsx("input",{id:"dev-user",className:`input mono${Y&&qe?" is-invalid":""}`,value:N,onChange:G=>T(G.target.value.trim()),disabled:Zr[h].fixed,autoComplete:"off",spellCheck:!1}),Y&&qe&&r.jsx("span",{className:"field-error",children:qe})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"dev-port",children:"SSH port"}),r.jsx("input",{id:"dev-port",className:`input mono${Y&&tt?" is-invalid":""}`,type:"number",min:1,max:65535,value:Number.isNaN(v)?"":v,onChange:G=>S(G.target.valueAsNumber),disabled:Zr[h].fixed}),Y&&tt&&r.jsx("span",{className:"field-error",children:tt})]}),r.jsx("div",{className:"span-2",children:r.jsx(G0,{value:k,onChange:L,kinds:Y0[h],username:N,showErrors:Y,onKeyCheck:U,rootedHint:h!=="devmode"})}),r.jsxs("div",{className:"field span-2",children:[r.jsx("label",{className:"field-label",htmlFor:"dev-desc",children:"Description"}),r.jsx("input",{id:"dev-desc",className:"input",value:D,onChange:G=>O(G.target.value),maxLength:200,placeholder:"Optional, e.g. living room, C2 55”"})]})]}),r.jsxs("div",{className:"form-actions",children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:It,children:"Back"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"submit",className:"btn btn--primary",disabled:!n,children:["Verify & add ",r.jsx(ce,{name:"chevRight"})]})]})]}),w==="verify"&&B&&r.jsxs("div",{className:"wizard-body",children:[r.jsx("ul",{className:"verify-list",children:Object.keys(Xy).filter(G=>B.steps[G]!=="skipped").map(G=>r.jsxs("li",{className:`verify-step is-${B.steps[G]}`,children:[r.jsx("span",{className:"verify-icon",children:B.steps[G]==="running"?r.jsx("span",{className:"spinner sm"}):B.steps[G]==="done"?r.jsx(ce,{name:"check",strokeWidth:2.6}):B.steps[G]==="failed"?r.jsx(ce,{name:"x",strokeWidth:2.6}):r.jsx("span",{className:"verify-dot"})}),Xy[G]]},G))}),B.error!==void 0&&r.jsx(Nt,{error:B.error,title:B.failedAt==="key"?"Couldn’t get the key from the TV":B.failedAt==="login"?"Couldn’t log in":"Logged in, but couldn’t read the TV’s details",hint:es?null:r.jsx(oj,{error:B.error,step:B.failedAt,mode:h})}),es&&r.jsx(Uf,{}),z&&!B.info&&r.jsx($e,{kind:"success",title:`${pe} was saved`,children:"Saved in this browser and set as the active TV."}),z&&B.info&&r.jsxs("div",{className:"verify-summary",children:[r.jsxs("div",{className:"verify-summary-head",children:[r.jsx("span",{className:"verify-summary-icon",children:r.jsx(ce,{name:"check",strokeWidth:2.6})}),r.jsxs("div",{children:[r.jsxs("div",{className:"verify-summary-title",children:[pe," is ready"]}),r.jsx("div",{className:"muted",children:"Saved in this browser and set as the active TV."})]})]}),r.jsxs("dl",{className:"kv",children:[r.jsx("dt",{children:"Model"}),r.jsx("dd",{children:Bf(B.info.modelName)??"—"}),r.jsx("dt",{children:"webOS"}),r.jsx("dd",{children:Rc(B.info.osVersion)??"—"}),r.jsx("dt",{children:"Firmware"}),r.jsx("dd",{className:"mono",children:B.info.firmwareVersion??"—"}),r.jsx("dt",{children:"Logged in as"}),r.jsxs("dd",{className:"mono",children:[N,B.login?.root?" (root)":""]}),r.jsx("dt",{children:"Response time"}),r.jsx("dd",{children:B.login?`${B.login.latencyMs} ms`:"—"})]})]}),r.jsxs("div",{className:"form-actions",children:[!z&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>c("details"),disabled:$,children:"Back to details"}),r.jsx("span",{className:"spacer"}),!z&&!$&&B.error!==void 0&&r.jsxs(r.Fragment,{children:[B.failedAt!=="key"&&B.auth&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>Bt(B).catch(G=>d({kind:"danger",title:"Could not save the TV",text:xt(G).message})),children:"Save anyway"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:Ke,children:[r.jsx(ce,{name:"refresh"})," Try again"]})]}),z&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>s("/devices/new"),children:[r.jsx(ce,{name:"plus"})," Add another TV"]}),r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>s("/devices"),children:"Manage devices"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>s("/apps/installed"),children:[r.jsx(ce,{name:"apps"})," Go to apps"]})]})]})]})]})})]})}function oj({error:s,step:n,mode:l}){const{code:o}=xt(s);return o===Vs.BadPassphrase||o===Vs.PassphraseRequired?r.jsx(r.Fragment,{children:"Check the passphrase in the Developer Mode app — it usually has 6 characters and is case-sensitive."}):o===Vs.KeyServerUnreachable||o===Vs.KeyNotFound?r.jsxs(r.Fragment,{children:["Make sure ",r.jsx("b",{children:"Key Server"})," is on in the Developer Mode app while you add the TV. If it is on and this keeps failing, try turning Developer Mode off and on again."]}):o===Vs.AuthFailed?l==="devmode"?r.jsx(r.Fragment,{children:"The TV rejected the key. Turn Key Server off and on in the Developer Mode app and try again — the key changes when Developer Mode is re-enabled."}):r.jsxs(r.Fragment,{children:["Homebrew Channel’s root password is ",r.jsx("span",{className:"mono",children:"alpine"})," — unless an SSH key has been added to"," ",r.jsx("span",{className:"mono",children:"/home/root/.ssh/authorized_keys"}),", which turns password login off. Then log in with that key (Private key). For a new key, make sure its public key is in that file."]}):o===Vs.Unreachable||o===Vs.Timeout?r.jsx(r.Fragment,{children:"Check the address and that the TV is on and on the same network as this computer."}):n==="info"?r.jsx(r.Fragment,{children:"The login works, so you can save the TV anyway."}):null}function cj(s){const n=xl(s.info?.modelName);return n&&n.trim().toLowerCase()!==s.name.trim().toLowerCase()?n:void 0}function ii({device:s}){const n=cj(s);return r.jsxs(r.Fragment,{children:[r.jsx("b",{children:s.name}),n&&r.jsxs(r.Fragment,{children:[" (",n,")"]})]})}function ri({device:s,children:n}){const{status:l}=Pi(),{devices:o}=Mt();if(l.state==="unpaired"||l.state==="error"){const d=l.state==="unpaired";return r.jsx("section",{className:"card col-12",children:r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"plug"})}),r.jsx("h3",{children:d?"Set up the bridge first":"The bridge isn’t connected"}),r.jsx("p",{children:d?"The bridge is the small helper on this computer that talks to your TV. Start it in a terminal and pair this browser.":`${l.message} Make sure the bridge is still running in its terminal.`}),r.jsxs(Jt,{to:"/bridge",className:"btn btn--primary",children:[r.jsx(ce,{name:"plug"})," Bridge setup"]})]})})}if(!s){const d=!!o?.length;return r.jsx("section",{className:"card col-12",children:r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"tv"})}),r.jsx("h3",{children:d?"Choose a TV":"Add your TV"}),r.jsx("p",{children:d?"Pick the TV to work with from the switcher at the bottom of the sidebar.":"Add an LG TV in Developer Mode or a rooted TV to get started."}),r.jsxs(Jt,{to:d?"/devices":"/devices/new",className:"btn btn--primary",children:[r.jsx(ce,{name:d?"tv":"plus"})," ",d?"Devices":"Add a TV"]})]})})}return r.jsx(r.Fragment,{children:n})}const uj=s=>["apps",s.id,s.updatedAt],hj=s=>["storage",s.id,s.updatedAt];function Vc(s){const{ready:n,call:l}=ut();return ss({queryKey:s?uj(s):["apps","none"],queryFn:async()=>(await l("apps.list",{device:gt(s)},6e4)).apps,enabled:n&&!!s,staleTime:3e4,retry:!1})}function dj(s){const{ready:n,call:l}=ut();return ss({queryKey:s?hj(s):["storage","none"],queryFn:()=>l("device.storage",{device:gt(s)},3e4),enabled:n&&!!s,staleTime:3e4,retry:!1})}function fj(s){return s.icon?s.icon.startsWith("/")?s.icon:s.folderPath?`${s.folderPath.replace(/\/$/,"")}/${s.icon}`:null:null}function mj(s,n){const{ready:l,call:o}=ut(),d=fj(n);return ss({queryKey:["icon",s?.id,s?.updatedAt,d],queryFn:async()=>{const _=await o("apps.icon",{device:gt(s),path:d},3e4);return`data:${_.mime};base64,${_.base64}`},enabled:l&&!!s&&!!d&&/\.(png|jpe?g|gif|webp|bmp)$/i.test(d),staleTime:1/0,gcTime:30*6e4,retry:!1})}function pj(){const s=En();return n=>{s.invalidateQueries({queryKey:["apps",n.id]}),s.invalidateQueries({queryKey:["storage",n.id]}),s.invalidateQueries({queryKey:["hbchannel",n.id]})}}const eb=["primary","success","purple","orange","pink","teal","info"];function gj(s){let n=0;for(const l of s)n=n*31+l.charCodeAt(0)>>>0;return eb[n%eb.length]}function vj({device:s,app:n}){const{data:l}=mj(s,n),o=(n.title||n.id).trim();return l?r.jsx("img",{className:"app-icon",src:l,alt:"",width:36,height:36,loading:"lazy"}):r.jsx("span",{className:`app-icon app-icon--fallback tint-${gj(n.id)}`,"aria-hidden":"true",children:o.slice(0,1).toUpperCase()})}var qd,tb;function Z0(){if(tb)return qd;tb=1;const s=da();return qd=(l,o,d)=>s(l,o,d)===0,qd}var _j=Z0();const yj=la(_j);var Kd,sb;function bj(){if(sb)return Kd;sb=1;class s{constructor(){this.max=1e3,this.map=new Map}get(l){const o=this.map.get(l);if(o!==void 0)return this.map.delete(l),this.map.set(l,o),o}delete(l){return this.map.delete(l)}set(l,o){if(!this.delete(l)&&o!==void 0){if(this.map.size>=this.max){const _=this.map.keys().next().value;this.delete(_)}this.map.set(l,o)}return this}}return Kd=s,Kd}var Gd,ib;function Sj(){if(ib)return Gd;ib=1;const s=da();return Gd=(l,o,d)=>s(l,o,d)!==0,Gd}var Yd,nb;function xj(){if(nb)return Yd;nb=1;const s=da();return Yd=(l,o,d)=>s(l,o,d)>=0,Yd}var Zd,rb;function wj(){if(rb)return Zd;rb=1;const s=da();return Zd=(l,o,d)=>s(l,o,d)<0,Zd}var Xd,ab;function Cj(){if(ab)return Xd;ab=1;const s=da();return Xd=(l,o,d)=>s(l,o,d)<=0,Xd}var Wd,lb;function Ej(){if(lb)return Wd;lb=1;const s=Z0(),n=Sj(),l=$0(),o=xj(),d=wj(),_=Cj();return Wd=(c,h,y,p)=>{switch(h){case"===":return typeof c=="object"&&(c=c.version),typeof y=="object"&&(y=y.version),c===y;case"!==":return typeof c=="object"&&(c=c.version),typeof y=="object"&&(y=y.version),c!==y;case"":case"=":case"==":return s(c,y,p);case"!=":return n(c,y,p);case">":return l(c,y,p);case">=":return o(c,y,p);case"<":return d(c,y,p);case"<=":return _(c,y,p);default:throw new TypeError(`Invalid operator: ${h}`)}},Wd}var Qd,ob;function Nj(){if(ob)return Qd;ob=1;const s=Symbol("SemVer ANY");class n{static get ANY(){return s}constructor(p,f){if(f=l(f),p instanceof n){if(p.loose===!!f.loose)return p;p=p.value}p=p.trim().split(/\s+/).join(" "),w("comparator",p,f),this.options=f,this.loose=!!f.loose,this.parse(p),this.semver===s?this.value="":this.value=this.operator+this.semver.version,w("comp",this)}parse(p){const f=this.options.loose?o[d.COMPARATORLOOSE]:o[d.COMPARATOR],x=p.match(f);if(!x)throw new TypeError(`Invalid comparator: ${p}`);this.operator=x[1]!==void 0?x[1]:"",this.operator==="="&&(this.operator=""),x[2]?this.semver=new c(x[2],this.options.loose):this.semver=s}toString(){return this.value}test(p){if(w("Comparator.test",p,this.options.loose),this.semver===s||p===s)return!0;if(typeof p=="string")try{p=new c(p,this.options)}catch{return!1}return _(p,this.operator,this.semver,this.options)}intersects(p,f){if(!(p instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new h(p.value,f).test(this.value):p.operator===""?p.value===""?!0:new h(this.value,f).test(p.semver):(f=l(f),f.includePrerelease&&(this.value==="<0.0.0-0"||p.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||p.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&p.operator.startsWith(">")||this.operator.startsWith("<")&&p.operator.startsWith("<")||this.semver.version===p.semver.version&&this.operator.includes("=")&&p.operator.includes("=")||_(this.semver,"<",p.semver,f)&&this.operator.startsWith(">")&&p.operator.startsWith("<")||_(this.semver,">",p.semver,f)&&this.operator.startsWith("<")&&p.operator.startsWith(">")))}}Qd=n;const l=_m(),{safeRe:o,t:d}=Fc(),_=Ej(),w=Pc(),c=jl(),h=bm();return Qd}var Jd,cb;function bm(){if(cb)return Jd;cb=1;const s=/\s+/g;class n{constructor(I,A){if(A=d(A),I instanceof n)return I.loose===!!A.loose&&I.includePrerelease===!!A.includePrerelease?I:new n(I.raw,A);if(I instanceof _)return this.raw=I.value,this.set=[[I]],this.formatted=void 0,this;if(this.options=A,this.loose=!!A.loose,this.includePrerelease=!!A.includePrerelease,this.raw=I.trim().replace(s," "),this.set=this.raw.split("||").map(B=>this.parseRange(B.trim())).filter(B=>B.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const B=this.set[0];if(this.set=this.set.filter(F=>!b(F[0])),this.set.length===0)this.set=[B];else if(this.set.length>1){for(const F of this.set)if(F.length===1&&v(F[0])){this.set=[F];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let I=0;I<this.set.length;I++){I>0&&(this.formatted+="||");const A=this.set[I];for(let B=0;B<A.length;B++)B>0&&(this.formatted+=" "),this.formatted+=A[B].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(I){I=I.replace(g,"");const B=((this.options.includePrerelease&&j)|(this.options.loose&&E))+":"+I,F=o.get(B);if(F)return F;const $=this.options.loose,J=$?h[p.HYPHENRANGELOOSE]:h[p.HYPHENRANGE];I=I.replace(J,he(this.options.includePrerelease)),w("hyphen replace",I),I=I.replace(h[p.COMPARATORTRIM],f),w("comparator trim",I),I=I.replace(h[p.TILDETRIM],x),w("tilde trim",I),I=I.replace(h[p.CARETTRIM],C),w("caret trim",I);let z=I.split(" ").map(U=>N(U,this.options)).join(" ").split(/\s+/).map(U=>Q(U,this.options));$&&(z=z.filter(U=>(w("loose invalid filter",U,this.options),!!U.match(h[p.COMPARATORLOOSE])))),w("range list",z);const ee=new Map,de=z.map(U=>new _(U,this.options));for(const U of de){if(b(U))return[U];ee.set(U.value,U)}ee.size>1&&ee.has("")&&ee.delete("");const Z=[...ee.values()];return o.set(B,Z),Z}intersects(I,A){if(!(I instanceof n))throw new TypeError("a Range is required");return this.set.some(B=>S(B,A)&&I.set.some(F=>S(F,A)&&B.every($=>F.every(J=>$.intersects(J,A)))))}test(I){if(!I)return!1;if(typeof I=="string")try{I=new c(I,this.options)}catch{return!1}for(let A=0;A<this.set.length;A++)if(ne(this.set[A],I,this.options))return!0;return!1}}Jd=n;const l=bj(),o=new l,d=_m(),_=Nj(),w=Pc(),c=jl(),{safeRe:h,src:y,t:p,comparatorTrimReplace:f,tildeTrimReplace:x,caretTrimReplace:C}=Fc(),{FLAG_INCLUDE_PRERELEASE:j,FLAG_LOOSE:E}=vm(),g=new RegExp(y[p.BUILD],"g"),b=W=>W.value==="<0.0.0-0",v=W=>W.value==="",S=(W,I)=>{let A=!0;const B=W.slice();let F=B.pop();for(;A&&B.length;)A=B.every($=>F.intersects($,I)),F=B.pop();return A},N=(W,I)=>(W=W.replace(h[p.BUILD],""),w("comp",W,I),W=L(W,I),w("caret",W),W=O(W,I),w("tildes",W),W=q(W,I),w("xrange",W),W=P(W,I),w("stars",W),W),T=W=>!W||W.toLowerCase()==="x"||W==="*",D=(W,I,A)=>T(W)&&!T(I)||T(I)&&A&&!T(A),O=(W,I)=>W.trim().split(/\s+/).map(A=>k(A,I)).join(" "),k=(W,I)=>{const A=I.loose?h[p.TILDELOOSE]:h[p.TILDE],B=I.includePrerelease?"-0":"";return W.replace(A,(F,$,J,z,ee)=>{w("tilde",W,F,$,J,z,ee);let de;return T($)?de="":T(J)?de=`>=${$}.0.0${B} <${+$+1}.0.0-0`:T(z)?de=`>=${$}.${J}.0${B} <${$}.${+J+1}.0-0`:ee?(w("replaceTilde pr",ee),de=`>=${$}.${J}.${z}-${ee} <${$}.${+J+1}.0-0`):de=`>=${$}.${J}.${z} <${$}.${+J+1}.0-0`,w("tilde return",de),de})},L=(W,I)=>W.trim().split(/\s+/).map(A=>V(A,I)).join(" "),V=(W,I)=>{w("caret",W,I);const A=I.loose?h[p.CARETLOOSE]:h[p.CARET],B=I.includePrerelease?"-0":"";return W.replace(A,(F,$,J,z,ee)=>{w("caret",W,F,$,J,z,ee);let de;return T($)?de="":T(J)?de=`>=${$}.0.0${B} <${+$+1}.0.0-0`:T(z)?$==="0"?de=`>=${$}.${J}.0${B} <${$}.${+J+1}.0-0`:de=`>=${$}.${J}.0${B} <${+$+1}.0.0-0`:ee?(w("replaceCaret pr",ee),$==="0"?J==="0"?de=`>=${$}.${J}.${z}-${ee} <${$}.${J}.${+z+1}-0`:de=`>=${$}.${J}.${z}-${ee} <${$}.${+J+1}.0-0`:de=`>=${$}.${J}.${z}-${ee} <${+$+1}.0.0-0`):(w("no pr"),$==="0"?J==="0"?de=`>=${$}.${J}.${z} <${$}.${J}.${+z+1}-0`:de=`>=${$}.${J}.${z} <${$}.${+J+1}.0-0`:de=`>=${$}.${J}.${z} <${+$+1}.0.0-0`),w("caret return",de),de})},q=(W,I)=>(w("replaceXRanges",W,I),W.split(/\s+/).map(A=>Y(A,I)).join(" ")),Y=(W,I)=>{W=W.trim();const A=I.loose?h[p.XRANGELOOSE]:h[p.XRANGE];return W.replace(A,(B,F,$,J,z,ee)=>{if(w("xRange",W,B,F,$,J,z,ee),D($,J,z))return W;const de=T($),Z=de||T(J),U=Z||T(z),ue=U;return F==="="&&ue&&(F=""),ee=I.includePrerelease?"-0":"",de?F===">"||F==="<"?B="<0.0.0-0":B="*":F&&ue?(Z&&(J=0),z=0,F===">"?(F=">=",Z?($=+$+1,J=0,z=0):(J=+J+1,z=0)):F==="<="&&(F="<",Z?$=+$+1:J=+J+1),F==="<"&&(ee="-0"),B=`${F+$}.${J}.${z}${ee}`):Z?B=`>=${$}.0.0${ee} <${+$+1}.0.0-0`:U&&(B=`>=${$}.${J}.0${ee} <${$}.${+J+1}.0-0`),w("xRange return",B),B})},P=(W,I)=>(w("replaceStars",W,I),W.trim().replace(h[p.STAR],"")),Q=(W,I)=>(w("replaceGTE0",W,I),W.trim().replace(h[I.includePrerelease?p.GTE0PRE:p.GTE0],"")),he=W=>(I,A,B,F,$,J,z,ee,de,Z,U,ue)=>(T(B)?A="":T(F)?A=`>=${B}.0.0${W?"-0":""}`:T($)?A=`>=${B}.${F}.0${W?"-0":""}`:J?A=`>=${A}`:A=`>=${A}${W?"-0":""}`,T(de)?ee="":T(Z)?ee=`<${+de+1}.0.0-0`:T(U)?ee=`<${de}.${+Z+1}.0-0`:ue?ee=`<=${de}.${Z}.${U}-${ue}`:W?ee=`<${de}.${Z}.${+U+1}-0`:ee=`<=${ee}`,`${A} ${ee}`.trim()),ne=(W,I,A)=>{for(let B=0;B<W.length;B++)if(!W[B].test(I))return!1;if(I.prerelease.length&&!A.includePrerelease){for(let B=0;B<W.length;B++)if(w(W[B].semver),W[B].semver!==_.ANY&&W[B].semver.prerelease.length>0){const F=W[B].semver;if(F.major===I.major&&F.minor===I.minor&&F.patch===I.patch)return!0}return!1}return!0};return Jd}var ef,ub;function jj(){if(ub)return ef;ub=1;const s=bm();return ef=(l,o,d)=>{try{o=new s(o,d)}catch{return!1}return o.test(l)},ef}var Tj=jj();const kj=la(Tj);var tf,hb;function Rj(){if(hb)return tf;hb=1;const s=jl(),n=P0(),{safeRe:l,t:o}=Fc();return tf=(_,w)=>{if(_ instanceof s)return _;if(typeof _=="number"&&(_=String(_)),typeof _!="string")return null;w=w||{};let c=null;if(!w.rtl)c=_.match(w.includePrerelease?l[o.COERCEFULL]:l[o.COERCE]);else{const C=w.includePrerelease?l[o.COERCERTLFULL]:l[o.COERCERTL];let j;for(;(j=C.exec(_))&&(!c||c.index+c[0].length!==_.length);)(!c||j.index+j[0].length!==c.index+c[0].length)&&(c=j),C.lastIndex=j.index+j[1].length+j[2].length;C.lastIndex=-1}if(c===null)return null;const h=c[2],y=c[3]||"0",p=c[4]||"0",f=w.includePrerelease&&c[5]?`-${c[5]}`:"",x=w.includePrerelease&&c[6]?`+${c[6]}`:"";return n(`${h}.${y}.${p}${f}${x}`,w)},tf}var Dj=Rj();const Pf=la(Dj);var sf,db;function Aj(){if(db)return sf;db=1;const s=bm();return sf=(l,o)=>{try{return new s(l,o).range||"*"}catch{return null}},sf}var Oj=Aj();const Lj=la(Oj);function X0(s,n){if(!s||!n)return null;const l=_=>{const w=_.split(".",4);return w.length>3?{base:w.slice(0,3).join("."),suffix:w[3]}:{base:_,suffix:""}},o=l(s),d=l(n);try{if((o.suffix||d.suffix)&&yj(o.base,d.base,!0)){const _=Number(o.suffix),w=Number(d.suffix);return!Number.isNaN(_)&&!Number.isNaN(w)?_>w:o.suffix.localeCompare(d.suffix)>0}return If(o.base,d.base,!0)}catch{const _=Pf(s),w=Pf(n);return _&&w?If(_,w):s!==n?null:!1}}const W0={root:"This app needs root, but this TV isn’t rooted.",soc:"This app isn’t made for this TV’s chip (SoC).",release:"This app needs a different webOS version."};function Mj(s,n,l,o=s.manifest){const d=[],_=s.requirements;if(n?.osVersion&&_?.webosRelease&&Lj(_.webosRelease,{loose:!0})){const w=Pf(n.osVersion);w&&!kj(w,_.webosRelease,{loose:!0})&&d.push("release")}if(n?.socName&&_?.deviceSoC?.length){const w=_.deviceSoC.filter(h=>h.startsWith("!")).map(h=>h.slice(1)),c=_.deviceSoC.filter(h=>!h.startsWith("!"));(c.length>0&&!c.includes(n.socName)||w.includes(n.socName))&&d.push("soc")}return l?.root===!1&&o?.rootRequired===!0&&d.push("root"),d.length?d:null}function Bj(s,n){return n===void 0?"install":X0(s.manifest?.version,n)?"update":"installed"}const Ij=s=>s===void 0?void 0:s>=1024*1024?`${(s/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(s/1024))} KB`,Hj={install:[{id:"send",label:"Send the IPK to the bridge"},{id:"copy",label:"Copy it to the TV"},{id:"install",label:"Install"}],repo:[{id:"copy",label:"Download the IPK"},{id:"install",label:"Install"}],remove:[{id:"install",label:"Uninstall"}]},fb=s=>s==="upload"||s==="verify"?"copy":"install",nf=s=>s>=1024*1024?`${(s/1024/1024).toFixed(1)} MB`:s>=1024?`${Math.round(s/1024)} KB`:`${s} B`;function Uj(s){const{code:n}=xt(s);return n===ac.InsufficientSpace?"Free some space on the TV (uninstall apps you don’t use) and try again.":n===ac.InstallFailed?"The TV rejected the package. Check that it is a webOS IPK made for this TV.":n===ac.ChecksumMismatch?"The download or the copy to the TV was damaged. Try again; if it keeps failing, the repository entry may be broken.":n===ac.Conflict?"An app with the same id came from the LG Content Store (or is built in). Uninstall that one on the TV first.":n===Ty.DownloadFailed||n===Ty.Unreachable||n===A2.Unreachable?"Check this computer’s internet connection and try again.":null}function qc(s,n){const{client:l,call:o}=ut(),{confirm:d,toast:_}=jt(),w=pj(),[c,h]=M.useState(null),y=M.useRef(null),p=!!c&&!c.done&&c.error===void 0,f=async T=>{if(s)try{await o("apps.launch",{device:gt(s),id:T.id},3e4),_({kind:"success",title:`Launched ${T.title??T.id}`,text:`On ${s.name}.`})}catch(D){_({kind:"danger",title:`Couldn’t launch ${T.title??T.id}`,text:xt(D).message})}},x=async T=>{if(!s||!l||p)return;if(!/\.ipk$/i.test(T.name)){_({kind:"warning",title:"Not an IPK file",text:"Choose a webOS package ending in .ipk."});return}const D=new AbortController;y.current=D;const O=ea();h({kind:"install",subject:T.name,phase:"send",percent:0,text:`0 of ${nf(T.size)}`});const k=pc(l,O,L=>{if(L.stage==="cleanup")return;const V=fb(L.stage);h(q=>q&&!q.done&&q.error===void 0?{...q,phase:V,percent:L.percent,text:L.text}:q)});try{const L=await H0(l,T,(q,Y)=>h(P=>P&&{...P,percent:Math.round(q/Y*100),text:`${nf(q)} of ${nf(Y)}`}),D.signal);h(q=>q&&{...q,phase:"copy",percent:void 0,text:"Starting…"});const V=await l.call("apps.install",{device:gt(s),uploadId:L,opId:O},20*6e4);h(q=>q&&{...q,done:V}),w(s)}catch(L){L instanceof yt&&L.code==="cancelled"?h(null):h(V=>V&&{...V,error:L})}finally{k(),y.current=null}},C=async(T,D={})=>{if(!s||!l||p)return!1;const O=D.channel??"stable";if(D.incompatible?.length&&!await d({title:`${T.title} may not work on ${s.name}`,message:r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["The repository marks ",r.jsx("b",{children:T.title})," as not compatible with this TV:"]}),r.jsx("ul",{className:"plain-list",children:D.incompatible.map(q=>r.jsx("li",{children:W0[q]},q))}),r.jsx("p",{children:"It may not work properly, or at all."})]}),confirmText:"Install anyway",danger:!0}))return!1;const k=D.update?"Updating":O==="beta"?"Installing the beta of":"Installing",L=gt(s);return E(k,T.title,V=>l.call("apps.installFromRepo",{device:L,id:T.id,channel:O,opId:V},20*6e4))},j=async(T,D,O)=>{if(!s||!l||p)return!1;const k=gt(s);return E("Installing",O,L=>l.call("litefin.install",{device:k,tag:T,variant:D,opId:L},20*6e4))},E=async(T,D,O)=>{if(!s||!l)return!1;const k=ea();h({kind:"repo",verb:T,subject:D,phase:"copy",text:"Starting…"});const L=pc(l,k,V=>{if(V.stage==="cleanup")return;const q=fb(V.stage);h(Y=>Y&&!Y.done&&Y.error===void 0?{...Y,phase:q,percent:V.percent,text:V.text}:Y)});try{const V=await O(k);return h(q=>q&&{...q,done:V}),w(s),!0}catch(V){return h(q=>q&&{...q,error:V}),!1}finally{L()}},g=async T=>{if(!s||!l||p)return;const D=T.title??T.id;if(!await d({title:`Uninstall ${D}?`,message:r.jsxs(r.Fragment,{children:[r.jsx("b",{children:D})," ",r.jsxs("span",{className:"mono",children:["(",T.id,")"]})," will be removed from ",s.name,"."]}),confirmText:"Uninstall",danger:!0})||T.id===kf&&!await d({title:"Remove Homebrew Channel?",message:r.jsx($e,{kind:"danger",title:"Danger",children:"You’re about to remove Homebrew Channel. On a rooted TV you lose root access immediately."}),confirmText:"Yes, uninstall Homebrew Channel",danger:!0}))return;const k=ea();h({kind:"remove",subject:D,phase:"install",text:"Removing…"});const L=pc(l,k,V=>h(q=>q&&!q.done&&q.error===void 0?{...q,text:V.text}:q));try{await l.call("apps.remove",{device:gt(s),id:T.id,opId:k},5*6e4),h(null),_({kind:"success",title:`Uninstalled ${D}`}),w(s)}catch(V){h(q=>q&&{...q,error:V})}finally{L()}},b=c?.done?.appId?n?.find(T=>T.id===c.done.appId):void 0,v=c?Hj[c.kind]:[],S=c?v.findIndex(T=>T.id===c.phase):-1,N=r.jsx(si,{open:!!c,onClose:()=>p?y.current?.abort():h(null),dismissible:!p,title:c?`${c.kind==="remove"?"Uninstalling":c.kind==="repo"?c.verb:"Installing"} ${c.subject}`:"",footer:c&&r.jsxs(r.Fragment,{children:[p&&c.phase==="send"&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>y.current?.abort(),children:"Cancel"}),!p&&c.done&&b&&r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>{h(null),f(b)},children:[r.jsx(ce,{name:"play"})," Launch"]}),!p&&r.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>h(null),children:c.error!==void 0?"Close":"Done"})]}),children:c&&r.jsxs("div",{className:"stack",children:[v.length>1&&r.jsx("ul",{className:"verify-list",children:v.map((T,D)=>{const O=c.done||D<S?"done":D===S?c.error!==void 0?"failed":"running":"pending";return r.jsxs("li",{className:`verify-step is-${O}`,children:[r.jsx("span",{className:"verify-icon",children:O==="running"?r.jsx("span",{className:"spinner sm"}):O==="done"?r.jsx(ce,{name:"check",strokeWidth:2.6}):O==="failed"?r.jsx(ce,{name:"x",strokeWidth:2.6}):r.jsx("span",{className:"verify-dot"})}),T.label]},T.id)})}),p&&r.jsxs("div",{className:"op-progress",children:[r.jsxs("div",{className:"op-progress-text",children:[r.jsx("span",{children:c.text??"Working…"}),c.percent!==void 0&&r.jsxs("span",{className:"mono",children:[c.percent,"%"]})]}),r.jsx("div",{className:"progress",children:r.jsx("div",{className:`progress-fill${c.percent===void 0?" is-indeterminate":""}`,style:c.percent!==void 0?{width:`${c.percent}%`,animation:"none"}:void 0})})]}),c.done&&r.jsxs($e,{kind:"success",title:b?`${b.title??b.id} ${b.version?`v${b.version} `:""}is installed`:c.done.version?`${c.subject} v${c.done.version} is installed`:"Installed",children:[c.done.via==="hbchannel"?"Installed by Homebrew Channel on ":"Installed on ",s?.name,"."]}),c.error!==void 0&&r.jsx(Nt,{error:c.error,title:c.kind==="remove"?"Uninstall failed":"Install failed",hint:c.kind==="remove"?null:Uj(c.error)})]})});return{install:x,installFromRepo:C,installLitefin:j,remove:g,launch:f,busy:p,dialog:N}}function zj(){const{ready:s,call:n}=ut();return ss({queryKey:["repo"],queryFn:()=>n("repo.list",{},6e4),enabled:s,staleTime:5*6e4,retry:!1})}function $j(){const s=En(),{call:n}=ut();return async()=>{s.setQueryData(["repo"],await n("repo.list",{refresh:!0},6e4))}}function Q0(){const s=zj(),n=M.useMemo(()=>new Map((s.data?.packages??[]).map(l=>[l.id,l])),[s.data]);return{...s,byId:n}}function Sm(s){const{ready:n,call:l}=ut();return ss({queryKey:["repo-image",s],queryFn:async()=>{const o=await l("repo.image",{url:s},3e4);return`data:${o.mime};base64,${o.base64}`},enabled:n&&!!s,staleTime:1/0,gcTime:30*6e4,retry:!1})}function Pj(s){const{ready:n,call:l}=ut();return ss({queryKey:["repo-description",s?.id],queryFn:()=>l("repo.description",{id:s.id},3e4),enabled:n&&!!s?.hasDescription,staleTime:10*6e4,retry:!1})}function J0(s){const{ready:n,call:l}=ut();return ss({queryKey:["hbchannel",s?.id,s?.updatedAt],queryFn:()=>l("device.hbchannel",{device:gt(s),quiet:!0},3e4),enabled:n&&!!s,staleTime:5*6e4,retry:!1})}function eS(s){const n=Q0(),l=Vc(s),o=J0(s),d=M.useMemo(()=>{const _=new Map((l.data??[]).map(h=>[h.id,h])),w=s?.info?{osVersion:s.info.osVersion,socName:s.info.socName}:void 0,c=new Map;for(const h of n.data?.packages??[]){const y=_.get(h.id);c.set(h.id,{pkg:h,installed:y,state:Bj(h,y?y.version??"":void 0),incompatible:Mj(h,w,o.data)})}return c},[n.data,l.data,o.data,s?.info]);return{repo:n,installed:l,hb:o,view:d,ready:!!n.data&&!!l.data}}const mb=["primary","success","purple","orange","pink","teal","info"],Fj=s=>{let n=0;for(const l of s)n=n*31+l.charCodeAt(0)>>>0;return mb[n%mb.length]};function tS({pkg:s,size:n=44,detail:l=!1}){const{data:o}=Sm(l&&s.detailIconUri||s.iconUri),d={width:n,height:n};return o?r.jsx("img",{className:"app-icon repo-icon",src:o,alt:"",width:n,height:n,style:d}):r.jsx("span",{className:`app-icon app-icon--fallback repo-icon tint-${Fj(s.id)}`,style:{...d,fontSize:Math.round(n*.4)},"aria-hidden":"true",children:s.title.trim().slice(0,1).toUpperCase()})}function Vj({url:s,caption:n}){const{data:l,isError:o}=Sm(s);return o?null:r.jsxs("figure",{className:"repo-shot",children:[l?r.jsx("img",{src:l,alt:n??"Screenshot"}):r.jsx("div",{className:"repo-shot-ph",children:r.jsx("span",{className:"spinner sm"})}),n&&r.jsx("figcaption",{children:n})]})}const qj=new Map(Object.entries({p:"p",br:"br",hr:"hr",ul:"ul",ol:"ol",li:"li",strong:"strong",b:"strong",em:"em",i:"em",code:"code",pre:"pre",blockquote:"blockquote",h1:"h3",h2:"h4",h3:"h5",h4:"h6",h5:"h6",h6:"h6",table:"table",thead:"thead",tbody:"tbody",tr:"tr",th:"th",td:"td",a:"a",img:"img"})),Kj=new Set(["script","style","iframe","frame","object","embed","template","noscript","svg","math","form","input","button","select","textarea","link","meta","base","head","title"]),Gj=new Set(["br","hr","img"]),Yj=5e3;function pb(s,n,l){if(!s)return null;try{const o=new URL(s,l);return n.includes(o.protocol)?o.toString():null}catch{return null}}function Zj(s,n={}){const l=new DOMParser().parseFromString(s,"text/html");let o=Yj,d=0;const _=w=>{const c=[];for(const h of Array.from(w.childNodes)){if(--o<0)break;if(h.nodeType===Node.TEXT_NODE){h.textContent&&c.push(h.textContent);continue}if(h.nodeType!==Node.ELEMENT_NODE)continue;const y=h,p=y.tagName.toLowerCase();if(Kj.has(p))continue;const f=qj.get(p);if(!f){c.push(..._(y));continue}if(f==="img"){const C=pb(y.getAttribute("src"),["https:","http:"],n.baseUrl);C&&n.renderImage&&c.push(n.renderImage(C,y.getAttribute("alt")??"",d++));continue}if(Gj.has(f)){c.push(M.createElement(f,{key:d++}));continue}const x=_(y);if(f==="a"){const C=pb(y.getAttribute("href"),["https:","http:"],n.baseUrl);c.push(C?M.createElement("a",{key:d++,href:C,target:"_blank",rel:"noopener noreferrer"},...x):M.createElement("span",{key:d++},...x));continue}c.push(M.createElement(f,{key:d++},...x))}return c};return _(l.body)}function Xj({html:s,className:n,baseUrl:l,renderImage:o}){return r.jsx("div",{className:n,children:Zj(s,{baseUrl:l,renderImage:o})})}function sS({view:s,device:n,ready:l,actions:o,onClose:d}){const _=s?.pkg??null,w=Pj(_);if(!s||!_)return r.jsx(si,{open:!1,onClose:d,title:"",children:null});const{installed:c,state:h,incompatible:y}=s,p=_.manifest,f=!n||!l||o.busy;return r.jsx(si,{open:!0,onClose:d,size:"lg",title:_.title,children:r.jsxs("div",{className:"repo-details",children:[r.jsxs("div",{className:"repo-details-head",children:[r.jsx(tS,{pkg:_,size:88,detail:!0}),r.jsxs("div",{className:"repo-details-meta",children:[r.jsx("div",{className:"mono muted repo-details-id",children:_.id}),r.jsxs("div",{className:"repo-details-version",children:[p?r.jsxs(r.Fragment,{children:["Version ",r.jsx("b",{children:p.version})]}):"No release",p?.ipkSize?r.jsxs("span",{className:"muted",children:[" · ",Ij(p.ipkSize)]}):null,c&&r.jsxs("span",{className:"muted",children:[" ","· installed ",c.version?`v${c.version}`:""]})]}),r.jsxs("div",{className:"repo-badges",children:[h==="update"&&r.jsx("span",{className:"badge warning",children:"Update available"}),h==="installed"&&r.jsx("span",{className:"badge success",children:"Installed"}),p?.rootRequired===!0&&r.jsx("span",{className:"badge purple",children:"Root required"}),p?.rootRequired==="optional"&&r.jsx("span",{className:"badge purple",children:"Root optional"}),_.manifestBeta&&r.jsxs("span",{className:"badge info",children:["Beta ",_.manifestBeta.version]})]})]}),r.jsx("div",{className:"repo-details-actions",children:h==="installed"?r.jsxs("button",{type:"button",className:"btn btn--primary",disabled:f,onClick:()=>o.launch(c??{id:_.id,title:_.title}),children:[r.jsx(ce,{name:"play"})," Launch"]}):r.jsxs("button",{type:"button",className:"btn btn--primary",disabled:f||!p,onClick:()=>o.installFromRepo(_,{update:h==="update",incompatible:y}),children:[r.jsx(ce,{name:"download"})," ",h==="update"?`Update to ${p?.version}`:"Install"]})})]}),y&&r.jsx($e,{kind:"warning",title:`${_.title} is marked as not compatible with ${n?.name??"this TV"}`,children:r.jsx("ul",{className:"plain-list",children:y.map(x=>r.jsx("li",{children:W0[x]},x))})}),r.jsxs("div",{className:"repo-details-secondary",children:[_.manifestBeta&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",disabled:f,onClick:()=>o.installFromRepo(_,{channel:"beta",incompatible:y}),children:[r.jsx(ce,{name:"download"})," Install beta ",_.manifestBeta.version]}),p?.sourceUrl&&r.jsxs("a",{className:"btn btn--sm btn--ghost",href:p.sourceUrl,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"external"})," Project page"]}),h==="update"&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",disabled:f,onClick:()=>o.launch(c??{id:_.id,title:_.title}),children:[r.jsx(ce,{name:"play"})," Launch installed version"]}),c&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-danger",disabled:f||c.removable===!1,onClick:()=>o.remove(c),children:[r.jsx(ce,{name:"trash"})," Uninstall"]})]}),!!_.screenshots?.length&&r.jsx("div",{className:"repo-shots","aria-label":"Screenshots",children:_.screenshots.map(x=>r.jsx(Vj,{url:x.url,caption:x.caption},x.url))}),r.jsx("div",{className:"repo-desc",children:w.isLoading?r.jsxs("div",{className:"muted",children:[r.jsx("span",{className:"spinner sm"})," Loading the description…"]}):w.error?r.jsx(Nt,{error:w.error,title:"Couldn’t load the description"}):w.data?.html?r.jsx(Xj,{html:w.data.html,baseUrl:w.data.baseUrl,className:"repo-desc-body",renderImage:(x,C,j)=>r.jsx(Wj,{src:x,alt:C},j)}):r.jsx("p",{children:p?.appDescription??_.shortDescription??"No description."})})]})})}function Wj({src:s,alt:n}){const{data:l}=Sm(s);return l?r.jsx("img",{src:l,alt:n}):null}const gb=s=>s>=1024*1024?`${(s/1024/1024).toFixed(1)} GB`:`${Math.round(s/1024)} MB`;function Qj({device:s}){const{data:n}=dj(s);if(!n)return null;const l=Math.round(n.used/Math.max(1,n.total)*100);return r.jsxs("div",{className:"storage-bar",title:"Developer partition (/media/developer)",children:[r.jsx(ce,{name:"disk"}),r.jsxs("span",{children:[r.jsx("b",{children:gb(n.available)})," free of ",gb(n.total)]}),r.jsx("div",{className:"progress thin",children:r.jsx("div",{className:`progress-fill${l>90?" danger":l>75?" warning":""}`,style:{width:`${l}%`}})})]})}function Jj(){const{active:s}=Mt(),{data:n,error:l,isLoading:o,isFetching:d,refetch:_}=Vc(s),w=qc(s,n),{install:c,remove:h,launch:y,busy:p,dialog:f}=w,x=eS(s),[C,j]=M.useState(null),{toast:E}=jt(),[g,b]=M.useState(""),[v,S]=M.useState(!1),[N,T]=M.useState(!1),D=M.useRef(null),O=M.useRef(0),k=!!n?.some(P=>P.systemApp),L=M.useMemo(()=>{const P=g.trim().toLowerCase();return(n??[]).filter(Q=>v||!Q.systemApp).filter(Q=>!P||(Q.title??"").toLowerCase().includes(P)||Q.id.toLowerCase().includes(P)).sort((Q,he)=>(Q.title??Q.id).localeCompare(he.title??he.id))},[n,g,v]),V=P=>{const Q=[...P??[]];Q.length&&(Q.length>1&&E({kind:"info",title:"One at a time",text:`Installing ${Q[0].name} — drop the others after it finishes.`}),c(Q[0]))},q=s?{onDragEnter:P=>{[...P.dataTransfer.types].includes("Files")&&(O.current++,T(!0))},onDragLeave:()=>{O.current=Math.max(0,O.current-1),O.current||T(!1)},onDragOver:P=>{[...P.dataTransfer.types].includes("Files")&&P.preventDefault()},onDrop:P=>{P.preventDefault(),O.current=0,T(!1),p||V(P.dataTransfer.files)}}:{},Y=!!s&&!p;return r.jsxs("div",{className:"drop-zone-page",...q,children:[r.jsx(ys,{eyebrow:"Apps",title:"Installed",accent:"apps",sub:s?r.jsxs(r.Fragment,{children:["Apps on ",r.jsx(ii,{device:s}),". Drop an ",r.jsx("span",{className:"mono",children:".ipk"})," anywhere on this page to install it."]}):"Apps on your TV.",actions:s&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>D.current?.click(),disabled:!Y,children:[r.jsx(ce,{name:"upload"})," Install IPK"]}),r.jsx("input",{ref:D,type:"file",accept:".ipk,application/vnd.debian.binary-package,application/octet-stream",hidden:!0,onChange:P=>{V(P.target.files),P.target.value=""}})]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left",children:[r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Search apps…",value:g,onChange:P=>b(P.target.value),"aria-label":"Search apps"})]}),k&&r.jsxs("label",{className:"switch",children:[r.jsx("input",{type:"checkbox",checked:v,onChange:P=>S(P.target.checked)}),r.jsx("span",{className:"track"}),"System apps"]})]}),r.jsxs("div",{className:"data-toolbar-right",children:[n&&r.jsxs("span",{className:"muted count-label",children:[L.length," of ",n.length]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>_(),"aria-label":"Refresh",title:"Refresh",disabled:d,children:r.jsx(ce,{name:"refresh",className:d?"spin":void 0})})]})]}),l?r.jsx(Nt,{error:l,title:"Couldn’t get the installed apps",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>_(),children:"Retry"})}):o?r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsxs("p",{children:["Asking ",s?.name," for its apps…"]})]}):L.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"apps"})}),r.jsx("h3",{children:g?"No matching apps":"No apps installed yet"}),r.jsx("p",{children:g?"Try another search.":r.jsxs(r.Fragment,{children:["Install an IPK from your computer, or browse the ",r.jsx(Jt,{to:"/apps/homebrew",children:"Homebrew repository"}),"."]})})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table apps-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"App"}),r.jsx("th",{className:"hide-sm",children:"Version"}),r.jsx("th",{className:"hide-sm",children:"Type"}),r.jsx("th",{"aria-label":"Actions"})]})}),r.jsx("tbody",{children:L.map(P=>r.jsx(eT,{app:P,device:s,repo:x.view.get(P.id),onLaunch:y,onRemove:h,onUpdate:Q=>w.installFromRepo(Q.pkg,{update:!0,incompatible:Q.incompatible}),onDetails:Q=>j(Q.pkg.id),busy:p},P.id))})]})}),s&&r.jsx("div",{className:"data-foot",children:r.jsx(Qj,{device:s})})]})})}),N&&r.jsx("div",{className:"drop-overlay","aria-hidden":"true",children:r.jsxs("div",{className:"drop-overlay-card",children:[r.jsx(ce,{name:"upload"}),r.jsxs("div",{children:["Drop to install on ",s?.name]})]})}),r.jsx(sS,{view:C?x.view.get(C)??null:null,device:s,ready:x.ready,actions:w,onClose:()=>j(null)}),f]})}function eT({app:s,device:n,repo:l,onLaunch:o,onRemove:d,onUpdate:_,onDetails:w,busy:c}){const h=l?.state==="update"?l:void 0,{toast:y}=jt(),p=s.removable!==!1&&!s.systemApp,f=s.title??s.id;return r.jsxs("tr",{children:[r.jsx("td",{children:r.jsxs("div",{className:"data-cell-user",children:[r.jsx(vj,{device:n,app:s}),r.jsxs("div",{className:"data-cell-user-meta",children:[r.jsx("div",{className:"data-cell-user-name",children:f}),r.jsxs("div",{className:"data-cell-user-email",children:[s.id,s.version&&r.jsxs("span",{className:"show-sm app-version-sm",children:["v",s.version]})]})]})]})}),r.jsxs("td",{className:"data-cell-mono hide-sm",children:[s.version?`v${s.version}`:"—",h&&r.jsxs("span",{className:"badge warning update-badge",title:`v${h.pkg.manifest?.version} is in the Homebrew repository`,children:["v",h.pkg.manifest?.version," available"]})]}),r.jsx("td",{className:"hide-sm",children:s.type?r.jsx("span",{className:"badge",children:s.type}):"—"}),r.jsx("td",{children:r.jsxs("div",{className:"row-actions",children:[h&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",onClick:()=>_(h),disabled:c,"aria-label":`Update ${f} to ${h.pkg.manifest?.version}`,title:`Update to v${h.pkg.manifest?.version}`,children:[r.jsx(ce,{name:"download"})," ",r.jsx("span",{className:"hide-sm",children:"Update"})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-primary",onClick:()=>o(s),"aria-label":`Launch ${f}`,children:[r.jsx(ce,{name:"play"})," ",r.jsx("span",{className:"hide-sm",children:"Launch"})]}),r.jsx(Ic,{label:`More actions for ${f}`,menuClassName:"dd-menu--compact",floating:!0,trigger:({toggle:x,...C})=>r.jsx("button",{type:"button",className:"btn btn--icon btn--sm btn--ghost","aria-label":`More actions for ${f}`,onClick:x,...C,children:r.jsx(ce,{name:"more"})}),children:x=>r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>{x(),navigator.clipboard.writeText(s.id).then(()=>y({kind:"success",title:"App id copied",text:s.id}))},children:[r.jsx(ce,{name:"copy"})," Copy app id"]}),l&&r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>{x(),w(l)},children:[r.jsx(ce,{name:"store"})," Homebrew repo details"]}),r.jsx("div",{className:"dd-divider"}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item danger",disabled:!p||c,title:p?void 0:"System apps can’t be uninstalled here",onClick:()=>{x(),d(s)},children:[r.jsx(ce,{name:"trash"})," Uninstall"]})]})})]})})]})}function tT(){const{active:s}=Mt(),{repo:n,installed:l,view:o,ready:d}=eS(s),_=qc(s,l.data),w=$j(),{toast:c}=jt(),[h,y]=M.useState(""),[p,f]=M.useState("all"),[x,C]=M.useState(null),[j,E]=M.useState(!1),g=M.useMemo(()=>[...o.values()].sort((D,O)=>D.pkg.title.localeCompare(O.pkg.title)),[o]),b=M.useMemo(()=>({all:g.length,installed:g.filter(D=>D.installed).length,updates:g.filter(D=>D.state==="update").length}),[g]),v=M.useMemo(()=>{const D=h.trim().toLowerCase();return g.filter(O=>p==="installed"?!!O.installed:p==="updates"?O.state==="update":!0).filter(O=>!D||O.pkg.title.toLowerCase().includes(D)||O.pkg.id.toLowerCase().includes(D)||(O.pkg.shortDescription??O.pkg.manifest?.appDescription??"").toLowerCase().includes(D))},[g,p,h]),S=async()=>{E(!0);try{await w(),l.refetch()}catch(D){c({kind:"danger",title:"Couldn’t refresh the repository",text:xt(D).message})}finally{E(!1)}},N=x?o.get(x)??null:null,T=[{id:"all",label:"All"},{id:"installed",label:"Installed"},{id:"updates",label:"Updates"}];return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Apps",title:"Homebrew",accent:"repository",sub:r.jsxs(r.Fragment,{children:["Apps from"," ",r.jsx("a",{href:"https://repo.webosbrew.org/",target:"_blank",rel:"noopener noreferrer",children:"repo.webosbrew.org"}),s&&r.jsxs(r.Fragment,{children:[" ","for ",r.jsx(ii,{device:s})]}),". Homebrew apps aren’t reviewed by LG — install what you trust."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left",children:[r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Search the repository…",value:h,onChange:D=>y(D.target.value),"aria-label":"Search the repository"})]}),r.jsx("div",{className:"tabs pills",role:"group","aria-label":"Show",children:T.map(D=>r.jsxs("button",{type:"button",className:`tab${p===D.id?" is-active":""}`,"aria-pressed":p===D.id,onClick:()=>f(D.id),children:[D.label,d&&r.jsx("span",{className:`tab-count${D.id==="updates"&&b.updates?" is-hot":""}`,children:b[D.id]})]},D.id))})]}),r.jsxs("div",{className:"data-toolbar-right",children:[n.data&&r.jsxs("span",{className:"muted count-label",children:[v.length," of ",g.length]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:S,"aria-label":"Refresh",title:"Fetch the repository again",disabled:j||n.isFetching,children:r.jsx(ce,{name:"refresh",className:j||n.isFetching?"spin":void 0})})]})]}),n.error?r.jsx(Nt,{error:n.error,title:"Couldn’t load the Homebrew repository",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>n.refetch(),children:"Retry"})}):n.data?v.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"store"})}),r.jsx("h3",{children:h?"No matching apps":p==="updates"?"Everything is up to date":"Nothing here yet"}),r.jsx("p",{children:h?"Try another search.":p==="updates"?"None of the repository apps on this TV has a newer version.":"No repository apps are installed on this TV."})]}):r.jsxs(r.Fragment,{children:[l.error&&r.jsx(Nt,{error:l.error,title:`Couldn’t read the apps on ${s?.name}`,hint:"Install and update buttons stay off until it works."}),r.jsx("ul",{className:"repo-grid",children:v.map(D=>r.jsx(sT,{v:D,ready:d,busy:_.busy,onOpen:()=>C(D.pkg.id),onInstall:()=>_.installFromRepo(D.pkg,{update:D.state==="update",incompatible:D.incompatible}),onLaunch:()=>_.launch(D.installed??{id:D.pkg.id,title:D.pkg.title})},D.pkg.id))})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Fetching the repository…"})]})]})})}),r.jsx(sS,{view:N,device:s,ready:d,actions:_,onClose:()=>C(null)}),_.dialog]})}function sT({v:s,ready:n,busy:l,onOpen:o,onInstall:d,onLaunch:_}){const{pkg:w,state:c,incompatible:h,installed:y}=s,p=w.manifest;return r.jsxs("li",{className:`repo-card${c==="update"?" has-update":""}`,children:[r.jsxs("button",{type:"button",className:"repo-card-main",onClick:o,"aria-label":`Details for ${w.title}`,children:[r.jsx(tS,{pkg:w}),r.jsxs("span",{className:"repo-card-text",children:[r.jsx("span",{className:"repo-card-title",children:w.title}),r.jsx("span",{className:"repo-card-desc",children:w.shortDescription??p?.appDescription??w.id})]})]}),r.jsxs("div",{className:"repo-card-foot",children:[r.jsxs("div",{className:"repo-badges",children:[p&&r.jsxs("span",{className:"mono repo-card-version",children:["v",p.version]}),c==="update"&&r.jsx("span",{className:"badge warning",title:`Installed: v${y?.version??"?"}`,children:"Update"}),c==="installed"&&r.jsx("span",{className:"badge success",children:"Installed"}),p?.rootRequired===!0&&r.jsx("span",{className:"badge purple",children:"Root"}),h&&r.jsx("span",{className:"badge danger",title:"Marked as not compatible with this TV",children:"May not work"})]}),c==="installed"?r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:_,disabled:!n||l,"aria-label":`Launch ${w.title}`,children:[r.jsx(ce,{name:"play"})," Launch"]}):r.jsxs("button",{type:"button",className:`btn btn--sm ${c==="update"?"btn--primary":"btn--soft-primary"}`,onClick:d,disabled:!n||l||!p,"aria-label":`${c==="update"?"Update":"Install"} ${w.title}`,children:[r.jsx(ce,{name:"download"})," ",c==="update"?"Update":"Install"]})]})]})}const hl=(s,n)=>s==="/"?`/${n}`:`${s}/${n}`,iT=s=>{if(s==="/")return null;const n=s.lastIndexOf("/");return n<=0?"/":s.slice(0,n)};function nT(s,n="/"){const l=s.trim();if(!l)return null;const o=(l.startsWith("/")?l:`${n}/${l}`).split("/"),d=[];for(const _ of o)if(!(!_||_==="."))if(_===".."){if(!d.length)return null;d.pop()}else d.push(_);return`/${d.join("/")}`}function rT(s){const n=[{name:"/",path:"/"}];let l="";for(const o of s.split("/").filter(Boolean))l+=`/${o}`,n.push({name:o,path:l});return n}const xn=s=>s.type==="d"||s.type==="l"&&s.link?.type==="d",Sn=s=>s.type==="-"||s.type==="l"&&s.link?.type==="-",Fs=s=>s>=1024**3?`${(s/1024**3).toFixed(1)} GB`:s>=1024**2?`${(s/1024**2).toFixed(1)} MB`:s>=1024?`${(s/1024).toFixed(s>=10*1024?0:1)} KB`:`${s} B`,aT=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),lT=s=>s>0?aT.format(new Date(s*1e3)):"—";function oT(s,n,l){const o=l==="asc"?1:-1,d=(_,w)=>_.name.localeCompare(w.name,void 0,{numeric:!0,sensitivity:"base"});return[...s].sort((_,w)=>{const c=Number(xn(w))-Number(xn(_));return c||(n==="size"?o*((Sn(_)?_.size:0)-(Sn(w)?w.size:0))||d(_,w):n==="mtime"?o*(_.mtime-w.mtime)||d(_,w):o*d(_,w))})}const cT=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"],["webp","image/webp"],["bmp","image/bmp"],["ico","image/x-icon"]]),iS=s=>s.includes(".")?cT.get(s.split(".").pop().toLowerCase()):void 0;function uT(s){const n=Math.min(s.length,4096);let l=0;for(let o=0;o<n;o++){const d=s[o];if(d===0)return!1;d<32&&d!==9&&d!==10&&d!==13&&d!==27&&l++}return l<=n/50}function vb({open:s,title:n,label:l,initial:o="",confirmText:d,taken:_,onSubmit:w,onClose:c}){const h=M.useId(),[y,p]=M.useState(o),[f,x]=M.useState(!1),[C,j]=M.useState(null),[E,g]=M.useState(!1),b=M.useRef(null);M.useEffect(()=>{s&&(p(o),j(null),g(!1),requestAnimationFrame(()=>{const N=b.current;if(!N)return;N.focus();const T=o.lastIndexOf(".");N.setSelectionRange(0,T>0?T:o.length)}))},[s,o]);const v=M.useMemo(()=>{const N=y.trim();return N?N.includes("/")?"Names can’t contain “/”.":N==="."||N===".."?"That name isn’t allowed.":N.length>255?"Keep it under 255 characters.":N!==o&&_.includes(N)?"Something with that name is already here.":null:"Enter a name."},[y,_,o]),S=async N=>{if(N.preventDefault(),g(!0),v||y.trim()===o){v||c();return}x(!0),j(null);try{await w(y.trim()),c()}catch(T){j(T)}finally{x(!1)}};return r.jsx(si,{open:s,onClose:c,dismissible:!f,size:"sm",title:n,footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:c,disabled:f,children:"Cancel"}),r.jsxs("button",{type:"submit",form:`${h}-form`,className:"btn btn--primary",disabled:f,children:[f?r.jsx("span",{className:"spinner sm"}):null," ",d]})]}),children:r.jsxs("form",{id:`${h}-form`,className:"stack",onSubmit:S,children:[r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:`${h}-name`,children:l}),r.jsx("input",{ref:b,id:`${h}-name`,className:`input mono${E&&v?" is-invalid":""}`,value:y,onChange:N=>p(N.target.value),autoComplete:"off",spellCheck:!1,maxLength:255}),E&&v&&r.jsx("span",{className:"field-error",children:v})]}),C!==null&&r.jsx(Nt,{error:C})]})})}function hT({preview:s,onDownload:n,onClose:l}){return r.jsxs(si,{open:!!s,onClose:l,size:"lg",title:s?.name??"",footer:s&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"muted preview-size",children:Fs(s.size)}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:n,disabled:s.kind==="loading",children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsx("button",{type:"button",className:"btn btn--primary",onClick:l,children:"Close"})]}),children:[s?.kind==="loading"&&r.jsxs("div",{className:"op-progress",children:[r.jsxs("div",{className:"op-progress-text",children:[r.jsx("span",{children:"Reading from the TV…"}),r.jsx("span",{className:"mono",children:Fs(s.got)})]}),r.jsx("div",{className:"progress",children:r.jsx("div",{className:"progress-fill is-indeterminate"})})]}),s?.kind==="text"&&r.jsxs(r.Fragment,{children:[s.truncated&&r.jsxs("p",{className:"muted",children:["Showing the first ",Fs(s.text.length),". Download the file to see all of it."]}),r.jsx("pre",{className:"file-preview-text",children:s.text||"(empty file)"})]}),s?.kind==="image"&&r.jsx("div",{className:"file-preview-image",children:r.jsx("img",{src:s.url,alt:s.name})}),s?.kind==="binary"&&r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"files"})}),r.jsx("h3",{children:"No preview for this file"}),r.jsx("p",{children:"It doesn’t look like text or an image. Download it to open it on this computer."})]}),s?.kind==="error"&&r.jsx(Nt,{error:s.error,title:"Couldn’t read the file"})]})}function dT({progress:s,onCancel:n,onClose:l}){const o=s?.error!==void 0;return r.jsxs(si,{open:!!s,onClose:o?s?.choose?()=>s.choose("abort"):l:n,dismissible:o||!!s?.canCancel,title:s?.title??"",footer:s&&(o&&s.choose?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>s.choose("abort"),children:s.canSkip?"Stop":"Close"}),s.canSkip&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>s.choose("skip"),children:"Skip"}),r.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>s.choose("retry"),children:"Retry"})]}):o?r.jsx("button",{type:"button",className:"btn btn--primary",onClick:l,children:"Close"}):s.canCancel?r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:n,children:"Cancel"}):null),children:[s&&!o&&r.jsxs("div",{className:"op-progress",children:[s.step&&r.jsx("div",{className:"muted",children:s.step}),r.jsxs("div",{className:"op-progress-text",children:[r.jsx("span",{children:s.text}),s.percent!==void 0&&r.jsxs("span",{className:"mono",children:[s.percent,"%"]})]}),r.jsx("div",{className:"progress",children:r.jsx("div",{className:`progress-fill${s.percent===void 0?" is-indeterminate":""}`,style:s.percent!==void 0?{width:`${s.percent}%`,animation:"none"}:void 0})})]}),s&&o&&r.jsx(Nt,{error:s.error,title:s.errorTitle})]})}const rf=512*1024,fT=20*1024*1024,mT=500*1024*1024;function pT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Device",title:"Files",sub:s?r.jsxs(r.Fragment,{children:["Browse ",r.jsx(ii,{device:s})," over SFTP. Drop files on this page to upload them to the folder you’re in."]}):"Browse your TV’s files."}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(vT,{device:s},`${s.id}:${s.updatedAt}`)})})]})}function gT(s){return xn(s)?"folder":s.type==="l"?"link":s.type==="-"?iS(s.name)?"image":"file":"cog"}function vT({device:s}){const{ready:n,call:l,client:o}=ut(),{confirm:d,toast:_}=jt(),w=En(),c=M.useMemo(()=>gt(s),[s]),[h,y]=M.useState(null),p=h?h.stack[h.i]:null,[f,x]=M.useState({key:"name",dir:"asc"}),[C,j]=M.useState(new Set),[E,g]=M.useState(!1),[b,v]=M.useState(""),[S,N]=M.useState(null),[T,D]=M.useState(null),[O,k]=M.useState(null),[L,V]=M.useState(!1),q=M.useRef(0),Y=M.useRef(null),P=M.useRef(null),Q=ss({queryKey:["files-home",s.id,s.updatedAt],queryFn:async()=>(await l("files.home",{device:c},3e4)).path,enabled:n,staleTime:1/0,retry:!1});M.useEffect(()=>{!h&&Q.data&&y({stack:[Q.data],i:0})},[Q.data,h]);const he=["files",s.id,s.updatedAt,p],ne=ss({queryKey:he,queryFn:()=>l("files.list",{device:c,path:p},6e4),enabled:n&&!!p,staleTime:1e4,retry:!1}),W=ss({queryKey:["storage",s.id,s.updatedAt,p],queryFn:()=>l("device.storage",{device:c,path:p},3e4),enabled:n&&!!p,staleTime:3e4,retry:!1}),I=M.useMemo(()=>oT(ne.data?.items??[],f.key,f.dir),[ne.data,f]),A=M.useMemo(()=>I.map(G=>G.name),[I]),B=I.filter(G=>C.has(G.name)),F=!!O&&O.error===void 0,$=()=>w.invalidateQueries({queryKey:["files",s.id]}),J=G=>{j(new Set),g(!1),y(Se=>{if(!Se)return{stack:[G],i:0};if(Se.stack[Se.i]===G)return Se;const Ie=[...Se.stack.slice(0,Se.i+1),G].slice(-20);return{stack:Ie,i:Ie.length-1}})},z=G=>{j(new Set),y(Se=>Se&&{...Se,i:Math.max(0,Math.min(Se.stack.length-1,Se.i+G))})},ee=G=>j(Se=>{const Ie=new Set(Se);return Ie.has(G)?Ie.delete(G):Ie.add(G),Ie}),de=I.length>0&&C.size===I.length,Z=G=>x(Se=>({key:G,dir:Se.key===G&&Se.dir==="asc"?"desc":"asc"})),U=G=>f.key===G?f.dir==="asc"?"ascending":"descending":"none",ue=G=>{if(p){if(xn(G))return J(hl(p,G.name));if(G.type==="l"&&G.link?.broken){_({kind:"warning",title:`${G.name} is a broken link`,text:G.link.target?`It points to ${G.link.target}, which doesn’t exist.`:void 0});return}Sn(G)&&pe(G)}},pe=async G=>{const Se=hl(p,G.name),Ie=G.type==="l"?(await l("files.stat",{device:c,path:Se}).catch(()=>G)).size:G.size,Qe=new AbortController;Y.current=Qe,D({kind:"loading",name:G.name,size:Ie,got:0,path:Se});const He=Be=>!Qe.signal.aborted&&D({...Be,path:Se});try{const Be=iS(G.name);if(Be&&Ie<=fT){const Ft=await Vd(o,c,Se,{onProgress:bi=>He({kind:"loading",name:G.name,size:Ie,got:bi}),signal:Qe.signal});He({kind:"image",name:G.name,size:Ie,url:URL.createObjectURL(new Blob(Ft.parts,{type:Be}))});return}const dt=await Vd(o,c,Se,{limit:rf,signal:Qe.signal}),De=new Uint8Array(await new Blob(dt.parts).arrayBuffer()).subarray(0,rf);if(!uT(De))return He({kind:"binary",name:G.name,size:Ie});He({kind:"text",name:G.name,size:Ie,text:new TextDecoder("utf-8",{fatal:!1}).decode(De),truncated:dt.truncated||Ie>rf})}catch(Be){Be instanceof yt&&Be.code==="cancelled"||He({kind:"error",name:G.name,size:Ie,error:Be})}},me=()=>{Y.current?.abort(),T?.kind==="image"&&URL.revokeObjectURL(T.url),D(null)},ge=(G,Se,Ie,Qe)=>new Promise(He=>k({...G,canCancel:!1,canSkip:Qe,error:Se,errorTitle:Ie,choose:Be=>{k(null),He(Be)}})),Re=async G=>{if(!o||!G.length)return;const Se=G.reduce((He,Be)=>He+Be.size,0);if(Se>mT&&!await d({title:`Download ${Fs(Se)}?`,message:r.jsx(r.Fragment,{children:"The browser keeps the whole download in memory until it is saved, which can slow this computer down or fail for very large files."}),confirmText:"Download"}))return;const Ie=new AbortController;Y.current=Ie;let Qe=0;for(const[He,Be]of G.entries()){const dt={title:G.length>1?"Downloading files":`Downloading ${Be.name}`,step:G.length>1?`${He+1} of ${G.length}: ${Be.name}`:void 0,canCancel:!0};for(;;){k({...dt,text:"Reading from the TV…",percent:Be.size?0:void 0});try{const De=await Vd(o,c,Be.path,{signal:Ie.signal,onProgress:Ft=>k({...dt,text:`${Fs(Ft)} of ${Fs(Be.size)}`,percent:Be.size?Math.min(100,Math.round(Ft/Be.size*100)):void 0})});Cn(new Blob(De.parts),Be.name),Qe++;break}catch(De){if(De instanceof yt&&De.code==="cancelled")return k(null);const Ft=await ge({...dt,text:""},De,`Couldn’t download ${Be.name}`,G.length>1);if(Ft==="abort")return;if(Ft==="skip")break}}}k(null),Qe>1&&_({kind:"success",title:`Downloaded ${Qe} files`})},tt=()=>Re(B.filter(Sn).map(G=>({name:G.name,path:hl(p,G.name),size:G.type==="-"?G.size:0}))),qe=async G=>{if(!o||!p||!G.length||F)return;const Se=p,Ie=new Map(I.map(dt=>[dt.name,dt])),Qe=new AbortController;Y.current=Qe;let He=0;const Be=()=>{$(),W.refetch(),He&&_({kind:"success",title:He===1&&G.length===1?`Uploaded ${G[0].name}`:`Uploaded ${He} ${He===1?"file":"files"}`,text:`To ${Se}.`})};for(const[dt,De]of G.entries()){const Ft=G.length>1?`Uploading ${G.length} files`:`Uploading ${De.name}`,bi=G.length>1?`${dt+1} of ${G.length}: ${De.name}`:void 0,Ss={title:Ft,step:bi,canCancel:!0},Fi=Ie.get(De.name),Tl=De.size>Rf?new Error(`It is larger than the bridge accepts (${Fs(Rf)}).`):Fi&&xn(Fi)?new Error(`There is a folder called ${De.name} in ${Se}. Rename one of them first.`):null;if(Tl){if(await ge({...Ss,text:""},Tl,`Can’t upload ${De.name}`,G.length>1)==="abort")return Be();continue}if(!(Fi&&(k(null),!await d({title:`Replace ${De.name}?`,message:r.jsxs(r.Fragment,{children:["A file called ",r.jsx("b",{children:De.name})," is already in ",r.jsx("span",{className:"mono",children:Se}),". Replace it with the one from this computer?"]}),confirmText:"Replace",danger:!0}))))for(;;){const rr=ea();k({...Ss,text:"Sending to the bridge…",percent:0});const ns=pc(o,rr,ai=>k({...Ss,canCancel:!1,text:ai.text??"Copying to the TV…",percent:ai.percent}));try{const ai=await H0(o,De,(Vi,fa)=>k({...Ss,text:`Sending to the bridge… ${Fs(Vi)} of ${Fs(fa)}`,percent:Math.round(Vi/Math.max(1,fa)*100)}),Qe.signal);k({...Ss,canCancel:!1,text:"Copying to the TV…",percent:0}),await o.call("files.write",{device:c,path:hl(Se,De.name),uploadId:ai,opId:rr,overwrite:!!Fi},30*6e4),He++;break}catch(ai){if(ai instanceof yt&&ai.code==="cancelled")return k(null),Be();const Vi=await ge({...Ss,text:""},ai,`Couldn’t upload ${De.name}`,G.length>1);if(Vi==="abort")return Be();if(Vi==="skip")break}finally{ns()}}}k(null),Be()},at=async()=>{if(!p||!B.length)return;const G=B.slice(0,6);if(!await d({title:B.length===1?`Delete ${B[0].name}?`:`Delete ${B.length} items?`,message:r.jsxs(r.Fragment,{children:[r.jsxs("ul",{className:"plain-list mono",children:[G.map(dt=>r.jsxs("li",{children:[dt.name,dt.type==="d"?"/ (and everything in it)":""]},dt.name)),B.length>G.length&&r.jsxs("li",{children:["…and ",B.length-G.length," more"]})]}),r.jsx("p",{children:"This can’t be undone. Deleting files you don’t know may break your TV."})]}),confirmText:"Delete",danger:!0}))return;const Ie=p,Qe=B;let He=0;const Be=()=>{j(new Set),$(),W.refetch(),He&&_({kind:"success",title:He===1&&Qe.length===1?`Deleted ${Qe[0].name}`:`Deleted ${He} ${He===1?"item":"items"}`})};for(const[dt,De]of Qe.entries()){const Ft={title:"Deleting",step:Qe.length>1?`${dt+1} of ${Qe.length}`:void 0,canCancel:!1};for(;;){k({...Ft,text:De.name});try{await l("files.remove",{device:c,path:hl(Ie,De.name)},13e4),He++;break}catch(bi){const Ss=await ge({...Ft,text:""},bi,`Couldn’t delete ${De.name}`,Qe.length>1);if(Ss==="abort")return Be();if(Ss==="skip")break}}}k(null),Be()},we=async G=>{await l("files.mkdir",{device:c,parent:p,name:G}),$(),_({kind:"success",title:`Created ${G}`})},Ke=async(G,Se)=>{await l("files.rename",{device:c,parent:p,from:G.name,to:Se}),j(new Set([Se])),$()},Bt=()=>{const G=nT(b,p??"/");if(!G)return _({kind:"warning",title:"That isn’t a path on the TV",text:"Use an absolute path like /media/developer."});J(G)},bs=G=>{G.key==="Enter"&&Bt(),G.key==="Escape"&&g(!1)},is={onDragEnter:G=>{[...G.dataTransfer.types].includes("Files")&&(q.current++,V(!0))},onDragLeave:()=>{q.current=Math.max(0,q.current-1),q.current||V(!1)},onDragOver:G=>{[...G.dataTransfer.types].includes("Files")&&G.preventDefault()},onDrop:G=>{G.preventDefault(),q.current=0,V(!1),qe([...G.dataTransfer.files])}},es=ne.error??Q.error,wt=!!p&&p!=="/",It=W.data?Math.round(W.data.used/Math.max(1,W.data.total)*100):0;return r.jsxs("section",{className:"card col-12 files-card",...is,children:[r.jsxs("div",{className:"files-nav",children:[r.jsxs("div",{className:"btn-group-tight",children:[r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>z(-1),disabled:!h||h.i===0,"aria-label":"Back",title:"Back",children:r.jsx(ce,{name:"chevLeft"})}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>z(1),disabled:!h||h.i>=h.stack.length-1,"aria-label":"Forward",title:"Forward",children:r.jsx(ce,{name:"chevRight"})}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>p&&J(iT(p)),disabled:!wt,"aria-label":"Up one folder",title:"Up one folder",children:r.jsx(ce,{name:"arrowUp"})}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>Q.data&&J(Q.data),disabled:!Q.data,"aria-label":"Home folder",title:Q.data?`Home (${Q.data})`:"Home",children:r.jsx(ce,{name:"home"})})]}),E?r.jsx("input",{className:"input mono files-path-input","aria-label":"Path",value:b,autoFocus:!0,onChange:G=>v(G.target.value),onKeyDown:bs,onBlur:()=>g(!1),spellCheck:!1}):r.jsxs("nav",{className:"files-crumbs","aria-label":"Folder path",children:[p?rT(p).map((G,Se,Ie)=>r.jsxs("span",{className:"files-crumb",children:[Se>1&&r.jsx("span",{className:"files-crumb-sep",children:"/"}),r.jsx("button",{type:"button",className:Se===Ie.length-1?"is-current":void 0,onClick:()=>J(G.path),"aria-current":Se===Ie.length-1?"page":void 0,children:Se===0?r.jsx(ce,{name:"disk"}):G.name})]},G.path)):r.jsx("span",{className:"muted",children:Q.error?"Couldn’t connect":`Connecting to ${s.name}…`}),r.jsx("button",{type:"button",className:"files-path-edit",onClick:()=>{v(p??"/"),g(!0)},"aria-label":"Type a path",title:"Type a path",children:r.jsx(ce,{name:"edit"})})]}),r.jsxs("div",{className:"btn-group-tight",children:[r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>$(),disabled:!p||ne.isFetching,"aria-label":"Refresh",title:"Refresh",children:r.jsx(ce,{name:"refresh",className:ne.isFetching?"spin":void 0})}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>N({kind:"mkdir"}),disabled:!ne.data||F,children:[r.jsx(ce,{name:"folderPlus"})," ",r.jsx("span",{className:"hide-sm",children:"New folder"})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",onClick:()=>P.current?.click(),disabled:!ne.data||F,children:[r.jsx(ce,{name:"upload"})," ",r.jsx("span",{className:"hide-sm",children:"Upload"})]}),r.jsx("input",{ref:P,type:"file",multiple:!0,hidden:!0,onChange:G=>{qe([...G.target.files??[]]),G.target.value=""}})]})]}),B.length>0&&r.jsxs("div",{className:"files-selbar",role:"toolbar","aria-label":"Selected items",children:[r.jsxs("span",{className:"files-selbar-count",children:[B.length," selected"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:tt,disabled:F||!B.some(Sn),title:B.every(Sn)?void 0:"Folders are skipped — only files can be downloaded",children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>N({kind:"rename",item:B[0]}),disabled:F||B.length!==1,children:[r.jsx(ce,{name:"edit"})," Rename"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-danger",onClick:at,disabled:F,children:[r.jsx(ce,{name:"trash"})," Delete"]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost files-selbar-clear",onClick:()=>j(new Set),children:"Clear"})]}),es?r.jsx(Nt,{error:es,title:xt(es).code==="no_sftp"?"The file browser needs SFTP":`Couldn’t open ${p??"the home folder"}`,action:r.jsxs("div",{className:"row",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>Q.error?Q.refetch():ne.refetch(),children:"Retry"}),p&&Q.data&&p!==Q.data&&r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>J(Q.data),children:"Home"})]})}):ne.data?I.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"folder"})}),r.jsx("h3",{children:"This folder is empty"}),r.jsx("p",{children:"Drop files here or use Upload to put something in it."})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table files-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"files-check",children:r.jsxs("label",{className:"check",title:de?"Select none":"Select all",children:[r.jsx("input",{type:"checkbox",checked:de,"aria-label":"Select all",ref:G=>{G&&(G.indeterminate=C.size>0&&!de)},onChange:()=>j(de?new Set:new Set(A))}),r.jsx("span",{className:"box"})]})}),[["name","Name",""],["size","Size","files-num"],["mtime","Modified","hide-sm"]].map(([G,Se,Ie])=>r.jsx("th",{className:`${Ie} ${f.key===G?`sorted-${f.dir}`:""}`,"aria-sort":U(G),children:r.jsxs("button",{type:"button",className:"th-sort",onClick:()=>Z(G),children:[Se,r.jsx("span",{className:"sort",children:r.jsx(ce,{name:"chevDown"})})]})},G)),r.jsx("th",{className:"hide-sm",children:"Permissions"}),r.jsx("th",{className:"hide-md",children:"Owner"})]})}),r.jsx("tbody",{children:I.map(G=>{const Se=C.has(G.name),Ie=G.access&&!G.access.write;return r.jsxs("tr",{className:Se?"is-selected":void 0,onDoubleClick:()=>ue(G),children:[r.jsx("td",{className:"files-check",children:r.jsxs("label",{className:"check",children:[r.jsx("input",{type:"checkbox",checked:Se,onChange:()=>ee(G.name),"aria-label":`Select ${G.name}`}),r.jsx("span",{className:"box"})]})}),r.jsx("td",{children:r.jsxs("div",{className:"files-name",children:[r.jsx("span",{className:`files-ico files-ico--${xn(G)?"dir":G.type==="l"?"link":"file"}`,children:r.jsx(ce,{name:gT(G)})}),xn(G)||Sn(G)||G.type==="l"?r.jsx("button",{type:"button",className:"files-open",onClick:()=>ue(G),title:xn(G)?`Open ${G.name}`:`Preview ${G.name}`,children:G.name}):r.jsx("span",{className:"files-open is-plain",children:G.name}),G.link&&r.jsxs("span",{className:`files-link${G.link.broken?" is-broken":""}`,title:G.link.broken?"Broken link":void 0,children:["→ ",G.link.target??"?"]}),Ie&&r.jsx("span",{className:"files-lock",title:"Read-only for this login",children:r.jsx(ce,{name:"lock"})})]})}),r.jsx("td",{className:"files-num mono",children:Sn(G)&&G.type==="-"?Fs(G.size):"—"}),r.jsx("td",{className:"hide-sm files-time",children:lT(G.mtime)}),r.jsxs("td",{className:"hide-sm mono files-mode",children:[G.type==="-"?"-":G.type,G.mode]}),r.jsxs("td",{className:"hide-md files-owner",children:[G.user??"—",G.group&&G.group!==G.user?r.jsxs("span",{className:"muted",children:[" · ",G.group]}):null]})]},G.name)})})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:p?`Opening ${p}…`:`Connecting to ${s.name}…`})]}),r.jsxs("div",{className:"data-foot files-foot",children:[r.jsxs("span",{className:"muted",children:[ne.data?`${I.length} ${I.length===1?"item":"items"}`:"",B.length>0?` · ${B.length} selected`:""]}),W.data&&r.jsxs("div",{className:"storage-bar",title:`Free space where ${p} lives`,children:[r.jsx(ce,{name:"disk"}),r.jsxs("span",{children:[r.jsx("b",{children:Fs(W.data.available*1024)})," free of ",Fs(W.data.total*1024)]}),r.jsx("div",{className:"progress thin",children:r.jsx("div",{className:`progress-fill${It>90?" danger":It>75?" warning":""}`,style:{width:`${It}%`}})})]})]}),L&&r.jsx("div",{className:"drop-overlay","aria-hidden":"true",children:r.jsxs("div",{className:"drop-overlay-card",children:[r.jsx(ce,{name:"upload"}),r.jsxs("div",{children:["Drop to upload to ",p]})]})}),r.jsx(vb,{open:S?.kind==="mkdir",title:"New folder",label:`Name of the new folder in ${p}`,confirmText:"Create",taken:A,onSubmit:we,onClose:()=>N(null)}),r.jsx(vb,{open:S?.kind==="rename",title:S?.kind==="rename"?`Rename ${S.item.name}`:"Rename",label:"New name",initial:S?.kind==="rename"?S.item.name:"",confirmText:"Rename",taken:A,onSubmit:G=>S?.kind==="rename"?Ke(S.item,G):Promise.resolve(),onClose:()=>N(null)}),r.jsx(hT,{preview:T,onClose:me,onDownload:()=>{if(!T)return;const G=T;me(),Re([{name:G.name,path:G.path,size:G.size}])}}),r.jsx(dT,{progress:O,onCancel:()=>Y.current?.abort(),onClose:()=>k(null)})]})}var af={exports:{}},_b;function _T(){return _b||(_b=1,(function(s,n){(function(l,o){s.exports=o()})(globalThis,(()=>(()=>{var l={4567:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=h(9042),x=h(9924),C=h(844),j=h(4725),E=h(2585),g=h(3656);let b=c.AccessibilityManager=class extends C.Disposable{constructor(v,S,N,T){super(),this._terminal=v,this._coreBrowserService=N,this._renderService=T,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let D=0;D<this._terminal.rows;D++)this._rowElements[D]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[D]);if(this._topBoundaryFocusListener=D=>this._handleBoundaryFocus(D,0),this._bottomBoundaryFocusListener=D=>this._handleBoundaryFocus(D,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(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((D=>this._handleResize(D.rows)))),this.register(this._terminal.onRender((D=>this._refreshRows(D.start,D.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((D=>this._handleChar(D)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
22
+ -----END OPENSSH PRIVATE KEY-----`,spellCheck:!1,autoComplete:"off",rows:5}),l&&r.jsx("span",{className:"field-error",children:l}),c&&r.jsx("span",{className:"field-error",children:c}),!l&&!c&&r.jsxs("span",{className:"field-help",children:[s.fileName?r.jsxs(r.Fragment,{children:["Loaded from ",r.jsx("span",{className:"mono",children:s.fileName}),". "]}):null,"Usually ",r.jsx("span",{className:"mono",children:"~/.ssh/id_ed25519"})," or ",r.jsx("span",{className:"mono",children:"id_rsa"})," on your computer. It is saved only in this browser."]}),r.jsx(ZN,{check:w})]}),y&&r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:`${d}-kpp`,children:"Key passphrase"}),r.jsx("input",{id:`${d}-kpp`,className:`input${w.state==="bad-passphrase"?" is-invalid":""}`,type:"password",value:s.passphrase,onChange:f=>n({...s,passphrase:f.target.value}),autoComplete:"off"})]})]})}function ZN({check:s}){switch(s.state){case"checking":return r.jsxs("span",{className:"field-help",children:[r.jsx("span",{className:"spinner sm"})," Checking key…"]});case"ok":return r.jsxs("span",{className:"field-ok",children:[r.jsx(ce,{name:"check",strokeWidth:2.4})," ",s.type," key · ",r.jsx("span",{className:"mono",children:s.fingerprint})]});case"needs-passphrase":return r.jsx("span",{className:"field-error",children:"This key is protected. Enter its passphrase below."});case"bad-passphrase":return r.jsx("span",{className:"field-error",children:"Wrong passphrase for this key."});case"bad-key":return r.jsx("span",{className:"field-error",children:"This doesn’t look like a private key (unsupported format)."});case"offline":return r.jsx("span",{className:"field-help",children:"Connect the bridge to check this key."});default:return null}}function XN({value:s,onChange:n,username:l,problem:o}){const{ready:d,call:_}=ut(),{toast:w}=jt(),[c,h]=M.useState(!1),y=async()=>{h(!0);try{const f=await _("device.generateKey",{comment:"lg-dev-manager"});n({kind:"generated",...f})}catch(f){w({kind:"danger",title:"Could not make a key",text:f.message})}finally{h(!1)}},p=l==="root"?"/home/root/.ssh/authorized_keys":"~/.ssh/authorized_keys";return s.privateKey?r.jsxs("div",{className:"field",children:[r.jsx("span",{className:"field-label",children:"Public key — add this line to the TV"}),r.jsx("div",{className:"codeblock codeblock--wrap",children:s.publicKey}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>navigator.clipboard.writeText(s.publicKey).then(()=>w({kind:"success",title:"Public key copied"}),()=>w({kind:"warning",title:"Copy failed",text:"Select the key and copy it by hand."})),children:[r.jsx(ce,{name:"copy"})," Copy"]}),r.jsxs("span",{className:"field-help",children:["Append it to ",r.jsx("span",{className:"mono",children:p})," on the TV (for example from an SSH session that still uses the password), then continue."]})]})]}):r.jsxs("div",{className:"field",children:[r.jsx("span",{className:"field-help",children:"The bridge makes a new ed25519 key pair. The private key is saved only in this browser; you add the public key to the TV once."}),r.jsx("div",{children:r.jsxs("button",{type:"button",className:"btn btn--soft-primary",onClick:y,disabled:!d||c,children:[r.jsx(ce,{name:"key"})," ",c?"Making key…":"Make a new key"]})}),o&&r.jsx("span",{className:"field-error",children:o})]})}function WN({device:s,onClose:n}){const{call:l,ready:o}=ut(),{devices:d}=Mt(),{toast:_}=jt(),[w,c]=M.useState(""),[h,y]=M.useState(""),[p,f]=M.useState(""),[x,C]=M.useState(0),[j,E]=M.useState(""),[g,b]=M.useState({kind:"keep"}),[v,S]=M.useState(!0),[N,T]=M.useState(!1),[D,O]=M.useState(!1),[k,L]=M.useState(null);M.useEffect(()=>{s&&(c(s.name),y(s.description??""),f(s.host),C(s.port),E(s.username),b({kind:"keep"}),T(!1),L(null))},[s]);const V=M.useMemo(()=>["keep",...s?.mode==="devmode"?["devkey"]:[],"password","key","generated"],[s?.mode]),q=M.useCallback(I=>S(I),[]);if(!s)return r.jsx(si,{open:!1,onClose:n,title:"",children:null});const Y=w.trim()?d?.some(I=>I.id!==s.id&&I.name===w.trim())?"You already have a TV with this name.":null:"Give the TV a name.",P=bl(p),Q=!Number.isInteger(x)||x<1||x>65535?"Port must be 1–65535.":null,he=Hc(j)?null:"Not a valid user name.",ne=!Y&&!P&&!Q&&!he&&Object.keys(Sm(g)).length===0&&(g.kind!=="key"||v),W=async I=>{if(I.preventDefault(),T(!0),!!ne){O(!0),L(null);try{let A=g.kind==="keep"?s.auth:G0(g);if(g.kind==="devkey"){const{privateKey:F}=await l("device.fetchKey",{host:p.trim(),passphrase:g.passphrase},3e4);A={kind:"key",privateKey:F,passphrase:g.passphrase}}const B=p.trim()!==s.host||x!==s.port||j!==s.username||g.kind!=="keep";o&&B&&l("device.disconnect",{device:{host:s.host,port:s.port,username:s.username,auth:s.auth}}).catch(()=>{}),await iN(s.id,{name:w.trim(),description:h.trim()||void 0,host:p.trim(),port:x,username:j,mode:j==="root"?"rooted":"devmode",auth:A}),_({kind:"success",title:`Saved ${w.trim()}`}),n()}catch(A){L(A)}finally{O(!1)}}};return r.jsx(si,{open:!0,onClose:n,dismissible:!D,size:"lg",title:`Edit ${s.name}`,footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:n,disabled:D,children:"Cancel"}),r.jsx("button",{type:"submit",form:"edit-device",className:"btn btn--primary",disabled:D,children:D?"Saving…":"Save"})]}),children:r.jsxs("form",{id:"edit-device",className:"stack",onSubmit:W,noValidate:!0,children:[r.jsxs("div",{className:"form-grid",children:[r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-name",children:"Name"}),r.jsx("input",{id:"ed-name",className:`input${N&&Y?" is-invalid":""}`,value:w,onChange:I=>c(I.target.value),maxLength:64}),N&&Y&&r.jsx("span",{className:"field-error",children:Y})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-host",children:"IP address"}),r.jsx("input",{id:"ed-host",className:`input mono${N&&P?" is-invalid":""}`,value:p,onChange:I=>f(I.target.value),spellCheck:!1}),N&&P&&r.jsx("span",{className:"field-error",children:P})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-user",children:"User"}),r.jsx("input",{id:"ed-user",className:`input mono${N&&he?" is-invalid":""}`,value:j,onChange:I=>E(I.target.value.trim()),spellCheck:!1}),N&&he&&r.jsx("span",{className:"field-error",children:he})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-port",children:"SSH port"}),r.jsx("input",{id:"ed-port",className:`input mono${N&&Q?" is-invalid":""}`,type:"number",value:Number.isNaN(x)?"":x,onChange:I=>C(I.target.valueAsNumber)}),N&&Q&&r.jsx("span",{className:"field-error",children:Q})]}),r.jsxs("div",{className:"field span-2",children:[r.jsx("label",{className:"field-label",htmlFor:"ed-desc",children:"Description"}),r.jsx("input",{id:"ed-desc",className:"input",value:h,onChange:I=>y(I.target.value),maxLength:200})]}),r.jsxs("div",{className:"span-2",children:[r.jsx(Y0,{value:g,onChange:b,kinds:V,username:j,showErrors:N,onKeyCheck:q,rootedHint:s.mode==="rooted"}),g.kind==="keep"&&r.jsxs("p",{className:"field-help",style:{margin:"8px 0 0"},children:["Currently: ",Uf(s.auth),"."]})]})]}),k!==null&&r.jsx(Nt,{error:k,title:"Couldn’t save"})]})})}function QN(){const{devices:s,activeId:n}=Mt(),{ready:l,call:o}=ut(),{confirm:d,toast:_}=jt(),[w,c]=M.useState(null),[h,y]=M.useState(null),p=async x=>{y(x.id);try{const C=gt(x),j=await o("device.test",{device:C},4e4),E=await o("device.info",{device:C},4e4).catch(()=>null);E&&vm(x.id,Uc(x,E)).catch(()=>{}),_({kind:"success",title:`${x.name} is reachable`,text:[If(E?.modelName),E?.osVersion&&`webOS ${Rc(E.osVersion)}`,`${j.latencyMs} ms`,j.root?"root":null].filter(Boolean).join(" · ")})}catch(C){_({kind:"danger",title:`Couldn’t reach ${x.name}`,text:xt(C).message})}finally{y(null)}},f=async x=>{await d({title:`Remove ${x.name}?`,message:r.jsxs(r.Fragment,{children:["This removes ",r.jsx("b",{children:x.name})," and its saved ",Uf(x.auth)," from this browser. Nothing on the TV changes, and you can add it again later."]}),confirmText:"Remove",danger:!0})&&(l&&o("device.disconnect",{device:gt(x)}).catch(()=>{}),await nN(x.id),_({kind:"success",title:`Removed ${x.name}`}))};return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Setup",title:"Devices",sub:"The TVs this browser knows about. The active TV is the one the Apps, Files and Terminal pages work with.",actions:r.jsxs(Jt,{to:"/devices/new",className:"btn btn--primary",children:[r.jsx(ce,{name:"plus"})," Add a TV"]})}),r.jsxs("div",{className:"grid",children:[!l&&(s?.length??0)>0&&r.jsx("div",{className:"col-12",children:r.jsx($e,{kind:"info",title:"The bridge isn’t connected",action:r.jsx(Jt,{to:"/bridge",className:"btn btn--sm btn--ghost",children:"Bridge"}),children:"You can rename or remove TVs, but testing them needs the bridge."})}),r.jsx("section",{className:"card col-12",children:s===null?r.jsx("div",{className:"empty-state",children:r.jsx("span",{className:"spinner"})}):s.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"tv"})}),r.jsx("h3",{children:"No TVs yet"}),r.jsx("p",{children:"Add your LG TV in Developer Mode or a rooted TV. The wizard checks the connection and fetches the login key for you."}),r.jsxs(Jt,{to:"/devices/new",className:"btn btn--primary",children:[r.jsx(ce,{name:"plus"})," Add a TV"]})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table devices-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Name"}),r.jsx("th",{className:"hide-sm",children:"Address"}),r.jsx("th",{className:"hide-sm",children:"Type"}),r.jsx("th",{className:"hide-sm",children:"Login"}),r.jsx("th",{"aria-label":"Status"}),r.jsx("th",{"aria-label":"Actions"})]})}),r.jsx("tbody",{children:s.map(x=>{const C=x.id===n;return r.jsxs("tr",{className:C?"is-selected":void 0,children:[r.jsx("td",{children:r.jsxs("div",{className:"data-cell-user",children:[r.jsx("span",{className:"device-av",children:r.jsx(ce,{name:"tv"})}),r.jsxs("div",{className:"data-cell-user-meta",children:[r.jsx("div",{className:"data-cell-user-name",children:x.name}),x.info?.modelName&&r.jsxs("div",{className:"cell-sub",title:x.info.firmwareVersion?`Firmware ${x.info.firmwareVersion}`:void 0,children:[If(x.info.modelName),x.info.osVersion&&r.jsxs(r.Fragment,{children:[" · webOS ",Rc(x.info.osVersion)]})]}),x.description&&r.jsx("div",{className:"cell-sub",children:x.description}),r.jsxs("div",{className:"cell-sub mono show-sm",children:[x.host,":",x.port]})]})]})}),r.jsxs("td",{className:"data-cell-mono hide-sm",children:[x.host,":",x.port]}),r.jsx("td",{className:"hide-sm",children:r.jsx("span",{className:`badge ${x.mode==="rooted"?"purple":"info"}`,children:x.mode==="rooted"?"Rooted":"Dev Mode"})}),r.jsxs("td",{className:"data-cell-mono hide-sm",children:[x.username," · ",Uf(x.auth)]}),r.jsx("td",{children:C?r.jsx("span",{className:"badge success dot",children:"Active"}):r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>Nn(x.id),children:"Make active"})}),r.jsx("td",{children:r.jsxs("div",{className:"data-cell-actions",children:[r.jsx("button",{type:"button",className:"btn btn--icon",title:"Test connection","aria-label":`Test connection to ${x.name}`,onClick:()=>p(x),disabled:!l||h===x.id,children:h===x.id?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"pulse"})}),r.jsx("button",{type:"button",className:"btn btn--icon",title:"Edit","aria-label":`Edit ${x.name}`,onClick:()=>c(x),children:r.jsx(ce,{name:"edit"})}),r.jsx(Ic,{label:`More actions for ${x.name}`,menuClassName:"dd-menu--compact",floating:!0,trigger:({toggle:j,...E})=>r.jsx("button",{type:"button",className:"btn btn--icon","aria-label":`More actions for ${x.name}`,onClick:j,...E,children:r.jsx(ce,{name:"more"})}),children:j=>r.jsx(r.Fragment,{children:r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item danger",onClick:()=>{j(),f(x)},children:[r.jsx(ce,{name:"trash"})," Remove from this browser"]})})})]})})]},x.id)})})]})})}),r.jsx(FN,{})]}),r.jsx(WN,{device:w,onClose:()=>c(null)})]})}const JN=[{key:"webos",label:"webOS TV",port:3e3},{key:"ssh22",label:"Root SSH",port:yl},{key:"ssh9922",label:"Dev Mode SSH",port:hm},{key:"keyServer",label:"Key server",port:l2}];function zf(){return r.jsxs($e,{kind:"warning",title:"This is an LG TV, but its SSH server is off",children:[r.jsxs("ol",{className:"hint-steps",children:[r.jsxs("li",{children:["On the TV, open ",r.jsx("b",{children:"Homebrew Channel"})," and go to ",r.jsx("b",{children:"Settings"}),"."]}),r.jsxs("li",{children:["Turn on ",r.jsx("b",{children:"SSH Server"}),"."]}),r.jsxs("li",{children:["On the same screen, select ",r.jsx("b",{children:"System reboot"})," — Homebrew Channel’s settings only take effect after a reboot."]}),r.jsxs("li",{children:["When the TV is back on, press ",r.jsx("b",{children:"Check"})," here again."]})]}),"If Homebrew Channel isn’t installed, the TV isn’t rooted — choose ",r.jsx("b",{children:"Developer Mode"})," instead."]})}function ej({result:s,checking:n,mode:l,port:o}){return!s&&!n?null:r.jsxs("div",{className:"stack",style:{gap:10},children:[r.jsx("div",{className:"port-chips","aria-live":"polite",children:JN.map(d=>{const _=s?.[d.key],w=n?"is-checking":_?"is-open":"is-closed";return r.jsxs("span",{className:`port-chip ${w}`,children:[r.jsx("span",{className:"dot","aria-hidden":"true"}),d.label," ",r.jsx("span",{className:"mono",children:d.port}),r.jsx("span",{className:"sr-only",children:n?"checking":_?"open":"closed"})]},d.key)})}),s&&!n&&r.jsx(tj,{result:s,mode:l,port:o})]})}function tj({result:s,mode:n,port:l}){return s.ssh22||s.ssh9922||s.keyServer||s.webos?n==="devmode"?s.ssh9922?s.keyServer?r.jsx($e,{kind:"success",title:"Ready",children:"Developer Mode SSH and the key server both answer."}):r.jsxs($e,{kind:"warning",title:"Key Server is off",children:["Turn on ",r.jsx("b",{children:"Key Server"})," in the Developer Mode app while adding the TV. If it is already on, try turning it off and on again."]}):r.jsxs($e,{kind:"warning",title:"Developer Mode SSH isn’t answering",children:["Open the Developer Mode app and check that ",r.jsx("b",{children:"Dev Mode Status"})," is ON. The TV restarts when you turn it on."]}):n==="rooted"&&!s.ssh22?s.webos?r.jsx(zf,{}):r.jsxs($e,{kind:"warning",title:"SSH on port 22 isn’t answering",children:["In Homebrew Channel → ",r.jsx("b",{children:"Settings"}),", turn on ",r.jsx("b",{children:"SSH Server"}),", then select ",r.jsx("b",{children:"System reboot"})," on the same screen."]}):n==="rooted"?r.jsx($e,{kind:"success",title:"Ready",children:"Homebrew Channel’s SSH server answers on port 22."}):n==="manual"&&l===yl&&!s.ssh22&&s.webos?r.jsx(zf,{}):n==="manual"&&l!==yl&&l!==hm?r.jsxs($e,{kind:"info",children:["Port ",l," isn’t one of the usual ones, so it wasn’t checked. Continue to test the login."]}):null:r.jsxs($e,{kind:"warning",title:"The TV didn’t answer",children:["Check the address, make sure the TV is on and on the same network as this computer",n==="devmode"?", and that Developer Mode is installed and turned on.":"."]})}function $f(s){return s.name?.replace(/^\[LG\]\s*/i,"").replace(/^webOS TV\s*/i,"").trim()||s.modelName||"LG TV"}const sj=(s,n)=>s.trim().replace(/^\[|\]$/g,"").toLowerCase()===n.trim().replace(/^\[|\]$/g,"").toLowerCase(),Pf=(s,n)=>s.filter(l=>sj(l.host,n));function ij({selected:s,onPick:n,saved:l}){const{ready:o,call:d}=ut(),[_,w]=M.useState(null),[c,h]=M.useState(!1),[y,p]=M.useState(null),f=M.useRef(!1),x=async()=>{h(!0),p(null);try{w((await d("device.scan",{timeoutMs:3e3},3e4)).tvs)}catch(C){p(xt(C).message)}finally{h(!1)}};return M.useEffect(()=>{o&&!f.current&&(f.current=!0,x())},[o]),r.jsxs("div",{className:"scan-panel",children:[r.jsxs("div",{className:"scan-head",children:[r.jsxs("div",{children:[r.jsx("div",{className:"scan-title",children:"TVs on your network"}),r.jsx("div",{className:"field-help",children:c?"Looking for LG TVs…":_?.length?"Pick your TV, or type its address below.":_?"No LG TVs found. Make sure the TV is on and on the same network, or type its address below.":"The bridge can look for LG TVs that are switched on."})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:x,disabled:!o||c,children:[c?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"search"})," ",_?"Scan again":"Scan"]})]}),y&&r.jsx("div",{className:"field-error",children:y}),!!_?.length&&r.jsx("div",{className:"scan-list",role:"listbox","aria-label":"TVs found on your network",children:_.map(C=>{const j=Pf(l,C.host),E=r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"device-av",children:r.jsx(ce,{name:"tv"})}),r.jsxs("span",{className:"scan-item-text",children:[r.jsx("span",{className:"scan-item-name",children:$f(C)}),r.jsxs("span",{className:"scan-item-sub mono",children:[C.host,C.modelName&&$f(C)!==C.modelName?` · ${C.modelName}`:""]}),j.length>0&&r.jsxs("span",{className:"scan-item-added",children:["Already added as ",r.jsx("b",{children:j.map(g=>g.name).join(", ")})]})]})]});return r.jsxs("button",{type:"button",role:"option","aria-selected":s===C.host,className:`scan-item${s===C.host?" is-selected":""}${j.length?" is-added":""}`,onClick:()=>n(C),children:[E,r.jsxs("span",{className:"scan-badges",children:[j.length>0&&r.jsxs("span",{className:"badge success",children:[r.jsx(ce,{name:"check"})," Added"]}),r.jsx("span",{className:`badge ${C.ports.ssh22?"success":""}`,children:C.ports.ssh22?"Root SSH on":"Root SSH off"}),C.ports.ssh9922&&r.jsx("span",{className:"badge info",children:"Dev Mode"}),C.ports.keyServer&&r.jsx("span",{className:"badge info",children:"Key server"})]})]},C.host)})}),_?.some(C=>Pf(l,C.host).length)&&r.jsxs("div",{className:"field-help",children:["TVs marked “Added” are already in ",r.jsx(Jt,{to:"/devices",children:"Devices"}),". You can still pick one to add it again with another login, e.g. as root after rooting it."]})]})}const Qy={key:"Fetch the Dev Mode key from the TV",login:"Log in over SSH",info:"Read model and webOS version"};async function nj(s,n,l){const o={steps:{key:"pending",login:"pending",info:"pending"}},d=()=>l({...o,steps:{...o.steps}}),_=async(w,c)=>{o.steps[w]="running",d();try{const h=await c();return o.steps[w]="done",d(),h}catch(h){throw o.steps[w]="failed",o.error=h,o.failedAt=w,d(),h}};try{if(n.auth.kind==="devkey"){const c=n.auth.passphrase,{privateKey:h}=await _("key",()=>s("device.fetchKey",{host:n.host,passphrase:c},3e4));o.auth={kind:"key",privateKey:h,passphrase:c}}else o.steps.key="skipped",o.auth=n.auth.kind==="keep"?n.currentAuth:G0(n.auth)??void 0,d();const w={host:n.host,port:n.port,username:n.username,auth:o.auth};o.login=await _("login",()=>s("device.test",{device:w},4e4)),o.info=await _("info",()=>s("device.info",{device:w},4e4))}catch{}return d(),o}const rj=[{id:"rooted",icon:"shield",title:"Rooted (Homebrew Channel)",text:"For rooted TVs with Homebrew Channel’s SSH server turned on. Logs in as root on port 22 — full access, no session to renew.",badge:"Recommended"},{id:"devmode",icon:"tv",title:"Developer Mode",text:"For TVs that aren’t rooted. Uses the Developer Mode app: SSH on port 9922 and the key from its key server."},{id:"manual",icon:"wrench",title:"Set up manually",text:"Choose the port, user and login yourself — password, your own key, or a new key."}],Z0={devmode:["devkey"],rooted:["password","key","generated"],manual:["key","password","generated","devkey"]},Jy=[{title:"Prepare an LG developer account",body:r.jsxs(r.Fragment,{children:["Developer Mode needs a free LG developer account. Create one at"," ",r.jsx("a",{href:"https://webostv.developer.lge.com/",target:"_blank",rel:"noopener noreferrer",children:"webostv.developer.lge.com"}),"."]})},{title:"Install the Developer Mode app",body:r.jsxs("ol",{children:[r.jsx("li",{children:"Open the LG Content Store on the TV"}),r.jsx("li",{children:"Search for “Developer Mode”"}),r.jsx("li",{children:"Select Install"})]})},{title:"Turn on Developer Mode",body:r.jsxs("ol",{children:[r.jsx("li",{children:"Launch the Developer Mode app"}),r.jsx("li",{children:"Log in with your developer account"}),r.jsx("li",{children:"Turn on Dev Mode Status and wait for the TV to restart"})]})},{title:"Get ready to connect",body:r.jsxs("ol",{children:[r.jsx("li",{children:"Launch the Developer Mode app again"}),r.jsx("li",{children:"Make sure Dev Mode Status is ON"}),r.jsx("li",{children:"Turn on Key Server — it hands this app the login key"})]})}],aj="alpine";function eb(s){return s==="rooted"?{kind:"password",password:aj}:K0(Z0[s][0])}function lj({steps:s,current:n}){const l=s.findIndex(o=>o.id===n);return r.jsx("ol",{className:"stepper","aria-label":"Progress",children:s.map((o,d)=>r.jsxs("li",{className:d<l?"is-done":d===l?"is-current":void 0,"aria-current":d===l?"step":void 0,children:[r.jsx("span",{className:"stepper-num",children:d<l?r.jsx(ce,{name:"check",strokeWidth:2.6}):d+1}),r.jsx("span",{className:"stepper-label",children:o.label})]},o.id))})}function tb(s){const n="LG TV";if(!s.includes(n))return n;for(let l=2;;l++)if(!s.includes(`${n} ${l}`))return`${n} ${l}`}function oj(){const s=Cl(),{ready:n,call:l}=ut(),{devices:o}=Mt(),{toast:d}=jt(),_=M.useMemo(()=>(o??[]).map(G=>G.name),[o]),[w,c]=M.useState("mode"),[h,y]=M.useState("rooted"),[p,f]=M.useState(Jy.map(()=>!1)),[x,C]=M.useState(0),[j,E]=M.useState(""),[g,b]=M.useState(""),[v,S]=M.useState(Zr.rooted.port),[N,T]=M.useState(Zr.rooted.username),[D,O]=M.useState(""),[k,L]=M.useState(eb("rooted")),[V,q]=M.useState(!0),[Y,P]=M.useState(!1),[Q,he]=M.useState(null),[ne,W]=M.useState(""),[I,A]=M.useState(!1),[B,F]=M.useState(null),[$,J]=M.useState(!1),[z,ee]=M.useState(null),de=M.useMemo(()=>[{id:"mode",label:"Connection"},...h==="devmode"?[{id:"prepare",label:"Prepare TV"}]:[],{id:"details",label:"Details"},{id:"verify",label:"Verify"}],[h]),Z=G=>{y(G),S(Zr[G].port),T(Zr[G].username),L(eb(G)),he(null)},U=M.useCallback(G=>q(G),[]),ue=G=>{b(G.host),!j.trim()&&(G.name||G.modelName)&&E($f(G).slice(0,64)),he({ssh22:G.ports.ssh22,ssh9922:G.ports.ssh9922,keyServer:G.ports.keyServer,webos:G.ports.webos}),W(G.host)},pe=(j||tb(_)).trim(),me=pe?pe.length>64?"Keep the name under 64 characters.":_.includes(pe)?"You already have a TV with this name.":null:"Give the TV a name.",ge=bl(g),Re=g.trim()&&!ge?Pf(o??[],g):[],tt=!Number.isInteger(v)||v<1||v>65535?"Port must be 1–65535.":null,qe=Hc(N)?null:"Not a valid user name.",at=!me&&!ge&&!tt&&!qe&&Object.keys(Sm(k)).length===0&&(k.kind!=="key"||V),we=async()=>{const G=g.trim();if(!(bl(G)||!n)){A(!0),W(G);try{he(await l("device.checkConnection",{host:G},2e4))}catch(Se){he(null),d({kind:"danger",title:"Port check failed",text:xt(Se).message})}finally{A(!1)}}},Ke=async()=>{E(pe),c("verify"),J(!0),ee(null);try{const G=await nj(l,{host:g.trim(),port:v,username:N,auth:k},F);G.error?G.failedAt==="login"&&we():await Bt(G)}catch(G){d({kind:"danger",title:"Could not save the TV",text:xt(G).message})}finally{J(!1)}},Bt=async G=>{if(!G.auth)return;const Se=await sN({name:pe,mode:h==="manual"?N==="root"?"rooted":"devmode":h,host:g.trim(),port:v,username:N,auth:G.auth,...D.trim()?{description:D.trim()}:{},...G.info?{info:Uc({host:g.trim(),port:v},G.info)}:{}});Nn(Se.id),ee(Se.id)},bs=G=>{G.preventDefault(),P(!0),at&&Ke()},es=B?.failedAt==="login"&&[Vs.Unreachable,Vs.Timeout].includes(xt(B.error).code)&&h!=="devmode"&&v===22&&ne===g.trim()&&!!Q?.webos&&!Q.ssh22&&!I,wt=!!B?.login&&!!B.auth&&!z;M.useEffect(()=>{if(!(!wt||!B?.auth))return kc.set({name:pe,host:g.trim(),port:v,username:N,device:{host:g.trim(),port:v,username:N,auth:B.auth}}),()=>kc.set(null)},[wt,B?.auth]);const It=()=>{const G=de.findIndex(Se=>Se.id===w);G>0&&c(de[G-1].id)};return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Setup",title:"Add a",accent:"TV",sub:"Connect this browser to an LG TV in Developer Mode or a rooted TV."}),r.jsx("div",{className:"grid",children:r.jsxs("section",{className:"card col-12 wizard",children:[r.jsx(lj,{steps:de,current:w}),!n&&w!=="verify"&&r.jsx($e,{kind:"warning",title:"The bridge isn’t connected",action:r.jsx(Jt,{to:"/bridge",className:"btn btn--sm btn--ghost",children:"Set up the bridge"}),children:"Adding a TV needs the bridge running on this computer: it checks the ports, fetches the key and tests the login."}),w==="mode"&&r.jsxs("div",{className:"wizard-body",children:[r.jsx("p",{className:"muted wizard-lead",children:"If your TV is rooted with Homebrew Channel, choose Rooted. If it isn’t rooted, or you’re not sure, choose Developer Mode."}),r.jsx("div",{className:"choice-grid",role:"radiogroup","aria-label":"Connection type",children:rj.map(G=>r.jsxs("button",{type:"button",role:"radio","aria-checked":h===G.id,className:`choice${h===G.id?" is-selected":""}`,onClick:()=>Z(G.id),onDoubleClick:()=>c(G.id==="devmode"?"prepare":"details"),children:[r.jsx("span",{className:"choice-icon",children:r.jsx(ce,{name:G.icon})}),r.jsxs("span",{className:"choice-title",children:[G.title," ",G.badge&&r.jsx("span",{className:"badge primary",children:G.badge})]}),r.jsx("span",{className:"choice-text",children:G.text})]},G.id))}),r.jsxs("div",{className:"form-actions",children:[r.jsx(Jt,{to:"/devices",className:"btn btn--ghost",children:"Cancel"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>c(h==="devmode"?"prepare":"details"),children:["Next ",r.jsx(ce,{name:"chevRight"})]})]})]}),w==="prepare"&&r.jsxs("div",{className:"wizard-body",children:[r.jsx("p",{className:"muted wizard-lead",children:"Do these on the TV first. Tick each one off — or skip if your TV is already set up."}),r.jsx("div",{className:"accordion",children:Jy.map((G,Se)=>r.jsxs("div",{className:`accordion-item${x===Se?" is-open":""}${p[Se]?" is-done":""}`,children:[r.jsxs("div",{className:"accordion-trigger-row",children:[r.jsxs("label",{className:"check",title:"Done",children:[r.jsx("input",{type:"checkbox",checked:p[Se],onChange:Ie=>{const Qe=p.map((He,Be)=>Be===Se?Ie.target.checked:He);f(Qe),Ie.target.checked&&C(Qe.findIndex(He=>!He))}}),r.jsx("span",{className:"box"}),r.jsxs("span",{className:"sr-only",children:["Mark “",G.title,"” done"]})]}),r.jsxs("button",{type:"button",className:"accordion-trigger","aria-expanded":x===Se,onClick:()=>C(x===Se?-1:Se),children:[r.jsxs("span",{children:[Se+1,". ",G.title]}),r.jsx("span",{className:"chev",children:r.jsx("svg",{viewBox:"0 0 24 24",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})})]})]}),r.jsx("div",{className:"accordion-body",children:r.jsx("div",{className:"accordion-body-inner",children:G.body})})]},G.title))}),r.jsxs("div",{className:"form-actions",children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:It,children:"Back"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>c("details"),children:[p.every(Boolean)?"Next":"Skip"," ",r.jsx(ce,{name:"chevRight"})]})]})]}),w==="details"&&r.jsxs("form",{className:"wizard-body",onSubmit:bs,noValidate:!0,children:[r.jsx(ij,{selected:g.trim(),onPick:ue,saved:o??[]}),r.jsxs("div",{className:"form-grid",children:[r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:"dev-name",children:["Name ",r.jsx("span",{className:"req",children:"*"})]}),r.jsx("input",{id:"dev-name",className:`input${Y&&me?" is-invalid":""}`,value:j,placeholder:tb(_),onChange:G=>E(G.target.value),maxLength:64,autoComplete:"off"}),Y&&me?r.jsx("span",{className:"field-error",children:me}):r.jsx("span",{className:"field-help",children:"Shown in the device switcher."})]}),r.jsxs("div",{className:"field",children:[r.jsxs("label",{className:"field-label",htmlFor:"dev-host",children:["IP address ",r.jsx("span",{className:"req",children:"*"})]}),r.jsxs("div",{className:"input-row",children:[r.jsx("input",{id:"dev-host",className:`input mono${Y&&ge?" is-invalid":""}`,value:g,placeholder:"192.168.1.20",onChange:G=>b(G.target.value),onBlur:()=>g.trim()!==ne&&we(),autoComplete:"off",spellCheck:!1,inputMode:"url"}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:we,disabled:!n||!!ge||I,children:[I?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"pulse"})," Check"]})]}),Y&&ge?r.jsx("span",{className:"field-error",children:ge}):Re.length?r.jsxs("span",{className:"field-warning",role:"status",children:[r.jsx(ce,{name:"alert"}),r.jsxs("span",{children:["This TV is already added as ",r.jsx("b",{children:Re.map(G=>G.name).join(", ")}),". You can still add it again, e.g. with another login."]})]}):r.jsx("span",{className:"field-help",children:"On the TV: Settings → General → Network → Wi-Fi / Wired → Advanced."})]}),r.jsx("div",{className:"span-2",children:r.jsx(ej,{result:Q,checking:I,mode:h,port:v})}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"dev-user",children:"User"}),r.jsx("input",{id:"dev-user",className:`input mono${Y&&qe?" is-invalid":""}`,value:N,onChange:G=>T(G.target.value.trim()),disabled:Zr[h].fixed,autoComplete:"off",spellCheck:!1}),Y&&qe&&r.jsx("span",{className:"field-error",children:qe})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"dev-port",children:"SSH port"}),r.jsx("input",{id:"dev-port",className:`input mono${Y&&tt?" is-invalid":""}`,type:"number",min:1,max:65535,value:Number.isNaN(v)?"":v,onChange:G=>S(G.target.valueAsNumber),disabled:Zr[h].fixed}),Y&&tt&&r.jsx("span",{className:"field-error",children:tt})]}),r.jsx("div",{className:"span-2",children:r.jsx(Y0,{value:k,onChange:L,kinds:Z0[h],username:N,showErrors:Y,onKeyCheck:U,rootedHint:h!=="devmode"})}),r.jsxs("div",{className:"field span-2",children:[r.jsx("label",{className:"field-label",htmlFor:"dev-desc",children:"Description"}),r.jsx("input",{id:"dev-desc",className:"input",value:D,onChange:G=>O(G.target.value),maxLength:200,placeholder:"Optional, e.g. living room, C2 55”"})]})]}),r.jsxs("div",{className:"form-actions",children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:It,children:"Back"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"submit",className:"btn btn--primary",disabled:!n,children:["Verify & add ",r.jsx(ce,{name:"chevRight"})]})]})]}),w==="verify"&&B&&r.jsxs("div",{className:"wizard-body",children:[r.jsx("ul",{className:"verify-list",children:Object.keys(Qy).filter(G=>B.steps[G]!=="skipped").map(G=>r.jsxs("li",{className:`verify-step is-${B.steps[G]}`,children:[r.jsx("span",{className:"verify-icon",children:B.steps[G]==="running"?r.jsx("span",{className:"spinner sm"}):B.steps[G]==="done"?r.jsx(ce,{name:"check",strokeWidth:2.6}):B.steps[G]==="failed"?r.jsx(ce,{name:"x",strokeWidth:2.6}):r.jsx("span",{className:"verify-dot"})}),Qy[G]]},G))}),B.error!==void 0&&r.jsx(Nt,{error:B.error,title:B.failedAt==="key"?"Couldn’t get the key from the TV":B.failedAt==="login"?"Couldn’t log in":"Logged in, but couldn’t read the TV’s details",hint:es?null:r.jsx(cj,{error:B.error,step:B.failedAt,mode:h})}),es&&r.jsx(zf,{}),z&&!B.info&&r.jsx($e,{kind:"success",title:`${pe} was saved`,children:"Saved in this browser and set as the active TV."}),z&&B.info&&r.jsxs("div",{className:"verify-summary",children:[r.jsxs("div",{className:"verify-summary-head",children:[r.jsx("span",{className:"verify-summary-icon",children:r.jsx(ce,{name:"check",strokeWidth:2.6})}),r.jsxs("div",{children:[r.jsxs("div",{className:"verify-summary-title",children:[pe," is ready"]}),r.jsx("div",{className:"muted",children:"Saved in this browser and set as the active TV."})]})]}),r.jsxs("dl",{className:"kv",children:[r.jsx("dt",{children:"Model"}),r.jsx("dd",{children:If(B.info.modelName)??"—"}),r.jsx("dt",{children:"webOS"}),r.jsx("dd",{children:Rc(B.info.osVersion)??"—"}),r.jsx("dt",{children:"Firmware"}),r.jsx("dd",{className:"mono",children:B.info.firmwareVersion??"—"}),r.jsx("dt",{children:"Logged in as"}),r.jsxs("dd",{className:"mono",children:[N,B.login?.root?" (root)":""]}),r.jsx("dt",{children:"Response time"}),r.jsx("dd",{children:B.login?`${B.login.latencyMs} ms`:"—"})]})]}),r.jsxs("div",{className:"form-actions",children:[!z&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>c("details"),disabled:$,children:"Back to details"}),r.jsx("span",{className:"spacer"}),!z&&!$&&B.error!==void 0&&r.jsxs(r.Fragment,{children:[B.failedAt!=="key"&&B.auth&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>Bt(B).catch(G=>d({kind:"danger",title:"Could not save the TV",text:xt(G).message})),children:"Save anyway"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:Ke,children:[r.jsx(ce,{name:"refresh"})," Try again"]})]}),z&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>s("/devices/new"),children:[r.jsx(ce,{name:"plus"})," Add another TV"]}),r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>s("/devices"),children:"Manage devices"}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>s("/apps/installed"),children:[r.jsx(ce,{name:"apps"})," Go to apps"]})]})]})]})]})})]})}function cj({error:s,step:n,mode:l}){const{code:o}=xt(s);return o===Vs.BadPassphrase||o===Vs.PassphraseRequired?r.jsx(r.Fragment,{children:"Check the passphrase in the Developer Mode app — it usually has 6 characters and is case-sensitive."}):o===Vs.KeyServerUnreachable||o===Vs.KeyNotFound?r.jsxs(r.Fragment,{children:["Make sure ",r.jsx("b",{children:"Key Server"})," is on in the Developer Mode app while you add the TV. If it is on and this keeps failing, try turning Developer Mode off and on again."]}):o===Vs.AuthFailed?l==="devmode"?r.jsx(r.Fragment,{children:"The TV rejected the key. Turn Key Server off and on in the Developer Mode app and try again — the key changes when Developer Mode is re-enabled."}):r.jsxs(r.Fragment,{children:["Homebrew Channel’s root password is ",r.jsx("span",{className:"mono",children:"alpine"})," — unless an SSH key has been added to"," ",r.jsx("span",{className:"mono",children:"/home/root/.ssh/authorized_keys"}),", which turns password login off. Then log in with that key (Private key). For a new key, make sure its public key is in that file."]}):o===Vs.Unreachable||o===Vs.Timeout?r.jsx(r.Fragment,{children:"Check the address and that the TV is on and on the same network as this computer."}):n==="info"?r.jsx(r.Fragment,{children:"The login works, so you can save the TV anyway."}):null}function uj(s){const n=xl(s.info?.modelName);return n&&n.trim().toLowerCase()!==s.name.trim().toLowerCase()?n:void 0}function ii({device:s}){const n=uj(s);return r.jsxs(r.Fragment,{children:[r.jsx("b",{children:s.name}),n&&r.jsxs(r.Fragment,{children:[" (",n,")"]})]})}function ri({device:s,children:n}){const{status:l}=Pi(),{devices:o}=Mt();if(l.state==="unpaired"||l.state==="error"){const d=l.state==="unpaired";return r.jsx("section",{className:"card col-12",children:r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"plug"})}),r.jsx("h3",{children:d?"Set up the bridge first":"The bridge isn’t connected"}),r.jsx("p",{children:d?"The bridge is the small helper on this computer that talks to your TV. Start it in a terminal and pair this browser.":`${l.message} Make sure the bridge is still running in its terminal.`}),r.jsxs(Jt,{to:"/bridge",className:"btn btn--primary",children:[r.jsx(ce,{name:"plug"})," Bridge setup"]})]})})}if(!s){const d=!!o?.length;return r.jsx("section",{className:"card col-12",children:r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"tv"})}),r.jsx("h3",{children:d?"Choose a TV":"Add your TV"}),r.jsx("p",{children:d?"Pick the TV to work with from the switcher at the bottom of the sidebar.":"Add an LG TV in Developer Mode or a rooted TV to get started."}),r.jsxs(Jt,{to:d?"/devices":"/devices/new",className:"btn btn--primary",children:[r.jsx(ce,{name:d?"tv":"plus"})," ",d?"Devices":"Add a TV"]})]})})}return r.jsx(r.Fragment,{children:n})}const hj=s=>["apps",s.id,s.updatedAt],dj=s=>["storage",s.id,s.updatedAt];function Vc(s){const{ready:n,call:l}=ut();return ss({queryKey:s?hj(s):["apps","none"],queryFn:async()=>(await l("apps.list",{device:gt(s)},6e4)).apps,enabled:n&&!!s,staleTime:3e4,retry:!1})}function fj(s){const{ready:n,call:l}=ut();return ss({queryKey:s?dj(s):["storage","none"],queryFn:()=>l("device.storage",{device:gt(s)},3e4),enabled:n&&!!s,staleTime:3e4,retry:!1})}function mj(s){return s.icon?s.icon.startsWith("/")?s.icon:s.folderPath?`${s.folderPath.replace(/\/$/,"")}/${s.icon}`:null:null}function pj(s,n){const{ready:l,call:o}=ut(),d=mj(n);return ss({queryKey:["icon",s?.id,s?.updatedAt,d],queryFn:async()=>{const _=await o("apps.icon",{device:gt(s),path:d},3e4);return`data:${_.mime};base64,${_.base64}`},enabled:l&&!!s&&!!d&&/\.(png|jpe?g|gif|webp|bmp)$/i.test(d),staleTime:1/0,gcTime:30*6e4,retry:!1})}function gj(){const s=En();return n=>{s.invalidateQueries({queryKey:["apps",n.id]}),s.invalidateQueries({queryKey:["storage",n.id]}),s.invalidateQueries({queryKey:["hbchannel",n.id]})}}const sb=["primary","success","purple","orange","pink","teal","info"];function vj(s){let n=0;for(const l of s)n=n*31+l.charCodeAt(0)>>>0;return sb[n%sb.length]}function _j({device:s,app:n}){const{data:l}=pj(s,n),o=(n.title||n.id).trim();return l?r.jsx("img",{className:"app-icon",src:l,alt:"",width:36,height:36,loading:"lazy"}):r.jsx("span",{className:`app-icon app-icon--fallback tint-${vj(n.id)}`,"aria-hidden":"true",children:o.slice(0,1).toUpperCase()})}var qd,ib;function X0(){if(ib)return qd;ib=1;const s=da();return qd=(l,o,d)=>s(l,o,d)===0,qd}var yj=X0();const bj=la(yj);var Kd,nb;function Sj(){if(nb)return Kd;nb=1;class s{constructor(){this.max=1e3,this.map=new Map}get(l){const o=this.map.get(l);if(o!==void 0)return this.map.delete(l),this.map.set(l,o),o}delete(l){return this.map.delete(l)}set(l,o){if(!this.delete(l)&&o!==void 0){if(this.map.size>=this.max){const _=this.map.keys().next().value;this.delete(_)}this.map.set(l,o)}return this}}return Kd=s,Kd}var Gd,rb;function xj(){if(rb)return Gd;rb=1;const s=da();return Gd=(l,o,d)=>s(l,o,d)!==0,Gd}var Yd,ab;function wj(){if(ab)return Yd;ab=1;const s=da();return Yd=(l,o,d)=>s(l,o,d)>=0,Yd}var Zd,lb;function Cj(){if(lb)return Zd;lb=1;const s=da();return Zd=(l,o,d)=>s(l,o,d)<0,Zd}var Xd,ob;function Ej(){if(ob)return Xd;ob=1;const s=da();return Xd=(l,o,d)=>s(l,o,d)<=0,Xd}var Wd,cb;function Nj(){if(cb)return Wd;cb=1;const s=X0(),n=xj(),l=P0(),o=wj(),d=Cj(),_=Ej();return Wd=(c,h,y,p)=>{switch(h){case"===":return typeof c=="object"&&(c=c.version),typeof y=="object"&&(y=y.version),c===y;case"!==":return typeof c=="object"&&(c=c.version),typeof y=="object"&&(y=y.version),c!==y;case"":case"=":case"==":return s(c,y,p);case"!=":return n(c,y,p);case">":return l(c,y,p);case">=":return o(c,y,p);case"<":return d(c,y,p);case"<=":return _(c,y,p);default:throw new TypeError(`Invalid operator: ${h}`)}},Wd}var Qd,ub;function jj(){if(ub)return Qd;ub=1;const s=Symbol("SemVer ANY");class n{static get ANY(){return s}constructor(p,f){if(f=l(f),p instanceof n){if(p.loose===!!f.loose)return p;p=p.value}p=p.trim().split(/\s+/).join(" "),w("comparator",p,f),this.options=f,this.loose=!!f.loose,this.parse(p),this.semver===s?this.value="":this.value=this.operator+this.semver.version,w("comp",this)}parse(p){const f=this.options.loose?o[d.COMPARATORLOOSE]:o[d.COMPARATOR],x=p.match(f);if(!x)throw new TypeError(`Invalid comparator: ${p}`);this.operator=x[1]!==void 0?x[1]:"",this.operator==="="&&(this.operator=""),x[2]?this.semver=new c(x[2],this.options.loose):this.semver=s}toString(){return this.value}test(p){if(w("Comparator.test",p,this.options.loose),this.semver===s||p===s)return!0;if(typeof p=="string")try{p=new c(p,this.options)}catch{return!1}return _(p,this.operator,this.semver,this.options)}intersects(p,f){if(!(p instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new h(p.value,f).test(this.value):p.operator===""?p.value===""?!0:new h(this.value,f).test(p.semver):(f=l(f),f.includePrerelease&&(this.value==="<0.0.0-0"||p.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||p.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&p.operator.startsWith(">")||this.operator.startsWith("<")&&p.operator.startsWith("<")||this.semver.version===p.semver.version&&this.operator.includes("=")&&p.operator.includes("=")||_(this.semver,"<",p.semver,f)&&this.operator.startsWith(">")&&p.operator.startsWith("<")||_(this.semver,">",p.semver,f)&&this.operator.startsWith("<")&&p.operator.startsWith(">")))}}Qd=n;const l=bm(),{safeRe:o,t:d}=Fc(),_=Nj(),w=Pc(),c=jl(),h=xm();return Qd}var Jd,hb;function xm(){if(hb)return Jd;hb=1;const s=/\s+/g;class n{constructor(I,A){if(A=d(A),I instanceof n)return I.loose===!!A.loose&&I.includePrerelease===!!A.includePrerelease?I:new n(I.raw,A);if(I instanceof _)return this.raw=I.value,this.set=[[I]],this.formatted=void 0,this;if(this.options=A,this.loose=!!A.loose,this.includePrerelease=!!A.includePrerelease,this.raw=I.trim().replace(s," "),this.set=this.raw.split("||").map(B=>this.parseRange(B.trim())).filter(B=>B.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const B=this.set[0];if(this.set=this.set.filter(F=>!b(F[0])),this.set.length===0)this.set=[B];else if(this.set.length>1){for(const F of this.set)if(F.length===1&&v(F[0])){this.set=[F];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let I=0;I<this.set.length;I++){I>0&&(this.formatted+="||");const A=this.set[I];for(let B=0;B<A.length;B++)B>0&&(this.formatted+=" "),this.formatted+=A[B].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(I){I=I.replace(g,"");const B=((this.options.includePrerelease&&j)|(this.options.loose&&E))+":"+I,F=o.get(B);if(F)return F;const $=this.options.loose,J=$?h[p.HYPHENRANGELOOSE]:h[p.HYPHENRANGE];I=I.replace(J,he(this.options.includePrerelease)),w("hyphen replace",I),I=I.replace(h[p.COMPARATORTRIM],f),w("comparator trim",I),I=I.replace(h[p.TILDETRIM],x),w("tilde trim",I),I=I.replace(h[p.CARETTRIM],C),w("caret trim",I);let z=I.split(" ").map(U=>N(U,this.options)).join(" ").split(/\s+/).map(U=>Q(U,this.options));$&&(z=z.filter(U=>(w("loose invalid filter",U,this.options),!!U.match(h[p.COMPARATORLOOSE])))),w("range list",z);const ee=new Map,de=z.map(U=>new _(U,this.options));for(const U of de){if(b(U))return[U];ee.set(U.value,U)}ee.size>1&&ee.has("")&&ee.delete("");const Z=[...ee.values()];return o.set(B,Z),Z}intersects(I,A){if(!(I instanceof n))throw new TypeError("a Range is required");return this.set.some(B=>S(B,A)&&I.set.some(F=>S(F,A)&&B.every($=>F.every(J=>$.intersects(J,A)))))}test(I){if(!I)return!1;if(typeof I=="string")try{I=new c(I,this.options)}catch{return!1}for(let A=0;A<this.set.length;A++)if(ne(this.set[A],I,this.options))return!0;return!1}}Jd=n;const l=Sj(),o=new l,d=bm(),_=jj(),w=Pc(),c=jl(),{safeRe:h,src:y,t:p,comparatorTrimReplace:f,tildeTrimReplace:x,caretTrimReplace:C}=Fc(),{FLAG_INCLUDE_PRERELEASE:j,FLAG_LOOSE:E}=ym(),g=new RegExp(y[p.BUILD],"g"),b=W=>W.value==="<0.0.0-0",v=W=>W.value==="",S=(W,I)=>{let A=!0;const B=W.slice();let F=B.pop();for(;A&&B.length;)A=B.every($=>F.intersects($,I)),F=B.pop();return A},N=(W,I)=>(W=W.replace(h[p.BUILD],""),w("comp",W,I),W=L(W,I),w("caret",W),W=O(W,I),w("tildes",W),W=q(W,I),w("xrange",W),W=P(W,I),w("stars",W),W),T=W=>!W||W.toLowerCase()==="x"||W==="*",D=(W,I,A)=>T(W)&&!T(I)||T(I)&&A&&!T(A),O=(W,I)=>W.trim().split(/\s+/).map(A=>k(A,I)).join(" "),k=(W,I)=>{const A=I.loose?h[p.TILDELOOSE]:h[p.TILDE],B=I.includePrerelease?"-0":"";return W.replace(A,(F,$,J,z,ee)=>{w("tilde",W,F,$,J,z,ee);let de;return T($)?de="":T(J)?de=`>=${$}.0.0${B} <${+$+1}.0.0-0`:T(z)?de=`>=${$}.${J}.0${B} <${$}.${+J+1}.0-0`:ee?(w("replaceTilde pr",ee),de=`>=${$}.${J}.${z}-${ee} <${$}.${+J+1}.0-0`):de=`>=${$}.${J}.${z} <${$}.${+J+1}.0-0`,w("tilde return",de),de})},L=(W,I)=>W.trim().split(/\s+/).map(A=>V(A,I)).join(" "),V=(W,I)=>{w("caret",W,I);const A=I.loose?h[p.CARETLOOSE]:h[p.CARET],B=I.includePrerelease?"-0":"";return W.replace(A,(F,$,J,z,ee)=>{w("caret",W,F,$,J,z,ee);let de;return T($)?de="":T(J)?de=`>=${$}.0.0${B} <${+$+1}.0.0-0`:T(z)?$==="0"?de=`>=${$}.${J}.0${B} <${$}.${+J+1}.0-0`:de=`>=${$}.${J}.0${B} <${+$+1}.0.0-0`:ee?(w("replaceCaret pr",ee),$==="0"?J==="0"?de=`>=${$}.${J}.${z}-${ee} <${$}.${J}.${+z+1}-0`:de=`>=${$}.${J}.${z}-${ee} <${$}.${+J+1}.0-0`:de=`>=${$}.${J}.${z}-${ee} <${+$+1}.0.0-0`):(w("no pr"),$==="0"?J==="0"?de=`>=${$}.${J}.${z} <${$}.${J}.${+z+1}-0`:de=`>=${$}.${J}.${z} <${$}.${+J+1}.0-0`:de=`>=${$}.${J}.${z} <${+$+1}.0.0-0`),w("caret return",de),de})},q=(W,I)=>(w("replaceXRanges",W,I),W.split(/\s+/).map(A=>Y(A,I)).join(" ")),Y=(W,I)=>{W=W.trim();const A=I.loose?h[p.XRANGELOOSE]:h[p.XRANGE];return W.replace(A,(B,F,$,J,z,ee)=>{if(w("xRange",W,B,F,$,J,z,ee),D($,J,z))return W;const de=T($),Z=de||T(J),U=Z||T(z),ue=U;return F==="="&&ue&&(F=""),ee=I.includePrerelease?"-0":"",de?F===">"||F==="<"?B="<0.0.0-0":B="*":F&&ue?(Z&&(J=0),z=0,F===">"?(F=">=",Z?($=+$+1,J=0,z=0):(J=+J+1,z=0)):F==="<="&&(F="<",Z?$=+$+1:J=+J+1),F==="<"&&(ee="-0"),B=`${F+$}.${J}.${z}${ee}`):Z?B=`>=${$}.0.0${ee} <${+$+1}.0.0-0`:U&&(B=`>=${$}.${J}.0${ee} <${$}.${+J+1}.0-0`),w("xRange return",B),B})},P=(W,I)=>(w("replaceStars",W,I),W.trim().replace(h[p.STAR],"")),Q=(W,I)=>(w("replaceGTE0",W,I),W.trim().replace(h[I.includePrerelease?p.GTE0PRE:p.GTE0],"")),he=W=>(I,A,B,F,$,J,z,ee,de,Z,U,ue)=>(T(B)?A="":T(F)?A=`>=${B}.0.0${W?"-0":""}`:T($)?A=`>=${B}.${F}.0${W?"-0":""}`:J?A=`>=${A}`:A=`>=${A}${W?"-0":""}`,T(de)?ee="":T(Z)?ee=`<${+de+1}.0.0-0`:T(U)?ee=`<${de}.${+Z+1}.0-0`:ue?ee=`<=${de}.${Z}.${U}-${ue}`:W?ee=`<${de}.${Z}.${+U+1}-0`:ee=`<=${ee}`,`${A} ${ee}`.trim()),ne=(W,I,A)=>{for(let B=0;B<W.length;B++)if(!W[B].test(I))return!1;if(I.prerelease.length&&!A.includePrerelease){for(let B=0;B<W.length;B++)if(w(W[B].semver),W[B].semver!==_.ANY&&W[B].semver.prerelease.length>0){const F=W[B].semver;if(F.major===I.major&&F.minor===I.minor&&F.patch===I.patch)return!0}return!1}return!0};return Jd}var ef,db;function Tj(){if(db)return ef;db=1;const s=xm();return ef=(l,o,d)=>{try{o=new s(o,d)}catch{return!1}return o.test(l)},ef}var kj=Tj();const Rj=la(kj);var tf,fb;function Dj(){if(fb)return tf;fb=1;const s=jl(),n=F0(),{safeRe:l,t:o}=Fc();return tf=(_,w)=>{if(_ instanceof s)return _;if(typeof _=="number"&&(_=String(_)),typeof _!="string")return null;w=w||{};let c=null;if(!w.rtl)c=_.match(w.includePrerelease?l[o.COERCEFULL]:l[o.COERCE]);else{const C=w.includePrerelease?l[o.COERCERTLFULL]:l[o.COERCERTL];let j;for(;(j=C.exec(_))&&(!c||c.index+c[0].length!==_.length);)(!c||j.index+j[0].length!==c.index+c[0].length)&&(c=j),C.lastIndex=j.index+j[1].length+j[2].length;C.lastIndex=-1}if(c===null)return null;const h=c[2],y=c[3]||"0",p=c[4]||"0",f=w.includePrerelease&&c[5]?`-${c[5]}`:"",x=w.includePrerelease&&c[6]?`+${c[6]}`:"";return n(`${h}.${y}.${p}${f}${x}`,w)},tf}var Aj=Dj();const Ff=la(Aj);var sf,mb;function Oj(){if(mb)return sf;mb=1;const s=xm();return sf=(l,o)=>{try{return new s(l,o).range||"*"}catch{return null}},sf}var Lj=Oj();const Mj=la(Lj);function W0(s,n){if(!s||!n)return null;const l=_=>{const w=_.split(".",4);return w.length>3?{base:w.slice(0,3).join("."),suffix:w[3]}:{base:_,suffix:""}},o=l(s),d=l(n);try{if((o.suffix||d.suffix)&&bj(o.base,d.base,!0)){const _=Number(o.suffix),w=Number(d.suffix);return!Number.isNaN(_)&&!Number.isNaN(w)?_>w:o.suffix.localeCompare(d.suffix)>0}return Hf(o.base,d.base,!0)}catch{const _=Ff(s),w=Ff(n);return _&&w?Hf(_,w):s!==n?null:!1}}const Q0={root:"This app needs root, but this TV isn’t rooted.",soc:"This app isn’t made for this TV’s chip (SoC).",release:"This app needs a different webOS version."};function Bj(s,n,l,o=s.manifest){const d=[],_=s.requirements;if(n?.osVersion&&_?.webosRelease&&Mj(_.webosRelease,{loose:!0})){const w=Ff(n.osVersion);w&&!Rj(w,_.webosRelease,{loose:!0})&&d.push("release")}if(n?.socName&&_?.deviceSoC?.length){const w=_.deviceSoC.filter(h=>h.startsWith("!")).map(h=>h.slice(1)),c=_.deviceSoC.filter(h=>!h.startsWith("!"));(c.length>0&&!c.includes(n.socName)||w.includes(n.socName))&&d.push("soc")}return l?.root===!1&&o?.rootRequired===!0&&d.push("root"),d.length?d:null}function Ij(s,n){return n===void 0?"install":W0(s.manifest?.version,n)?"update":"installed"}const Hj=s=>s===void 0?void 0:s>=1024*1024?`${(s/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(s/1024))} KB`,Uj={install:[{id:"send",label:"Send the IPK to the bridge"},{id:"copy",label:"Copy it to the TV"},{id:"install",label:"Install"}],repo:[{id:"copy",label:"Download the IPK"},{id:"install",label:"Install"}],remove:[{id:"install",label:"Uninstall"}]},pb=s=>s==="upload"||s==="verify"?"copy":"install",nf=s=>s>=1024*1024?`${(s/1024/1024).toFixed(1)} MB`:s>=1024?`${Math.round(s/1024)} KB`:`${s} B`;function zj(s){const{code:n}=xt(s);return n===ac.InsufficientSpace?"Free some space on the TV (uninstall apps you don’t use) and try again.":n===ac.InstallFailed?"The TV rejected the package. Check that it is a webOS IPK made for this TV.":n===ac.ChecksumMismatch?"The download or the copy to the TV was damaged. Try again; if it keeps failing, the repository entry may be broken.":n===ac.Conflict?"An app with the same id came from the LG Content Store (or is built in). Uninstall that one on the TV first.":n===Ry.DownloadFailed||n===Ry.Unreachable||n===O2.Unreachable?"Check this computer’s internet connection and try again.":null}function qc(s,n){const{client:l,call:o}=ut(),{confirm:d,toast:_}=jt(),w=gj(),[c,h]=M.useState(null),y=M.useRef(null),p=!!c&&!c.done&&c.error===void 0,f=async T=>{if(s)try{await o("apps.launch",{device:gt(s),id:T.id},3e4),_({kind:"success",title:`Launched ${T.title??T.id}`,text:`On ${s.name}.`})}catch(D){_({kind:"danger",title:`Couldn’t launch ${T.title??T.id}`,text:xt(D).message})}},x=async T=>{if(!s||!l||p)return;if(!/\.ipk$/i.test(T.name)){_({kind:"warning",title:"Not an IPK file",text:"Choose a webOS package ending in .ipk."});return}const D=new AbortController;y.current=D;const O=ea();h({kind:"install",subject:T.name,phase:"send",percent:0,text:`0 of ${nf(T.size)}`});const k=pc(l,O,L=>{if(L.stage==="cleanup")return;const V=pb(L.stage);h(q=>q&&!q.done&&q.error===void 0?{...q,phase:V,percent:L.percent,text:L.text}:q)});try{const L=await U0(l,T,(q,Y)=>h(P=>P&&{...P,percent:Math.round(q/Y*100),text:`${nf(q)} of ${nf(Y)}`}),D.signal);h(q=>q&&{...q,phase:"copy",percent:void 0,text:"Starting…"});const V=await l.call("apps.install",{device:gt(s),uploadId:L,opId:O},20*6e4);h(q=>q&&{...q,done:V}),w(s)}catch(L){L instanceof yt&&L.code==="cancelled"?h(null):h(V=>V&&{...V,error:L})}finally{k(),y.current=null}},C=async(T,D={})=>{if(!s||!l||p)return!1;const O=D.channel??"stable";if(D.incompatible?.length&&!await d({title:`${T.title} may not work on ${s.name}`,message:r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["The repository marks ",r.jsx("b",{children:T.title})," as not compatible with this TV:"]}),r.jsx("ul",{className:"plain-list",children:D.incompatible.map(q=>r.jsx("li",{children:Q0[q]},q))}),r.jsx("p",{children:"It may not work properly, or at all."})]}),confirmText:"Install anyway",danger:!0}))return!1;const k=D.update?"Updating":O==="beta"?"Installing the beta of":"Installing",L=gt(s);return E(k,T.title,V=>l.call("apps.installFromRepo",{device:L,id:T.id,channel:O,opId:V},20*6e4))},j=async(T,D,O)=>{if(!s||!l||p)return!1;const k=gt(s);return E("Installing",O,L=>l.call("litefin.install",{device:k,tag:T,variant:D,opId:L},20*6e4))},E=async(T,D,O)=>{if(!s||!l)return!1;const k=ea();h({kind:"repo",verb:T,subject:D,phase:"copy",text:"Starting…"});const L=pc(l,k,V=>{if(V.stage==="cleanup")return;const q=pb(V.stage);h(Y=>Y&&!Y.done&&Y.error===void 0?{...Y,phase:q,percent:V.percent,text:V.text}:Y)});try{const V=await O(k);return h(q=>q&&{...q,done:V}),w(s),!0}catch(V){return h(q=>q&&{...q,error:V}),!1}finally{L()}},g=async T=>{if(!s||!l||p)return;const D=T.title??T.id;if(!await d({title:`Uninstall ${D}?`,message:r.jsxs(r.Fragment,{children:[r.jsx("b",{children:D})," ",r.jsxs("span",{className:"mono",children:["(",T.id,")"]})," will be removed from ",s.name,"."]}),confirmText:"Uninstall",danger:!0})||T.id===kf&&!await d({title:"Remove Homebrew Channel?",message:r.jsx($e,{kind:"danger",title:"Danger",children:"You’re about to remove Homebrew Channel. On a rooted TV you lose root access immediately."}),confirmText:"Yes, uninstall Homebrew Channel",danger:!0}))return;const k=ea();h({kind:"remove",subject:D,phase:"install",text:"Removing…"});const L=pc(l,k,V=>h(q=>q&&!q.done&&q.error===void 0?{...q,text:V.text}:q));try{await l.call("apps.remove",{device:gt(s),id:T.id,opId:k},5*6e4),h(null),_({kind:"success",title:`Uninstalled ${D}`}),w(s)}catch(V){h(q=>q&&{...q,error:V})}finally{L()}},b=c?.done?.appId?n?.find(T=>T.id===c.done.appId):void 0,v=c?Uj[c.kind]:[],S=c?v.findIndex(T=>T.id===c.phase):-1,N=r.jsx(si,{open:!!c,onClose:()=>p?y.current?.abort():h(null),dismissible:!p,title:c?`${c.kind==="remove"?"Uninstalling":c.kind==="repo"?c.verb:"Installing"} ${c.subject}`:"",footer:c&&r.jsxs(r.Fragment,{children:[p&&c.phase==="send"&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>y.current?.abort(),children:"Cancel"}),!p&&c.done&&b&&r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>{h(null),f(b)},children:[r.jsx(ce,{name:"play"})," Launch"]}),!p&&r.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>h(null),children:c.error!==void 0?"Close":"Done"})]}),children:c&&r.jsxs("div",{className:"stack",children:[v.length>1&&r.jsx("ul",{className:"verify-list",children:v.map((T,D)=>{const O=c.done||D<S?"done":D===S?c.error!==void 0?"failed":"running":"pending";return r.jsxs("li",{className:`verify-step is-${O}`,children:[r.jsx("span",{className:"verify-icon",children:O==="running"?r.jsx("span",{className:"spinner sm"}):O==="done"?r.jsx(ce,{name:"check",strokeWidth:2.6}):O==="failed"?r.jsx(ce,{name:"x",strokeWidth:2.6}):r.jsx("span",{className:"verify-dot"})}),T.label]},T.id)})}),p&&r.jsxs("div",{className:"op-progress",children:[r.jsxs("div",{className:"op-progress-text",children:[r.jsx("span",{children:c.text??"Working…"}),c.percent!==void 0&&r.jsxs("span",{className:"mono",children:[c.percent,"%"]})]}),r.jsx("div",{className:"progress",children:r.jsx("div",{className:`progress-fill${c.percent===void 0?" is-indeterminate":""}`,style:c.percent!==void 0?{width:`${c.percent}%`,animation:"none"}:void 0})})]}),c.done&&r.jsxs($e,{kind:"success",title:b?`${b.title??b.id} ${b.version?`v${b.version} `:""}is installed`:c.done.version?`${c.subject} v${c.done.version} is installed`:"Installed",children:[c.done.via==="hbchannel"?"Installed by Homebrew Channel on ":"Installed on ",s?.name,"."]}),c.error!==void 0&&r.jsx(Nt,{error:c.error,title:c.kind==="remove"?"Uninstall failed":"Install failed",hint:c.kind==="remove"?null:zj(c.error)})]})});return{install:x,installFromRepo:C,installLitefin:j,remove:g,launch:f,busy:p,dialog:N}}function $j(){const{ready:s,call:n}=ut();return ss({queryKey:["repo"],queryFn:()=>n("repo.list",{},6e4),enabled:s,staleTime:5*6e4,retry:!1})}function Pj(){const s=En(),{call:n}=ut();return async()=>{s.setQueryData(["repo"],await n("repo.list",{refresh:!0},6e4))}}function J0(){const s=$j(),n=M.useMemo(()=>new Map((s.data?.packages??[]).map(l=>[l.id,l])),[s.data]);return{...s,byId:n}}function wm(s){const{ready:n,call:l}=ut();return ss({queryKey:["repo-image",s],queryFn:async()=>{const o=await l("repo.image",{url:s},3e4);return`data:${o.mime};base64,${o.base64}`},enabled:n&&!!s,staleTime:1/0,gcTime:30*6e4,retry:!1})}function Fj(s){const{ready:n,call:l}=ut();return ss({queryKey:["repo-description",s?.id],queryFn:()=>l("repo.description",{id:s.id},3e4),enabled:n&&!!s?.hasDescription,staleTime:10*6e4,retry:!1})}function eS(s){const{ready:n,call:l}=ut();return ss({queryKey:["hbchannel",s?.id,s?.updatedAt],queryFn:()=>l("device.hbchannel",{device:gt(s),quiet:!0},3e4),enabled:n&&!!s,staleTime:5*6e4,retry:!1})}function tS(s){const n=J0(),l=Vc(s),o=eS(s),d=M.useMemo(()=>{const _=new Map((l.data??[]).map(h=>[h.id,h])),w=s?.info?{osVersion:s.info.osVersion,socName:s.info.socName}:void 0,c=new Map;for(const h of n.data?.packages??[]){const y=_.get(h.id);c.set(h.id,{pkg:h,installed:y,state:Ij(h,y?y.version??"":void 0),incompatible:Bj(h,w,o.data)})}return c},[n.data,l.data,o.data,s?.info]);return{repo:n,installed:l,hb:o,view:d,ready:!!n.data&&!!l.data}}const gb=["primary","success","purple","orange","pink","teal","info"],Vj=s=>{let n=0;for(const l of s)n=n*31+l.charCodeAt(0)>>>0;return gb[n%gb.length]};function sS({pkg:s,size:n=44,detail:l=!1}){const{data:o}=wm(l&&s.detailIconUri||s.iconUri),d={width:n,height:n};return o?r.jsx("img",{className:"app-icon repo-icon",src:o,alt:"",width:n,height:n,style:d}):r.jsx("span",{className:`app-icon app-icon--fallback repo-icon tint-${Vj(s.id)}`,style:{...d,fontSize:Math.round(n*.4)},"aria-hidden":"true",children:s.title.trim().slice(0,1).toUpperCase()})}function qj({url:s,caption:n}){const{data:l,isError:o}=wm(s);return o?null:r.jsxs("figure",{className:"repo-shot",children:[l?r.jsx("img",{src:l,alt:n??"Screenshot"}):r.jsx("div",{className:"repo-shot-ph",children:r.jsx("span",{className:"spinner sm"})}),n&&r.jsx("figcaption",{children:n})]})}const Kj=new Map(Object.entries({p:"p",br:"br",hr:"hr",ul:"ul",ol:"ol",li:"li",strong:"strong",b:"strong",em:"em",i:"em",code:"code",pre:"pre",blockquote:"blockquote",h1:"h3",h2:"h4",h3:"h5",h4:"h6",h5:"h6",h6:"h6",table:"table",thead:"thead",tbody:"tbody",tr:"tr",th:"th",td:"td",a:"a",img:"img"})),Gj=new Set(["script","style","iframe","frame","object","embed","template","noscript","svg","math","form","input","button","select","textarea","link","meta","base","head","title"]),Yj=new Set(["br","hr","img"]),Zj=5e3;function vb(s,n,l){if(!s)return null;try{const o=new URL(s,l);return n.includes(o.protocol)?o.toString():null}catch{return null}}function Xj(s,n={}){const l=new DOMParser().parseFromString(s,"text/html");let o=Zj,d=0;const _=w=>{const c=[];for(const h of Array.from(w.childNodes)){if(--o<0)break;if(h.nodeType===Node.TEXT_NODE){h.textContent&&c.push(h.textContent);continue}if(h.nodeType!==Node.ELEMENT_NODE)continue;const y=h,p=y.tagName.toLowerCase();if(Gj.has(p))continue;const f=Kj.get(p);if(!f){c.push(..._(y));continue}if(f==="img"){const C=vb(y.getAttribute("src"),["https:","http:"],n.baseUrl);C&&n.renderImage&&c.push(n.renderImage(C,y.getAttribute("alt")??"",d++));continue}if(Yj.has(f)){c.push(M.createElement(f,{key:d++}));continue}const x=_(y);if(f==="a"){const C=vb(y.getAttribute("href"),["https:","http:"],n.baseUrl);c.push(C?M.createElement("a",{key:d++,href:C,target:"_blank",rel:"noopener noreferrer"},...x):M.createElement("span",{key:d++},...x));continue}c.push(M.createElement(f,{key:d++},...x))}return c};return _(l.body)}function Wj({html:s,className:n,baseUrl:l,renderImage:o}){return r.jsx("div",{className:n,children:Xj(s,{baseUrl:l,renderImage:o})})}function iS({view:s,device:n,ready:l,actions:o,onClose:d}){const _=s?.pkg??null,w=Fj(_);if(!s||!_)return r.jsx(si,{open:!1,onClose:d,title:"",children:null});const{installed:c,state:h,incompatible:y}=s,p=_.manifest,f=!n||!l||o.busy;return r.jsx(si,{open:!0,onClose:d,size:"lg",title:_.title,children:r.jsxs("div",{className:"repo-details",children:[r.jsxs("div",{className:"repo-details-head",children:[r.jsx(sS,{pkg:_,size:88,detail:!0}),r.jsxs("div",{className:"repo-details-meta",children:[r.jsx("div",{className:"mono muted repo-details-id",children:_.id}),r.jsxs("div",{className:"repo-details-version",children:[p?r.jsxs(r.Fragment,{children:["Version ",r.jsx("b",{children:p.version})]}):"No release",p?.ipkSize?r.jsxs("span",{className:"muted",children:[" · ",Hj(p.ipkSize)]}):null,c&&r.jsxs("span",{className:"muted",children:[" ","· installed ",c.version?`v${c.version}`:""]})]}),r.jsxs("div",{className:"repo-badges",children:[h==="update"&&r.jsx("span",{className:"badge warning",children:"Update available"}),h==="installed"&&r.jsx("span",{className:"badge success",children:"Installed"}),p?.rootRequired===!0&&r.jsx("span",{className:"badge purple",children:"Root required"}),p?.rootRequired==="optional"&&r.jsx("span",{className:"badge purple",children:"Root optional"}),_.manifestBeta&&r.jsxs("span",{className:"badge info",children:["Beta ",_.manifestBeta.version]})]})]}),r.jsx("div",{className:"repo-details-actions",children:h==="installed"?r.jsxs("button",{type:"button",className:"btn btn--primary",disabled:f,onClick:()=>o.launch(c??{id:_.id,title:_.title}),children:[r.jsx(ce,{name:"play"})," Launch"]}):r.jsxs("button",{type:"button",className:"btn btn--primary",disabled:f||!p,onClick:()=>o.installFromRepo(_,{update:h==="update",incompatible:y}),children:[r.jsx(ce,{name:"download"})," ",h==="update"?`Update to ${p?.version}`:"Install"]})})]}),y&&r.jsx($e,{kind:"warning",title:`${_.title} is marked as not compatible with ${n?.name??"this TV"}`,children:r.jsx("ul",{className:"plain-list",children:y.map(x=>r.jsx("li",{children:Q0[x]},x))})}),r.jsxs("div",{className:"repo-details-secondary",children:[_.manifestBeta&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",disabled:f,onClick:()=>o.installFromRepo(_,{channel:"beta",incompatible:y}),children:[r.jsx(ce,{name:"download"})," Install beta ",_.manifestBeta.version]}),p?.sourceUrl&&r.jsxs("a",{className:"btn btn--sm btn--ghost",href:p.sourceUrl,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"external"})," Project page"]}),h==="update"&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",disabled:f,onClick:()=>o.launch(c??{id:_.id,title:_.title}),children:[r.jsx(ce,{name:"play"})," Launch installed version"]}),c&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-danger",disabled:f||c.removable===!1,onClick:()=>o.remove(c),children:[r.jsx(ce,{name:"trash"})," Uninstall"]})]}),!!_.screenshots?.length&&r.jsx("div",{className:"repo-shots","aria-label":"Screenshots",children:_.screenshots.map(x=>r.jsx(qj,{url:x.url,caption:x.caption},x.url))}),r.jsx("div",{className:"repo-desc",children:w.isLoading?r.jsxs("div",{className:"muted",children:[r.jsx("span",{className:"spinner sm"})," Loading the description…"]}):w.error?r.jsx(Nt,{error:w.error,title:"Couldn’t load the description"}):w.data?.html?r.jsx(Wj,{html:w.data.html,baseUrl:w.data.baseUrl,className:"repo-desc-body",renderImage:(x,C,j)=>r.jsx(Qj,{src:x,alt:C},j)}):r.jsx("p",{children:p?.appDescription??_.shortDescription??"No description."})})]})})}function Qj({src:s,alt:n}){const{data:l}=wm(s);return l?r.jsx("img",{src:l,alt:n}):null}const _b=s=>s>=1024*1024?`${(s/1024/1024).toFixed(1)} GB`:`${Math.round(s/1024)} MB`;function Jj({device:s}){const{data:n}=fj(s);if(!n)return null;const l=Math.round(n.used/Math.max(1,n.total)*100);return r.jsxs("div",{className:"storage-bar",title:"Developer partition (/media/developer)",children:[r.jsx(ce,{name:"disk"}),r.jsxs("span",{children:[r.jsx("b",{children:_b(n.available)})," free of ",_b(n.total)]}),r.jsx("div",{className:"progress thin",children:r.jsx("div",{className:`progress-fill${l>90?" danger":l>75?" warning":""}`,style:{width:`${l}%`}})})]})}function eT(){const{active:s}=Mt(),{data:n,error:l,isLoading:o,isFetching:d,refetch:_}=Vc(s),w=qc(s,n),{install:c,remove:h,launch:y,busy:p,dialog:f}=w,x=tS(s),[C,j]=M.useState(null),{toast:E}=jt(),[g,b]=M.useState(""),[v,S]=M.useState(!1),[N,T]=M.useState(!1),D=M.useRef(null),O=M.useRef(0),k=!!n?.some(P=>P.systemApp),L=M.useMemo(()=>{const P=g.trim().toLowerCase();return(n??[]).filter(Q=>v||!Q.systemApp).filter(Q=>!P||(Q.title??"").toLowerCase().includes(P)||Q.id.toLowerCase().includes(P)).sort((Q,he)=>(Q.title??Q.id).localeCompare(he.title??he.id))},[n,g,v]),V=P=>{const Q=[...P??[]];Q.length&&(Q.length>1&&E({kind:"info",title:"One at a time",text:`Installing ${Q[0].name} — drop the others after it finishes.`}),c(Q[0]))},q=s?{onDragEnter:P=>{[...P.dataTransfer.types].includes("Files")&&(O.current++,T(!0))},onDragLeave:()=>{O.current=Math.max(0,O.current-1),O.current||T(!1)},onDragOver:P=>{[...P.dataTransfer.types].includes("Files")&&P.preventDefault()},onDrop:P=>{P.preventDefault(),O.current=0,T(!1),p||V(P.dataTransfer.files)}}:{},Y=!!s&&!p;return r.jsxs("div",{className:"drop-zone-page",...q,children:[r.jsx(ys,{eyebrow:"Apps",title:"Installed",accent:"apps",sub:s?r.jsxs(r.Fragment,{children:["Apps on ",r.jsx(ii,{device:s}),". Drop an ",r.jsx("span",{className:"mono",children:".ipk"})," anywhere on this page to install it."]}):"Apps on your TV.",actions:s&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>D.current?.click(),disabled:!Y,children:[r.jsx(ce,{name:"upload"})," Install IPK"]}),r.jsx("input",{ref:D,type:"file",accept:".ipk,application/vnd.debian.binary-package,application/octet-stream",hidden:!0,onChange:P=>{V(P.target.files),P.target.value=""}})]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left",children:[r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Search apps…",value:g,onChange:P=>b(P.target.value),"aria-label":"Search apps"})]}),k&&r.jsxs("label",{className:"switch",children:[r.jsx("input",{type:"checkbox",checked:v,onChange:P=>S(P.target.checked)}),r.jsx("span",{className:"track"}),"System apps"]})]}),r.jsxs("div",{className:"data-toolbar-right",children:[n&&r.jsxs("span",{className:"muted count-label",children:[L.length," of ",n.length]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>_(),"aria-label":"Refresh",title:"Refresh",disabled:d,children:r.jsx(ce,{name:"refresh",className:d?"spin":void 0})})]})]}),l?r.jsx(Nt,{error:l,title:"Couldn’t get the installed apps",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>_(),children:"Retry"})}):o?r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsxs("p",{children:["Asking ",s?.name," for its apps…"]})]}):L.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"apps"})}),r.jsx("h3",{children:g?"No matching apps":"No apps installed yet"}),r.jsx("p",{children:g?"Try another search.":r.jsxs(r.Fragment,{children:["Install an IPK from your computer, or browse the ",r.jsx(Jt,{to:"/apps/homebrew",children:"Homebrew repository"}),"."]})})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table apps-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"App"}),r.jsx("th",{className:"hide-sm",children:"Version"}),r.jsx("th",{className:"hide-sm",children:"Type"}),r.jsx("th",{"aria-label":"Actions"})]})}),r.jsx("tbody",{children:L.map(P=>r.jsx(tT,{app:P,device:s,repo:x.view.get(P.id),onLaunch:y,onRemove:h,onUpdate:Q=>w.installFromRepo(Q.pkg,{update:!0,incompatible:Q.incompatible}),onDetails:Q=>j(Q.pkg.id),busy:p},P.id))})]})}),s&&r.jsx("div",{className:"data-foot",children:r.jsx(Jj,{device:s})})]})})}),N&&r.jsx("div",{className:"drop-overlay","aria-hidden":"true",children:r.jsxs("div",{className:"drop-overlay-card",children:[r.jsx(ce,{name:"upload"}),r.jsxs("div",{children:["Drop to install on ",s?.name]})]})}),r.jsx(iS,{view:C?x.view.get(C)??null:null,device:s,ready:x.ready,actions:w,onClose:()=>j(null)}),f]})}function tT({app:s,device:n,repo:l,onLaunch:o,onRemove:d,onUpdate:_,onDetails:w,busy:c}){const h=l?.state==="update"?l:void 0,{toast:y}=jt(),p=s.removable!==!1&&!s.systemApp,f=s.title??s.id;return r.jsxs("tr",{children:[r.jsx("td",{children:r.jsxs("div",{className:"data-cell-user",children:[r.jsx(_j,{device:n,app:s}),r.jsxs("div",{className:"data-cell-user-meta",children:[r.jsx("div",{className:"data-cell-user-name",children:f}),r.jsxs("div",{className:"data-cell-user-email",children:[s.id,s.version&&r.jsxs("span",{className:"show-sm app-version-sm",children:["v",s.version]})]})]})]})}),r.jsxs("td",{className:"data-cell-mono hide-sm",children:[s.version?`v${s.version}`:"—",h&&r.jsxs("span",{className:"badge warning update-badge",title:`v${h.pkg.manifest?.version} is in the Homebrew repository`,children:["v",h.pkg.manifest?.version," available"]})]}),r.jsx("td",{className:"hide-sm",children:s.type?r.jsx("span",{className:"badge",children:s.type}):"—"}),r.jsx("td",{children:r.jsxs("div",{className:"row-actions",children:[h&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",onClick:()=>_(h),disabled:c,"aria-label":`Update ${f} to ${h.pkg.manifest?.version}`,title:`Update to v${h.pkg.manifest?.version}`,children:[r.jsx(ce,{name:"download"})," ",r.jsx("span",{className:"hide-sm",children:"Update"})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-primary",onClick:()=>o(s),"aria-label":`Launch ${f}`,children:[r.jsx(ce,{name:"play"})," ",r.jsx("span",{className:"hide-sm",children:"Launch"})]}),r.jsx(Ic,{label:`More actions for ${f}`,menuClassName:"dd-menu--compact",floating:!0,trigger:({toggle:x,...C})=>r.jsx("button",{type:"button",className:"btn btn--icon btn--sm btn--ghost","aria-label":`More actions for ${f}`,onClick:x,...C,children:r.jsx(ce,{name:"more"})}),children:x=>r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>{x(),navigator.clipboard.writeText(s.id).then(()=>y({kind:"success",title:"App id copied",text:s.id}))},children:[r.jsx(ce,{name:"copy"})," Copy app id"]}),l&&r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>{x(),w(l)},children:[r.jsx(ce,{name:"store"})," Homebrew repo details"]}),r.jsx("div",{className:"dd-divider"}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item danger",disabled:!p||c,title:p?void 0:"System apps can’t be uninstalled here",onClick:()=>{x(),d(s)},children:[r.jsx(ce,{name:"trash"})," Uninstall"]})]})})]})})]})}function sT(){const{active:s}=Mt(),{repo:n,installed:l,view:o,ready:d}=tS(s),_=qc(s,l.data),w=Pj(),{toast:c}=jt(),[h,y]=M.useState(""),[p,f]=M.useState("all"),[x,C]=M.useState(null),[j,E]=M.useState(!1),g=M.useMemo(()=>[...o.values()].sort((D,O)=>D.pkg.title.localeCompare(O.pkg.title)),[o]),b=M.useMemo(()=>({all:g.length,installed:g.filter(D=>D.installed).length,updates:g.filter(D=>D.state==="update").length}),[g]),v=M.useMemo(()=>{const D=h.trim().toLowerCase();return g.filter(O=>p==="installed"?!!O.installed:p==="updates"?O.state==="update":!0).filter(O=>!D||O.pkg.title.toLowerCase().includes(D)||O.pkg.id.toLowerCase().includes(D)||(O.pkg.shortDescription??O.pkg.manifest?.appDescription??"").toLowerCase().includes(D))},[g,p,h]),S=async()=>{E(!0);try{await w(),l.refetch()}catch(D){c({kind:"danger",title:"Couldn’t refresh the repository",text:xt(D).message})}finally{E(!1)}},N=x?o.get(x)??null:null,T=[{id:"all",label:"All"},{id:"installed",label:"Installed"},{id:"updates",label:"Updates"}];return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Apps",title:"Homebrew",accent:"repository",sub:r.jsxs(r.Fragment,{children:["Apps from"," ",r.jsx("a",{href:"https://repo.webosbrew.org/",target:"_blank",rel:"noopener noreferrer",children:"repo.webosbrew.org"}),s&&r.jsxs(r.Fragment,{children:[" ","for ",r.jsx(ii,{device:s})]}),". Homebrew apps aren’t reviewed by LG — install what you trust."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left",children:[r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Search the repository…",value:h,onChange:D=>y(D.target.value),"aria-label":"Search the repository"})]}),r.jsx("div",{className:"tabs pills",role:"group","aria-label":"Show",children:T.map(D=>r.jsxs("button",{type:"button",className:`tab${p===D.id?" is-active":""}`,"aria-pressed":p===D.id,onClick:()=>f(D.id),children:[D.label,d&&r.jsx("span",{className:`tab-count${D.id==="updates"&&b.updates?" is-hot":""}`,children:b[D.id]})]},D.id))})]}),r.jsxs("div",{className:"data-toolbar-right",children:[n.data&&r.jsxs("span",{className:"muted count-label",children:[v.length," of ",g.length]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:S,"aria-label":"Refresh",title:"Fetch the repository again",disabled:j||n.isFetching,children:r.jsx(ce,{name:"refresh",className:j||n.isFetching?"spin":void 0})})]})]}),n.error?r.jsx(Nt,{error:n.error,title:"Couldn’t load the Homebrew repository",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>n.refetch(),children:"Retry"})}):n.data?v.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"store"})}),r.jsx("h3",{children:h?"No matching apps":p==="updates"?"Everything is up to date":"Nothing here yet"}),r.jsx("p",{children:h?"Try another search.":p==="updates"?"None of the repository apps on this TV has a newer version.":"No repository apps are installed on this TV."})]}):r.jsxs(r.Fragment,{children:[l.error&&r.jsx(Nt,{error:l.error,title:`Couldn’t read the apps on ${s?.name}`,hint:"Install and update buttons stay off until it works."}),r.jsx("ul",{className:"repo-grid",children:v.map(D=>r.jsx(iT,{v:D,ready:d,busy:_.busy,onOpen:()=>C(D.pkg.id),onInstall:()=>_.installFromRepo(D.pkg,{update:D.state==="update",incompatible:D.incompatible}),onLaunch:()=>_.launch(D.installed??{id:D.pkg.id,title:D.pkg.title})},D.pkg.id))})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Fetching the repository…"})]})]})})}),r.jsx(iS,{view:N,device:s,ready:d,actions:_,onClose:()=>C(null)}),_.dialog]})}function iT({v:s,ready:n,busy:l,onOpen:o,onInstall:d,onLaunch:_}){const{pkg:w,state:c,incompatible:h,installed:y}=s,p=w.manifest;return r.jsxs("li",{className:`repo-card${c==="update"?" has-update":""}`,children:[r.jsxs("button",{type:"button",className:"repo-card-main",onClick:o,"aria-label":`Details for ${w.title}`,children:[r.jsx(sS,{pkg:w}),r.jsxs("span",{className:"repo-card-text",children:[r.jsx("span",{className:"repo-card-title",children:w.title}),r.jsx("span",{className:"repo-card-desc",children:w.shortDescription??p?.appDescription??w.id})]})]}),r.jsxs("div",{className:"repo-card-foot",children:[r.jsxs("div",{className:"repo-badges",children:[p&&r.jsxs("span",{className:"mono repo-card-version",children:["v",p.version]}),c==="update"&&r.jsx("span",{className:"badge warning",title:`Installed: v${y?.version??"?"}`,children:"Update"}),c==="installed"&&r.jsx("span",{className:"badge success",children:"Installed"}),p?.rootRequired===!0&&r.jsx("span",{className:"badge purple",children:"Root"}),h&&r.jsx("span",{className:"badge danger",title:"Marked as not compatible with this TV",children:"May not work"})]}),c==="installed"?r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:_,disabled:!n||l,"aria-label":`Launch ${w.title}`,children:[r.jsx(ce,{name:"play"})," Launch"]}):r.jsxs("button",{type:"button",className:`btn btn--sm ${c==="update"?"btn--primary":"btn--soft-primary"}`,onClick:d,disabled:!n||l||!p,"aria-label":`${c==="update"?"Update":"Install"} ${w.title}`,children:[r.jsx(ce,{name:"download"})," ",c==="update"?"Update":"Install"]})]})]})}const hl=(s,n)=>s==="/"?`/${n}`:`${s}/${n}`,nT=s=>{if(s==="/")return null;const n=s.lastIndexOf("/");return n<=0?"/":s.slice(0,n)};function rT(s,n="/"){const l=s.trim();if(!l)return null;const o=(l.startsWith("/")?l:`${n}/${l}`).split("/"),d=[];for(const _ of o)if(!(!_||_==="."))if(_===".."){if(!d.length)return null;d.pop()}else d.push(_);return`/${d.join("/")}`}function aT(s){const n=[{name:"/",path:"/"}];let l="";for(const o of s.split("/").filter(Boolean))l+=`/${o}`,n.push({name:o,path:l});return n}const xn=s=>s.type==="d"||s.type==="l"&&s.link?.type==="d",Sn=s=>s.type==="-"||s.type==="l"&&s.link?.type==="-",Fs=s=>s>=1024**3?`${(s/1024**3).toFixed(1)} GB`:s>=1024**2?`${(s/1024**2).toFixed(1)} MB`:s>=1024?`${(s/1024).toFixed(s>=10*1024?0:1)} KB`:`${s} B`,lT=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),oT=s=>s>0?lT.format(new Date(s*1e3)):"—";function cT(s,n,l){const o=l==="asc"?1:-1,d=(_,w)=>_.name.localeCompare(w.name,void 0,{numeric:!0,sensitivity:"base"});return[...s].sort((_,w)=>{const c=Number(xn(w))-Number(xn(_));return c||(n==="size"?o*((Sn(_)?_.size:0)-(Sn(w)?w.size:0))||d(_,w):n==="mtime"?o*(_.mtime-w.mtime)||d(_,w):o*d(_,w))})}const uT=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"],["webp","image/webp"],["bmp","image/bmp"],["ico","image/x-icon"]]),nS=s=>s.includes(".")?uT.get(s.split(".").pop().toLowerCase()):void 0;function hT(s){const n=Math.min(s.length,4096);let l=0;for(let o=0;o<n;o++){const d=s[o];if(d===0)return!1;d<32&&d!==9&&d!==10&&d!==13&&d!==27&&l++}return l<=n/50}function yb({open:s,title:n,label:l,initial:o="",confirmText:d,taken:_,onSubmit:w,onClose:c}){const h=M.useId(),[y,p]=M.useState(o),[f,x]=M.useState(!1),[C,j]=M.useState(null),[E,g]=M.useState(!1),b=M.useRef(null);M.useEffect(()=>{s&&(p(o),j(null),g(!1),requestAnimationFrame(()=>{const N=b.current;if(!N)return;N.focus();const T=o.lastIndexOf(".");N.setSelectionRange(0,T>0?T:o.length)}))},[s,o]);const v=M.useMemo(()=>{const N=y.trim();return N?N.includes("/")?"Names can’t contain “/”.":N==="."||N===".."?"That name isn’t allowed.":N.length>255?"Keep it under 255 characters.":N!==o&&_.includes(N)?"Something with that name is already here.":null:"Enter a name."},[y,_,o]),S=async N=>{if(N.preventDefault(),g(!0),v||y.trim()===o){v||c();return}x(!0),j(null);try{await w(y.trim()),c()}catch(T){j(T)}finally{x(!1)}};return r.jsx(si,{open:s,onClose:c,dismissible:!f,size:"sm",title:n,footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:c,disabled:f,children:"Cancel"}),r.jsxs("button",{type:"submit",form:`${h}-form`,className:"btn btn--primary",disabled:f,children:[f?r.jsx("span",{className:"spinner sm"}):null," ",d]})]}),children:r.jsxs("form",{id:`${h}-form`,className:"stack",onSubmit:S,children:[r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:`${h}-name`,children:l}),r.jsx("input",{ref:b,id:`${h}-name`,className:`input mono${E&&v?" is-invalid":""}`,value:y,onChange:N=>p(N.target.value),autoComplete:"off",spellCheck:!1,maxLength:255}),E&&v&&r.jsx("span",{className:"field-error",children:v})]}),C!==null&&r.jsx(Nt,{error:C})]})})}function dT({preview:s,onDownload:n,onClose:l}){return r.jsxs(si,{open:!!s,onClose:l,size:"lg",title:s?.name??"",footer:s&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"muted preview-size",children:Fs(s.size)}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:n,disabled:s.kind==="loading",children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsx("button",{type:"button",className:"btn btn--primary",onClick:l,children:"Close"})]}),children:[s?.kind==="loading"&&r.jsxs("div",{className:"op-progress",children:[r.jsxs("div",{className:"op-progress-text",children:[r.jsx("span",{children:"Reading from the TV…"}),r.jsx("span",{className:"mono",children:Fs(s.got)})]}),r.jsx("div",{className:"progress",children:r.jsx("div",{className:"progress-fill is-indeterminate"})})]}),s?.kind==="text"&&r.jsxs(r.Fragment,{children:[s.truncated&&r.jsxs("p",{className:"muted",children:["Showing the first ",Fs(s.text.length),". Download the file to see all of it."]}),r.jsx("pre",{className:"file-preview-text",children:s.text||"(empty file)"})]}),s?.kind==="image"&&r.jsx("div",{className:"file-preview-image",children:r.jsx("img",{src:s.url,alt:s.name})}),s?.kind==="binary"&&r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"files"})}),r.jsx("h3",{children:"No preview for this file"}),r.jsx("p",{children:"It doesn’t look like text or an image. Download it to open it on this computer."})]}),s?.kind==="error"&&r.jsx(Nt,{error:s.error,title:"Couldn’t read the file"})]})}function fT({progress:s,onCancel:n,onClose:l}){const o=s?.error!==void 0;return r.jsxs(si,{open:!!s,onClose:o?s?.choose?()=>s.choose("abort"):l:n,dismissible:o||!!s?.canCancel,title:s?.title??"",footer:s&&(o&&s.choose?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>s.choose("abort"),children:s.canSkip?"Stop":"Close"}),s.canSkip&&r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>s.choose("skip"),children:"Skip"}),r.jsx("button",{type:"button",className:"btn btn--primary",onClick:()=>s.choose("retry"),children:"Retry"})]}):o?r.jsx("button",{type:"button",className:"btn btn--primary",onClick:l,children:"Close"}):s.canCancel?r.jsx("button",{type:"button",className:"btn btn--ghost",onClick:n,children:"Cancel"}):null),children:[s&&!o&&r.jsxs("div",{className:"op-progress",children:[s.step&&r.jsx("div",{className:"muted",children:s.step}),r.jsxs("div",{className:"op-progress-text",children:[r.jsx("span",{children:s.text}),s.percent!==void 0&&r.jsxs("span",{className:"mono",children:[s.percent,"%"]})]}),r.jsx("div",{className:"progress",children:r.jsx("div",{className:`progress-fill${s.percent===void 0?" is-indeterminate":""}`,style:s.percent!==void 0?{width:`${s.percent}%`,animation:"none"}:void 0})})]}),s&&o&&r.jsx(Nt,{error:s.error,title:s.errorTitle})]})}const rf=512*1024,mT=20*1024*1024,pT=500*1024*1024;function gT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Device",title:"Files",sub:s?r.jsxs(r.Fragment,{children:["Browse ",r.jsx(ii,{device:s})," over SFTP. Drop files on this page to upload them to the folder you’re in."]}):"Browse your TV’s files."}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(_T,{device:s},`${s.id}:${s.updatedAt}`)})})]})}function vT(s){return xn(s)?"folder":s.type==="l"?"link":s.type==="-"?nS(s.name)?"image":"file":"cog"}function _T({device:s}){const{ready:n,call:l,client:o}=ut(),{confirm:d,toast:_}=jt(),w=En(),c=M.useMemo(()=>gt(s),[s]),[h,y]=M.useState(null),p=h?h.stack[h.i]:null,[f,x]=M.useState({key:"name",dir:"asc"}),[C,j]=M.useState(new Set),[E,g]=M.useState(!1),[b,v]=M.useState(""),[S,N]=M.useState(null),[T,D]=M.useState(null),[O,k]=M.useState(null),[L,V]=M.useState(!1),q=M.useRef(0),Y=M.useRef(null),P=M.useRef(null),Q=ss({queryKey:["files-home",s.id,s.updatedAt],queryFn:async()=>(await l("files.home",{device:c},3e4)).path,enabled:n,staleTime:1/0,retry:!1});M.useEffect(()=>{!h&&Q.data&&y({stack:[Q.data],i:0})},[Q.data,h]);const he=["files",s.id,s.updatedAt,p],ne=ss({queryKey:he,queryFn:()=>l("files.list",{device:c,path:p},6e4),enabled:n&&!!p,staleTime:1e4,retry:!1}),W=ss({queryKey:["storage",s.id,s.updatedAt,p],queryFn:()=>l("device.storage",{device:c,path:p},3e4),enabled:n&&!!p,staleTime:3e4,retry:!1}),I=M.useMemo(()=>cT(ne.data?.items??[],f.key,f.dir),[ne.data,f]),A=M.useMemo(()=>I.map(G=>G.name),[I]),B=I.filter(G=>C.has(G.name)),F=!!O&&O.error===void 0,$=()=>w.invalidateQueries({queryKey:["files",s.id]}),J=G=>{j(new Set),g(!1),y(Se=>{if(!Se)return{stack:[G],i:0};if(Se.stack[Se.i]===G)return Se;const Ie=[...Se.stack.slice(0,Se.i+1),G].slice(-20);return{stack:Ie,i:Ie.length-1}})},z=G=>{j(new Set),y(Se=>Se&&{...Se,i:Math.max(0,Math.min(Se.stack.length-1,Se.i+G))})},ee=G=>j(Se=>{const Ie=new Set(Se);return Ie.has(G)?Ie.delete(G):Ie.add(G),Ie}),de=I.length>0&&C.size===I.length,Z=G=>x(Se=>({key:G,dir:Se.key===G&&Se.dir==="asc"?"desc":"asc"})),U=G=>f.key===G?f.dir==="asc"?"ascending":"descending":"none",ue=G=>{if(p){if(xn(G))return J(hl(p,G.name));if(G.type==="l"&&G.link?.broken){_({kind:"warning",title:`${G.name} is a broken link`,text:G.link.target?`It points to ${G.link.target}, which doesn’t exist.`:void 0});return}Sn(G)&&pe(G)}},pe=async G=>{const Se=hl(p,G.name),Ie=G.type==="l"?(await l("files.stat",{device:c,path:Se}).catch(()=>G)).size:G.size,Qe=new AbortController;Y.current=Qe,D({kind:"loading",name:G.name,size:Ie,got:0,path:Se});const He=Be=>!Qe.signal.aborted&&D({...Be,path:Se});try{const Be=nS(G.name);if(Be&&Ie<=mT){const Vt=await Vd(o,c,Se,{onProgress:bi=>He({kind:"loading",name:G.name,size:Ie,got:bi}),signal:Qe.signal});He({kind:"image",name:G.name,size:Ie,url:URL.createObjectURL(new Blob(Vt.parts,{type:Be}))});return}const dt=await Vd(o,c,Se,{limit:rf,signal:Qe.signal}),De=new Uint8Array(await new Blob(dt.parts).arrayBuffer()).subarray(0,rf);if(!hT(De))return He({kind:"binary",name:G.name,size:Ie});He({kind:"text",name:G.name,size:Ie,text:new TextDecoder("utf-8",{fatal:!1}).decode(De),truncated:dt.truncated||Ie>rf})}catch(Be){Be instanceof yt&&Be.code==="cancelled"||He({kind:"error",name:G.name,size:Ie,error:Be})}},me=()=>{Y.current?.abort(),T?.kind==="image"&&URL.revokeObjectURL(T.url),D(null)},ge=(G,Se,Ie,Qe)=>new Promise(He=>k({...G,canCancel:!1,canSkip:Qe,error:Se,errorTitle:Ie,choose:Be=>{k(null),He(Be)}})),Re=async G=>{if(!o||!G.length)return;const Se=G.reduce((He,Be)=>He+Be.size,0);if(Se>pT&&!await d({title:`Download ${Fs(Se)}?`,message:r.jsx(r.Fragment,{children:"The browser keeps the whole download in memory until it is saved, which can slow this computer down or fail for very large files."}),confirmText:"Download"}))return;const Ie=new AbortController;Y.current=Ie;let Qe=0;for(const[He,Be]of G.entries()){const dt={title:G.length>1?"Downloading files":`Downloading ${Be.name}`,step:G.length>1?`${He+1} of ${G.length}: ${Be.name}`:void 0,canCancel:!0};for(;;){k({...dt,text:"Reading from the TV…",percent:Be.size?0:void 0});try{const De=await Vd(o,c,Be.path,{signal:Ie.signal,onProgress:Vt=>k({...dt,text:`${Fs(Vt)} of ${Fs(Be.size)}`,percent:Be.size?Math.min(100,Math.round(Vt/Be.size*100)):void 0})});Cn(new Blob(De.parts),Be.name),Qe++;break}catch(De){if(De instanceof yt&&De.code==="cancelled")return k(null);const Vt=await ge({...dt,text:""},De,`Couldn’t download ${Be.name}`,G.length>1);if(Vt==="abort")return;if(Vt==="skip")break}}}k(null),Qe>1&&_({kind:"success",title:`Downloaded ${Qe} files`})},tt=()=>Re(B.filter(Sn).map(G=>({name:G.name,path:hl(p,G.name),size:G.type==="-"?G.size:0}))),qe=async G=>{if(!o||!p||!G.length||F)return;const Se=p,Ie=new Map(I.map(dt=>[dt.name,dt])),Qe=new AbortController;Y.current=Qe;let He=0;const Be=()=>{$(),W.refetch(),He&&_({kind:"success",title:He===1&&G.length===1?`Uploaded ${G[0].name}`:`Uploaded ${He} ${He===1?"file":"files"}`,text:`To ${Se}.`})};for(const[dt,De]of G.entries()){const Vt=G.length>1?`Uploading ${G.length} files`:`Uploading ${De.name}`,bi=G.length>1?`${dt+1} of ${G.length}: ${De.name}`:void 0,Ss={title:Vt,step:bi,canCancel:!0},Fi=Ie.get(De.name),Tl=De.size>Rf?new Error(`It is larger than the bridge accepts (${Fs(Rf)}).`):Fi&&xn(Fi)?new Error(`There is a folder called ${De.name} in ${Se}. Rename one of them first.`):null;if(Tl){if(await ge({...Ss,text:""},Tl,`Can’t upload ${De.name}`,G.length>1)==="abort")return Be();continue}if(!(Fi&&(k(null),!await d({title:`Replace ${De.name}?`,message:r.jsxs(r.Fragment,{children:["A file called ",r.jsx("b",{children:De.name})," is already in ",r.jsx("span",{className:"mono",children:Se}),". Replace it with the one from this computer?"]}),confirmText:"Replace",danger:!0}))))for(;;){const rr=ea();k({...Ss,text:"Sending to the bridge…",percent:0});const ns=pc(o,rr,ai=>k({...Ss,canCancel:!1,text:ai.text??"Copying to the TV…",percent:ai.percent}));try{const ai=await U0(o,De,(Vi,fa)=>k({...Ss,text:`Sending to the bridge… ${Fs(Vi)} of ${Fs(fa)}`,percent:Math.round(Vi/Math.max(1,fa)*100)}),Qe.signal);k({...Ss,canCancel:!1,text:"Copying to the TV…",percent:0}),await o.call("files.write",{device:c,path:hl(Se,De.name),uploadId:ai,opId:rr,overwrite:!!Fi},30*6e4),He++;break}catch(ai){if(ai instanceof yt&&ai.code==="cancelled")return k(null),Be();const Vi=await ge({...Ss,text:""},ai,`Couldn’t upload ${De.name}`,G.length>1);if(Vi==="abort")return Be();if(Vi==="skip")break}finally{ns()}}}k(null),Be()},at=async()=>{if(!p||!B.length)return;const G=B.slice(0,6);if(!await d({title:B.length===1?`Delete ${B[0].name}?`:`Delete ${B.length} items?`,message:r.jsxs(r.Fragment,{children:[r.jsxs("ul",{className:"plain-list mono",children:[G.map(dt=>r.jsxs("li",{children:[dt.name,dt.type==="d"?"/ (and everything in it)":""]},dt.name)),B.length>G.length&&r.jsxs("li",{children:["…and ",B.length-G.length," more"]})]}),r.jsx("p",{children:"This can’t be undone. Deleting files you don’t know may break your TV."})]}),confirmText:"Delete",danger:!0}))return;const Ie=p,Qe=B;let He=0;const Be=()=>{j(new Set),$(),W.refetch(),He&&_({kind:"success",title:He===1&&Qe.length===1?`Deleted ${Qe[0].name}`:`Deleted ${He} ${He===1?"item":"items"}`})};for(const[dt,De]of Qe.entries()){const Vt={title:"Deleting",step:Qe.length>1?`${dt+1} of ${Qe.length}`:void 0,canCancel:!1};for(;;){k({...Vt,text:De.name});try{await l("files.remove",{device:c,path:hl(Ie,De.name)},13e4),He++;break}catch(bi){const Ss=await ge({...Vt,text:""},bi,`Couldn’t delete ${De.name}`,Qe.length>1);if(Ss==="abort")return Be();if(Ss==="skip")break}}}k(null),Be()},we=async G=>{await l("files.mkdir",{device:c,parent:p,name:G}),$(),_({kind:"success",title:`Created ${G}`})},Ke=async(G,Se)=>{await l("files.rename",{device:c,parent:p,from:G.name,to:Se}),j(new Set([Se])),$()},Bt=()=>{const G=rT(b,p??"/");if(!G)return _({kind:"warning",title:"That isn’t a path on the TV",text:"Use an absolute path like /media/developer."});J(G)},bs=G=>{G.key==="Enter"&&Bt(),G.key==="Escape"&&g(!1)},is={onDragEnter:G=>{[...G.dataTransfer.types].includes("Files")&&(q.current++,V(!0))},onDragLeave:()=>{q.current=Math.max(0,q.current-1),q.current||V(!1)},onDragOver:G=>{[...G.dataTransfer.types].includes("Files")&&G.preventDefault()},onDrop:G=>{G.preventDefault(),q.current=0,V(!1),qe([...G.dataTransfer.files])}},es=ne.error??Q.error,wt=!!p&&p!=="/",It=W.data?Math.round(W.data.used/Math.max(1,W.data.total)*100):0;return r.jsxs("section",{className:"card col-12 files-card",...is,children:[r.jsxs("div",{className:"files-nav",children:[r.jsxs("div",{className:"btn-group-tight",children:[r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>z(-1),disabled:!h||h.i===0,"aria-label":"Back",title:"Back",children:r.jsx(ce,{name:"chevLeft"})}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>z(1),disabled:!h||h.i>=h.stack.length-1,"aria-label":"Forward",title:"Forward",children:r.jsx(ce,{name:"chevRight"})}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>p&&J(nT(p)),disabled:!wt,"aria-label":"Up one folder",title:"Up one folder",children:r.jsx(ce,{name:"arrowUp"})}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>Q.data&&J(Q.data),disabled:!Q.data,"aria-label":"Home folder",title:Q.data?`Home (${Q.data})`:"Home",children:r.jsx(ce,{name:"home"})})]}),E?r.jsx("input",{className:"input mono files-path-input","aria-label":"Path",value:b,autoFocus:!0,onChange:G=>v(G.target.value),onKeyDown:bs,onBlur:()=>g(!1),spellCheck:!1}):r.jsxs("nav",{className:"files-crumbs","aria-label":"Folder path",children:[p?aT(p).map((G,Se,Ie)=>r.jsxs("span",{className:"files-crumb",children:[Se>1&&r.jsx("span",{className:"files-crumb-sep",children:"/"}),r.jsx("button",{type:"button",className:Se===Ie.length-1?"is-current":void 0,onClick:()=>J(G.path),"aria-current":Se===Ie.length-1?"page":void 0,children:Se===0?r.jsx(ce,{name:"disk"}):G.name})]},G.path)):r.jsx("span",{className:"muted",children:Q.error?"Couldn’t connect":`Connecting to ${s.name}…`}),r.jsx("button",{type:"button",className:"files-path-edit",onClick:()=>{v(p??"/"),g(!0)},"aria-label":"Type a path",title:"Type a path",children:r.jsx(ce,{name:"edit"})})]}),r.jsxs("div",{className:"btn-group-tight",children:[r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>$(),disabled:!p||ne.isFetching,"aria-label":"Refresh",title:"Refresh",children:r.jsx(ce,{name:"refresh",className:ne.isFetching?"spin":void 0})}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>N({kind:"mkdir"}),disabled:!ne.data||F,children:[r.jsx(ce,{name:"folderPlus"})," ",r.jsx("span",{className:"hide-sm",children:"New folder"})]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",onClick:()=>P.current?.click(),disabled:!ne.data||F,children:[r.jsx(ce,{name:"upload"})," ",r.jsx("span",{className:"hide-sm",children:"Upload"})]}),r.jsx("input",{ref:P,type:"file",multiple:!0,hidden:!0,onChange:G=>{qe([...G.target.files??[]]),G.target.value=""}})]})]}),B.length>0&&r.jsxs("div",{className:"files-selbar",role:"toolbar","aria-label":"Selected items",children:[r.jsxs("span",{className:"files-selbar-count",children:[B.length," selected"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:tt,disabled:F||!B.some(Sn),title:B.every(Sn)?void 0:"Folders are skipped — only files can be downloaded",children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>N({kind:"rename",item:B[0]}),disabled:F||B.length!==1,children:[r.jsx(ce,{name:"edit"})," Rename"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-danger",onClick:at,disabled:F,children:[r.jsx(ce,{name:"trash"})," Delete"]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost files-selbar-clear",onClick:()=>j(new Set),children:"Clear"})]}),es?r.jsx(Nt,{error:es,title:xt(es).code==="no_sftp"?"The file browser needs SFTP":`Couldn’t open ${p??"the home folder"}`,action:r.jsxs("div",{className:"row",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>Q.error?Q.refetch():ne.refetch(),children:"Retry"}),p&&Q.data&&p!==Q.data&&r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>J(Q.data),children:"Home"})]})}):ne.data?I.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"folder"})}),r.jsx("h3",{children:"This folder is empty"}),r.jsx("p",{children:"Drop files here or use Upload to put something in it."})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table files-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"files-check",children:r.jsxs("label",{className:"check",title:de?"Select none":"Select all",children:[r.jsx("input",{type:"checkbox",checked:de,"aria-label":"Select all",ref:G=>{G&&(G.indeterminate=C.size>0&&!de)},onChange:()=>j(de?new Set:new Set(A))}),r.jsx("span",{className:"box"})]})}),[["name","Name",""],["size","Size","files-num"],["mtime","Modified","hide-sm"]].map(([G,Se,Ie])=>r.jsx("th",{className:`${Ie} ${f.key===G?`sorted-${f.dir}`:""}`,"aria-sort":U(G),children:r.jsxs("button",{type:"button",className:"th-sort",onClick:()=>Z(G),children:[Se,r.jsx("span",{className:"sort",children:r.jsx(ce,{name:"chevDown"})})]})},G)),r.jsx("th",{className:"hide-sm",children:"Permissions"}),r.jsx("th",{className:"hide-md",children:"Owner"})]})}),r.jsx("tbody",{children:I.map(G=>{const Se=C.has(G.name),Ie=G.access&&!G.access.write;return r.jsxs("tr",{className:Se?"is-selected":void 0,onDoubleClick:()=>ue(G),children:[r.jsx("td",{className:"files-check",children:r.jsxs("label",{className:"check",children:[r.jsx("input",{type:"checkbox",checked:Se,onChange:()=>ee(G.name),"aria-label":`Select ${G.name}`}),r.jsx("span",{className:"box"})]})}),r.jsx("td",{children:r.jsxs("div",{className:"files-name",children:[r.jsx("span",{className:`files-ico files-ico--${xn(G)?"dir":G.type==="l"?"link":"file"}`,children:r.jsx(ce,{name:vT(G)})}),xn(G)||Sn(G)||G.type==="l"?r.jsx("button",{type:"button",className:"files-open",onClick:()=>ue(G),title:xn(G)?`Open ${G.name}`:`Preview ${G.name}`,children:G.name}):r.jsx("span",{className:"files-open is-plain",children:G.name}),G.link&&r.jsxs("span",{className:`files-link${G.link.broken?" is-broken":""}`,title:G.link.broken?"Broken link":void 0,children:["→ ",G.link.target??"?"]}),Ie&&r.jsx("span",{className:"files-lock",title:"Read-only for this login",children:r.jsx(ce,{name:"lock"})})]})}),r.jsx("td",{className:"files-num mono",children:Sn(G)&&G.type==="-"?Fs(G.size):"—"}),r.jsx("td",{className:"hide-sm files-time",children:oT(G.mtime)}),r.jsxs("td",{className:"hide-sm mono files-mode",children:[G.type==="-"?"-":G.type,G.mode]}),r.jsxs("td",{className:"hide-md files-owner",children:[G.user??"—",G.group&&G.group!==G.user?r.jsxs("span",{className:"muted",children:[" · ",G.group]}):null]})]},G.name)})})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:p?`Opening ${p}…`:`Connecting to ${s.name}…`})]}),r.jsxs("div",{className:"data-foot files-foot",children:[r.jsxs("span",{className:"muted",children:[ne.data?`${I.length} ${I.length===1?"item":"items"}`:"",B.length>0?` · ${B.length} selected`:""]}),W.data&&r.jsxs("div",{className:"storage-bar",title:`Free space where ${p} lives`,children:[r.jsx(ce,{name:"disk"}),r.jsxs("span",{children:[r.jsx("b",{children:Fs(W.data.available*1024)})," free of ",Fs(W.data.total*1024)]}),r.jsx("div",{className:"progress thin",children:r.jsx("div",{className:`progress-fill${It>90?" danger":It>75?" warning":""}`,style:{width:`${It}%`}})})]})]}),L&&r.jsx("div",{className:"drop-overlay","aria-hidden":"true",children:r.jsxs("div",{className:"drop-overlay-card",children:[r.jsx(ce,{name:"upload"}),r.jsxs("div",{children:["Drop to upload to ",p]})]})}),r.jsx(yb,{open:S?.kind==="mkdir",title:"New folder",label:`Name of the new folder in ${p}`,confirmText:"Create",taken:A,onSubmit:we,onClose:()=>N(null)}),r.jsx(yb,{open:S?.kind==="rename",title:S?.kind==="rename"?`Rename ${S.item.name}`:"Rename",label:"New name",initial:S?.kind==="rename"?S.item.name:"",confirmText:"Rename",taken:A,onSubmit:G=>S?.kind==="rename"?Ke(S.item,G):Promise.resolve(),onClose:()=>N(null)}),r.jsx(dT,{preview:T,onClose:me,onDownload:()=>{if(!T)return;const G=T;me(),Re([{name:G.name,path:G.path,size:G.size}])}}),r.jsx(fT,{progress:O,onCancel:()=>Y.current?.abort(),onClose:()=>k(null)})]})}var af={exports:{}},bb;function yT(){return bb||(bb=1,(function(s,n){(function(l,o){s.exports=o()})(globalThis,(()=>(()=>{var l={4567:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const f=h(9042),x=h(9924),C=h(844),j=h(4725),E=h(2585),g=h(3656);let b=c.AccessibilityManager=class extends C.Disposable{constructor(v,S,N,T){super(),this._terminal=v,this._coreBrowserService=N,this._renderService=T,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let D=0;D<this._terminal.rows;D++)this._rowElements[D]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[D]);if(this._topBoundaryFocusListener=D=>this._handleBoundaryFocus(D,0),this._bottomBoundaryFocusListener=D=>this._handleBoundaryFocus(D,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(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((D=>this._handleResize(D.rows)))),this.register(this._terminal.onRender((D=>this._refreshRows(D.start,D.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((D=>this._handleChar(D)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
23
23
  `)))),this.register(this._terminal.onA11yTab((D=>this._handleTab(D)))),this.register(this._terminal.onKey((D=>this._handleKey(D.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let S=0;S<v;S++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
24
24
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),/\p{Control}/u.test(v)||this._charsToConsume.push(v)}_refreshRows(v,S){this._liveRegionDebouncer.refresh(v,S,this._terminal.rows)}_renderRows(v,S){const N=this._terminal.buffer,T=N.lines.length.toString();for(let D=v;D<=S;D++){const O=N.lines.get(N.ydisp+D),k=[],L=O?.translateToString(!0,void 0,void 0,k)||"",V=(N.ydisp+D+1).toString(),q=this._rowElements[D];q&&(L.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=L,this._rowColumns.set(q,k)),q.setAttribute("aria-posinset",V),q.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,S){const N=v.target,T=this._rowElements[S===0?1:this._rowElements.length-2];if(N.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==T)return;let D,O;if(S===0?(D=N,O=this._rowElements.pop(),this._rowContainer.removeChild(O)):(D=this._rowElements.shift(),O=N,this._rowContainer.removeChild(D)),D.removeEventListener("focus",this._topBoundaryFocusListener),O.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const k=this._createAccessibilityTreeNode();this._rowElements.unshift(k),this._rowContainer.insertAdjacentElement("afterbegin",k)}else{const k=this._createAccessibilityTreeNode();this._rowElements.push(k),this._rowContainer.appendChild(k)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:v.anchorNode,offset:v.anchorOffset},N={node:v.focusNode,offset:v.focusOffset};if((S.node.compareDocumentPosition(N.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===N.node&&S.offset>N.offset)&&([S,N]=[N,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const T=this._rowElements.slice(-1)[0];if(N.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(N={node:T,offset:T.textContent?.length??0}),!this._rowContainer.contains(N.node))return;const D=({node:L,offset:V})=>{const q=L instanceof Text?L.parentNode:L;let Y=parseInt(q?.getAttribute("aria-posinset"),10)-1;if(isNaN(Y))return console.warn("row is invalid. Race condition?"),null;const P=this._rowColumns.get(q);if(!P)return console.warn("columns is null. Race condition?"),null;let Q=V<P.length?P[V]:P.slice(-1)[0]+1;return Q>=this._terminal.cols&&(++Y,Q=0),{row:Y,column:Q}},O=D(S),k=D(N);if(O&&k){if(O.row>k.row||O.row===k.row&&O.column>=k.column)throw new Error("invalid range");this._terminal.select(O.column,O.row,(k.row-O.row)*this._terminal.cols-O.column+k.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=b=y([p(1,E.IInstantiationService),p(2,j.ICoreBrowserService),p(3,j.IRenderService)],b)},3614:(w,c)=>{function h(x){return x.replace(/\r?\n/g,"\r")}function y(x,C){return C?"\x1B[200~"+x+"\x1B[201~":x}function p(x,C,j,E){x=y(x=h(x),j.decPrivateModes.bracketedPasteMode&&E.rawOptions.ignoreBracketedPasteMode!==!0),j.triggerDataEvent(x,!0),C.value=""}function f(x,C,j){const E=j.getBoundingClientRect(),g=x.clientX-E.left-10,b=x.clientY-E.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${g}px`,C.style.top=`${b}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=h,c.bracketTextForPaste=y,c.copyHandler=function(x,C){x.clipboardData&&x.clipboardData.setData("text/plain",C.selectionText),x.preventDefault()},c.handlePasteEvent=function(x,C,j,E){x.stopPropagation(),x.clipboardData&&p(x.clipboardData.getData("text/plain"),C,j,E)},c.paste=p,c.moveTextAreaUnderMouseCursor=f,c.rightClickHandler=function(x,C,j,E,g){f(x,C,j),g&&E.rightClickSelect(x),C.value=E.selectionText,C.select()}},7239:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const y=h(1505);c.ColorContrastCache=class{constructor(){this._color=new y.TwoKeyMap,this._css=new y.TwoKeyMap}setCss(p,f,x){this._css.set(p,f,x)}getCss(p,f){return this._css.get(p,f)}setColor(p,f,x){this._color.set(p,f,x)}getColor(p,f){return this._color.get(p,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(h,y,p,f){h.addEventListener(y,p,f);let x=!1;return{dispose:()=>{x||(x=!0,h.removeEventListener(y,p,f))}}}},3551:function(w,c,h){var y=this&&this.__decorate||function(b,v,S,N){var T,D=arguments.length,O=D<3?v:N===null?N=Object.getOwnPropertyDescriptor(v,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,v,S,N);else for(var k=b.length-1;k>=0;k--)(T=b[k])&&(O=(D<3?T(O):D>3?T(v,S,O):T(v,S))||O);return D>3&&O&&Object.defineProperty(v,S,O),O},p=this&&this.__param||function(b,v){return function(S,N){v(S,N,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const f=h(3656),x=h(8460),C=h(844),j=h(2585),E=h(4725);let g=c.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(b,v,S,N,T){super(),this._element=b,this._mouseService=v,this._renderService=S,this._bufferService=N,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const S=b.composedPath();for(let N=0;N<S.length;N++){const T=S[N];if(T.classList.contains("xterm"))break;if(T.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,v){this._activeProviderReplies&&v||(this._activeProviderReplies?.forEach((N=>{N?.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[N,T]of this._linkProviderService.linkProviders.entries())v?this._activeProviderReplies?.get(N)&&(S=this._checkLinkProviderResult(N,b,S)):T.provideLinks(b.y,(D=>{if(this._isMouseOut)return;const O=D?.map((k=>({link:k})));this._activeProviderReplies?.set(N,O),S=this._checkLinkProviderResult(N,b,S),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,v){const S=new Set;for(let N=0;N<v.size;N++){const T=v.get(N);if(T)for(let D=0;D<T.length;D++){const O=T[D],k=O.link.range.start.y<b?0:O.link.range.start.x,L=O.link.range.end.y>b?this._bufferService.cols:O.link.range.end.x;for(let V=k;V<=L;V++){if(S.has(V)){T.splice(D--,1);break}S.add(V)}}}}_checkLinkProviderResult(b,v,S){if(!this._activeProviderReplies)return S;const N=this._activeProviderReplies.get(b);let T=!1;for(let D=0;D<b;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(T=!0);if(!T&&N){const D=N.find((O=>this._linkAtPosition(O.link,v)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;D<this._activeProviderReplies.size;D++){const O=this._activeProviderReplies.get(D)?.find((k=>this._linkAtPosition(k.link,v)));if(O){S=!0,this._handleNewLink(O);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,v){this._currentLink&&this._lastMouseEvent&&(!b||!v||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(b.link,v)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:S=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:S=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const N=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,T=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=N&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(N,T),this._lastMouseEvent)){const D=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);D&&this._askForLink(D,!1)}}))))}_linkHover(b,v,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(S,v.text)}_fireUnderlineEvent(b,v){const S=b.range,N=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-N-1,S.end.x,S.end.y-N-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(b,v,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(S,v.text)}_linkAtPosition(b,v){const S=b.range.start.y*this._bufferService.cols+b.range.start.x,N=b.range.end.y*this._bufferService.cols+b.range.end.x,T=v.y*this._bufferService.cols+v.x;return S<=T&&T<=N}_positionFromMouseEvent(b,v,S){const N=S.getCoords(b,v,this._bufferService.cols,this._bufferService.rows);if(N)return{x:N[0],y:N[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,v,S,N,T){return{x1:b,y1:v,x2:S,y2:N,cols:this._bufferService.cols,fg:T}}};c.Linkifier=g=y([p(1,E.IMouseService),p(2,E.IRenderService),p(3,j.IBufferService),p(4,E.ILinkProviderService)],g)},9042:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(w,c,h){var y=this&&this.__decorate||function(E,g,b,v){var S,N=arguments.length,T=N<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,g,b,v);else for(var D=E.length-1;D>=0;D--)(S=E[D])&&(T=(N<3?S(T):N>3?S(g,b,T):S(g,b))||T);return N>3&&T&&Object.defineProperty(g,b,T),T},p=this&&this.__param||function(E,g){return function(b,v){g(b,v,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const f=h(511),x=h(2585);let C=c.OscLinkProvider=class{constructor(E,g,b){this._bufferService=E,this._optionsService=g,this._oscLinkService=b}provideLinks(E,g){const b=this._bufferService.buffer.lines.get(E-1);if(!b)return void g(void 0);const v=[],S=this._optionsService.rawOptions.linkHandler,N=new f.CellData,T=b.getTrimmedLength();let D=-1,O=-1,k=!1;for(let L=0;L<T;L++)if(O!==-1||b.hasContent(L)){if(b.loadCell(L,N),N.hasExtendedAttrs()&&N.extended.urlId){if(O===-1){O=L,D=N.extended.urlId;continue}k=N.extended.urlId!==D}else O!==-1&&(k=!0);if(k||O!==-1&&L===T-1){const V=this._oscLinkService.getLinkData(D)?.uri;if(V){const q={start:{x:O+1,y:E},end:{x:L+(k||L!==T-1?0:1),y:E}};let Y=!1;if(!S?.allowNonHttpProtocols)try{const P=new URL(V);["http:","https:"].includes(P.protocol)||(Y=!0)}catch{Y=!0}Y||v.push({text:V,range:q,activate:(P,Q)=>S?S.activate(P,Q,q):j(0,Q),hover:(P,Q)=>S?.hover?.(P,Q,q),leave:(P,Q)=>S?.leave?.(P,Q,q)})}k=!1,N.hasExtendedAttrs()&&N.extended.urlId?(O=L,D=N.extended.urlId):(O=-1,D=-1)}}g(v)}};function j(E,g){if(confirm(`Do you want to navigate to ${g}?
25
25
 
26
- WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=C=y([p(0,x.IBufferService),p(1,x.IOptionsService),p(2,x.IOscLinkService)],C)},6193:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(h,y){this._renderCallback=h,this._coreBrowserService=y,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,y,p){this._rowCount=p,h=h!==void 0?h:0,y=y!==void 0?y:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,y):y,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)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),y=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,y),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const y=h(3614),p=h(3656),f=h(3551),x=h(9042),C=h(3730),j=h(1680),E=h(3107),g=h(5744),b=h(2950),v=h(1296),S=h(428),N=h(4269),T=h(5114),D=h(8934),O=h(3230),k=h(9312),L=h(4725),V=h(6731),q=h(8055),Y=h(8969),P=h(8460),Q=h(844),he=h(6114),ne=h(8437),W=h(2584),I=h(7399),A=h(5941),B=h(9074),F=h(2585),$=h(5435),J=h(4567),z=h(779);class ee extends Y.CoreTerminal{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}constructor(Z={}){super(Z),this.browser=he,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Q.MutableDisposable),this._onCursorMove=this.register(new P.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new P.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new P.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new P.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new P.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new P.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new P.EventEmitter),this._onBlur=this.register(new P.EventEmitter),this._onA11yCharEmitter=this.register(new P.EventEmitter),this._onA11yTabEmitter=this.register(new P.EventEmitter),this._onWillOpen=this.register(new P.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService(F.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((U,ue)=>this.refresh(U,ue)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((U=>this._reportWindowsOptions(U)))),this.register(this._inputHandler.onColor((U=>this._handleColorEvent(U)))),this.register((0,P.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,P.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((U=>this._afterResize(U.cols,U.rows)))),this.register((0,Q.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const U of Z){let ue,pe="";switch(U.index){case 256:ue="foreground",pe="10";break;case 257:ue="background",pe="11";break;case 258:ue="cursor",pe="12";break;default:ue="ansi",pe="4;"+U.index}switch(U.type){case 0:const me=q.color.toColorRGB(ue==="ansi"?this._themeService.colors.ansi[U.index]:this._themeService.colors[ue]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${pe};${(0,A.toRgbString)(me)}${W.C1_ESCAPED.ST}`);break;case 1:if(ue==="ansi")this._themeService.modifyColors((ge=>ge.ansi[U.index]=q.channels.toColor(...U.color)));else{const ge=ue;this._themeService.modifyColors((Re=>Re[ge]=q.channels.toColor(...U.color)))}break;case 2:this._themeService.restoreColor(U.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(J.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Z=this.buffer.ybase+this.buffer.y,U=this.buffer.lines.get(Z);if(!U)return;const ue=Math.min(this.buffer.x,this.cols-1),pe=this._renderService.dimensions.css.cell.height,me=U.getWidth(ue),ge=this._renderService.dimensions.css.cell.width*me,Re=this.buffer.y*this._renderService.dimensions.css.cell.height,tt=ue*this._renderService.dimensions.css.cell.width;this.textarea.style.left=tt+"px",this.textarea.style.top=Re+"px",this.textarea.style.width=ge+"px",this.textarea.style.height=pe+"px",this.textarea.style.lineHeight=pe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(U=>{this.hasSelection()&&(0,y.copyHandler)(U,this._selectionService)})));const Z=U=>(0,y.handlePasteEvent)(U,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Z)),he.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(U=>{U.button===2&&(0,y.rightClickHandler)(U,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(U=>{(0,y.rightClickHandler)(U,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),he.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(U=>{U.button===1&&(0,y.moveTextAreaUnderMouseCursor)(U,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const U=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),U.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(ue=>this.updateCursorStyle(ue)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),U.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),he.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(T.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(ue=>this._handleTextAreaFocus(ue)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(V.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(N.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(O.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ue=>this._onRender.fire(ue)))),this.onResize((ue=>this._renderService.resize(ue.cols,ue.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(D.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(U);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(j.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ue=>this.scrollLines(ue.amount,ue.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ue=>this.scrollLines(ue.amount,ue.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ue=>this._renderService.handleSelectionChanged(ue.start,ue.end,ue.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ue=>{this.textarea.value=ue,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ue=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(E.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(ue=>this._selectionService.handleMouseDown(ue)))),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(J.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ue=>this._handleScreenReaderModeOptionChange(ue)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ue=>{!this._overviewRulerRenderer&&ue&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,U=this.element;function ue(ge){const Re=Z._mouseService.getMouseReportCoords(ge,Z.screenElement);if(!Re)return!1;let tt,qe;switch(ge.overrideType||ge.type){case"mousemove":qe=32,ge.buttons===void 0?(tt=3,ge.button!==void 0&&(tt=ge.button<3?ge.button:3)):tt=1&ge.buttons?0:4&ge.buttons?1:2&ge.buttons?2:3;break;case"mouseup":qe=0,tt=ge.button<3?ge.button:3;break;case"mousedown":qe=1,tt=ge.button<3?ge.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(ge)===!1||Z.viewport.getLinesScrolled(ge)===0)return!1;qe=ge.deltaY<0?0:1,tt=4;break;default:return!1}return!(qe===void 0||tt===void 0||tt>4)&&Z.coreMouseService.triggerMouseEvent({col:Re.col,row:Re.row,x:Re.x,y:Re.y,button:tt,action:qe,ctrl:ge.ctrlKey,alt:ge.altKey,shift:ge.shiftKey})}const pe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},me={mouseup:ge=>(ue(ge),ge.buttons||(this._document.removeEventListener("mouseup",pe.mouseup),pe.mousedrag&&this._document.removeEventListener("mousemove",pe.mousedrag)),this.cancel(ge)),wheel:ge=>(ue(ge),this.cancel(ge,!0)),mousedrag:ge=>{ge.buttons&&ue(ge)},mousemove:ge=>{ge.buttons||ue(ge)}};this.register(this.coreMouseService.onProtocolChange((ge=>{ge?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ge)),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()),8&ge?pe.mousemove||(U.addEventListener("mousemove",me.mousemove),pe.mousemove=me.mousemove):(U.removeEventListener("mousemove",pe.mousemove),pe.mousemove=null),16&ge?pe.wheel||(U.addEventListener("wheel",me.wheel,{passive:!1}),pe.wheel=me.wheel):(U.removeEventListener("wheel",pe.wheel),pe.wheel=null),2&ge?pe.mouseup||(pe.mouseup=me.mouseup):(this._document.removeEventListener("mouseup",pe.mouseup),pe.mouseup=null),4&ge?pe.mousedrag||(pe.mousedrag=me.mousedrag):(this._document.removeEventListener("mousemove",pe.mousedrag),pe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(U,"mousedown",(ge=>{if(ge.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ge))return ue(ge),pe.mouseup&&this._document.addEventListener("mouseup",pe.mouseup),pe.mousedrag&&this._document.addEventListener("mousemove",pe.mousedrag),this.cancel(ge)}))),this.register((0,p.addDisposableDomListener)(U,"wheel",(ge=>{if(!pe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ge)===!1)return!1;if(!this.buffer.hasScrollback){const Re=this.viewport.getLinesScrolled(ge);if(Re===0)return;const tt=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ge.deltaY<0?"A":"B");let qe="";for(let at=0;at<Math.abs(Re);at++)qe+=tt;return this.coreService.triggerDataEvent(qe,!0),this.cancel(ge,!0)}return this.viewport.handleWheel(ge)?this.cancel(ge):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(U,"touchstart",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ge),this.cancel(ge)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(U,"touchmove",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ge)?void 0:this.cancel(ge)}),{passive:!1}))}refresh(Z,U){this._renderService?.refreshRows(Z,U)}updateCursorStyle(Z){this._selectionService?.shouldColumnSelect(Z)?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(Z,U,ue=0){ue===1?(super.scrollLines(Z,U,ue),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(Z)}paste(Z){(0,y.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const U=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),U}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,U,ue){this._selectionService.setSelection(Z,U,ue)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(Z,U){this._selectionService?.selectLines(Z,U)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const U=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!U&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;U||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ue=(0,I.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ue.type===3||ue.type===2){const pe=this.rows-1;return this.scrollLines(ue.type===2?-pe:pe),this.cancel(Z,!0)}return ue.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ue.cancel&&this.cancel(Z,!0),!ue.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ue.key!==W.C0.ETX&&ue.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ue.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ue.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,U){const ue=Z.isMac&&!this.options.macOptionIsMeta&&U.altKey&&!U.ctrlKey&&!U.metaKey||Z.isWindows&&U.altKey&&U.ctrlKey&&!U.metaKey||Z.isWindows&&U.getModifierState("AltGraph");return U.type==="keypress"?ue:ue&&(!U.keyCode||U.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let U;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)U=Z.charCode;else if(Z.which===null||Z.which===void 0)U=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;U=Z.which}return!(!U||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(U=String.fromCharCode(U),this._onKey.fire({key:U,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(U,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const U=Z.data;return this.coreService.triggerDataEvent(U,!0),this.cancel(Z),!0}return!1}resize(Z,U){Z!==this.cols||U!==this.rows?super.resize(Z,U):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,U){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}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 Z=1;Z<this.rows;Z++)this.buffer.lines.push(this.buffer.getBlankLine(ne.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const Z=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=Z,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(Z){if(this._renderService)switch(Z){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const U=this._renderService.dimensions.css.canvas.width.toFixed(0),ue=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${ue};${U}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const pe=this._renderService.dimensions.css.cell.width.toFixed(0),me=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${me};${pe}t`)}}cancel(Z,U){if(this.options.cancelEvents||U)return Z.preventDefault(),Z.stopPropagation(),!1}}c.Terminal=ee},9924:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(h,y=1e3){this._renderCallback=h,this._debounceThresholdMS=y,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,y,p){this._rowCount=p,h=h!==void 0?h:0,y=y!==void 0?y:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,y):y;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=f-this._lastRefreshMs,C=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),y=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,y)}}},1680:function(w,c,h){var y=this&&this.__decorate||function(b,v,S,N){var T,D=arguments.length,O=D<3?v:N===null?N=Object.getOwnPropertyDescriptor(v,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,v,S,N);else for(var k=b.length-1;k>=0;k--)(T=b[k])&&(O=(D<3?T(O):D>3?T(v,S,O):T(v,S))||O);return D>3&&O&&Object.defineProperty(v,S,O),O},p=this&&this.__param||function(b,v){return function(S,N){v(S,N,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const f=h(3656),x=h(4725),C=h(8460),j=h(844),E=h(2585);let g=c.Viewport=class extends j.Disposable{constructor(b,v,S,N,T,D,O,k){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=S,this._optionsService=N,this._charSizeService=T,this._renderService=D,this._coreBrowserService=O,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,v){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&S<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){let S,N="";const T=[],D=v??this._bufferService.buffer.lines.length,O=this._bufferService.buffer.lines;for(let k=b;k<D;k++){const L=O.get(k);if(!L)continue;const V=O.get(k+1)?.isWrapped;if(N+=L.translateToString(!V),!V||k===O.length-1){const q=document.createElement("div");q.textContent=N,T.push(q),N.length>0&&(S=q),N=""}}return{bufferElements:T,cursorElement:S}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&v.altKey||S==="ctrl"&&v.ctrlKey||S==="shift"&&v.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};c.Viewport=g=y([p(2,E.IBufferService),p(3,E.IOptionsService),p(4,x.ICharSizeService),p(5,x.IRenderService),p(6,x.ICoreBrowserService),p(7,x.IThemeService)],g)},3107:function(w,c,h){var y=this&&this.__decorate||function(E,g,b,v){var S,N=arguments.length,T=N<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,g,b,v);else for(var D=E.length-1;D>=0;D--)(S=E[D])&&(T=(N<3?S(T):N>3?S(g,b,T):S(g,b))||T);return N>3&&T&&Object.defineProperty(g,b,T),T},p=this&&this.__param||function(E,g){return function(b,v){g(b,v,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const f=h(4725),x=h(844),C=h(2585);let j=c.BufferDecorationRenderer=class extends x.Disposable{constructor(E,g,b,v,S){super(),this._screenElement=E,this._bufferService=g,this._coreBrowserService=b,this._decorationService=v,this._renderService=S,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((N=>this._removeDecoration(N)))),this.register((0,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const E of this._decorationService.decorations)this._renderDecoration(E);this._dimensionsChanged=!1}_renderDecoration(E){this._refreshStyle(E),this._dimensionsChanged&&this._refreshXPosition(E)}_createElement(E){const g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",E?.options?.layer==="top"),g.style.width=`${Math.round((E.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(E.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(E.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=E.options.x??0;return b&&b>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(E,g),g}_refreshStyle(E){const g=E.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=this._bufferService.rows)E.element&&(E.element.style.display="none",E.onRenderEmitter.fire(E.element));else{let b=this._decorationElements.get(E);b||(b=this._createElement(E),E.element=b,this._decorationElements.set(E,b),this._container.appendChild(b),E.onDispose((()=>{this._decorationElements.delete(E),b.remove()}))),b.style.top=g*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",E.onRenderEmitter.fire(b)}}_refreshXPosition(E,g=E.element){if(!g)return;const b=E.options.x??0;(E.options.anchor||"left")==="right"?g.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(E){this._decorationElements.get(E)?.remove(),this._decorationElements.delete(E),E.dispose()}};c.BufferDecorationRenderer=j=y([p(1,C.IBufferService),p(2,f.ICoreBrowserService),p(3,C.IDecorationService),p(4,f.IRenderService)],j)},5871:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.ColorZoneStore=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(h){if(h.options.overviewRulerOptions){for(const y of this._zones)if(y.color===h.options.overviewRulerOptions.color&&y.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(y,h.marker.line))return;if(this._lineAdjacentToZone(y,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(y,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,y){return y>=h.startBufferLine&&y<=h.endBufferLine}_lineAdjacentToZone(h,y,p){return y>=h.startBufferLine-this._linePadding[p||"full"]&&y<=h.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(h,y){h.startBufferLine=Math.min(h.startBufferLine,y),h.endBufferLine=Math.max(h.endBufferLine,y)}}},5744:function(w,c,h){var y=this&&this.__decorate||function(S,N,T,D){var O,k=arguments.length,L=k<3?N:D===null?D=Object.getOwnPropertyDescriptor(N,T):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,T,D);else for(var V=S.length-1;V>=0;V--)(O=S[V])&&(L=(k<3?O(L):k>3?O(N,T,L):O(N,T))||L);return k>3&&L&&Object.defineProperty(N,T,L),L},p=this&&this.__param||function(S,N){return function(T,D){N(T,D,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const f=h(5871),x=h(4725),C=h(844),j=h(2585),E={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let v=c.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,N,T,D,O,k,L){super(),this._viewportElement=S,this._screenElement=N,this._bufferService=T,this._decorationService=D,this._renderService=O,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new f.ColorZoneStore,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const V=this._canvas.getContext("2d");if(!V)throw new Error("Ctx cannot be null");this._ctx=V,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),N=Math.ceil(this._canvas.width/3);g.full=this._canvas.width,g.left=S,g.center=N,g.right=S,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=g.left,b.right=g.left+g.center}_refreshDrawHeightConstants(){E.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,N=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);E.left=N,E.center=N,E.right=N}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.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(const N of this._decorationService.decorations)this._colorZoneStore.addDecoration(N);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const N of S)N.position!=="full"&&this._renderColorZone(N);for(const N of S)N.position==="full"&&this._renderColorZone(N);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(b[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-E[S.position||"full"]/2),g[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+E[S.position||"full"]))}_queueRefresh(S,N){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=N||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=v=y([p(2,j.IBufferService),p(3,j.IDecorationService),p(4,x.IRenderService),p(5,j.IOptionsService),p(6,x.ICoreBrowserService)],v)},2950:function(w,c,h){var y=this&&this.__decorate||function(E,g,b,v){var S,N=arguments.length,T=N<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,g,b,v);else for(var D=E.length-1;D>=0;D--)(S=E[D])&&(T=(N<3?S(T):N>3?S(g,b,T):S(g,b))||T);return N>3&&T&&Object.defineProperty(g,b,T),T},p=this&&this.__param||function(E,g){return function(b,v){g(b,v,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const f=h(4725),x=h(2585),C=h(2584);let j=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(E,g,b,v,S,N){this._textarea=E,this._compositionView=g,this._bufferService=b,this._optionsService=v,this._coreService=S,this._renderService=N,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}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===229||E.keyCode===16||E.keyCode===17||E.keyCode===18)return!1;this._finalizeComposition(!1)}return E.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(E){if(this._compositionView.classList.remove("active"),this._isComposing=!1,E){const g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const E=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,b=g.replace(E,"");this._dataAlreadySent=b,g.length>E.length?this._coreService.triggerDataEvent(b,!0):g.length<E.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):g.length===E.length&&g!==E&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(E){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=g*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const N=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(N.width,1)+"px",this._textarea.style.height=Math.max(N.height,1)+"px",this._textarea.style.lineHeight=N.height+"px"}E||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=j=y([p(2,x.IBufferService),p(3,x.IOptionsService),p(4,x.ICoreService),p(5,f.IRenderService)],j)},9806:(w,c)=>{function h(y,p,f){const x=f.getBoundingClientRect(),C=y.getComputedStyle(f),j=parseInt(C.getPropertyValue("padding-left")),E=parseInt(C.getPropertyValue("padding-top"));return[p.clientX-x.left-j,p.clientY-x.top-E]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(y,p,f,x,C,j,E,g,b){if(!j)return;const v=h(y,p,f);return v?(v[0]=Math.ceil((v[0]+(b?E/2:0))/E),v[1]=Math.ceil(v[1]/g),v[0]=Math.min(Math.max(v[0],1),x+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),C),v):void 0}},9504:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const y=h(2584);function p(g,b,v,S){const N=g-f(g,v),T=b-f(b,v),D=Math.abs(N-T)-(function(O,k,L){let V=0;const q=O-f(O,L),Y=k-f(k,L);for(let P=0;P<Math.abs(q-Y);P++){const Q=x(O,k)==="A"?-1:1;L.buffer.lines.get(q+Q*P)?.isWrapped&&V++}return V})(g,b,v);return E(D,j(x(g,b),S))}function f(g,b){let v=0,S=b.buffer.lines.get(g),N=S?.isWrapped;for(;N&&g>=0&&g<b.rows;)v++,S=b.buffer.lines.get(--g),N=S?.isWrapped;return v}function x(g,b){return g>b?"A":"B"}function C(g,b,v,S,N,T){let D=g,O=b,k="";for(;D!==v||O!==S;)D+=N?1:-1,N&&D>T.cols-1?(k+=T.buffer.translateBufferLineToString(O,!1,g,D),D=0,g=0,O++):!N&&D<0&&(k+=T.buffer.translateBufferLineToString(O,!1,0,g+1),D=T.cols-1,g=D,O--);return k+T.buffer.translateBufferLineToString(O,!1,g,D)}function j(g,b){const v=b?"O":"[";return y.C0.ESC+v+g}function E(g,b){g=Math.floor(g);let v="";for(let S=0;S<g;S++)v+=b;return v}c.moveToCellSequence=function(g,b,v,S){const N=v.buffer.x,T=v.buffer.y;if(!v.buffer.hasScrollback)return(function(k,L,V,q,Y,P){return p(L,q,Y,P).length===0?"":E(C(k,L,k,L-f(L,Y),!1,Y).length,j("D",P))})(N,T,0,b,v,S)+p(T,b,v,S)+(function(k,L,V,q,Y,P){let Q;Q=p(L,q,Y,P).length>0?q-f(q,Y):L;const he=q,ne=(function(W,I,A,B,F,$){let J;return J=p(A,B,F,$).length>0?B-f(B,F):I,W<A&&J<=B||W>=A&&J<B?"C":"D"})(k,L,V,q,Y,P);return E(C(k,Q,V,he,ne==="C",Y).length,j(ne,P))})(N,T,g,b,v,S);let D;if(T===b)return D=N>g?"D":"C",E(Math.abs(N-g),j(D,S));D=T>b?"D":"C";const O=Math.abs(T-b);return E((function(k,L){return L.cols-k})(T>b?g:N,v)+(O-1)*v.cols+1+((T>b?N:g)-1),j(D,S))}},1296:function(w,c,h){var y=this&&this.__decorate||function(P,Q,he,ne){var W,I=arguments.length,A=I<3?Q:ne===null?ne=Object.getOwnPropertyDescriptor(Q,he):ne;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(P,Q,he,ne);else for(var B=P.length-1;B>=0;B--)(W=P[B])&&(A=(I<3?W(A):I>3?W(Q,he,A):W(Q,he))||A);return I>3&&A&&Object.defineProperty(Q,he,A),A},p=this&&this.__param||function(P,Q){return function(he,ne){Q(he,ne,P)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const f=h(3787),x=h(2550),C=h(2223),j=h(6171),E=h(6052),g=h(4725),b=h(8055),v=h(8460),S=h(844),N=h(2585),T="xterm-dom-renderer-owner-",D="xterm-rows",O="xterm-fg-",k="xterm-bg-",L="xterm-focus",V="xterm-selection";let q=1,Y=c.DomRenderer=class extends S.Disposable{constructor(P,Q,he,ne,W,I,A,B,F,$,J,z,ee){super(),this._terminal=P,this._document=Q,this._element=he,this._screenElement=ne,this._viewportElement=W,this._helperContainer=I,this._linkifier2=A,this._charSizeService=F,this._optionsService=$,this._bufferService=J,this._coreBrowserService=z,this._themeService=ee,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,E.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(D),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(V),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,j.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((de=>this._injectCss(de)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(T+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((de=>this._handleLinkHover(de)))),this.register(this._linkifier2.onHideLinkUnderline((de=>this._handleLinkLeave(de)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(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(){const P=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*P,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*P),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/P),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/P),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(const he of this._rowElements)he.style.width=`${this.dimensions.css.canvas.width}px`,he.style.height=`${this.dimensions.css.cell.height}px`,he.style.lineHeight=`${this.dimensions.css.cell.height}px`,he.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Q=`${this._terminalSelector} .${D} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Q,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(P){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Q=`${this._terminalSelector} .${D} { color: ${P.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Q+=`${this._terminalSelector} .${D} .xterm-dim { color: ${b.color.multiplyOpacity(P.foreground,.5).css};}`,Q+=`${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;}`;const he=`blink_underline_${this._terminalClass}`,ne=`blink_bar_${this._terminalClass}`,W=`blink_block_${this._terminalClass}`;Q+=`@keyframes ${he} { 50% { border-bottom-style: hidden; }}`,Q+=`@keyframes ${ne} { 50% { box-shadow: none; }}`,Q+=`@keyframes ${W} { 0% { background-color: ${P.cursor.css}; color: ${P.cursorAccent.css}; } 50% { background-color: inherit; color: ${P.cursor.css}; }}`,Q+=`${this._terminalSelector} .${D}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${he} 1s step-end infinite;}${this._terminalSelector} .${D}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${ne} 1s step-end infinite;}${this._terminalSelector} .${D}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-block { background-color: ${P.cursor.css}; color: ${P.cursorAccent.css};}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${P.cursor.css} !important; color: ${P.cursorAccent.css} !important;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${P.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${P.cursor.css} inset;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${P.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Q+=`${this._terminalSelector} .${V} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${V} div { position: absolute; background-color: ${P.selectionBackgroundOpaque.css};}${this._terminalSelector} .${V} div { position: absolute; background-color: ${P.selectionInactiveBackgroundOpaque.css};}`;for(const[I,A]of P.ansi.entries())Q+=`${this._terminalSelector} .${O}${I} { color: ${A.css}; }${this._terminalSelector} .${O}${I}.xterm-dim { color: ${b.color.multiplyOpacity(A,.5).css}; }${this._terminalSelector} .${k}${I} { background-color: ${A.css}; }`;Q+=`${this._terminalSelector} .${O}${C.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(P.background).css}; }${this._terminalSelector} .${O}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(P.background),.5).css}; }${this._terminalSelector} .${k}${C.INVERTED_DEFAULT_COLOR} { background-color: ${P.foreground.css}; }`,this._themeStyleElement.textContent=Q}_setDefaultSpacing(){const P=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${P}px`,this._rowFactory.defaultSpacing=P}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(P,Q){for(let he=this._rowElements.length;he<=Q;he++){const ne=this._document.createElement("div");this._rowContainer.appendChild(ne),this._rowElements.push(ne)}for(;this._rowElements.length>Q;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(P,Q){this._refreshRowElements(P,Q),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(P,Q,he){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(P,Q,he),this.renderRows(0,this._bufferService.rows-1),!P||!Q)return;this._selectionRenderModel.update(this._terminal,P,Q,he);const ne=this._selectionRenderModel.viewportStartRow,W=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,A=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||A<0)return;const B=this._document.createDocumentFragment();if(he){const F=P[0]>Q[0];B.appendChild(this._createSelectionElement(I,F?Q[0]:P[0],F?P[0]:Q[0],A-I+1))}else{const F=ne===I?P[0]:0,$=I===W?Q[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(I,F,$));const J=A-I-1;if(B.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,J)),I!==A){const z=W===A?Q[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(A,0,z))}}this._selectionContainer.appendChild(B)}_createSelectionElement(P,Q,he,ne=1){const W=this._document.createElement("div"),I=Q*this.dimensions.css.cell.width;let A=this.dimensions.css.cell.width*(he-Q);return I+A>this.dimensions.css.canvas.width&&(A=this.dimensions.css.canvas.width-I),W.style.height=ne*this.dimensions.css.cell.height+"px",W.style.top=P*this.dimensions.css.cell.height+"px",W.style.left=`${I}px`,W.style.width=`${A}px`,W}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(const P of this._rowElements)P.replaceChildren()}renderRows(P,Q){const he=this._bufferService.buffer,ne=he.ybase+he.y,W=Math.min(he.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let F=P;F<=Q;F++){const $=F+he.ydisp,J=this._rowElements[F],z=he.lines.get($);if(!J||!z)break;J.replaceChildren(...this._rowFactory.createRow(z,$,$===ne,A,B,W,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover(P){this._setCellUnderline(P.x1,P.x2,P.y1,P.y2,P.cols,!0)}_handleLinkLeave(P){this._setCellUnderline(P.x1,P.x2,P.y1,P.y2,P.cols,!1)}_setCellUnderline(P,Q,he,ne,W,I){he<0&&(P=0),ne<0&&(Q=0);const A=this._bufferService.rows-1;he=Math.max(Math.min(he,A),0),ne=Math.max(Math.min(ne,A),0),W=Math.min(W,this._bufferService.cols);const B=this._bufferService.buffer,F=B.ybase+B.y,$=Math.min(B.x,W-1),J=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let de=he;de<=ne;++de){const Z=de+B.ydisp,U=this._rowElements[de],ue=B.lines.get(Z);if(!U||!ue)break;U.replaceChildren(...this._rowFactory.createRow(ue,Z,Z===F,z,ee,$,J,this.dimensions.css.cell.width,this._widthCache,I?de===he?P:0:-1,I?(de===ne?Q:W)-1:-1))}}};c.DomRenderer=Y=y([p(7,N.IInstantiationService),p(8,g.ICharSizeService),p(9,N.IOptionsService),p(10,N.IBufferService),p(11,g.ICoreBrowserService),p(12,g.IThemeService)],Y)},3787:function(w,c,h){var y=this&&this.__decorate||function(D,O,k,L){var V,q=arguments.length,Y=q<3?O:L===null?L=Object.getOwnPropertyDescriptor(O,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(D,O,k,L);else for(var P=D.length-1;P>=0;P--)(V=D[P])&&(Y=(q<3?V(Y):q>3?V(O,k,Y):V(O,k))||Y);return q>3&&Y&&Object.defineProperty(O,k,Y),Y},p=this&&this.__param||function(D,O){return function(k,L){O(k,L,D)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const f=h(2223),x=h(643),C=h(511),j=h(2585),E=h(8055),g=h(4725),b=h(4269),v=h(6171),S=h(3734);let N=c.DomRendererRowFactory=class{constructor(D,O,k,L,V,q,Y){this._document=D,this._characterJoinerService=O,this._optionsService=k,this._coreBrowserService=L,this._coreService=V,this._decorationService=q,this._themeService=Y,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(D,O,k){this._selectionStart=D,this._selectionEnd=O,this._columnSelectMode=k}createRow(D,O,k,L,V,q,Y,P,Q,he,ne){const W=[],I=this._characterJoinerService.getJoinedCharacters(O),A=this._themeService.colors;let B,F=D.getNoBgTrimmedLength();k&&F<q+1&&(F=q+1);let $=0,J="",z=0,ee=0,de=0,Z=!1,U=0,ue=!1,pe=0;const me=[],ge=he!==-1&&ne!==-1;for(let Re=0;Re<F;Re++){D.loadCell(Re,this._workCell);let tt=this._workCell.getWidth();if(tt===0)continue;let qe=!1,at=Re,we=this._workCell;if(I.length>0&&Re===I[0][0]){qe=!0;const De=I.shift();we=new b.JoinedCellData(this._workCell,D.translateToString(!0,De[0],De[1]),De[1]-De[0]),at=De[1]-1,tt=we.getWidth()}const Ke=this._isCellInSelection(Re,O),Bt=k&&Re===q,bs=ge&&Re>=he&&Re<=ne;let is=!1;this._decorationService.forEachDecorationAtCell(Re,O,void 0,(De=>{is=!0}));let es=we.getChars()||x.WHITESPACE_CELL_CHAR;if(es===" "&&(we.isUnderline()||we.isOverline())&&(es=" "),pe=tt*P-Q.get(es,we.isBold(),we.isItalic()),B){if($&&(Ke&&ue||!Ke&&!ue&&we.bg===z)&&(Ke&&ue&&A.selectionForeground||we.fg===ee)&&we.extended.ext===de&&bs===Z&&pe===U&&!Bt&&!qe&&!is){we.isInvisible()?J+=x.WHITESPACE_CELL_CHAR:J+=es,$++;continue}$&&(B.textContent=J),B=this._document.createElement("span"),$=0,J=""}else B=this._document.createElement("span");if(z=we.bg,ee=we.fg,de=we.extended.ext,Z=bs,U=pe,ue=Ke,qe&&q>=Re&&q<=at&&(q=Re),!this._coreService.isCursorHidden&&Bt&&this._coreService.isCursorInitialized){if(me.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&me.push("xterm-cursor-blink"),me.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(V)switch(V){case"outline":me.push("xterm-cursor-outline");break;case"block":me.push("xterm-cursor-block");break;case"bar":me.push("xterm-cursor-bar");break;case"underline":me.push("xterm-cursor-underline")}}if(we.isBold()&&me.push("xterm-bold"),we.isItalic()&&me.push("xterm-italic"),we.isDim()&&me.push("xterm-dim"),J=we.isInvisible()?x.WHITESPACE_CELL_CHAR:we.getChars()||x.WHITESPACE_CELL_CHAR,we.isUnderline()&&(me.push(`xterm-underline-${we.extended.underlineStyle}`),J===" "&&(J=" "),!we.isUnderlineColorDefault()))if(we.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(we.getUnderlineColor()).join(",")})`;else{let De=we.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&we.isBold()&&De<8&&(De+=8),B.style.textDecorationColor=A.ansi[De].css}we.isOverline()&&(me.push("xterm-overline"),J===" "&&(J=" ")),we.isStrikethrough()&&me.push("xterm-strikethrough"),bs&&(B.style.textDecoration="underline");let wt=we.getFgColor(),It=we.getFgColorMode(),G=we.getBgColor(),Se=we.getBgColorMode();const Ie=!!we.isInverse();if(Ie){const De=wt;wt=G,G=De;const Ft=It;It=Se,Se=Ft}let Qe,He,Be,dt=!1;switch(this._decorationService.forEachDecorationAtCell(Re,O,void 0,(De=>{De.options.layer!=="top"&&dt||(De.backgroundColorRGB&&(Se=50331648,G=De.backgroundColorRGB.rgba>>8&16777215,Qe=De.backgroundColorRGB),De.foregroundColorRGB&&(It=50331648,wt=De.foregroundColorRGB.rgba>>8&16777215,He=De.foregroundColorRGB),dt=De.options.layer==="top")})),!dt&&Ke&&(Qe=this._coreBrowserService.isFocused?A.selectionBackgroundOpaque:A.selectionInactiveBackgroundOpaque,G=Qe.rgba>>8&16777215,Se=50331648,dt=!0,A.selectionForeground&&(It=50331648,wt=A.selectionForeground.rgba>>8&16777215,He=A.selectionForeground)),dt&&me.push("xterm-decoration-top"),Se){case 16777216:case 33554432:Be=A.ansi[G],me.push(`xterm-bg-${G}`);break;case 50331648:Be=E.channels.toColor(G>>16,G>>8&255,255&G),this._addStyle(B,`background-color:#${T((G>>>0).toString(16),"0",6)}`);break;default:Ie?(Be=A.foreground,me.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):Be=A.background}switch(Qe||we.isDim()&&(Qe=E.color.multiplyOpacity(Be,.5)),It){case 16777216:case 33554432:we.isBold()&&wt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(wt+=8),this._applyMinimumContrast(B,Be,A.ansi[wt],we,Qe,void 0)||me.push(`xterm-fg-${wt}`);break;case 50331648:const De=E.channels.toColor(wt>>16&255,wt>>8&255,255&wt);this._applyMinimumContrast(B,Be,De,we,Qe,He)||this._addStyle(B,`color:#${T(wt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,Be,A.foreground,we,Qe,He)||Ie&&me.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}me.length&&(B.className=me.join(" "),me.length=0),Bt||qe||is?B.textContent=J:$++,pe!==this.defaultSpacing&&(B.style.letterSpacing=`${pe}px`),W.push(B),Re=at}return B&&$&&(B.textContent=J),W}_applyMinimumContrast(D,O,k,L,V,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const Y=this._getContrastCache(L);let P;if(V||q||(P=Y.getColor(O.rgba,k.rgba)),P===void 0){const Q=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);P=E.color.ensureContrastRatio(V||O,q||k,Q),Y.setColor((V||O).rgba,(q||k).rgba,P??null)}return!!P&&(this._addStyle(D,`color:${P.css}`),!0)}_getContrastCache(D){return D.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(D,O){D.setAttribute("style",`${D.getAttribute("style")||""}${O};`)}_isCellInSelection(D,O){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?D>=k[0]&&O>=k[1]&&D<L[0]&&O<=L[1]:D<k[0]&&O>=k[1]&&D>=L[0]&&O<=L[1]:O>k[1]&&O<L[1]||k[1]===L[1]&&O===k[1]&&D>=k[0]&&D<L[0]||k[1]<L[1]&&O===L[1]&&D<L[0]||k[1]<L[1]&&O===k[1]&&D>=k[0])}};function T(D,O,k){for(;D.length<k;)D=O+D;return D}c.DomRendererRowFactory=N=y([p(1,g.ICharacterJoinerService),p(2,j.IOptionsService),p(3,g.ICoreBrowserService),p(4,j.ICoreService),p(5,j.IDecorationService),p(6,g.IThemeService)],N)},2550:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(h,y){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.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";const p=h.createElement("span");p.classList.add("xterm-char-measure-element");const f=h.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const x=h.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const C=h.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[p,f,x,C],this._container.appendChild(p),this._container.appendChild(f),this._container.appendChild(x),this._container.appendChild(C),y.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(h,y,p,f){h===this._font&&y===this._fontSize&&p===this._weight&&f===this._weightBold||(this._font=h,this._fontSize=y,this._weight=p,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(h,y,p){let f=0;if(!y&&!p&&h.length===1&&(f=h.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const j=this._measure(h,0);return j>0&&(this._flat[f]=j),j}let x=h;y&&(x+="B"),p&&(x+="I");let C=this._holey.get(x);if(C===void 0){let j=0;y&&(j|=1),p&&(j|=2),C=this._measure(h,j),C>0&&this._holey.set(x,C)}return C}_measure(h,y){const p=this._measureElements[y];return p.textContent=h.repeat(32),p.offsetWidth/32}}},2223:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const y=h(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=y.isFirefox||y.isLegacyEdge?"bottom":"ideographic"},6171:(w,c)=>{function h(p){return 57508<=p&&p<=57558}function y(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},c.isEmoji=y,c.allowRescaling=function(p,f,x,C){return f===1&&x>Math.ceil(1.5*C)&&p!==void 0&&p>255&&!y(p)&&!h(p)&&!(function(j){return 57344<=j&&j<=63743})(p)},c.treatGlyphAsBackgroundColor=function(p){return h(p)||(function(f){return 9472<=f&&f<=9631})(p)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(p,f,x=0){return(p-(2*Math.round(f)-x))%(2*Math.round(f))}},6052:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class h{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(p,f,x,C=!1){if(this.selectionStart=f,this.selectionEnd=x,!f||!x||f[0]===x[0]&&f[1]===x[1])return void this.clear();const j=p.buffers.active.ydisp,E=f[1]-j,g=x[1]-j,b=Math.max(E,0),v=Math.min(g,p.rows-1);b>=p.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=E,this.viewportEndRow=g,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=f[0],this.endCol=x[0])}isCellSelected(p,f,x){return!!this.hasSelection&&(x-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&x>=this.viewportCappedStartRow&&f<this.endCol&&x<=this.viewportCappedEndRow:f<this.startCol&&x>=this.viewportCappedStartRow&&f>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&f>=this.startCol&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&f>=this.startCol)}}c.createSelectionRenderModel=function(){return new h}},456:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.SelectionModel=class{constructor(h){this._bufferService=h,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.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()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,y=this.selectionEnd;return!(!h||!y)&&(h[1]>y[1]||h[1]===y[1]&&h[0]>y[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const f=h(2585),x=h(8460),C=h(844);let j=c.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,S,N){super(),this._optionsService=N,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new g(v,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};c.CharSizeService=j=y([p(2,f.IOptionsService)],j);class E extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,N){S!==void 0&&S>0&&N!==void 0&&N>0&&(this._result.width=S,this._result.height=N)}}class g extends E{constructor(S,N,T){super(),this._document=S,this._parentElement=N,this._optionsService=T,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}}class b extends E{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const N=this._ctx.measureText("W");if(!("width"in N&&"fontBoundingBoxAscent"in N&&"fontBoundingBoxDescent"in N))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(w,c,h){var y=this&&this.__decorate||function(b,v,S,N){var T,D=arguments.length,O=D<3?v:N===null?N=Object.getOwnPropertyDescriptor(v,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,v,S,N);else for(var k=b.length-1;k>=0;k--)(T=b[k])&&(O=(D<3?T(O):D>3?T(v,S,O):T(v,S))||O);return D>3&&O&&Object.defineProperty(v,S,O),O},p=this&&this.__param||function(b,v){return function(S,N){v(S,N,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const f=h(3734),x=h(643),C=h(511),j=h(2585);class E extends f.AttributeData{constructor(v,S,N){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=S,this._width=N}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=E;let g=c.CharacterJoinerService=class nS{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(v){const S={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(S),S.id}deregister(v){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===v)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(v);if(!S||S.length===0)return[];const N=[],T=S.translateToString(!0);let D=0,O=0,k=0,L=S.getFg(0),V=S.getBg(0);for(let q=0;q<S.getTrimmedLength();q++)if(S.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==V){if(q-D>1){const Y=this._getJoinedRanges(T,k,O,S,D);for(let P=0;P<Y.length;P++)N.push(Y[P])}D=q,k=O,L=this._workCell.fg,V=this._workCell.bg}O+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-D>1){const q=this._getJoinedRanges(T,k,O,S,D);for(let Y=0;Y<q.length;Y++)N.push(q[Y])}return N}_getJoinedRanges(v,S,N,T,D){const O=v.substring(S,N);let k=[];try{k=this._characterJoiners[0].handler(O)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const V=this._characterJoiners[L].handler(O);for(let q=0;q<V.length;q++)nS._mergeRanges(k,V[q])}catch(V){console.error(V)}return this._stringRangesToCellRanges(k,T,D),k}_stringRangesToCellRanges(v,S,N){let T=0,D=!1,O=0,k=v[T];if(k){for(let L=N;L<this._bufferService.cols;L++){const V=S.getWidth(L),q=S.getString(L).length||x.WHITESPACE_CELL_CHAR.length;if(V!==0){if(!D&&k[0]<=O&&(k[0]=L,D=!0),k[1]<=O){if(k[1]=L,k=v[++T],!k)break;k[0]<=O?(k[0]=L,D=!0):D=!1}O+=q}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(v,S){let N=!1;for(let T=0;T<v.length;T++){const D=v[T];if(N){if(S[1]<=D[0])return v[T-1][1]=S[1],v;if(S[1]<=D[1])return v[T-1][1]=Math.max(S[1],D[1]),v.splice(T,1),v;v.splice(T,1),T--}else{if(S[1]<=D[0])return v.splice(T,0,S),v;if(S[1]<=D[1])return D[0]=Math.min(S[0],D[0]),v;S[0]<D[1]&&(D[0]=Math.min(S[0],D[0]),N=!0)}}return N?v[v.length-1][1]=S[1]:v.push(S),v}};c.CharacterJoinerService=g=y([p(0,j.IBufferService)],g)},5114:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const y=h(844),p=h(8460),f=h(3656);class x extends y.Disposable{constructor(E,g,b){super(),this._textarea=E,this._window=g,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("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}}c.CoreBrowserService=x;class C extends y.Disposable{constructor(E){super(),this._parentWindow=E,this._windowResizeListener=this.register(new y.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,y.toDisposable)((()=>this.clearListener())))}setWindow(E){this._parentWindow=E,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}}},779:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const y=h(844);class p extends y.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,y.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const C=this.linkProviders.indexOf(x);C!==-1&&this.linkProviders.splice(C,1)}}}}c.LinkProviderService=p},8934:function(w,c,h){var y=this&&this.__decorate||function(j,E,g,b){var v,S=arguments.length,N=S<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,g):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(j,E,g,b);else for(var T=j.length-1;T>=0;T--)(v=j[T])&&(N=(S<3?v(N):S>3?v(E,g,N):v(E,g))||N);return S>3&&N&&Object.defineProperty(E,g,N),N},p=this&&this.__param||function(j,E){return function(g,b){E(g,b,j)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const f=h(4725),x=h(9806);let C=c.MouseService=class{constructor(j,E){this._renderService=j,this._charSizeService=E}getCoords(j,E,g,b,v){return(0,x.getCoords)(window,j,E,g,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(j,E){const g=(0,x.getCoordsRelativeToElement)(window,j,E);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};c.MouseService=C=y([p(0,f.IRenderService),p(1,f.ICharSizeService)],C)},3230:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const f=h(6193),x=h(4725),C=h(8460),j=h(844),E=h(7226),g=h(2585);let b=c.RenderService=class extends j.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,S,N,T,D,O,k,L){super(),this._rowCount=v,this._charSizeService=T,this._renderer=this.register(new j.MutableDisposable),this._pausedResizeTask=new E.DebouncedIdleTask,this._observerDisposable=this.register(new j.MutableDisposable),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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((V,q)=>this._renderRows(V,q)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(O.onResize((()=>this._fullRefresh()))),this.register(O.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(N.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(D.onDecorationRegistered((()=>this._fullRefresh()))),this.register(D.onDecorationRemoved((()=>this._fullRefresh()))),this.register(N.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(O.cols,O.rows),this._fullRefresh()}))),this.register(N.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(O.buffer.y,O.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,S),this.register(k.onWindowChange((V=>this._registerIntersectionObserver(V,S))))}_registerIntersectionObserver(v,S){if("IntersectionObserver"in v){const N=new v.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});N.observe(S),this._observerDisposable.value=(0,j.toDisposable)((()=>N.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,S,N=!1){this._isPaused?this._needsFullRefresh=!0:(N||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,S,this._rowCount))}_renderRows(v,S){this._renderer.value&&(v=Math.min(v,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(v,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:S}),this._onRender.fire({start:v,end:S}),this._isNextRenderRedrawOnly=!0)}resize(v,S){this._rowCount=S,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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(v,S))):this._renderer.value.handleResize(v,S),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(v,S,N){this._selectionState.start=v,this._selectionState.end=S,this._selectionState.columnSelectMode=N,this._renderer.value?.handleSelectionChanged(v,S,N)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};c.RenderService=b=y([p(2,g.IOptionsService),p(3,x.ICharSizeService),p(4,g.IDecorationService),p(5,g.IBufferService),p(6,x.ICoreBrowserService),p(7,x.IThemeService)],b)},9312:function(w,c,h){var y=this&&this.__decorate||function(k,L,V,q){var Y,P=arguments.length,Q=P<3?L:q===null?q=Object.getOwnPropertyDescriptor(L,V):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(k,L,V,q);else for(var he=k.length-1;he>=0;he--)(Y=k[he])&&(Q=(P<3?Y(Q):P>3?Y(L,V,Q):Y(L,V))||Q);return P>3&&Q&&Object.defineProperty(L,V,Q),Q},p=this&&this.__param||function(k,L){return function(V,q){L(V,q,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const f=h(9806),x=h(9504),C=h(456),j=h(4725),E=h(8460),g=h(844),b=h(6114),v=h(4841),S=h(511),N=h(2585),T=" ",D=new RegExp(T,"g");let O=c.SelectionService=class extends g.Disposable{constructor(k,L,V,q,Y,P,Q,he,ne){super(),this._element=k,this._screenElement=L,this._linkifier=V,this._bufferService=q,this._coreService=Y,this._mouseService=P,this._optionsService=Q,this._renderService=he,this._coreBrowserService=ne,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new E.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new E.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=W=>this._handleMouseMove(W),this._mouseUpListener=W=>this._handleMouseUp(W),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((W=>this._handleTrim(W))),this.register(this._bufferService.buffers.onBufferActivate((W=>this._handleBufferActivate(W)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!k||!L||k[0]===L[0]&&k[1]===L[1])}get selectionText(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!k||!L)return"";const V=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(k[0]===L[0])return"";const Y=k[0]<L[0]?k[0]:L[0],P=k[0]<L[0]?L[0]:k[0];for(let Q=k[1];Q<=L[1];Q++){const he=V.translateBufferLineToString(Q,!0,Y,P);q.push(he)}}else{const Y=k[1]===L[1]?L[0]:void 0;q.push(V.translateBufferLineToString(k[1],!0,k[0],Y));for(let P=k[1]+1;P<=L[1]-1;P++){const Q=V.lines.get(P),he=V.translateBufferLineToString(P,!0);Q?.isWrapped?q[q.length-1]+=he:q.push(he)}if(k[1]!==L[1]){const P=V.lines.get(L[1]),Q=V.translateBufferLineToString(L[1],!0,0,L[0]);P&&P.isWrapped?q[q.length-1]+=Q:q.push(Q)}}return q.map((Y=>Y.replace(D," "))).join(b.isWindows?`\r
26
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=C=y([p(0,x.IBufferService),p(1,x.IOptionsService),p(2,x.IOscLinkService)],C)},6193:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(h,y){this._renderCallback=h,this._coreBrowserService=y,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,y,p){this._rowCount=p,h=h!==void 0?h:0,y=y!==void 0?y:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,y):y,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)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),y=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,y),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const y=h(3614),p=h(3656),f=h(3551),x=h(9042),C=h(3730),j=h(1680),E=h(3107),g=h(5744),b=h(2950),v=h(1296),S=h(428),N=h(4269),T=h(5114),D=h(8934),O=h(3230),k=h(9312),L=h(4725),V=h(6731),q=h(8055),Y=h(8969),P=h(8460),Q=h(844),he=h(6114),ne=h(8437),W=h(2584),I=h(7399),A=h(5941),B=h(9074),F=h(2585),$=h(5435),J=h(4567),z=h(779);class ee extends Y.CoreTerminal{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}constructor(Z={}){super(Z),this.browser=he,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Q.MutableDisposable),this._onCursorMove=this.register(new P.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new P.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new P.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new P.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new P.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new P.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new P.EventEmitter),this._onBlur=this.register(new P.EventEmitter),this._onA11yCharEmitter=this.register(new P.EventEmitter),this._onA11yTabEmitter=this.register(new P.EventEmitter),this._onWillOpen=this.register(new P.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(B.DecorationService),this._instantiationService.setService(F.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((U,ue)=>this.refresh(U,ue)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((U=>this._reportWindowsOptions(U)))),this.register(this._inputHandler.onColor((U=>this._handleColorEvent(U)))),this.register((0,P.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,P.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((U=>this._afterResize(U.cols,U.rows)))),this.register((0,Q.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const U of Z){let ue,pe="";switch(U.index){case 256:ue="foreground",pe="10";break;case 257:ue="background",pe="11";break;case 258:ue="cursor",pe="12";break;default:ue="ansi",pe="4;"+U.index}switch(U.type){case 0:const me=q.color.toColorRGB(ue==="ansi"?this._themeService.colors.ansi[U.index]:this._themeService.colors[ue]);this.coreService.triggerDataEvent(`${W.C0.ESC}]${pe};${(0,A.toRgbString)(me)}${W.C1_ESCAPED.ST}`);break;case 1:if(ue==="ansi")this._themeService.modifyColors((ge=>ge.ansi[U.index]=q.channels.toColor(...U.color)));else{const ge=ue;this._themeService.modifyColors((Re=>Re[ge]=q.channels.toColor(...U.color)))}break;case 2:this._themeService.restoreColor(U.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(J.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Z=this.buffer.ybase+this.buffer.y,U=this.buffer.lines.get(Z);if(!U)return;const ue=Math.min(this.buffer.x,this.cols-1),pe=this._renderService.dimensions.css.cell.height,me=U.getWidth(ue),ge=this._renderService.dimensions.css.cell.width*me,Re=this.buffer.y*this._renderService.dimensions.css.cell.height,tt=ue*this._renderService.dimensions.css.cell.width;this.textarea.style.left=tt+"px",this.textarea.style.top=Re+"px",this.textarea.style.width=ge+"px",this.textarea.style.height=pe+"px",this.textarea.style.lineHeight=pe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(U=>{this.hasSelection()&&(0,y.copyHandler)(U,this._selectionService)})));const Z=U=>(0,y.handlePasteEvent)(U,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Z)),he.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(U=>{U.button===2&&(0,y.rightClickHandler)(U,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(U=>{(0,y.rightClickHandler)(U,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),he.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(U=>{U.button===1&&(0,y.moveTextAreaUnderMouseCursor)(U,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const U=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),U.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(ue=>this.updateCursorStyle(ue)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),U.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),he.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(T.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(ue=>this._handleTextAreaFocus(ue)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(V.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(N.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(O.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ue=>this._onRender.fire(ue)))),this.onResize((ue=>this._renderService.resize(ue.cols,ue.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(D.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(U);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(j.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ue=>this.scrollLines(ue.amount,ue.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(k.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ue=>this.scrollLines(ue.amount,ue.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ue=>this._renderService.handleSelectionChanged(ue.start,ue.end,ue.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ue=>{this.textarea.value=ue,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ue=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(E.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(ue=>this._selectionService.handleMouseDown(ue)))),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(J.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ue=>this._handleScreenReaderModeOptionChange(ue)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ue=>{!this._overviewRulerRenderer&&ue&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,U=this.element;function ue(ge){const Re=Z._mouseService.getMouseReportCoords(ge,Z.screenElement);if(!Re)return!1;let tt,qe;switch(ge.overrideType||ge.type){case"mousemove":qe=32,ge.buttons===void 0?(tt=3,ge.button!==void 0&&(tt=ge.button<3?ge.button:3)):tt=1&ge.buttons?0:4&ge.buttons?1:2&ge.buttons?2:3;break;case"mouseup":qe=0,tt=ge.button<3?ge.button:3;break;case"mousedown":qe=1,tt=ge.button<3?ge.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(ge)===!1||Z.viewport.getLinesScrolled(ge)===0)return!1;qe=ge.deltaY<0?0:1,tt=4;break;default:return!1}return!(qe===void 0||tt===void 0||tt>4)&&Z.coreMouseService.triggerMouseEvent({col:Re.col,row:Re.row,x:Re.x,y:Re.y,button:tt,action:qe,ctrl:ge.ctrlKey,alt:ge.altKey,shift:ge.shiftKey})}const pe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},me={mouseup:ge=>(ue(ge),ge.buttons||(this._document.removeEventListener("mouseup",pe.mouseup),pe.mousedrag&&this._document.removeEventListener("mousemove",pe.mousedrag)),this.cancel(ge)),wheel:ge=>(ue(ge),this.cancel(ge,!0)),mousedrag:ge=>{ge.buttons&&ue(ge)},mousemove:ge=>{ge.buttons||ue(ge)}};this.register(this.coreMouseService.onProtocolChange((ge=>{ge?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ge)),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()),8&ge?pe.mousemove||(U.addEventListener("mousemove",me.mousemove),pe.mousemove=me.mousemove):(U.removeEventListener("mousemove",pe.mousemove),pe.mousemove=null),16&ge?pe.wheel||(U.addEventListener("wheel",me.wheel,{passive:!1}),pe.wheel=me.wheel):(U.removeEventListener("wheel",pe.wheel),pe.wheel=null),2&ge?pe.mouseup||(pe.mouseup=me.mouseup):(this._document.removeEventListener("mouseup",pe.mouseup),pe.mouseup=null),4&ge?pe.mousedrag||(pe.mousedrag=me.mousedrag):(this._document.removeEventListener("mousemove",pe.mousedrag),pe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(U,"mousedown",(ge=>{if(ge.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ge))return ue(ge),pe.mouseup&&this._document.addEventListener("mouseup",pe.mouseup),pe.mousedrag&&this._document.addEventListener("mousemove",pe.mousedrag),this.cancel(ge)}))),this.register((0,p.addDisposableDomListener)(U,"wheel",(ge=>{if(!pe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ge)===!1)return!1;if(!this.buffer.hasScrollback){const Re=this.viewport.getLinesScrolled(ge);if(Re===0)return;const tt=W.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ge.deltaY<0?"A":"B");let qe="";for(let at=0;at<Math.abs(Re);at++)qe+=tt;return this.coreService.triggerDataEvent(qe,!0),this.cancel(ge,!0)}return this.viewport.handleWheel(ge)?this.cancel(ge):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(U,"touchstart",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ge),this.cancel(ge)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(U,"touchmove",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ge)?void 0:this.cancel(ge)}),{passive:!1}))}refresh(Z,U){this._renderService?.refreshRows(Z,U)}updateCursorStyle(Z){this._selectionService?.shouldColumnSelect(Z)?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(Z,U,ue=0){ue===1?(super.scrollLines(Z,U,ue),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(Z)}paste(Z){(0,y.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const U=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),U}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,U,ue){this._selectionService.setSelection(Z,U,ue)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(Z,U){this._selectionService?.selectLines(Z,U)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const U=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!U&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;U||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ue=(0,I.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ue.type===3||ue.type===2){const pe=this.rows-1;return this.scrollLines(ue.type===2?-pe:pe),this.cancel(Z,!0)}return ue.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ue.cancel&&this.cancel(Z,!0),!ue.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ue.key!==W.C0.ETX&&ue.key!==W.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ue.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ue.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,U){const ue=Z.isMac&&!this.options.macOptionIsMeta&&U.altKey&&!U.ctrlKey&&!U.metaKey||Z.isWindows&&U.altKey&&U.ctrlKey&&!U.metaKey||Z.isWindows&&U.getModifierState("AltGraph");return U.type==="keypress"?ue:ue&&(!U.keyCode||U.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let U;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)U=Z.charCode;else if(Z.which===null||Z.which===void 0)U=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;U=Z.which}return!(!U||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(U=String.fromCharCode(U),this._onKey.fire({key:U,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(U,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const U=Z.data;return this.coreService.triggerDataEvent(U,!0),this.cancel(Z),!0}return!1}resize(Z,U){Z!==this.cols||U!==this.rows?super.resize(Z,U):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,U){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}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 Z=1;Z<this.rows;Z++)this.buffer.lines.push(this.buffer.getBlankLine(ne.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const Z=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=Z,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(W.C0.ESC+"[I"):this.coreService.triggerDataEvent(W.C0.ESC+"[O")}_reportWindowsOptions(Z){if(this._renderService)switch(Z){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const U=this._renderService.dimensions.css.canvas.width.toFixed(0),ue=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[4;${ue};${U}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const pe=this._renderService.dimensions.css.cell.width.toFixed(0),me=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.C0.ESC}[6;${me};${pe}t`)}}cancel(Z,U){if(this.options.cancelEvents||U)return Z.preventDefault(),Z.stopPropagation(),!1}}c.Terminal=ee},9924:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(h,y=1e3){this._renderCallback=h,this._debounceThresholdMS=y,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,y,p){this._rowCount=p,h=h!==void 0?h:0,y=y!==void 0?y:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,y):y;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=f-this._lastRefreshMs,C=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),y=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,y)}}},1680:function(w,c,h){var y=this&&this.__decorate||function(b,v,S,N){var T,D=arguments.length,O=D<3?v:N===null?N=Object.getOwnPropertyDescriptor(v,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,v,S,N);else for(var k=b.length-1;k>=0;k--)(T=b[k])&&(O=(D<3?T(O):D>3?T(v,S,O):T(v,S))||O);return D>3&&O&&Object.defineProperty(v,S,O),O},p=this&&this.__param||function(b,v){return function(S,N){v(S,N,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const f=h(3656),x=h(4725),C=h(8460),j=h(844),E=h(2585);let g=c.Viewport=class extends j.Disposable{constructor(b,v,S,N,T,D,O,k){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=S,this._optionsService=N,this._charSizeService=T,this._renderService=D,this._coreBrowserService=O,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(k.colors),this.register(k.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,v){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&S<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){let S,N="";const T=[],D=v??this._bufferService.buffer.lines.length,O=this._bufferService.buffer.lines;for(let k=b;k<D;k++){const L=O.get(k);if(!L)continue;const V=O.get(k+1)?.isWrapped;if(N+=L.translateToString(!V),!V||k===O.length-1){const q=document.createElement("div");q.textContent=N,T.push(q),N.length>0&&(S=q),N=""}}return{bufferElements:T,cursorElement:S}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&v.altKey||S==="ctrl"&&v.ctrlKey||S==="shift"&&v.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};c.Viewport=g=y([p(2,E.IBufferService),p(3,E.IOptionsService),p(4,x.ICharSizeService),p(5,x.IRenderService),p(6,x.ICoreBrowserService),p(7,x.IThemeService)],g)},3107:function(w,c,h){var y=this&&this.__decorate||function(E,g,b,v){var S,N=arguments.length,T=N<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,g,b,v);else for(var D=E.length-1;D>=0;D--)(S=E[D])&&(T=(N<3?S(T):N>3?S(g,b,T):S(g,b))||T);return N>3&&T&&Object.defineProperty(g,b,T),T},p=this&&this.__param||function(E,g){return function(b,v){g(b,v,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const f=h(4725),x=h(844),C=h(2585);let j=c.BufferDecorationRenderer=class extends x.Disposable{constructor(E,g,b,v,S){super(),this._screenElement=E,this._bufferService=g,this._coreBrowserService=b,this._decorationService=v,this._renderService=S,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((N=>this._removeDecoration(N)))),this.register((0,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const E of this._decorationService.decorations)this._renderDecoration(E);this._dimensionsChanged=!1}_renderDecoration(E){this._refreshStyle(E),this._dimensionsChanged&&this._refreshXPosition(E)}_createElement(E){const g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",E?.options?.layer==="top"),g.style.width=`${Math.round((E.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(E.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(E.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=E.options.x??0;return b&&b>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(E,g),g}_refreshStyle(E){const g=E.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=this._bufferService.rows)E.element&&(E.element.style.display="none",E.onRenderEmitter.fire(E.element));else{let b=this._decorationElements.get(E);b||(b=this._createElement(E),E.element=b,this._decorationElements.set(E,b),this._container.appendChild(b),E.onDispose((()=>{this._decorationElements.delete(E),b.remove()}))),b.style.top=g*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",E.onRenderEmitter.fire(b)}}_refreshXPosition(E,g=E.element){if(!g)return;const b=E.options.x??0;(E.options.anchor||"left")==="right"?g.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(E){this._decorationElements.get(E)?.remove(),this._decorationElements.delete(E),E.dispose()}};c.BufferDecorationRenderer=j=y([p(1,C.IBufferService),p(2,f.ICoreBrowserService),p(3,C.IDecorationService),p(4,f.IRenderService)],j)},5871:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.ColorZoneStore=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(h){if(h.options.overviewRulerOptions){for(const y of this._zones)if(y.color===h.options.overviewRulerOptions.color&&y.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(y,h.marker.line))return;if(this._lineAdjacentToZone(y,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(y,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,y){return y>=h.startBufferLine&&y<=h.endBufferLine}_lineAdjacentToZone(h,y,p){return y>=h.startBufferLine-this._linePadding[p||"full"]&&y<=h.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(h,y){h.startBufferLine=Math.min(h.startBufferLine,y),h.endBufferLine=Math.max(h.endBufferLine,y)}}},5744:function(w,c,h){var y=this&&this.__decorate||function(S,N,T,D){var O,k=arguments.length,L=k<3?N:D===null?D=Object.getOwnPropertyDescriptor(N,T):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,T,D);else for(var V=S.length-1;V>=0;V--)(O=S[V])&&(L=(k<3?O(L):k>3?O(N,T,L):O(N,T))||L);return k>3&&L&&Object.defineProperty(N,T,L),L},p=this&&this.__param||function(S,N){return function(T,D){N(T,D,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const f=h(5871),x=h(4725),C=h(844),j=h(2585),E={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let v=c.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,N,T,D,O,k,L){super(),this._viewportElement=S,this._screenElement=N,this._bufferService=T,this._decorationService=D,this._renderService=O,this._optionsService=k,this._coreBrowserService=L,this._colorZoneStore=new f.ColorZoneStore,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const V=this._canvas.getContext("2d");if(!V)throw new Error("Ctx cannot be null");this._ctx=V,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),N=Math.ceil(this._canvas.width/3);g.full=this._canvas.width,g.left=S,g.center=N,g.right=S,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=g.left,b.right=g.left+g.center}_refreshDrawHeightConstants(){E.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,N=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);E.left=N,E.center=N,E.right=N}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*E.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(const N of this._decorationService.decorations)this._colorZoneStore.addDecoration(N);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const N of S)N.position!=="full"&&this._renderColorZone(N);for(const N of S)N.position==="full"&&this._renderColorZone(N);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(b[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-E[S.position||"full"]/2),g[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+E[S.position||"full"]))}_queueRefresh(S,N){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=N||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=v=y([p(2,j.IBufferService),p(3,j.IDecorationService),p(4,x.IRenderService),p(5,j.IOptionsService),p(6,x.ICoreBrowserService)],v)},2950:function(w,c,h){var y=this&&this.__decorate||function(E,g,b,v){var S,N=arguments.length,T=N<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(E,g,b,v);else for(var D=E.length-1;D>=0;D--)(S=E[D])&&(T=(N<3?S(T):N>3?S(g,b,T):S(g,b))||T);return N>3&&T&&Object.defineProperty(g,b,T),T},p=this&&this.__param||function(E,g){return function(b,v){g(b,v,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const f=h(4725),x=h(2585),C=h(2584);let j=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(E,g,b,v,S,N){this._textarea=E,this._compositionView=g,this._bufferService=b,this._optionsService=v,this._coreService=S,this._renderService=N,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}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===229||E.keyCode===16||E.keyCode===17||E.keyCode===18)return!1;this._finalizeComposition(!1)}return E.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(E){if(this._compositionView.classList.remove("active"),this._isComposing=!1,E){const g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const E=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,b=g.replace(E,"");this._dataAlreadySent=b,g.length>E.length?this._coreService.triggerDataEvent(b,!0):g.length<E.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):g.length===E.length&&g!==E&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(E){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=g*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const N=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(N.width,1)+"px",this._textarea.style.height=Math.max(N.height,1)+"px",this._textarea.style.lineHeight=N.height+"px"}E||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=j=y([p(2,x.IBufferService),p(3,x.IOptionsService),p(4,x.ICoreService),p(5,f.IRenderService)],j)},9806:(w,c)=>{function h(y,p,f){const x=f.getBoundingClientRect(),C=y.getComputedStyle(f),j=parseInt(C.getPropertyValue("padding-left")),E=parseInt(C.getPropertyValue("padding-top"));return[p.clientX-x.left-j,p.clientY-x.top-E]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(y,p,f,x,C,j,E,g,b){if(!j)return;const v=h(y,p,f);return v?(v[0]=Math.ceil((v[0]+(b?E/2:0))/E),v[1]=Math.ceil(v[1]/g),v[0]=Math.min(Math.max(v[0],1),x+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),C),v):void 0}},9504:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const y=h(2584);function p(g,b,v,S){const N=g-f(g,v),T=b-f(b,v),D=Math.abs(N-T)-(function(O,k,L){let V=0;const q=O-f(O,L),Y=k-f(k,L);for(let P=0;P<Math.abs(q-Y);P++){const Q=x(O,k)==="A"?-1:1;L.buffer.lines.get(q+Q*P)?.isWrapped&&V++}return V})(g,b,v);return E(D,j(x(g,b),S))}function f(g,b){let v=0,S=b.buffer.lines.get(g),N=S?.isWrapped;for(;N&&g>=0&&g<b.rows;)v++,S=b.buffer.lines.get(--g),N=S?.isWrapped;return v}function x(g,b){return g>b?"A":"B"}function C(g,b,v,S,N,T){let D=g,O=b,k="";for(;D!==v||O!==S;)D+=N?1:-1,N&&D>T.cols-1?(k+=T.buffer.translateBufferLineToString(O,!1,g,D),D=0,g=0,O++):!N&&D<0&&(k+=T.buffer.translateBufferLineToString(O,!1,0,g+1),D=T.cols-1,g=D,O--);return k+T.buffer.translateBufferLineToString(O,!1,g,D)}function j(g,b){const v=b?"O":"[";return y.C0.ESC+v+g}function E(g,b){g=Math.floor(g);let v="";for(let S=0;S<g;S++)v+=b;return v}c.moveToCellSequence=function(g,b,v,S){const N=v.buffer.x,T=v.buffer.y;if(!v.buffer.hasScrollback)return(function(k,L,V,q,Y,P){return p(L,q,Y,P).length===0?"":E(C(k,L,k,L-f(L,Y),!1,Y).length,j("D",P))})(N,T,0,b,v,S)+p(T,b,v,S)+(function(k,L,V,q,Y,P){let Q;Q=p(L,q,Y,P).length>0?q-f(q,Y):L;const he=q,ne=(function(W,I,A,B,F,$){let J;return J=p(A,B,F,$).length>0?B-f(B,F):I,W<A&&J<=B||W>=A&&J<B?"C":"D"})(k,L,V,q,Y,P);return E(C(k,Q,V,he,ne==="C",Y).length,j(ne,P))})(N,T,g,b,v,S);let D;if(T===b)return D=N>g?"D":"C",E(Math.abs(N-g),j(D,S));D=T>b?"D":"C";const O=Math.abs(T-b);return E((function(k,L){return L.cols-k})(T>b?g:N,v)+(O-1)*v.cols+1+((T>b?N:g)-1),j(D,S))}},1296:function(w,c,h){var y=this&&this.__decorate||function(P,Q,he,ne){var W,I=arguments.length,A=I<3?Q:ne===null?ne=Object.getOwnPropertyDescriptor(Q,he):ne;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(P,Q,he,ne);else for(var B=P.length-1;B>=0;B--)(W=P[B])&&(A=(I<3?W(A):I>3?W(Q,he,A):W(Q,he))||A);return I>3&&A&&Object.defineProperty(Q,he,A),A},p=this&&this.__param||function(P,Q){return function(he,ne){Q(he,ne,P)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const f=h(3787),x=h(2550),C=h(2223),j=h(6171),E=h(6052),g=h(4725),b=h(8055),v=h(8460),S=h(844),N=h(2585),T="xterm-dom-renderer-owner-",D="xterm-rows",O="xterm-fg-",k="xterm-bg-",L="xterm-focus",V="xterm-selection";let q=1,Y=c.DomRenderer=class extends S.Disposable{constructor(P,Q,he,ne,W,I,A,B,F,$,J,z,ee){super(),this._terminal=P,this._document=Q,this._element=he,this._screenElement=ne,this._viewportElement=W,this._helperContainer=I,this._linkifier2=A,this._charSizeService=F,this._optionsService=$,this._bufferService=J,this._coreBrowserService=z,this._themeService=ee,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,E.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(D),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(V),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,j.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((de=>this._injectCss(de)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(T+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((de=>this._handleLinkHover(de)))),this.register(this._linkifier2.onHideLinkUnderline((de=>this._handleLinkLeave(de)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(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(){const P=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*P,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*P),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/P),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/P),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(const he of this._rowElements)he.style.width=`${this.dimensions.css.canvas.width}px`,he.style.height=`${this.dimensions.css.cell.height}px`,he.style.lineHeight=`${this.dimensions.css.cell.height}px`,he.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Q=`${this._terminalSelector} .${D} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Q,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(P){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Q=`${this._terminalSelector} .${D} { color: ${P.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Q+=`${this._terminalSelector} .${D} .xterm-dim { color: ${b.color.multiplyOpacity(P.foreground,.5).css};}`,Q+=`${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;}`;const he=`blink_underline_${this._terminalClass}`,ne=`blink_bar_${this._terminalClass}`,W=`blink_block_${this._terminalClass}`;Q+=`@keyframes ${he} { 50% { border-bottom-style: hidden; }}`,Q+=`@keyframes ${ne} { 50% { box-shadow: none; }}`,Q+=`@keyframes ${W} { 0% { background-color: ${P.cursor.css}; color: ${P.cursorAccent.css}; } 50% { background-color: inherit; color: ${P.cursor.css}; }}`,Q+=`${this._terminalSelector} .${D}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${he} 1s step-end infinite;}${this._terminalSelector} .${D}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${ne} 1s step-end infinite;}${this._terminalSelector} .${D}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-block { background-color: ${P.cursor.css}; color: ${P.cursorAccent.css};}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${P.cursor.css} !important; color: ${P.cursorAccent.css} !important;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${P.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${P.cursor.css} inset;}${this._terminalSelector} .${D} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${P.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Q+=`${this._terminalSelector} .${V} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${V} div { position: absolute; background-color: ${P.selectionBackgroundOpaque.css};}${this._terminalSelector} .${V} div { position: absolute; background-color: ${P.selectionInactiveBackgroundOpaque.css};}`;for(const[I,A]of P.ansi.entries())Q+=`${this._terminalSelector} .${O}${I} { color: ${A.css}; }${this._terminalSelector} .${O}${I}.xterm-dim { color: ${b.color.multiplyOpacity(A,.5).css}; }${this._terminalSelector} .${k}${I} { background-color: ${A.css}; }`;Q+=`${this._terminalSelector} .${O}${C.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(P.background).css}; }${this._terminalSelector} .${O}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(P.background),.5).css}; }${this._terminalSelector} .${k}${C.INVERTED_DEFAULT_COLOR} { background-color: ${P.foreground.css}; }`,this._themeStyleElement.textContent=Q}_setDefaultSpacing(){const P=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${P}px`,this._rowFactory.defaultSpacing=P}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(P,Q){for(let he=this._rowElements.length;he<=Q;he++){const ne=this._document.createElement("div");this._rowContainer.appendChild(ne),this._rowElements.push(ne)}for(;this._rowElements.length>Q;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(P,Q){this._refreshRowElements(P,Q),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(P,Q,he){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(P,Q,he),this.renderRows(0,this._bufferService.rows-1),!P||!Q)return;this._selectionRenderModel.update(this._terminal,P,Q,he);const ne=this._selectionRenderModel.viewportStartRow,W=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,A=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||A<0)return;const B=this._document.createDocumentFragment();if(he){const F=P[0]>Q[0];B.appendChild(this._createSelectionElement(I,F?Q[0]:P[0],F?P[0]:Q[0],A-I+1))}else{const F=ne===I?P[0]:0,$=I===W?Q[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(I,F,$));const J=A-I-1;if(B.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,J)),I!==A){const z=W===A?Q[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(A,0,z))}}this._selectionContainer.appendChild(B)}_createSelectionElement(P,Q,he,ne=1){const W=this._document.createElement("div"),I=Q*this.dimensions.css.cell.width;let A=this.dimensions.css.cell.width*(he-Q);return I+A>this.dimensions.css.canvas.width&&(A=this.dimensions.css.canvas.width-I),W.style.height=ne*this.dimensions.css.cell.height+"px",W.style.top=P*this.dimensions.css.cell.height+"px",W.style.left=`${I}px`,W.style.width=`${A}px`,W}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(const P of this._rowElements)P.replaceChildren()}renderRows(P,Q){const he=this._bufferService.buffer,ne=he.ybase+he.y,W=Math.min(he.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,A=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let F=P;F<=Q;F++){const $=F+he.ydisp,J=this._rowElements[F],z=he.lines.get($);if(!J||!z)break;J.replaceChildren(...this._rowFactory.createRow(z,$,$===ne,A,B,W,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover(P){this._setCellUnderline(P.x1,P.x2,P.y1,P.y2,P.cols,!0)}_handleLinkLeave(P){this._setCellUnderline(P.x1,P.x2,P.y1,P.y2,P.cols,!1)}_setCellUnderline(P,Q,he,ne,W,I){he<0&&(P=0),ne<0&&(Q=0);const A=this._bufferService.rows-1;he=Math.max(Math.min(he,A),0),ne=Math.max(Math.min(ne,A),0),W=Math.min(W,this._bufferService.cols);const B=this._bufferService.buffer,F=B.ybase+B.y,$=Math.min(B.x,W-1),J=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let de=he;de<=ne;++de){const Z=de+B.ydisp,U=this._rowElements[de],ue=B.lines.get(Z);if(!U||!ue)break;U.replaceChildren(...this._rowFactory.createRow(ue,Z,Z===F,z,ee,$,J,this.dimensions.css.cell.width,this._widthCache,I?de===he?P:0:-1,I?(de===ne?Q:W)-1:-1))}}};c.DomRenderer=Y=y([p(7,N.IInstantiationService),p(8,g.ICharSizeService),p(9,N.IOptionsService),p(10,N.IBufferService),p(11,g.ICoreBrowserService),p(12,g.IThemeService)],Y)},3787:function(w,c,h){var y=this&&this.__decorate||function(D,O,k,L){var V,q=arguments.length,Y=q<3?O:L===null?L=Object.getOwnPropertyDescriptor(O,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(D,O,k,L);else for(var P=D.length-1;P>=0;P--)(V=D[P])&&(Y=(q<3?V(Y):q>3?V(O,k,Y):V(O,k))||Y);return q>3&&Y&&Object.defineProperty(O,k,Y),Y},p=this&&this.__param||function(D,O){return function(k,L){O(k,L,D)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const f=h(2223),x=h(643),C=h(511),j=h(2585),E=h(8055),g=h(4725),b=h(4269),v=h(6171),S=h(3734);let N=c.DomRendererRowFactory=class{constructor(D,O,k,L,V,q,Y){this._document=D,this._characterJoinerService=O,this._optionsService=k,this._coreBrowserService=L,this._coreService=V,this._decorationService=q,this._themeService=Y,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(D,O,k){this._selectionStart=D,this._selectionEnd=O,this._columnSelectMode=k}createRow(D,O,k,L,V,q,Y,P,Q,he,ne){const W=[],I=this._characterJoinerService.getJoinedCharacters(O),A=this._themeService.colors;let B,F=D.getNoBgTrimmedLength();k&&F<q+1&&(F=q+1);let $=0,J="",z=0,ee=0,de=0,Z=!1,U=0,ue=!1,pe=0;const me=[],ge=he!==-1&&ne!==-1;for(let Re=0;Re<F;Re++){D.loadCell(Re,this._workCell);let tt=this._workCell.getWidth();if(tt===0)continue;let qe=!1,at=Re,we=this._workCell;if(I.length>0&&Re===I[0][0]){qe=!0;const De=I.shift();we=new b.JoinedCellData(this._workCell,D.translateToString(!0,De[0],De[1]),De[1]-De[0]),at=De[1]-1,tt=we.getWidth()}const Ke=this._isCellInSelection(Re,O),Bt=k&&Re===q,bs=ge&&Re>=he&&Re<=ne;let is=!1;this._decorationService.forEachDecorationAtCell(Re,O,void 0,(De=>{is=!0}));let es=we.getChars()||x.WHITESPACE_CELL_CHAR;if(es===" "&&(we.isUnderline()||we.isOverline())&&(es=" "),pe=tt*P-Q.get(es,we.isBold(),we.isItalic()),B){if($&&(Ke&&ue||!Ke&&!ue&&we.bg===z)&&(Ke&&ue&&A.selectionForeground||we.fg===ee)&&we.extended.ext===de&&bs===Z&&pe===U&&!Bt&&!qe&&!is){we.isInvisible()?J+=x.WHITESPACE_CELL_CHAR:J+=es,$++;continue}$&&(B.textContent=J),B=this._document.createElement("span"),$=0,J=""}else B=this._document.createElement("span");if(z=we.bg,ee=we.fg,de=we.extended.ext,Z=bs,U=pe,ue=Ke,qe&&q>=Re&&q<=at&&(q=Re),!this._coreService.isCursorHidden&&Bt&&this._coreService.isCursorInitialized){if(me.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&me.push("xterm-cursor-blink"),me.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(V)switch(V){case"outline":me.push("xterm-cursor-outline");break;case"block":me.push("xterm-cursor-block");break;case"bar":me.push("xterm-cursor-bar");break;case"underline":me.push("xterm-cursor-underline")}}if(we.isBold()&&me.push("xterm-bold"),we.isItalic()&&me.push("xterm-italic"),we.isDim()&&me.push("xterm-dim"),J=we.isInvisible()?x.WHITESPACE_CELL_CHAR:we.getChars()||x.WHITESPACE_CELL_CHAR,we.isUnderline()&&(me.push(`xterm-underline-${we.extended.underlineStyle}`),J===" "&&(J=" "),!we.isUnderlineColorDefault()))if(we.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(we.getUnderlineColor()).join(",")})`;else{let De=we.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&we.isBold()&&De<8&&(De+=8),B.style.textDecorationColor=A.ansi[De].css}we.isOverline()&&(me.push("xterm-overline"),J===" "&&(J=" ")),we.isStrikethrough()&&me.push("xterm-strikethrough"),bs&&(B.style.textDecoration="underline");let wt=we.getFgColor(),It=we.getFgColorMode(),G=we.getBgColor(),Se=we.getBgColorMode();const Ie=!!we.isInverse();if(Ie){const De=wt;wt=G,G=De;const Vt=It;It=Se,Se=Vt}let Qe,He,Be,dt=!1;switch(this._decorationService.forEachDecorationAtCell(Re,O,void 0,(De=>{De.options.layer!=="top"&&dt||(De.backgroundColorRGB&&(Se=50331648,G=De.backgroundColorRGB.rgba>>8&16777215,Qe=De.backgroundColorRGB),De.foregroundColorRGB&&(It=50331648,wt=De.foregroundColorRGB.rgba>>8&16777215,He=De.foregroundColorRGB),dt=De.options.layer==="top")})),!dt&&Ke&&(Qe=this._coreBrowserService.isFocused?A.selectionBackgroundOpaque:A.selectionInactiveBackgroundOpaque,G=Qe.rgba>>8&16777215,Se=50331648,dt=!0,A.selectionForeground&&(It=50331648,wt=A.selectionForeground.rgba>>8&16777215,He=A.selectionForeground)),dt&&me.push("xterm-decoration-top"),Se){case 16777216:case 33554432:Be=A.ansi[G],me.push(`xterm-bg-${G}`);break;case 50331648:Be=E.channels.toColor(G>>16,G>>8&255,255&G),this._addStyle(B,`background-color:#${T((G>>>0).toString(16),"0",6)}`);break;default:Ie?(Be=A.foreground,me.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):Be=A.background}switch(Qe||we.isDim()&&(Qe=E.color.multiplyOpacity(Be,.5)),It){case 16777216:case 33554432:we.isBold()&&wt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(wt+=8),this._applyMinimumContrast(B,Be,A.ansi[wt],we,Qe,void 0)||me.push(`xterm-fg-${wt}`);break;case 50331648:const De=E.channels.toColor(wt>>16&255,wt>>8&255,255&wt);this._applyMinimumContrast(B,Be,De,we,Qe,He)||this._addStyle(B,`color:#${T(wt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,Be,A.foreground,we,Qe,He)||Ie&&me.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}me.length&&(B.className=me.join(" "),me.length=0),Bt||qe||is?B.textContent=J:$++,pe!==this.defaultSpacing&&(B.style.letterSpacing=`${pe}px`),W.push(B),Re=at}return B&&$&&(B.textContent=J),W}_applyMinimumContrast(D,O,k,L,V,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const Y=this._getContrastCache(L);let P;if(V||q||(P=Y.getColor(O.rgba,k.rgba)),P===void 0){const Q=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);P=E.color.ensureContrastRatio(V||O,q||k,Q),Y.setColor((V||O).rgba,(q||k).rgba,P??null)}return!!P&&(this._addStyle(D,`color:${P.css}`),!0)}_getContrastCache(D){return D.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(D,O){D.setAttribute("style",`${D.getAttribute("style")||""}${O};`)}_isCellInSelection(D,O){const k=this._selectionStart,L=this._selectionEnd;return!(!k||!L)&&(this._columnSelectMode?k[0]<=L[0]?D>=k[0]&&O>=k[1]&&D<L[0]&&O<=L[1]:D<k[0]&&O>=k[1]&&D>=L[0]&&O<=L[1]:O>k[1]&&O<L[1]||k[1]===L[1]&&O===k[1]&&D>=k[0]&&D<L[0]||k[1]<L[1]&&O===L[1]&&D<L[0]||k[1]<L[1]&&O===k[1]&&D>=k[0])}};function T(D,O,k){for(;D.length<k;)D=O+D;return D}c.DomRendererRowFactory=N=y([p(1,g.ICharacterJoinerService),p(2,j.IOptionsService),p(3,g.ICoreBrowserService),p(4,j.ICoreService),p(5,j.IDecorationService),p(6,g.IThemeService)],N)},2550:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(h,y){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.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";const p=h.createElement("span");p.classList.add("xterm-char-measure-element");const f=h.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const x=h.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const C=h.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[p,f,x,C],this._container.appendChild(p),this._container.appendChild(f),this._container.appendChild(x),this._container.appendChild(C),y.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(h,y,p,f){h===this._font&&y===this._fontSize&&p===this._weight&&f===this._weightBold||(this._font=h,this._fontSize=y,this._weight=p,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(h,y,p){let f=0;if(!y&&!p&&h.length===1&&(f=h.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const j=this._measure(h,0);return j>0&&(this._flat[f]=j),j}let x=h;y&&(x+="B"),p&&(x+="I");let C=this._holey.get(x);if(C===void 0){let j=0;y&&(j|=1),p&&(j|=2),C=this._measure(h,j),C>0&&this._holey.set(x,C)}return C}_measure(h,y){const p=this._measureElements[y];return p.textContent=h.repeat(32),p.offsetWidth/32}}},2223:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const y=h(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=y.isFirefox||y.isLegacyEdge?"bottom":"ideographic"},6171:(w,c)=>{function h(p){return 57508<=p&&p<=57558}function y(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},c.isEmoji=y,c.allowRescaling=function(p,f,x,C){return f===1&&x>Math.ceil(1.5*C)&&p!==void 0&&p>255&&!y(p)&&!h(p)&&!(function(j){return 57344<=j&&j<=63743})(p)},c.treatGlyphAsBackgroundColor=function(p){return h(p)||(function(f){return 9472<=f&&f<=9631})(p)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(p,f,x=0){return(p-(2*Math.round(f)-x))%(2*Math.round(f))}},6052:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class h{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(p,f,x,C=!1){if(this.selectionStart=f,this.selectionEnd=x,!f||!x||f[0]===x[0]&&f[1]===x[1])return void this.clear();const j=p.buffers.active.ydisp,E=f[1]-j,g=x[1]-j,b=Math.max(E,0),v=Math.min(g,p.rows-1);b>=p.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=E,this.viewportEndRow=g,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=f[0],this.endCol=x[0])}isCellSelected(p,f,x){return!!this.hasSelection&&(x-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&x>=this.viewportCappedStartRow&&f<this.endCol&&x<=this.viewportCappedEndRow:f<this.startCol&&x>=this.viewportCappedStartRow&&f>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&f>=this.startCol&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&f<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&f>=this.startCol)}}c.createSelectionRenderModel=function(){return new h}},456:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.SelectionModel=class{constructor(h){this._bufferService=h,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.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()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,y=this.selectionEnd;return!(!h||!y)&&(h[1]>y[1]||h[1]===y[1]&&h[0]>y[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const f=h(2585),x=h(8460),C=h(844);let j=c.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,S,N){super(),this._optionsService=N,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new g(v,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};c.CharSizeService=j=y([p(2,f.IOptionsService)],j);class E extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,N){S!==void 0&&S>0&&N!==void 0&&N>0&&(this._result.width=S,this._result.height=N)}}class g extends E{constructor(S,N,T){super(),this._document=S,this._parentElement=N,this._optionsService=T,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}}class b extends E{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const N=this._ctx.measureText("W");if(!("width"in N&&"fontBoundingBoxAscent"in N&&"fontBoundingBoxDescent"in N))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(w,c,h){var y=this&&this.__decorate||function(b,v,S,N){var T,D=arguments.length,O=D<3?v:N===null?N=Object.getOwnPropertyDescriptor(v,S):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,v,S,N);else for(var k=b.length-1;k>=0;k--)(T=b[k])&&(O=(D<3?T(O):D>3?T(v,S,O):T(v,S))||O);return D>3&&O&&Object.defineProperty(v,S,O),O},p=this&&this.__param||function(b,v){return function(S,N){v(S,N,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const f=h(3734),x=h(643),C=h(511),j=h(2585);class E extends f.AttributeData{constructor(v,S,N){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=S,this._width=N}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=E;let g=c.CharacterJoinerService=class rS{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(v){const S={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(S),S.id}deregister(v){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===v)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(v);if(!S||S.length===0)return[];const N=[],T=S.translateToString(!0);let D=0,O=0,k=0,L=S.getFg(0),V=S.getBg(0);for(let q=0;q<S.getTrimmedLength();q++)if(S.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==V){if(q-D>1){const Y=this._getJoinedRanges(T,k,O,S,D);for(let P=0;P<Y.length;P++)N.push(Y[P])}D=q,k=O,L=this._workCell.fg,V=this._workCell.bg}O+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-D>1){const q=this._getJoinedRanges(T,k,O,S,D);for(let Y=0;Y<q.length;Y++)N.push(q[Y])}return N}_getJoinedRanges(v,S,N,T,D){const O=v.substring(S,N);let k=[];try{k=this._characterJoiners[0].handler(O)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const V=this._characterJoiners[L].handler(O);for(let q=0;q<V.length;q++)rS._mergeRanges(k,V[q])}catch(V){console.error(V)}return this._stringRangesToCellRanges(k,T,D),k}_stringRangesToCellRanges(v,S,N){let T=0,D=!1,O=0,k=v[T];if(k){for(let L=N;L<this._bufferService.cols;L++){const V=S.getWidth(L),q=S.getString(L).length||x.WHITESPACE_CELL_CHAR.length;if(V!==0){if(!D&&k[0]<=O&&(k[0]=L,D=!0),k[1]<=O){if(k[1]=L,k=v[++T],!k)break;k[0]<=O?(k[0]=L,D=!0):D=!1}O+=q}}k&&(k[1]=this._bufferService.cols)}}static _mergeRanges(v,S){let N=!1;for(let T=0;T<v.length;T++){const D=v[T];if(N){if(S[1]<=D[0])return v[T-1][1]=S[1],v;if(S[1]<=D[1])return v[T-1][1]=Math.max(S[1],D[1]),v.splice(T,1),v;v.splice(T,1),T--}else{if(S[1]<=D[0])return v.splice(T,0,S),v;if(S[1]<=D[1])return D[0]=Math.min(S[0],D[0]),v;S[0]<D[1]&&(D[0]=Math.min(S[0],D[0]),N=!0)}}return N?v[v.length-1][1]=S[1]:v.push(S),v}};c.CharacterJoinerService=g=y([p(0,j.IBufferService)],g)},5114:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const y=h(844),p=h(8460),f=h(3656);class x extends y.Disposable{constructor(E,g,b){super(),this._textarea=E,this._window=g,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("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}}c.CoreBrowserService=x;class C extends y.Disposable{constructor(E){super(),this._parentWindow=E,this._windowResizeListener=this.register(new y.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,y.toDisposable)((()=>this.clearListener())))}setWindow(E){this._parentWindow=E,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}}},779:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const y=h(844);class p extends y.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,y.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const C=this.linkProviders.indexOf(x);C!==-1&&this.linkProviders.splice(C,1)}}}}c.LinkProviderService=p},8934:function(w,c,h){var y=this&&this.__decorate||function(j,E,g,b){var v,S=arguments.length,N=S<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,g):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(j,E,g,b);else for(var T=j.length-1;T>=0;T--)(v=j[T])&&(N=(S<3?v(N):S>3?v(E,g,N):v(E,g))||N);return S>3&&N&&Object.defineProperty(E,g,N),N},p=this&&this.__param||function(j,E){return function(g,b){E(g,b,j)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const f=h(4725),x=h(9806);let C=c.MouseService=class{constructor(j,E){this._renderService=j,this._charSizeService=E}getCoords(j,E,g,b,v){return(0,x.getCoords)(window,j,E,g,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(j,E){const g=(0,x.getCoordsRelativeToElement)(window,j,E);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};c.MouseService=C=y([p(0,f.IRenderService),p(1,f.ICharSizeService)],C)},3230:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const f=h(6193),x=h(4725),C=h(8460),j=h(844),E=h(7226),g=h(2585);let b=c.RenderService=class extends j.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,S,N,T,D,O,k,L){super(),this._rowCount=v,this._charSizeService=T,this._renderer=this.register(new j.MutableDisposable),this._pausedResizeTask=new E.DebouncedIdleTask,this._observerDisposable=this.register(new j.MutableDisposable),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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((V,q)=>this._renderRows(V,q)),k),this.register(this._renderDebouncer),this.register(k.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(O.onResize((()=>this._fullRefresh()))),this.register(O.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(N.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(D.onDecorationRegistered((()=>this._fullRefresh()))),this.register(D.onDecorationRemoved((()=>this._fullRefresh()))),this.register(N.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(O.cols,O.rows),this._fullRefresh()}))),this.register(N.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(O.buffer.y,O.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(k.window,S),this.register(k.onWindowChange((V=>this._registerIntersectionObserver(V,S))))}_registerIntersectionObserver(v,S){if("IntersectionObserver"in v){const N=new v.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});N.observe(S),this._observerDisposable.value=(0,j.toDisposable)((()=>N.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,S,N=!1){this._isPaused?this._needsFullRefresh=!0:(N||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,S,this._rowCount))}_renderRows(v,S){this._renderer.value&&(v=Math.min(v,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(v,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:S}),this._onRender.fire({start:v,end:S}),this._isNextRenderRedrawOnly=!0)}resize(v,S){this._rowCount=S,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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(v,S))):this._renderer.value.handleResize(v,S),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(v,S,N){this._selectionState.start=v,this._selectionState.end=S,this._selectionState.columnSelectMode=N,this._renderer.value?.handleSelectionChanged(v,S,N)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};c.RenderService=b=y([p(2,g.IOptionsService),p(3,x.ICharSizeService),p(4,g.IDecorationService),p(5,g.IBufferService),p(6,x.ICoreBrowserService),p(7,x.IThemeService)],b)},9312:function(w,c,h){var y=this&&this.__decorate||function(k,L,V,q){var Y,P=arguments.length,Q=P<3?L:q===null?q=Object.getOwnPropertyDescriptor(L,V):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(k,L,V,q);else for(var he=k.length-1;he>=0;he--)(Y=k[he])&&(Q=(P<3?Y(Q):P>3?Y(L,V,Q):Y(L,V))||Q);return P>3&&Q&&Object.defineProperty(L,V,Q),Q},p=this&&this.__param||function(k,L){return function(V,q){L(V,q,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const f=h(9806),x=h(9504),C=h(456),j=h(4725),E=h(8460),g=h(844),b=h(6114),v=h(4841),S=h(511),N=h(2585),T=" ",D=new RegExp(T,"g");let O=c.SelectionService=class extends g.Disposable{constructor(k,L,V,q,Y,P,Q,he,ne){super(),this._element=k,this._screenElement=L,this._linkifier=V,this._bufferService=q,this._coreService=Y,this._mouseService=P,this._optionsService=Q,this._renderService=he,this._coreBrowserService=ne,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new E.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new E.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=W=>this._handleMouseMove(W),this._mouseUpListener=W=>this._handleMouseUp(W),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((W=>this._handleTrim(W))),this.register(this._bufferService.buffers.onBufferActivate((W=>this._handleBufferActivate(W)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!k||!L||k[0]===L[0]&&k[1]===L[1])}get selectionText(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!k||!L)return"";const V=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(k[0]===L[0])return"";const Y=k[0]<L[0]?k[0]:L[0],P=k[0]<L[0]?L[0]:k[0];for(let Q=k[1];Q<=L[1];Q++){const he=V.translateBufferLineToString(Q,!0,Y,P);q.push(he)}}else{const Y=k[1]===L[1]?L[0]:void 0;q.push(V.translateBufferLineToString(k[1],!0,k[0],Y));for(let P=k[1]+1;P<=L[1]-1;P++){const Q=V.lines.get(P),he=V.translateBufferLineToString(P,!0);Q?.isWrapped?q[q.length-1]+=he:q.push(he)}if(k[1]!==L[1]){const P=V.lines.get(L[1]),Q=V.translateBufferLineToString(L[1],!0,0,L[0]);P&&P.isWrapped?q[q.length-1]+=Q:q.push(Q)}}return q.map((Y=>Y.replace(D," "))).join(b.isWindows?`\r
27
27
  `:`
28
28
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(k){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&k&&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(k){const L=this._getMouseBufferCoords(k),V=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(V&&q&&L)&&this._areCoordsInSelection(L,V,q)}isCellInSelection(k,L){const V=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!V||!q)&&this._areCoordsInSelection([k,L],V,q)}_areCoordsInSelection(k,L,V){return k[1]>L[1]&&k[1]<V[1]||L[1]===V[1]&&k[1]===L[1]&&k[0]>=L[0]&&k[0]<V[0]||L[1]<V[1]&&k[1]===V[1]&&k[0]<V[0]||L[1]<V[1]&&k[1]===L[1]&&k[0]>=L[0]}_selectWordAtCursor(k,L){const V=this._linkifier.currentLink?.link?.range;if(V)return this._model.selectionStart=[V.start.x-1,V.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(V,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const q=this._getMouseBufferCoords(k);return!!q&&(this._selectWordAt(q,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(k,L){this._model.clearSelection(),k=Math.max(k,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,k],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(k){this._model.handleTrim(k)&&this.refresh()}_getMouseBufferCoords(k){const L=this._mouseService.getCoords(k,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(k){let L=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,k,this._screenElement)[1];const V=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=V?0:(L>V&&(L-=V),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(k){return b.isMac?k.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:k.shiftKey}handleMouseDown(k){if(this._mouseDownTimeStamp=k.timeStamp,(k.button!==2||!this.hasSelection)&&k.button===0){if(!this._enabled){if(!this.shouldForceSelection(k))return;k.stopPropagation()}k.preventDefault(),this._dragScrollAmount=0,this._enabled&&k.shiftKey?this._handleIncrementalClick(k):k.detail===1?this._handleSingleClick(k):k.detail===2?this._handleDoubleClick(k):k.detail===3&&this._handleTripleClick(k),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(k){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(k))}_handleSingleClick(k){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(k)?3:0,this._model.selectionStart=this._getMouseBufferCoords(k),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(k){this._selectWordAtCursor(k,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(k){const L=this._getMouseBufferCoords(k);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(k){return k.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(k){if(k.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(k),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(k),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const V=this._bufferService.buffer;if(this._model.selectionEnd[1]<V.lines.length){const q=V.lines.get(this._model.selectionEnd[1]);q&&q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[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});const k=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(k.ydisp+this._bufferService.rows,k.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=k.ydisp),this.refresh()}}_handleMouseUp(k){const L=k.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&k.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const V=this._mouseService.getCoords(k,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(V&&V[0]!==void 0&&V[1]!==void 0){const q=(0,x.moveToCellSequence)(V[0]-1,V[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const k=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,V=!(!k||!L||k[0]===L[0]&&k[1]===L[1]);V?k&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&k[0]===this._oldSelectionStart[0]&&k[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(k,L,V)):this._oldHasSelection&&this._fireOnSelectionChange(k,L,V)}_fireOnSelectionChange(k,L,V){this._oldSelectionStart=k,this._oldSelectionEnd=L,this._oldHasSelection=V,this._onSelectionChange.fire()}_handleBufferActivate(k){this.clearSelection(),this._trimListener.dispose(),this._trimListener=k.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(k,L){let V=L;for(let q=0;L>=q;q++){const Y=k.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?V--:Y>1&&L!==q&&(V+=Y-1)}return V}setSelection(k,L,V){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[k,L],this._model.selectionStartLength=V,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(k){this._isClickInSelection(k)||(this._selectWordAtCursor(k,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(k,L,V=!0,q=!0){if(k[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,P=Y.lines.get(k[1]);if(!P)return;const Q=Y.translateBufferLineToString(k[1],!1);let he=this._convertViewportColToCharacterIndex(P,k[0]),ne=he;const W=k[0]-he;let I=0,A=0,B=0,F=0;if(Q.charAt(he)===" "){for(;he>0&&Q.charAt(he-1)===" ";)he--;for(;ne<Q.length&&Q.charAt(ne+1)===" ";)ne++}else{let z=k[0],ee=k[0];P.getWidth(z)===0&&(I++,z--),P.getWidth(ee)===2&&(A++,ee++);const de=P.getString(ee).length;for(de>1&&(F+=de-1,ne+=de-1);z>0&&he>0&&!this._isCharWordSeparator(P.loadCell(z-1,this._workCell));){P.loadCell(z-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,z--):Z>1&&(B+=Z-1,he-=Z-1),he--,z--}for(;ee<P.length&&ne+1<Q.length&&!this._isCharWordSeparator(P.loadCell(ee+1,this._workCell));){P.loadCell(ee+1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===2?(A++,ee++):Z>1&&(F+=Z-1,ne+=Z-1),ne++,ee++}}ne++;let $=he+W-I+B,J=Math.min(this._bufferService.cols,ne-he+I+A-B-F);if(L||Q.slice(he,ne).trim()!==""){if(V&&$===0&&P.getCodePoint(0)!==32){const z=Y.lines.get(k[1]-1);if(z&&P.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){const ee=this._getWordAt([this._bufferService.cols-1,k[1]-1],!1,!0,!1);if(ee){const de=this._bufferService.cols-ee.start;$-=de,J+=de}}}if(q&&$+J===this._bufferService.cols&&P.getCodePoint(this._bufferService.cols-1)!==32){const z=Y.lines.get(k[1]+1);if(z?.isWrapped&&z.getCodePoint(0)!==32){const ee=this._getWordAt([0,k[1]+1],!1,!1,!0);ee&&(J+=ee.length)}}return{start:$,length:J}}}_selectWordAt(k,L){const V=this._getWordAt(k,L);if(V){for(;V.start<0;)V.start+=this._bufferService.cols,k[1]--;this._model.selectionStart=[V.start,k[1]],this._model.selectionStartLength=V.length}}_selectToWordAt(k){const L=this._getWordAt(k,!0);if(L){let V=k[1];for(;L.start<0;)L.start+=this._bufferService.cols,V--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,V++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,V]}}_isCharWordSeparator(k){return k.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(k.getChars())>=0}_selectLineAt(k){const L=this._bufferService.buffer.getWrappedRangeForLine(k),V={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(V,this._bufferService.cols)}};c.SelectionService=O=y([p(3,N.IBufferService),p(4,N.ICoreService),p(5,j.IMouseService),p(6,N.IOptionsService),p(7,j.IRenderService),p(8,j.ICoreBrowserService)],O)},4725:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const y=h(8343);c.ICharSizeService=(0,y.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,y.createDecorator)("CoreBrowserService"),c.IMouseService=(0,y.createDecorator)("MouseService"),c.IRenderService=(0,y.createDecorator)("RenderService"),c.ISelectionService=(0,y.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,y.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,y.createDecorator)("ThemeService"),c.ILinkProviderService=(0,y.createDecorator)("LinkProviderService")},6731:function(w,c,h){var y=this&&this.__decorate||function(O,k,L,V){var q,Y=arguments.length,P=Y<3?k:V===null?V=Object.getOwnPropertyDescriptor(k,L):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(O,k,L,V);else for(var Q=O.length-1;Q>=0;Q--)(q=O[Q])&&(P=(Y<3?q(P):Y>3?q(k,L,P):q(k,L))||P);return Y>3&&P&&Object.defineProperty(k,L,P),P},p=this&&this.__param||function(O,k){return function(L,V){k(L,V,O)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const f=h(7239),x=h(8055),C=h(8460),j=h(844),E=h(2585),g=x.css.toColor("#ffffff"),b=x.css.toColor("#000000"),v=x.css.toColor("#ffffff"),S=x.css.toColor("#000000"),N={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const O=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],k=[0,95,135,175,215,255];for(let L=0;L<216;L++){const V=k[L/36%6|0],q=k[L/6%6|0],Y=k[L%6];O.push({css:x.channels.toCss(V,q,Y),rgba:x.channels.toRgba(V,q,Y)})}for(let L=0;L<24;L++){const V=8+10*L;O.push({css:x.channels.toCss(V,V,V),rgba:x.channels.toRgba(V,V,V)})}return O})());let T=c.ThemeService=class extends j.Disposable{get colors(){return this._colors}constructor(O){super(),this._optionsService=O,this._contrastCache=new f.ColorContrastCache,this._halfContrastCache=new f.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:b,cursor:v,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:N,selectionBackgroundOpaque:x.color.blend(b,N),selectionInactiveBackgroundTransparent:N,selectionInactiveBackgroundOpaque:x.color.blend(b,N),ansi:c.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(O={}){const k=this._colors;if(k.foreground=D(O.foreground,g),k.background=D(O.background,b),k.cursor=D(O.cursor,v),k.cursorAccent=D(O.cursorAccent,S),k.selectionBackgroundTransparent=D(O.selectionBackground,N),k.selectionBackgroundOpaque=x.color.blend(k.background,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundTransparent=D(O.selectionInactiveBackground,k.selectionBackgroundTransparent),k.selectionInactiveBackgroundOpaque=x.color.blend(k.background,k.selectionInactiveBackgroundTransparent),k.selectionForeground=O.selectionForeground?D(O.selectionForeground,x.NULL_COLOR):void 0,k.selectionForeground===x.NULL_COLOR&&(k.selectionForeground=void 0),x.color.isOpaque(k.selectionBackgroundTransparent)&&(k.selectionBackgroundTransparent=x.color.opacity(k.selectionBackgroundTransparent,.3)),x.color.isOpaque(k.selectionInactiveBackgroundTransparent)&&(k.selectionInactiveBackgroundTransparent=x.color.opacity(k.selectionInactiveBackgroundTransparent,.3)),k.ansi=c.DEFAULT_ANSI_COLORS.slice(),k.ansi[0]=D(O.black,c.DEFAULT_ANSI_COLORS[0]),k.ansi[1]=D(O.red,c.DEFAULT_ANSI_COLORS[1]),k.ansi[2]=D(O.green,c.DEFAULT_ANSI_COLORS[2]),k.ansi[3]=D(O.yellow,c.DEFAULT_ANSI_COLORS[3]),k.ansi[4]=D(O.blue,c.DEFAULT_ANSI_COLORS[4]),k.ansi[5]=D(O.magenta,c.DEFAULT_ANSI_COLORS[5]),k.ansi[6]=D(O.cyan,c.DEFAULT_ANSI_COLORS[6]),k.ansi[7]=D(O.white,c.DEFAULT_ANSI_COLORS[7]),k.ansi[8]=D(O.brightBlack,c.DEFAULT_ANSI_COLORS[8]),k.ansi[9]=D(O.brightRed,c.DEFAULT_ANSI_COLORS[9]),k.ansi[10]=D(O.brightGreen,c.DEFAULT_ANSI_COLORS[10]),k.ansi[11]=D(O.brightYellow,c.DEFAULT_ANSI_COLORS[11]),k.ansi[12]=D(O.brightBlue,c.DEFAULT_ANSI_COLORS[12]),k.ansi[13]=D(O.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),k.ansi[14]=D(O.brightCyan,c.DEFAULT_ANSI_COLORS[14]),k.ansi[15]=D(O.brightWhite,c.DEFAULT_ANSI_COLORS[15]),O.extendedAnsi){const L=Math.min(k.ansi.length-16,O.extendedAnsi.length);for(let V=0;V<L;V++)k.ansi[V+16]=D(O.extendedAnsi[V],c.DEFAULT_ANSI_COLORS[V+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(O){this._restoreColor(O),this._onChangeColors.fire(this.colors)}_restoreColor(O){if(O!==void 0)switch(O){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[O]=this._restoreColors.ansi[O]}else for(let k=0;k<this._restoreColors.ansi.length;++k)this._colors.ansi[k]=this._restoreColors.ansi[k]}modifyColors(O){O(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function D(O,k){if(O!==void 0)try{return x.css.toColor(O)}catch{}return k}c.ThemeService=T=y([p(0,E.IOptionsService)],T)},6349:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const y=h(8460),p=h(844);class f extends p.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new y.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new y.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new y.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const j=new Array(C);for(let E=0;E<Math.min(C,this.length);E++)j[E]=this._array[this._getCyclicIndex(E)];this._array=j,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let j=this._length;j<C;j++)this._array[j]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,j){this._array[this._getCyclicIndex(C)]=j}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,j,...E){if(j){for(let g=C;g<this._length-j;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+j)];this._length-=j,this.onDeleteEmitter.fire({index:C,amount:j})}for(let g=this._length-1;g>=C;g--)this._array[this._getCyclicIndex(g+E.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<E.length;g++)this._array[this._getCyclicIndex(C+g)]=E[g];if(E.length&&this.onInsertEmitter.fire({index:C,amount:E.length}),this._length+E.length>this._maxLength){const g=this._length+E.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=E.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,j,E){if(!(j<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+E<0)throw new Error("Cannot shift elements in list beyond index 0");if(E>0){for(let b=j-1;b>=0;b--)this.set(C+b+E,this.get(C+b));const g=C+j+E-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<j;g++)this.set(C+g+E,this.get(C+g))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}c.CircularList=f},1439:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function h(y,p=5){if(typeof y!="object")return y;const f=Array.isArray(y)?[]:{};for(const x in y)f[x]=p<=1?y[x]:y[x]&&h(y[x],p-1);return f}},8055:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let h=0,y=0,p=0,f=0;var x,C,j,E,g;function b(S){const N=S.toString(16);return N.length<2?"0"+N:N}function v(S,N){return S<N?(N+.05)/(S+.05):(S+.05)/(N+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(N,T,D,O){return O!==void 0?`#${b(N)}${b(T)}${b(D)}${b(O)}`:`#${b(N)}${b(T)}${b(D)}`},S.toRgba=function(N,T,D,O=255){return(N<<24|T<<16|D<<8|O)>>>0},S.toColor=function(N,T,D,O){return{css:S.toCss(N,T,D,O),rgba:S.toRgba(N,T,D,O)}}})(x||(c.channels=x={})),(function(S){function N(T,D){return f=Math.round(255*D),[h,y,p]=g.toChannels(T.rgba),{css:x.toCss(h,y,p,f),rgba:x.toRgba(h,y,p,f)}}S.blend=function(T,D){if(f=(255&D.rgba)/255,f===1)return{css:D.css,rgba:D.rgba};const O=D.rgba>>24&255,k=D.rgba>>16&255,L=D.rgba>>8&255,V=T.rgba>>24&255,q=T.rgba>>16&255,Y=T.rgba>>8&255;return h=V+Math.round((O-V)*f),y=q+Math.round((k-q)*f),p=Y+Math.round((L-Y)*f),{css:x.toCss(h,y,p),rgba:x.toRgba(h,y,p)}},S.isOpaque=function(T){return(255&T.rgba)==255},S.ensureContrastRatio=function(T,D,O){const k=g.ensureContrastRatio(T.rgba,D.rgba,O);if(k)return x.toColor(k>>24&255,k>>16&255,k>>8&255)},S.opaque=function(T){const D=(255|T.rgba)>>>0;return[h,y,p]=g.toChannels(D),{css:x.toCss(h,y,p),rgba:D}},S.opacity=N,S.multiplyOpacity=function(T,D){return f=255&T.rgba,N(T,f*D/255)},S.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(C||(c.color=C={})),(function(S){let N,T;try{const D=document.createElement("canvas");D.width=1,D.height=1;const O=D.getContext("2d",{willReadFrequently:!0});O&&(N=O,N.globalCompositeOperation="copy",T=N.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(D){if(D.match(/#[\da-f]{3,8}/i))switch(D.length){case 4:return h=parseInt(D.slice(1,2).repeat(2),16),y=parseInt(D.slice(2,3).repeat(2),16),p=parseInt(D.slice(3,4).repeat(2),16),x.toColor(h,y,p);case 5:return h=parseInt(D.slice(1,2).repeat(2),16),y=parseInt(D.slice(2,3).repeat(2),16),p=parseInt(D.slice(3,4).repeat(2),16),f=parseInt(D.slice(4,5).repeat(2),16),x.toColor(h,y,p,f);case 7:return{css:D,rgba:(parseInt(D.slice(1),16)<<8|255)>>>0};case 9:return{css:D,rgba:parseInt(D.slice(1),16)>>>0}}const O=D.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(O)return h=parseInt(O[1]),y=parseInt(O[2]),p=parseInt(O[3]),f=Math.round(255*(O[5]===void 0?1:parseFloat(O[5]))),x.toColor(h,y,p,f);if(!N||!T)throw new Error("css.toColor: Unsupported css format");if(N.fillStyle=T,N.fillStyle=D,typeof N.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(N.fillRect(0,0,1,1),[h,y,p,f]=N.getImageData(0,0,1,1).data,f!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:x.toRgba(h,y,p,f),css:D}}})(j||(c.css=j={})),(function(S){function N(T,D,O){const k=T/255,L=D/255,V=O/255;return .2126*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(V<=.03928?V/12.92:Math.pow((V+.055)/1.055,2.4))}S.relativeLuminance=function(T){return N(T>>16&255,T>>8&255,255&T)},S.relativeLuminance2=N})(E||(c.rgb=E={})),(function(S){function N(D,O,k){const L=D>>24&255,V=D>>16&255,q=D>>8&255;let Y=O>>24&255,P=O>>16&255,Q=O>>8&255,he=v(E.relativeLuminance2(Y,P,Q),E.relativeLuminance2(L,V,q));for(;he<k&&(Y>0||P>0||Q>0);)Y-=Math.max(0,Math.ceil(.1*Y)),P-=Math.max(0,Math.ceil(.1*P)),Q-=Math.max(0,Math.ceil(.1*Q)),he=v(E.relativeLuminance2(Y,P,Q),E.relativeLuminance2(L,V,q));return(Y<<24|P<<16|Q<<8|255)>>>0}function T(D,O,k){const L=D>>24&255,V=D>>16&255,q=D>>8&255;let Y=O>>24&255,P=O>>16&255,Q=O>>8&255,he=v(E.relativeLuminance2(Y,P,Q),E.relativeLuminance2(L,V,q));for(;he<k&&(Y<255||P<255||Q<255);)Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),P=Math.min(255,P+Math.ceil(.1*(255-P))),Q=Math.min(255,Q+Math.ceil(.1*(255-Q))),he=v(E.relativeLuminance2(Y,P,Q),E.relativeLuminance2(L,V,q));return(Y<<24|P<<16|Q<<8|255)>>>0}S.blend=function(D,O){if(f=(255&O)/255,f===1)return O;const k=O>>24&255,L=O>>16&255,V=O>>8&255,q=D>>24&255,Y=D>>16&255,P=D>>8&255;return h=q+Math.round((k-q)*f),y=Y+Math.round((L-Y)*f),p=P+Math.round((V-P)*f),x.toRgba(h,y,p)},S.ensureContrastRatio=function(D,O,k){const L=E.relativeLuminance(D>>8),V=E.relativeLuminance(O>>8);if(v(L,V)<k){if(V<L){const P=N(D,O,k),Q=v(L,E.relativeLuminance(P>>8));if(Q<k){const he=T(D,O,k);return Q>v(L,E.relativeLuminance(he>>8))?P:he}return P}const q=T(D,O,k),Y=v(L,E.relativeLuminance(q>>8));if(Y<k){const P=N(D,O,k);return Y>v(L,E.relativeLuminance(P>>8))?q:P}return q}},S.reduceLuminance=N,S.increaseLuminance=T,S.toChannels=function(D){return[D>>24&255,D>>16&255,D>>8&255,255&D]}})(g||(c.rgba=g={})),c.toPaddedHex=b,c.contrastRatio=v},8969:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const y=h(844),p=h(2585),f=h(4348),x=h(7866),C=h(744),j=h(7302),E=h(6975),g=h(8460),b=h(1753),v=h(1480),S=h(7994),N=h(9282),T=h(5435),D=h(5981),O=h(2660);let k=!1;class L extends y.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new g.EventEmitter),this._onScroll.event((q=>{this._onScrollApi?.fire(q.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(q){for(const Y in q)this.optionsService.options[Y]=q[Y]}constructor(q){super(),this._windowsWrappingHeuristics=this.register(new y.MutableDisposable),this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new f.InstantiationService,this.optionsService=this.register(new j.OptionsService(q)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(x.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(E.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(O.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((Y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((Y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new D.WriteBuffer(((Y,P)=>this._inputHandler.parse(Y,P)))),this.register((0,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,Y){this._writeBuffer.write(q,Y)}writeSync(q,Y){this._logService.logLevel<=p.LogLevelEnum.WARN&&!k&&(this._logService.warn("writeSync is unreliable and will be removed soon."),k=!0),this._writeBuffer.writeSync(q,Y)}input(q,Y=!0){this.coreService.triggerDataEvent(q,Y)}resize(q,Y){isNaN(q)||isNaN(Y)||(q=Math.max(q,C.MINIMUM_COLS),Y=Math.max(Y,C.MINIMUM_ROWS),this._bufferService.resize(q,Y))}scroll(q,Y=!1){this._bufferService.scroll(q,Y)}scrollLines(q,Y,P){this._bufferService.scrollLines(q,Y,P)}scrollPages(q){this.scrollLines(q*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(q){const Y=q-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(q,Y){return this._inputHandler.registerEscHandler(q,Y)}registerDcsHandler(q,Y){return this._inputHandler.registerDcsHandler(q,Y)}registerCsiHandler(q,Y){return this._inputHandler.registerCsiHandler(q,Y)}registerOscHandler(q,Y){return this._inputHandler.registerOscHandler(q,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?q=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(q=!0),q?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const q=[];q.push(this.onLineFeed(N.updateWindowsModeWrappedState.bind(null,this._bufferService))),q.push(this.registerCsiHandler({final:"H"},(()=>((0,N.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,y.toDisposable)((()=>{for(const Y of q)Y.dispose()}))}}}c.CoreTerminal=L},8460:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let y=0;y<this._listeners.length;y++)if(this._listeners[y]===h)return void this._listeners.splice(y,1)}}})),this._event}fire(h,y){const p=[];for(let f=0;f<this._listeners.length;f++)p.push(this._listeners[f]);for(let f=0;f<p.length;f++)p[f].call(void 0,h,y)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,y){return h((p=>y.fire(p)))},c.runAndSubscribe=function(h,y){return y(void 0),h((p=>y(p)))}},5435:function(w,c,h){var y=this&&this.__decorate||function(I,A,B,F){var $,J=arguments.length,z=J<3?A:F===null?F=Object.getOwnPropertyDescriptor(A,B):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(I,A,B,F);else for(var ee=I.length-1;ee>=0;ee--)($=I[ee])&&(z=(J<3?$(z):J>3?$(A,B,z):$(A,B))||z);return J>3&&z&&Object.defineProperty(A,B,z),z},p=this&&this.__param||function(I,A){return function(B,F){A(B,F,I)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const f=h(2584),x=h(7116),C=h(2015),j=h(844),E=h(482),g=h(8437),b=h(8460),v=h(643),S=h(511),N=h(3734),T=h(2585),D=h(1480),O=h(6242),k=h(6351),L=h(5941),V={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function Y(I,A){if(I>24)return A.setWinLines||!1;switch(I){case 1:return!!A.restoreWin;case 2:return!!A.minimizeWin;case 3:return!!A.setWinPosition;case 4:return!!A.setWinSizePixels;case 5:return!!A.raiseWin;case 6:return!!A.lowerWin;case 7:return!!A.refreshWin;case 8:return!!A.setWinSizeChars;case 9:return!!A.maximizeWin;case 10:return!!A.fullscreenWin;case 11:return!!A.getWinState;case 13:return!!A.getWinPosition;case 14:return!!A.getWinSizePixels;case 15:return!!A.getScreenSizePixels;case 16:return!!A.getCellSizePixels;case 18:return!!A.getWinSizeChars;case 19:return!!A.getScreenSizeChars;case 20:return!!A.getIconTitle;case 21:return!!A.getWinTitle;case 22:return!!A.pushTitle;case 23:return!!A.popTitle;case 24:return!!A.setWinLines}return!1}var P;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(P||(c.WindowsOptionsReportType=P={}));let Q=0;class he extends j.Disposable{getAttrData(){return this._curAttrData}constructor(A,B,F,$,J,z,ee,de,Z=new C.EscapeSequenceParser){super(),this._bufferService=A,this._charsetService=B,this._coreService=F,this._logService=$,this._optionsService=J,this._oscLinkService=z,this._coreMouseService=ee,this._unicodeService=de,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new E.StringToUtf32,this._utf8Decoder=new E.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new ne(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((U=>this._activeBuffer=U.activeBuffer))),this._parser.setCsiHandlerFallback(((U,ue)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(U),params:ue.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,ue,pe)=>{this._logService.debug("Unknown OSC code: ",{identifier:U,action:ue,data:pe})})),this._parser.setDcsHandlerFallback(((U,ue,pe)=>{ue==="HOOK"&&(pe=pe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(U),action:ue,payload:pe})})),this._parser.setPrintHandler(((U,ue,pe)=>this.print(U,ue,pe))),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(f.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(f.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(f.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(f.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(f.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(f.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(f.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(f.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(f.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new O.OscHandler((U=>(this.setTitle(U),this.setIconName(U),!0)))),this._parser.registerOscHandler(1,new O.OscHandler((U=>this.setIconName(U)))),this._parser.registerOscHandler(2,new O.OscHandler((U=>this.setTitle(U)))),this._parser.registerOscHandler(4,new O.OscHandler((U=>this.setOrReportIndexedColor(U)))),this._parser.registerOscHandler(8,new O.OscHandler((U=>this.setHyperlink(U)))),this._parser.registerOscHandler(10,new O.OscHandler((U=>this.setOrReportFgColor(U)))),this._parser.registerOscHandler(11,new O.OscHandler((U=>this.setOrReportBgColor(U)))),this._parser.registerOscHandler(12,new O.OscHandler((U=>this.setOrReportCursorColor(U)))),this._parser.registerOscHandler(104,new O.OscHandler((U=>this.restoreIndexedColor(U)))),this._parser.registerOscHandler(110,new O.OscHandler((U=>this.restoreFgColor(U)))),this._parser.registerOscHandler(111,new O.OscHandler((U=>this.restoreBgColor(U)))),this._parser.registerOscHandler(112,new O.OscHandler((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(const U in x.CHARSETS)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 k.DcsHandler(((U,ue)=>this.requestStatusString(U,ue))))}_preserveStack(A,B,F,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=A,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=F,this._parseStack.position=$}_logSlowResolvingAsync(A){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([A,new Promise(((B,F)=>setTimeout((()=>F("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(A,B){let F,$=this._activeBuffer.x,J=this._activeBuffer.y,z=0;const ee=this._parseStack.paused;if(ee){if(F=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync(F),F;$=this._parseStack.cursorStartX,J=this._parseStack.cursorStartY,this._parseStack.paused=!1,A.length>q&&(z=this._parseStack.position+q)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof A=="string"?` "${A}"`:` "${Array.prototype.map.call(A,(U=>String.fromCharCode(U))).join("")}"`),typeof A=="string"?A.split("").map((U=>U.charCodeAt(0))):A),this._parseBuffer.length<A.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(A.length,q))),ee||this._dirtyRowTracker.clearRange(),A.length>q)for(let U=z;U<A.length;U+=q){const ue=U+q<A.length?U+q:A.length,pe=typeof A=="string"?this._stringDecoder.decode(A.substring(U,ue),this._parseBuffer):this._utf8Decoder.decode(A.subarray(U,ue),this._parseBuffer);if(F=this._parser.parse(this._parseBuffer,pe))return this._preserveStack($,J,pe,U),this._logSlowResolvingAsync(F),F}else if(!ee){const U=typeof A=="string"?this._stringDecoder.decode(A,this._parseBuffer):this._utf8Decoder.decode(A,this._parseBuffer);if(F=this._parser.parse(this._parseBuffer,U))return this._preserveStack($,J,U,0),this._logSlowResolvingAsync(F),F}this._activeBuffer.x===$&&this._activeBuffer.y===J||this._onCursorMove.fire();const de=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Z,this._bufferService.rows-1),Math.min(de,this._bufferService.rows-1))}print(A,B,F){let $,J;const z=this._charsetService.charset,ee=this._optionsService.rawOptions.screenReaderMode,de=this._bufferService.cols,Z=this._coreService.decPrivateModes.wraparound,U=this._coreService.modes.insertMode,ue=this._curAttrData;let pe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&F-B>0&&pe.getWidth(this._activeBuffer.x-1)===2&&pe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ue);let me=this._parser.precedingJoinState;for(let ge=B;ge<F;++ge){if($=A[ge],$<127&&z){const at=z[String.fromCharCode($)];at&&($=at.charCodeAt(0))}const Re=this._unicodeService.charProperties($,me);J=D.UnicodeService.extractWidth(Re);const tt=D.UnicodeService.extractShouldJoin(Re),qe=tt?D.UnicodeService.extractWidth(me):0;if(me=Re,ee&&this._onA11yChar.fire((0,E.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+J-qe>de){if(Z){const at=pe;let we=this._activeBuffer.x-qe;for(this._activeBuffer.x=qe,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),pe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),qe>0&&pe instanceof g.BufferLine&&pe.copyCellsFrom(at,we,0,qe,!1);we<de;)at.setCellFromCodepoint(we++,0,1,ue)}else if(this._activeBuffer.x=de-1,J===2)continue}if(tt&&this._activeBuffer.x){const at=pe.getWidth(this._activeBuffer.x-1)?1:2;pe.addCodepointToCell(this._activeBuffer.x-at,$,J);for(let we=J-qe;--we>=0;)pe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ue)}else if(U&&(pe.insertCells(this._activeBuffer.x,J-qe,this._activeBuffer.getNullCell(ue)),pe.getWidth(de-1)===2&&pe.setCellFromCodepoint(de-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ue)),pe.setCellFromCodepoint(this._activeBuffer.x++,$,J,ue),J>0)for(;--J;)pe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ue)}this._parser.precedingJoinState=me,this._activeBuffer.x<de&&F-B>0&&pe.getWidth(this._activeBuffer.x)===0&&!pe.hasContent(this._activeBuffer.x)&&pe.setCellFromCodepoint(this._activeBuffer.x,0,1,ue),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(A,B){return A.final!=="t"||A.prefix||A.intermediates?this._parser.registerCsiHandler(A,B):this._parser.registerCsiHandler(A,(F=>!Y(F.params[0],this._optionsService.rawOptions.windowOptions)||B(F)))}registerDcsHandler(A,B){return this._parser.registerDcsHandler(A,new k.DcsHandler(B))}registerEscHandler(A,B){return this._parser.registerEscHandler(A,B)}registerOscHandler(A,B){return this._parser.registerOscHandler(A,new O.OscHandler(B))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);A.hasWidth(this._activeBuffer.x)&&!A.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const A=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-A),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(A=this._bufferService.cols-1){this._activeBuffer.x=Math.min(A,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(A,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=A,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=A,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(A,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+A,this._activeBuffer.y+B)}cursorUp(A){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,A.params[0]||1)):this._moveCursor(0,-(A.params[0]||1)),!0}cursorDown(A){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,A.params[0]||1)):this._moveCursor(0,A.params[0]||1),!0}cursorForward(A){return this._moveCursor(A.params[0]||1,0),!0}cursorBackward(A){return this._moveCursor(-(A.params[0]||1),0),!0}cursorNextLine(A){return this.cursorDown(A),this._activeBuffer.x=0,!0}cursorPrecedingLine(A){return this.cursorUp(A),this._activeBuffer.x=0,!0}cursorCharAbsolute(A){return this._setCursor((A.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(A){return this._setCursor(A.length>=2?(A.params[1]||1)-1:0,(A.params[0]||1)-1),!0}charPosAbsolute(A){return this._setCursor((A.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(A){return this._moveCursor(A.params[0]||1,0),!0}linePosAbsolute(A){return this._setCursor(this._activeBuffer.x,(A.params[0]||1)-1),!0}vPositionRelative(A){return this._moveCursor(0,A.params[0]||1),!0}hVPosition(A){return this.cursorPosition(A),!0}tabClear(A){const B=A.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(A){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=A.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(A){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=A.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(A){const B=A.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(A,B,F,$=!1,J=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);z.replaceCells(B,F,this._activeBuffer.getNullCell(this._eraseAttrData()),J),$&&(z.isWrapped=!1)}_resetBufferLine(A,B=!1){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);F&&(F.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+A),F.isWrapped=!1)}eraseInDisplay(A,B=!1){let F;switch(this._restrictCursor(this._bufferService.cols),A.params[0]){case 0:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);F<this._bufferService.rows;F++)this._resetBufferLine(F,B);this._dirtyRowTracker.markDirty(F);break;case 1:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(F+1).isWrapped=!1);F--;)this._resetBufferLine(F,B);this._dirtyRowTracker.markDirty(0);break;case 2:for(F=this._bufferService.rows,this._dirtyRowTracker.markDirty(F-1);F--;)this._resetBufferLine(F,B);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(A,B=!1){switch(this._restrictCursor(this._bufferService.cols),A.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(A){this._restrictCursor();let B=A.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,J=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;B--;)this._activeBuffer.lines.splice(J-1,1),this._activeBuffer.lines.splice(F,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(A){this._restrictCursor();let B=A.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;B--;)this._activeBuffer.lines.splice(F,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(A){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,A.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(A){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,A.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(A){let B=A.params[0]||1;for(;B--;)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(A){let B=A.params[0]||1;for(;B--;)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(g.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=A.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=A.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=A.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(A){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=A.params[0]||1;for(let F=this._activeBuffer.scrollTop;F<=this._activeBuffer.scrollBottom;++F){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+F);$.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(A){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(A.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(A){const B=this._parser.precedingJoinState;if(!B)return!0;const F=A.params[0]||1,$=D.UnicodeService.extractWidth(B),J=this._activeBuffer.x-$,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(J),ee=new Uint32Array(z.length*F);let de=0;for(let U=0;U<z.length;){const ue=z.codePointAt(U)||0;ee[de++]=ue,U+=ue>65535?2:1}let Z=de;for(let U=1;U<F;++U)ee.copyWithin(Z,0,de),Z+=de;return this.print(ee,0,Z),!0}sendDeviceAttributesPrimary(A){return A.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(A){return A.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(A.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c")),!0}_is(A){return(this._optionsService.rawOptions.termName+"").indexOf(A)===0}setMode(A){for(let B=0;B<A.length;B++)switch(A.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(A){for(let B=0;B<A.length;B++)switch(A.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(A){for(let B=0;B<A.length;B++)switch(A.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(A){for(let B=0;B<A.length;B++)switch(A.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),A.params[B]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(A,B){const F=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:J}=this._coreMouseService,z=this._coreService,{buffers:ee,cols:de}=this._bufferService,{active:Z,alt:U}=ee,ue=this._optionsService.rawOptions,pe=tt=>tt?1:2,me=A.params[0];return ge=me,Re=B?me===2?4:me===4?pe(z.modes.insertMode):me===12?3:me===20?pe(ue.convertEol):0:me===1?pe(F.applicationCursorKeys):me===3?ue.windowOptions.setWinLines?de===80?2:de===132?1:0:0:me===6?pe(F.origin):me===7?pe(F.wraparound):me===8?3:me===9?pe($==="X10"):me===12?pe(ue.cursorBlink):me===25?pe(!z.isCursorHidden):me===45?pe(F.reverseWraparound):me===66?pe(F.applicationKeypad):me===67?4:me===1e3?pe($==="VT200"):me===1002?pe($==="DRAG"):me===1003?pe($==="ANY"):me===1004?pe(F.sendFocus):me===1005?4:me===1006?pe(J==="SGR"):me===1015?4:me===1016?pe(J==="SGR_PIXELS"):me===1048?1:me===47||me===1047||me===1049?pe(Z===U):me===2004?pe(F.bracketedPasteMode):0,z.triggerDataEvent(`${f.C0.ESC}[${B?"":"?"}${ge};${Re}$y`),!0;var ge,Re}_updateAttrColor(A,B,F,$,J){return B===2?(A|=50331648,A&=-16777216,A|=N.AttributeData.fromColorRGB([F,$,J])):B===5&&(A&=-50331904,A|=33554432|255&F),A}_extractColor(A,B,F){const $=[0,0,-1,0,0,0];let J=0,z=0;do{if($[z+J]=A.params[B+z],A.hasSubParams(B+z)){const ee=A.getSubParams(B+z);let de=0;do $[1]===5&&(J=1),$[z+de+1+J]=ee[de];while(++de<ee.length&&de+z+1+J<$.length);break}if($[1]===5&&z+J>=2||$[1]===2&&z+J>=5)break;$[1]&&(J=1)}while(++z+B<A.length&&z+J<$.length);for(let ee=2;ee<$.length;++ee)$[ee]===-1&&($[ee]=0);switch($[0]){case 38:F.fg=this._updateAttrColor(F.fg,$[1],$[3],$[4],$[5]);break;case 48:F.bg=this._updateAttrColor(F.bg,$[1],$[3],$[4],$[5]);break;case 58:F.extended=F.extended.clone(),F.extended.underlineColor=this._updateAttrColor(F.extended.underlineColor,$[1],$[3],$[4],$[5])}return z}_processUnderline(A,B){B.extended=B.extended.clone(),(!~A||A>5)&&(A=1),B.extended.underlineStyle=A,B.fg|=268435456,A===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(A){A.fg=g.DEFAULT_ATTR_DATA.fg,A.bg=g.DEFAULT_ATTR_DATA.bg,A.extended=A.extended.clone(),A.extended.underlineStyle=0,A.extended.underlineColor&=-67108864,A.updateExtended()}charAttributes(A){if(A.length===1&&A.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=A.length;let F;const $=this._curAttrData;for(let J=0;J<B;J++)F=A.params[J],F>=30&&F<=37?($.fg&=-50331904,$.fg|=16777216|F-30):F>=40&&F<=47?($.bg&=-50331904,$.bg|=16777216|F-40):F>=90&&F<=97?($.fg&=-50331904,$.fg|=16777224|F-90):F>=100&&F<=107?($.bg&=-50331904,$.bg|=16777224|F-100):F===0?this._processSGR0($):F===1?$.fg|=134217728:F===3?$.bg|=67108864:F===4?($.fg|=268435456,this._processUnderline(A.hasSubParams(J)?A.getSubParams(J)[0]:1,$)):F===5?$.fg|=536870912:F===7?$.fg|=67108864:F===8?$.fg|=1073741824:F===9?$.fg|=2147483648:F===2?$.bg|=134217728:F===21?this._processUnderline(2,$):F===22?($.fg&=-134217729,$.bg&=-134217729):F===23?$.bg&=-67108865:F===24?($.fg&=-268435457,this._processUnderline(0,$)):F===25?$.fg&=-536870913:F===27?$.fg&=-67108865:F===28?$.fg&=-1073741825:F===29?$.fg&=2147483647:F===39?($.fg&=-67108864,$.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):F===49?($.bg&=-67108864,$.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):F===38||F===48||F===58?J+=this._extractColor(A,J,$):F===53?$.bg|=1073741824:F===55?$.bg&=-1073741825:F===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):F===100?($.fg&=-67108864,$.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",F);return!0}deviceStatus(A){switch(A.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${B};${F}R`)}return!0}deviceStatusPrivate(A){if(A.params[0]===6){const B=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${B};${F}R`)}return!0}softReset(A){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(A){const B=A.params[0]||1;switch(B){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const F=B%2==1;return this._optionsService.options.cursorBlink=F,!0}setScrollRegion(A){const B=A.params[0]||1;let F;return(A.length<2||(F=A.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=F-1,this._setCursor(0,0)),!0}windowOptions(A){if(!Y(A.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=A.length>1?A.params[1]:0;switch(A.params[0]){case 14:B!==2&&this._onRequestWindowsOptionsReport.fire(P.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(P.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${f.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(A){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(A){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(A){return this._windowTitle=A,this._onTitleChange.fire(A),!0}setIconName(A){return this._iconName=A,!0}setOrReportIndexedColor(A){const B=[],F=A.split(";");for(;F.length>1;){const $=F.shift(),J=F.shift();if(/^\d+$/.exec($)){const z=parseInt($);if(W(z))if(J==="?")B.push({type:0,index:z});else{const ee=(0,L.parseColor)(J);ee&&B.push({type:1,index:z,color:ee})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(A){const B=A.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(A,B){this._getCurrentLinkId()&&this._finishHyperlink();const F=A.split(":");let $;const J=F.findIndex((z=>z.startsWith("id=")));return J!==-1&&($=F[J].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(A,B){const F=A.split(";");for(let $=0;$<F.length&&!(B>=this._specialColors.length);++$,++B)if(F[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const J=(0,L.parseColor)(F[$]);J&&this._onColor.fire([{type:1,index:this._specialColors[B],color:J}])}return!0}setOrReportFgColor(A){return this._setOrReportSpecialColor(A,0)}setOrReportBgColor(A){return this._setOrReportSpecialColor(A,1)}setOrReportCursorColor(A){return this._setOrReportSpecialColor(A,2)}restoreIndexedColor(A){if(!A)return this._onColor.fire([{type:2}]),!0;const B=[],F=A.split(";");for(let $=0;$<F.length;++$)if(/^\d+$/.exec(F[$])){const J=parseInt(F[$]);W(J)&&B.push({type:2,index:J})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(A){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(A){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(A){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,x.DEFAULT_CHARSET),!0}selectCharset(A){return A.length!==2?(this.selectDefaultCharset(),!0):(A[0]==="/"||this._charsetService.setgCharset(V[A[0]],x.CHARSETS[A[1]]||x.DEFAULT_CHARSET),!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){const A=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,A,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=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(A){return this._charsetService.setgLevel(A),!0}screenAlignmentPattern(){const A=new S.CellData;A.content=4194373,A.fg=this._curAttrData.fg,A.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const F=this._activeBuffer.ybase+this._activeBuffer.y+B,$=this._activeBuffer.lines.get(F);$&&($.fill(A),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(A,B){const F=this._bufferService.buffer,$=this._optionsService.rawOptions;return(J=>(this._coreService.triggerDataEvent(`${f.C0.ESC}${J}${f.C0.ESC}\\`),!0))(A==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:A==='"p'?'P1$r61;1"p':A==="r"?`P1$r${F.scrollTop+1};${F.scrollBottom+1}r`:A==="m"?"P1$r0m":A===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(A,B){this._dirtyRowTracker.markRangeDirty(A,B)}}c.InputHandler=he;let ne=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,A){I>A&&(Q=I,I=A,A=Q),I<this.start&&(this.start=I),A>this.end&&(this.end=A)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function W(I){return 0<=I&&I<256}ne=y([p(0,T.IBufferService)],ne)},844:(w,c)=>{function h(y){for(const p of y)p.dispose();y.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const y of this._disposables)y.dispose();this._disposables.length=0}register(y){return this._disposables.push(y),y}unregister(y){const p=this._disposables.indexOf(y);p!==-1&&this._disposables.splice(p,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(y){this._isDisposed||y===this._value||(this._value?.dispose(),this._value=y)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},c.toDisposable=function(y){return{dispose:y}},c.disposeArray=h,c.getDisposeArrayDisposable=function(y){return{dispose:()=>h(y)}}},1505:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(p,f,x){this._data[p]||(this._data[p]={}),this._data[p][f]=x}get(p,f){return this._data[p]?this._data[p][f]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(y,p,f,x,C){this._data.get(y,p)||this._data.set(y,p,new h),this._data.get(y,p).set(f,x,C)}get(y,p,f,x){return this._data.get(y,p)?.get(f,x)}clear(){this._data.clear()}}},6114:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const h=c.isNode?"node":navigator.userAgent,y=c.isNode?"node":navigator.platform;c.isFirefox=h.includes("Firefox"),c.isLegacyEdge=h.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(h),c.getSafariVersion=function(){if(!c.isSafari)return 0;const p=h.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(y),c.isIpad=y==="iPad",c.isIphone=y==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(y),c.isLinux=y.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(h)},6106:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let h=0;c.SortedList=class{constructor(y){this._getKey=y,this._array=[]}clear(){this._array.length=0}insert(y){this._array.length!==0?(h=this._search(this._getKey(y)),this._array.splice(h,0,y)):this._array.push(y)}delete(y){if(this._array.length===0)return!1;const p=this._getKey(y);if(p===void 0||(h=this._search(p),h===-1)||this._getKey(this._array[h])!==p)return!1;do if(this._array[h]===y)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===p);return!1}*getKeyIterator(y){if(this._array.length!==0&&(h=this._search(y),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===y))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===y)}forEachByKey(y,p){if(this._array.length!==0&&(h=this._search(y),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===y))do p(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===y)}values(){return[...this._array].values()}_search(y){let p=0,f=this._array.length-1;for(;f>=p;){let x=p+f>>1;const C=this._getKey(this._array[x]);if(C>y)f=x-1;else{if(!(C<y)){for(;x>0&&this._getKey(this._array[x-1])===y;)x--;return x}p=x+1}}return p}}},7226:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const y=h(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let j=0,E=0,g=C.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(j=Date.now(),this._tasks[this._i]()||this._i++,j=Math.max(1,Date.now()-j),E=Math.max(j,E),b=C.timeRemaining(),1.5*E>b)return g-j<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-j))}ms`),void this._start();g=b}this.clear()}}class f extends p{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const j=Date.now()+C;return{timeRemaining:()=>Math.max(0,j-Date.now())}}}c.PriorityTaskQueue=f,c.IdleTaskQueue=!y.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:f,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}flush(){this._queue.flush()}}},9282:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const y=h(643);c.updateWindowsModeWrappedState=function(p){const f=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),x=f?.get(p.cols-1),C=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);C&&x&&(C.isWrapped=x[y.CHAR_DATA_CODE_INDEX]!==y.NULL_CELL_CODE&&x[y.CHAR_DATA_CODE_INDEX]!==y.WHITESPACE_CELL_CODE)}},3734:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new y}static toColorRGB(f){return[f>>>16&255,f>>>8&255,255&f]}static fromColorRGB(f){return(255&f[0])<<16|(255&f[1])<<8|255&f[2]}clone(){const f=new h;return f.fg=this.fg,f.bg=this.bg,f.extended=this.extended.clone(),f}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}c.AttributeData=h;class y{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(f){this._ext=f}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(f){this._ext&=-469762049,this._ext|=f<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(f){this._ext&=-67108864,this._ext|=67108863&f}get urlId(){return this._urlId}set urlId(f){this._urlId=f}get underlineVariantOffset(){const f=(3758096384&this._ext)>>29;return f<0?4294967288^f:f}set underlineVariantOffset(f){this._ext&=536870911,this._ext|=f<<29&3758096384}constructor(f=0,x=0){this._ext=0,this._urlId=0,this._ext=f,this._urlId=x}clone(){return new y(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=y},9092:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const y=h(6349),p=h(7226),f=h(3734),x=h(8437),C=h(4634),j=h(511),E=h(643),g=h(4863),b=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(v,S,N){this._hasScrollback=v,this._optionsService=S,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=x.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=j.CellData.fromCharData([0,E.NULL_CELL_CHAR,E.NULL_CELL_WIDTH,E.NULL_CELL_CODE]),this._whitespaceCell=j.CellData.fromCharData([0,E.WHITESPACE_CELL_CHAR,E.WHITESPACE_CELL_WIDTH,E.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new y.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new f.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new f.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,S){return new x.BufferLine(this._bufferService.cols,this.getNullCell(v),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const S=v+this._optionsService.rawOptions.scrollback;return S>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:S}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=x.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new y.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,S){const N=this.getNullCell(x.DEFAULT_ATTR_DATA);let T=0;const D=this._getCorrectBufferLength(S);if(D>this.lines.maxLength&&(this.lines.maxLength=D),this.lines.length>0){if(this._cols<v)for(let k=0;k<this.lines.length;k++)T+=+this.lines.get(k).resize(v,N);let O=0;if(this._rows<S)for(let k=this._rows;k<S;k++)this.lines.length<S+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new x.BufferLine(v,N)):this.ybase>0&&this.lines.length<=this.ybase+this.y+O+1?(this.ybase--,O++,this.ydisp>0&&this.ydisp--):this.lines.push(new x.BufferLine(v,N)));else for(let k=this._rows;k>S;k--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(D<this.lines.maxLength){const k=this.lines.length-D;k>0&&(this.lines.trimStart(k),this.ybase=Math.max(this.ybase-k,0),this.ydisp=Math.max(this.ydisp-k,0),this.savedY=Math.max(this.savedY-k,0)),this.lines.maxLength=D}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,S-1),O&&(this.y+=O),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(v,S),this._cols>v))for(let O=0;O<this.lines.length;O++)T+=+this.lines.get(O).resize(v,N);this._cols=v,this._rows=S,this._memoryCleanupQueue.clear(),T>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,S){this._cols!==v&&(v>this._cols?this._reflowLarger(v,S):this._reflowSmaller(v,S))}_reflowLarger(v,S){const N=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(N.length>0){const T=(0,C.reflowLargerCreateNewLayout)(this.lines,N);(0,C.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(v,S,T.countRemoved)}}_reflowLargerAdjustViewport(v,S,N){const T=this.getNullCell(x.DEFAULT_ATTR_DATA);let D=N;for(;D-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new x.BufferLine(v,T))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-N,0)}_reflowSmaller(v,S){const N=this.getNullCell(x.DEFAULT_ATTR_DATA),T=[];let D=0;for(let O=this.lines.length-1;O>=0;O--){let k=this.lines.get(O);if(!k||!k.isWrapped&&k.getTrimmedLength()<=v)continue;const L=[k];for(;k.isWrapped&&O>0;)k=this.lines.get(--O),L.unshift(k);const V=this.ybase+this.y;if(V>=O&&V<O+L.length)continue;const q=L[L.length-1].getTrimmedLength(),Y=(0,C.reflowSmallerGetNewLineLengths)(L,this._cols,v),P=Y.length-L.length;let Q;Q=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+P):Math.max(0,this.lines.length-this.lines.maxLength+P);const he=[];for(let F=0;F<P;F++){const $=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);he.push($)}he.length>0&&(T.push({start:O+L.length+D,newLines:he}),D+=he.length),L.push(...he);let ne=Y.length-1,W=Y[ne];W===0&&(ne--,W=Y[ne]);let I=L.length-P-1,A=q;for(;I>=0;){const F=Math.min(A,W);if(L[ne]===void 0)break;if(L[ne].copyCellsFrom(L[I],A-F,W-F,F,!0),W-=F,W===0&&(ne--,W=Y[ne]),A-=F,A===0){I--;const $=Math.max(I,0);A=(0,C.getWrappedLineTrimmedLength)(L,$,this._cols)}}for(let F=0;F<L.length;F++)Y[F]<v&&L[F].setCell(Y[F],N);let B=P-Q;for(;B-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+D)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+S-1)}if(T.length>0){const O=[],k=[];for(let ne=0;ne<this.lines.length;ne++)k.push(this.lines.get(ne));const L=this.lines.length;let V=L-1,q=0,Y=T[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+D);let P=0;for(let ne=Math.min(this.lines.maxLength-1,L+D-1);ne>=0;ne--)if(Y&&Y.start>V+P){for(let W=Y.newLines.length-1;W>=0;W--)this.lines.set(ne--,Y.newLines[W]);ne++,O.push({index:V+1,amount:Y.newLines.length}),P+=Y.newLines.length,Y=T[++q]}else this.lines.set(ne,k[V--]);let Q=0;for(let ne=O.length-1;ne>=0;ne--)O[ne].index+=Q,this.lines.onInsertEmitter.fire(O[ne]),Q+=O[ne].amount;const he=Math.max(0,L+D-this.lines.maxLength);he>0&&this.lines.onTrimEmitter.fire(he)}}translateBufferLineToString(v,S,N=0,T){const D=this.lines.get(v);return D?D.translateToString(S,N,T):""}getWrappedRangeForLine(v){let S=v,N=v;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;N+1<this.lines.length&&this.lines.get(N+1).isWrapped;)N++;return{first:S,last:N}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===v&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const S=new g.Marker(v);return this.markers.push(S),S.register(this.lines.onTrim((N=>{S.line-=N,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((N=>{S.line>=N.index&&(S.line+=N.amount)}))),S.register(this.lines.onDelete((N=>{S.line>=N.index&&S.line<N.index+N.amount&&S.dispose(),S.line>N.index&&(S.line-=N.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const y=h(3734),p=h(511),f=h(643),x=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new y.AttributeData);let C=0;class j{constructor(g,b,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const S=b||p.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]);for(let N=0;N<g;++N)this.setCell(N,S);this.length=g}get(g){const b=this._data[3*g+0],v=2097151&b;return[this._data[3*g+1],2097152&b?this._combined[g]:v?(0,x.stringFromCodePoint)(v):"",b>>22,2097152&b?this._combined[g].charCodeAt(this._combined[g].length-1):v]}set(g,b){this._data[3*g+1]=b[f.CHAR_DATA_ATTR_INDEX],b[f.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=b[1],this._data[3*g+0]=2097152|g|b[f.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=b[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[f.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const b=this._data[3*g+0];return 2097152&b?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&b}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const b=this._data[3*g+0];return 2097152&b?this._combined[g]:2097151&b?(0,x.stringFromCodePoint)(2097151&b):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,b){return C=3*g,b.content=this._data[C+0],b.fg=this._data[C+1],b.bg=this._data[C+2],2097152&b.content&&(b.combinedData=this._combined[g]),268435456&b.bg&&(b.extended=this._extendedAttrs[g]),b}setCell(g,b){2097152&b.content&&(this._combined[g]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[g]=b.extended),this._data[3*g+0]=b.content,this._data[3*g+1]=b.fg,this._data[3*g+2]=b.bg}setCellFromCodepoint(g,b,v,S){268435456&S.bg&&(this._extendedAttrs[g]=S.extended),this._data[3*g+0]=b|v<<22,this._data[3*g+1]=S.fg,this._data[3*g+2]=S.bg}addCodepointToCell(g,b,v){let S=this._data[3*g+0];2097152&S?this._combined[g]+=(0,x.stringFromCodePoint)(b):2097151&S?(this._combined[g]=(0,x.stringFromCodePoint)(2097151&S)+(0,x.stringFromCodePoint)(b),S&=-2097152,S|=2097152):S=b|4194304,v&&(S&=-12582913,S|=v<<22),this._data[3*g+0]=S}insertCells(g,b,v){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,v),b<this.length-g){const S=new p.CellData;for(let N=this.length-g-b-1;N>=0;--N)this.setCell(g+b+N,this.loadCell(g+N,S));for(let N=0;N<b;++N)this.setCell(g+N,v)}else for(let S=g;S<this.length;++S)this.setCell(S,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(g,b,v){if(g%=this.length,b<this.length-g){const S=new p.CellData;for(let N=0;N<this.length-g-b;++N)this.setCell(g+N,this.loadCell(g+b+N,S));for(let N=this.length-b;N<this.length;++N)this.setCell(N,v)}else for(let S=g;S<this.length;++S)this.setCell(S,v);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,v),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,v)}replaceCells(g,b,v,S=!1){if(S)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,v);g<b&&g<this.length;)this.isProtected(g)||this.setCell(g,v),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,v);g<b&&g<this.length;)this.setCell(g++,v)}resize(g,b){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*g;if(g>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const S=new Uint32Array(v);S.set(this._data),this._data=S}for(let S=this.length;S<g;++S)this.setCell(S,b)}else{this._data=this._data.subarray(0,v);const S=Object.keys(this._combined);for(let T=0;T<S.length;T++){const D=parseInt(S[T],10);D>=g&&delete this._combined[D]}const N=Object.keys(this._extendedAttrs);for(let T=0;T<N.length;T++){const D=parseInt(N[T],10);D>=g&&delete this._extendedAttrs[D]}}return this.length=g,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,b=!1){if(b)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,g);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const b in g._combined)this._combined[b]=g._combined[b];this._extendedAttrs={};for(const b in g._extendedAttrs)this._extendedAttrs[b]=g._extendedAttrs[b];this.isWrapped=g.isWrapped}clone(){const g=new j(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const b in this._combined)g._combined[b]=this._combined[b];for(const b in this._extendedAttrs)g._extendedAttrs[b]=this._extendedAttrs[b];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,b,v,S,N){const T=g._data;if(N)for(let O=S-1;O>=0;O--){for(let k=0;k<3;k++)this._data[3*(v+O)+k]=T[3*(b+O)+k];268435456&T[3*(b+O)+2]&&(this._extendedAttrs[v+O]=g._extendedAttrs[b+O])}else for(let O=0;O<S;O++){for(let k=0;k<3;k++)this._data[3*(v+O)+k]=T[3*(b+O)+k];268435456&T[3*(b+O)+2]&&(this._extendedAttrs[v+O]=g._extendedAttrs[b+O])}const D=Object.keys(g._combined);for(let O=0;O<D.length;O++){const k=parseInt(D[O],10);k>=b&&(this._combined[k-b+v]=g._combined[k])}}translateToString(g,b,v,S){b=b??0,v=v??this.length,g&&(v=Math.min(v,this.getTrimmedLength())),S&&(S.length=0);let N="";for(;b<v;){const T=this._data[3*b+0],D=2097151&T,O=2097152&T?this._combined[b]:D?(0,x.stringFromCodePoint)(D):f.WHITESPACE_CELL_CHAR;if(N+=O,S)for(let k=0;k<O.length;++k)S.push(b);b+=T>>22||1}return S&&S.push(b),N}}c.BufferLine=j},4841:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(h,y){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return y*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(w,c)=>{function h(y,p,f){if(p===y.length-1)return y[p].getTrimmedLength();const x=!y[p].hasContent(f-1)&&y[p].getWidth(f-1)===1,C=y[p+1].getWidth(0)===2;return x&&C?f-1:f}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(y,p,f,x,C){const j=[];for(let E=0;E<y.length-1;E++){let g=E,b=y.get(++g);if(!b.isWrapped)continue;const v=[y.get(E)];for(;g<y.length&&b.isWrapped;)v.push(b),b=y.get(++g);if(x>=E&&x<g){E+=v.length-1;continue}let S=0,N=h(v,S,p),T=1,D=0;for(;T<v.length;){const k=h(v,T,p),L=k-D,V=f-N,q=Math.min(L,V);v[S].copyCellsFrom(v[T],D,N,q,!1),N+=q,N===f&&(S++,N=0),D+=q,D===k&&(T++,D=0),N===0&&S!==0&&v[S-1].getWidth(f-1)===2&&(v[S].copyCellsFrom(v[S-1],f-1,N++,1,!1),v[S-1].setCell(f-1,C))}v[S].replaceCells(N,f,C);let O=0;for(let k=v.length-1;k>0&&(k>S||v[k].getTrimmedLength()===0);k--)O++;O>0&&(j.push(E+v.length-O),j.push(O)),E+=v.length-1}return j},c.reflowLargerCreateNewLayout=function(y,p){const f=[];let x=0,C=p[x],j=0;for(let E=0;E<y.length;E++)if(C===E){const g=p[++x];y.onDeleteEmitter.fire({index:E-j,amount:g}),E+=g-1,j+=g,C=p[++x]}else f.push(E);return{layout:f,countRemoved:j}},c.reflowLargerApplyNewLayout=function(y,p){const f=[];for(let x=0;x<p.length;x++)f.push(y.get(p[x]));for(let x=0;x<f.length;x++)y.set(x,f[x]);y.length=p.length},c.reflowSmallerGetNewLineLengths=function(y,p,f){const x=[],C=y.map(((b,v)=>h(y,v,p))).reduce(((b,v)=>b+v));let j=0,E=0,g=0;for(;g<C;){if(C-g<f){x.push(C-g);break}j+=f;const b=h(y,E,p);j>b&&(j-=b,E++);const v=y[E].getWidth(j-1)===2;v&&j--;const S=v?f-1:f;x.push(S),g+=S}return x},c.getWrappedLineTrimmedLength=h},5295:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const y=h(8460),p=h(844),f=h(9092);class x extends p.Disposable{constructor(j,E){super(),this._optionsService=j,this._bufferService=E,this._onBufferActivate=this.register(new y.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new f.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new f.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(j){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(j),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(j,E){this._normal.resize(j,E),this._alt.resize(j,E),this.setupTabStops(j)}setupTabStops(j){this._normal.setupTabStops(j),this._alt.setupTabStops(j)}}c.BufferSet=x},511:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const y=h(482),p=h(643),f=h(3734);class x extends f.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new f.ExtendedAttrs,this.combinedData=""}static fromCharData(j){const E=new x;return E.setFromCharData(j),E}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,y.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(j){this.fg=j[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let E=!1;if(j[p.CHAR_DATA_CHAR_INDEX].length>2)E=!0;else if(j[p.CHAR_DATA_CHAR_INDEX].length===2){const g=j[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const b=j[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(g-55296)+b-56320+65536|j[p.CHAR_DATA_WIDTH_INDEX]<<22:E=!0}else E=!0}else this.content=j[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|j[p.CHAR_DATA_WIDTH_INDEX]<<22;E&&(this.combinedData=j[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|j[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=x},643:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const y=h(8460),p=h(844);class f{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=f._nextId++,this._onDispose=this.register(new y.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}c.Marker=f,f._nextId=1},7116:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(w,c)=>{var h,y,p;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(f){f.NUL="\0",f.SOH="",f.STX="",f.ETX="",f.EOT="",f.ENQ="",f.ACK="",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=`
29
29
  `,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(h||(c.C0=h={})),(function(f){f.PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ"})(y||(c.C1=y={})),(function(f){f.ST=`${h.ESC}\\`})(p||(c.C1_ESCAPED=p={}))},7399:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const y=h(2584),p={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:["'",'"']};c.evaluateKeyboardEvent=function(f,x,C,j){const E={type:0,cancel:!1,key:void 0},g=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?E.key=x?y.C0.ESC+"OA":y.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?E.key=x?y.C0.ESC+"OD":y.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?E.key=x?y.C0.ESC+"OC":y.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(E.key=x?y.C0.ESC+"OB":y.C0.ESC+"[B");break;case 8:E.key=f.ctrlKey?"\b":y.C0.DEL,f.altKey&&(E.key=y.C0.ESC+E.key);break;case 9:if(f.shiftKey){E.key=y.C0.ESC+"[Z";break}E.key=y.C0.HT,E.cancel=!0;break;case 13:E.key=f.altKey?y.C0.ESC+y.C0.CR:y.C0.CR,E.cancel=!0;break;case 27:E.key=y.C0.ESC,f.altKey&&(E.key=y.C0.ESC+y.C0.ESC),E.cancel=!0;break;case 37:if(f.metaKey)break;g?(E.key=y.C0.ESC+"[1;"+(g+1)+"D",E.key===y.C0.ESC+"[1;3D"&&(E.key=y.C0.ESC+(C?"b":"[1;5D"))):E.key=x?y.C0.ESC+"OD":y.C0.ESC+"[D";break;case 39:if(f.metaKey)break;g?(E.key=y.C0.ESC+"[1;"+(g+1)+"C",E.key===y.C0.ESC+"[1;3C"&&(E.key=y.C0.ESC+(C?"f":"[1;5C"))):E.key=x?y.C0.ESC+"OC":y.C0.ESC+"[C";break;case 38:if(f.metaKey)break;g?(E.key=y.C0.ESC+"[1;"+(g+1)+"A",C||E.key!==y.C0.ESC+"[1;3A"||(E.key=y.C0.ESC+"[1;5A")):E.key=x?y.C0.ESC+"OA":y.C0.ESC+"[A";break;case 40:if(f.metaKey)break;g?(E.key=y.C0.ESC+"[1;"+(g+1)+"B",C||E.key!==y.C0.ESC+"[1;3B"||(E.key=y.C0.ESC+"[1;5B")):E.key=x?y.C0.ESC+"OB":y.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(E.key=y.C0.ESC+"[2~");break;case 46:E.key=g?y.C0.ESC+"[3;"+(g+1)+"~":y.C0.ESC+"[3~";break;case 36:E.key=g?y.C0.ESC+"[1;"+(g+1)+"H":x?y.C0.ESC+"OH":y.C0.ESC+"[H";break;case 35:E.key=g?y.C0.ESC+"[1;"+(g+1)+"F":x?y.C0.ESC+"OF":y.C0.ESC+"[F";break;case 33:f.shiftKey?E.type=2:f.ctrlKey?E.key=y.C0.ESC+"[5;"+(g+1)+"~":E.key=y.C0.ESC+"[5~";break;case 34:f.shiftKey?E.type=3:f.ctrlKey?E.key=y.C0.ESC+"[6;"+(g+1)+"~":E.key=y.C0.ESC+"[6~";break;case 112:E.key=g?y.C0.ESC+"[1;"+(g+1)+"P":y.C0.ESC+"OP";break;case 113:E.key=g?y.C0.ESC+"[1;"+(g+1)+"Q":y.C0.ESC+"OQ";break;case 114:E.key=g?y.C0.ESC+"[1;"+(g+1)+"R":y.C0.ESC+"OR";break;case 115:E.key=g?y.C0.ESC+"[1;"+(g+1)+"S":y.C0.ESC+"OS";break;case 116:E.key=g?y.C0.ESC+"[15;"+(g+1)+"~":y.C0.ESC+"[15~";break;case 117:E.key=g?y.C0.ESC+"[17;"+(g+1)+"~":y.C0.ESC+"[17~";break;case 118:E.key=g?y.C0.ESC+"[18;"+(g+1)+"~":y.C0.ESC+"[18~";break;case 119:E.key=g?y.C0.ESC+"[19;"+(g+1)+"~":y.C0.ESC+"[19~";break;case 120:E.key=g?y.C0.ESC+"[20;"+(g+1)+"~":y.C0.ESC+"[20~";break;case 121:E.key=g?y.C0.ESC+"[21;"+(g+1)+"~":y.C0.ESC+"[21~";break;case 122:E.key=g?y.C0.ESC+"[23;"+(g+1)+"~":y.C0.ESC+"[23~";break;case 123:E.key=g?y.C0.ESC+"[24;"+(g+1)+"~":y.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(C&&!j||!f.altKey||f.metaKey)!C||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?E.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(E.key=y.C0.US),f.key==="@"&&(E.key=y.C0.NUL)):f.keyCode===65&&(E.type=1);else{const b=p[f.keyCode],v=b?.[f.shiftKey?1:0];if(v)E.key=y.C0.ESC+v;else if(f.keyCode>=65&&f.keyCode<=90){const S=f.ctrlKey?f.keyCode-64:f.keyCode+32;let N=String.fromCharCode(S);f.shiftKey&&(N=N.toUpperCase()),E.key=y.C0.ESC+N}else if(f.keyCode===32)E.key=y.C0.ESC+(f.ctrlKey?y.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let S=f.code.slice(3,4);f.shiftKey||(S=S.toLowerCase()),E.key=y.C0.ESC+S,E.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?E.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?E.key=y.C0.NUL:f.keyCode>=51&&f.keyCode<=55?E.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?E.key=y.C0.DEL:f.keyCode===219?E.key=y.C0.ESC:f.keyCode===220?E.key=y.C0.FS:f.keyCode===221&&(E.key=y.C0.GS)}return E}},482:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},c.utf32ToString=function(h,y=0,p=h.length){let f="";for(let x=y;x<p;++x){let C=h[x];C>65535?(C-=65536,f+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):f+=String.fromCharCode(C)}return f},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,y){const p=h.length;if(!p)return 0;let f=0,x=0;if(this._interim){const C=h.charCodeAt(x++);56320<=C&&C<=57343?y[f++]=1024*(this._interim-55296)+C-56320+65536:(y[f++]=this._interim,y[f++]=C),this._interim=0}for(let C=x;C<p;++C){const j=h.charCodeAt(C);if(55296<=j&&j<=56319){if(++C>=p)return this._interim=j,f;const E=h.charCodeAt(C);56320<=E&&E<=57343?y[f++]=1024*(j-55296)+E-56320+65536:(y[f++]=j,y[f++]=E)}else j!==65279&&(y[f++]=j)}return f}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,y){const p=h.length;if(!p)return 0;let f,x,C,j,E=0,g=0,b=0;if(this.interim[0]){let N=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let D,O=0;for(;(D=63&this.interim[++O])&&O<4;)T<<=6,T|=D;const k=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=k-O;for(;b<L;){if(b>=p)return 0;if(D=h[b++],(192&D)!=128){b--,N=!0;break}this.interim[O++]=D,T<<=6,T|=63&D}N||(k===2?T<128?b--:y[E++]=T:k===3?T<2048||T>=55296&&T<=57343||T===65279||(y[E++]=T):T<65536||T>1114111||(y[E++]=T)),this.interim.fill(0)}const v=p-4;let S=b;for(;S<p;){for(;!(!(S<v)||128&(f=h[S])||128&(x=h[S+1])||128&(C=h[S+2])||128&(j=h[S+3]));)y[E++]=f,y[E++]=x,y[E++]=C,y[E++]=j,S+=4;if(f=h[S++],f<128)y[E++]=f;else if((224&f)==192){if(S>=p)return this.interim[0]=f,E;if(x=h[S++],(192&x)!=128){S--;continue}if(g=(31&f)<<6|63&x,g<128){S--;continue}y[E++]=g}else if((240&f)==224){if(S>=p)return this.interim[0]=f,E;if(x=h[S++],(192&x)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=x,E;if(C=h[S++],(192&C)!=128){S--;continue}if(g=(15&f)<<12|(63&x)<<6|63&C,g<2048||g>=55296&&g<=57343||g===65279)continue;y[E++]=g}else if((248&f)==240){if(S>=p)return this.interim[0]=f,E;if(x=h[S++],(192&x)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=x,E;if(C=h[S++],(192&C)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=x,this.interim[2]=C,E;if(j=h[S++],(192&j)!=128){S--;continue}if(g=(7&f)<<18|(63&x)<<12|(63&C)<<6|63&j,g<65536||g>1114111)continue;y[E++]=g}}return E}}},225:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const y=h(1480),p=[[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]],f=[[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]];let x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let C=0;C<p.length;++C)x.fill(0,p[C][0],p[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?x[C]:(function(j,E){let g,b=0,v=E.length-1;if(j<E[0][0]||j>E[v][1])return!1;for(;v>=b;)if(g=b+v>>1,j>E[g][1])b=g+1;else{if(!(j<E[g][0]))return!0;v=g-1}return!1})(C,f)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,j){let E=this.wcwidth(C),g=E===0&&j!==0;if(g){const b=y.UnicodeService.extractWidth(j);b===0?g=!1:b>E&&(E=b)}return y.UnicodeService.createPropertyValue(0,E,g)}}},5981:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const y=h(8460),p=h(844);class f extends p.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,j){if(j!==void 0&&this._syncCalls>j)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let E;for(this._isSyncWriting=!0;E=this._writeBuffer.shift();){this._action(E);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,j){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(j),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(j)}_innerWrite(C=0,j=!0){const E=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],b=this._action(g,j);if(b){const S=N=>Date.now()-E>=12?setTimeout((()=>this._innerWrite(0,N))):this._innerWrite(E,N);return void b.catch((N=>(queueMicrotask((()=>{throw N})),Promise.resolve(!1)))).then(S)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-E>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}c.WriteBuffer=f},5941:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const h=/^([\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})$/,y=/^[\da-f]+$/;function p(f,x){const C=f.toString(16),j=C.length<2?"0"+C:C;switch(x){case 4:return C[0];case 8:return j;case 12:return(j+j).slice(0,3);default:return j+j}}c.parseColor=function(f){if(!f)return;let x=f.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const C=h.exec(x);if(C){const j=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/j*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/j*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/j*255)]}}else if(x.indexOf("#")===0&&(x=x.slice(1),y.exec(x)&&[3,6,9,12].includes(x.length))){const C=x.length/3,j=[0,0,0];for(let E=0;E<3;++E){const g=parseInt(x.slice(C*E,C*E+C),16);j[E]=C===1?g<<4:C===2?g:C===3?g>>4:g>>8}return j}},c.toRgbString=function(f,x=16){const[C,j,E]=f;return`rgb:${p(C,x)}/${p(j,x)}/${p(E,x)}`}},5770:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const y=h(482),p=h(8742),f=h(5770),x=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}registerHandler(j,E){this._handlers[j]===void 0&&(this._handlers[j]=[]);const g=this._handlers[j];return g.push(E),{dispose:()=>{const b=g.indexOf(E);b!==-1&&g.splice(b,1)}}}clearHandler(j){this._handlers[j]&&delete this._handlers[j]}setHandlerFallback(j){this._handlerFb=j}reset(){if(this._active.length)for(let j=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;j>=0;--j)this._active[j].unhook(!1);this._stack.paused=!1,this._active=x,this._ident=0}hook(j,E){if(this.reset(),this._ident=j,this._active=this._handlers[j]||x,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(E);else this._handlerFb(this._ident,"HOOK",E)}put(j,E,g){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(j,E,g);else this._handlerFb(this._ident,"PUT",(0,y.utf32ToString)(j,E,g))}unhook(j,E=!0){if(this._active.length){let g=!1,b=this._active.length-1,v=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,g=E,v=this._stack.fallThrough,this._stack.paused=!1),!v&&g===!1){for(;b>=0&&(g=this._active[b].unhook(j),g!==!0);b--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,g;b--}for(;b>=0;b--)if(g=this._active[b].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",j);this._active=x,this._ident=0}};const C=new p.Params;C.addParam(0),c.DcsHandler=class{constructor(j){this._handler=j,this._data="",this._params=C,this._hitLimit=!1}hook(j){this._params=j.length>1||j.params[0]?j.clone():C,this._data="",this._hitLimit=!1}put(j,E,g){this._hitLimit||(this._data+=(0,y.utf32ToString)(j,E,g),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(j){let E=!1;if(this._hitLimit)E=!1;else if(j&&(E=this._handler(this._data,this._params),E instanceof Promise))return E.then((g=>(this._params=C,this._data="",this._hitLimit=!1,g)));return this._params=C,this._data="",this._hitLimit=!1,E}}},2015:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const y=h(844),p=h(8742),f=h(6242),x=h(6351);class C{constructor(b){this.table=new Uint8Array(b)}setDefault(b,v){this.table.fill(b<<4|v)}add(b,v,S,N){this.table[v<<8|b]=S<<4|N}addMany(b,v,S,N){for(let T=0;T<b.length;T++)this.table[v<<8|b[T]]=S<<4|N}}c.TransitionTable=C;const j=160;c.VT500_TRANSITION_TABLE=(function(){const g=new C(4095),b=Array.apply(null,Array(256)).map(((O,k)=>k)),v=(O,k)=>b.slice(O,k),S=v(32,127),N=v(0,24);N.push(25),N.push.apply(N,v(28,32));const T=v(0,14);let D;for(D in g.setDefault(1,0),g.addMany(S,0,2,0),T)g.addMany([24,26,153,154],D,3,0),g.addMany(v(128,144),D,3,0),g.addMany(v(144,152),D,3,0),g.add(156,D,0,0),g.add(27,D,11,1),g.add(157,D,4,8),g.addMany([152,158,159],D,0,7),g.add(155,D,11,3),g.add(144,D,11,9);return g.addMany(N,0,3,0),g.addMany(N,1,3,1),g.add(127,1,0,1),g.addMany(N,8,0,8),g.addMany(N,3,3,3),g.add(127,3,0,3),g.addMany(N,4,3,4),g.add(127,4,0,4),g.addMany(N,6,3,6),g.addMany(N,5,3,5),g.add(127,5,0,5),g.addMany(N,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(S,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(v(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(S,7,0,7),g.addMany(N,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(v(64,127),3,7,0),g.addMany(v(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(v(48,60),4,8,4),g.addMany(v(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(v(32,64),6,0,6),g.add(127,6,0,6),g.addMany(v(64,127),6,0,0),g.addMany(v(32,48),3,9,5),g.addMany(v(32,48),5,9,5),g.addMany(v(48,64),5,0,6),g.addMany(v(64,127),5,7,0),g.addMany(v(32,48),4,9,5),g.addMany(v(32,48),1,9,2),g.addMany(v(32,48),2,9,2),g.addMany(v(48,127),2,10,0),g.addMany(v(48,80),1,10,0),g.addMany(v(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(v(96,127),1,10,0),g.add(80,1,11,9),g.addMany(N,9,0,9),g.add(127,9,0,9),g.addMany(v(28,32),9,0,9),g.addMany(v(32,48),9,9,12),g.addMany(v(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(N,11,0,11),g.addMany(v(32,128),11,0,11),g.addMany(v(28,32),11,0,11),g.addMany(N,10,0,10),g.add(127,10,0,10),g.addMany(v(28,32),10,0,10),g.addMany(v(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(v(32,48),10,9,12),g.addMany(N,12,0,12),g.add(127,12,0,12),g.addMany(v(28,32),12,0,12),g.addMany(v(32,48),12,9,12),g.addMany(v(48,64),12,0,11),g.addMany(v(64,127),12,12,13),g.addMany(v(64,127),10,12,13),g.addMany(v(64,127),9,12,13),g.addMany(N,13,13,13),g.addMany(S,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(j,0,2,0),g.add(j,8,5,8),g.add(j,6,0,6),g.add(j,11,0,11),g.add(j,13,13,13),g})();class E extends y.Disposable{constructor(b=c.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,S,N)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,S)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,y.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,v=[64,126]){let S=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=b.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let T=0;T<b.intermediates.length;++T){const D=b.intermediates.charCodeAt(T);if(32>D||D>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=D}}if(b.final.length!==1)throw new Error("final must be a single byte");const N=b.final.charCodeAt(0);if(v[0]>N||N>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return S<<=8,S|=N,S}identToString(b){const v=[];for(;b;)v.push(String.fromCharCode(255&b)),b>>=8;return v.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,v){const S=this._identifier(b,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const N=this._escHandlers[S];return N.push(v),{dispose:()=>{const T=N.indexOf(v);T!==-1&&N.splice(T,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,v){this._executeHandlers[b.charCodeAt(0)]=v}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,v){const S=this._identifier(b);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const N=this._csiHandlers[S];return N.push(v),{dispose:()=>{const T=N.indexOf(v);T!==-1&&N.splice(T,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,v){return this._dcsParser.registerHandler(this._identifier(b),v)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,v){return this._oscParser.registerHandler(b,v)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}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(b,v,S,N,T){this._parseStack.state=b,this._parseStack.handlers=v,this._parseStack.handlerPos=S,this._parseStack.transition=N,this._parseStack.chunkPos=T}parse(b,v,S){let N,T=0,D=0,O=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,O=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const k=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&L>-1){for(;L>=0&&(N=k[L](this._params),N!==!0);L--)if(N instanceof Promise)return this._parseStack.handlerPos=L,N}this._parseStack.handlers=[];break;case 4:if(S===!1&&L>-1){for(;L>=0&&(N=k[L](),N!==!0);L--)if(N instanceof Promise)return this._parseStack.handlerPos=L,N}this._parseStack.handlers=[];break;case 6:if(T=b[this._parseStack.chunkPos],N=this._dcsParser.unhook(T!==24&&T!==26,S),N)return N;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=b[this._parseStack.chunkPos],N=this._oscParser.end(T!==24&&T!==26,S),N)return N;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,O=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let k=O;k<v;++k){switch(T=b[k],D=this._transitions.table[this.currentState<<8|(T<160?T:j)],D>>4){case 2:for(let P=k+1;;++P){if(P>=v||(T=b[P])<32||T>126&&T<j){this._printHandler(b,k,P),k=P-1;break}if(++P>=v||(T=b[P])<32||T>126&&T<j){this._printHandler(b,k,P),k=P-1;break}if(++P>=v||(T=b[P])<32||T>126&&T<j){this._printHandler(b,k,P),k=P-1;break}if(++P>=v||(T=b[P])<32||T>126&&T<j){this._printHandler(b,k,P),k=P-1;break}}break;case 3:this._executeHandlers[T]?this._executeHandlers[T]():this._executeHandlerFb(T),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:k,code:T,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|T];let V=L?L.length-1:-1;for(;V>=0&&(N=L[V](this._params),N!==!0);V--)if(N instanceof Promise)return this._preserveStack(3,L,V,D,k),N;V<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++k<v&&(T=b[k])>47&&T<60);k--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const q=this._escHandlers[this._collect<<8|T];let Y=q?q.length-1:-1;for(;Y>=0&&(N=q[Y](),N!==!0);Y--)if(N instanceof Promise)return this._preserveStack(4,q,Y,D,k),N;Y<0&&this._escHandlerFb(this._collect<<8|T),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|T,this._params);break;case 13:for(let P=k+1;;++P)if(P>=v||(T=b[P])===24||T===26||T===27||T>127&&T<j){this._dcsParser.put(b,k,P),k=P-1;break}break;case 14:if(N=this._dcsParser.unhook(T!==24&&T!==26),N)return this._preserveStack(6,[],0,D,k),N;T===27&&(D|=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 P=k+1;;P++)if(P>=v||(T=b[P])<32||T>127&&T<j){this._oscParser.put(b,k,P),k=P-1;break}break;case 6:if(N=this._oscParser.end(T!==24&&T!==26),N)return this._preserveStack(5,[],0,D,k),N;T===27&&(D|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&D}}}c.EscapeSequenceParser=E},6242:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const y=h(5770),p=h(482),f=[];c.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(x,C){this._handlers[x]===void 0&&(this._handlers[x]=[]);const j=this._handlers[x];return j.push(C),{dispose:()=>{const E=j.indexOf(C);E!==-1&&j.splice(E,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,C,j){if(this._active.length)for(let E=this._active.length-1;E>=0;E--)this._active[E].put(x,C,j);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(x,C,j))}start(){this.reset(),this._state=1}put(x,C,j){if(this._state!==3){if(this._state===1)for(;C<j;){const E=x[C++];if(E===59){this._state=2,this._start();break}if(E<48||57<E)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+E-48}this._state===2&&j-C>0&&this._put(x,C,j)}}end(x,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let j=!1,E=this._active.length-1,g=!1;if(this._stack.paused&&(E=this._stack.loopPosition-1,j=C,g=this._stack.fallThrough,this._stack.paused=!1),!g&&j===!1){for(;E>=0&&(j=this._active[E].end(x),j!==!0);E--)if(j instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!1,j;E--}for(;E>=0;E--)if(j=this._active[E].end(!1),j instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=E,this._stack.fallThrough=!0,j}else this._handlerFb(this._id,"END",x);this._active=f,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,C,j){this._hitLimit||(this._data+=(0,p.utf32ToString)(x,C,j),this._data.length>y.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let C=!1;if(this._hitLimit)C=!1;else if(x&&(C=this._handler(this._data),C instanceof Promise))return C.then((j=>(this._data="",this._hitLimit=!1,j)));return this._data="",this._hitLimit=!1,C}}},8742:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const h=2147483647;class y{static fromArray(f){const x=new y;if(!f.length)return x;for(let C=Array.isArray(f[0])?1:0;C<f.length;++C){const j=f[C];if(Array.isArray(j))for(let E=0;E<j.length;++E)x.addSubParam(j[E]);else x.addParam(j)}return x}constructor(f=32,x=32){if(this.maxLength=f,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(x),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new y(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let x=0;x<this.length;++x){f.push(this.params[x]);const C=this._subParamsIdx[x]>>8,j=255&this._subParamsIdx[x];j-C>0&&f.push(Array.prototype.slice.call(this._subParams,C,j))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>h?h:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>h?h:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const x=this._subParamsIdx[f]>>8,C=255&this._subParamsIdx[f];return C-x>0?this._subParams.subarray(x,C):null}getSubParamsAll(){const f={};for(let x=0;x<this.length;++x){const C=this._subParamsIdx[x]>>8,j=255&this._subParamsIdx[x];j-C>0&&(f[x]=this._subParams.slice(C,j))}return f}addDigit(f){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,j=C[x-1];C[x-1]=~j?Math.min(10*j+f,h):f}}c.Params=y},5741:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,y){const p={instance:y,dispose:y.dispose,isDisposed:!1};this._addons.push(p),y.dispose=()=>this._wrappedAddonDispose(p),y.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let y=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===h){y=p;break}if(y===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(y,1)}}},8771:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const y=h(3785),p=h(511);c.BufferApiView=class{constructor(f,x){this._buffer=f,this.type=x}init(f){return this._buffer=f,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(f){const x=this._buffer.lines.get(f);if(x)return new y.BufferLineApiView(x)}getNullCell(){return new p.CellData}}},3785:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const y=h(511);c.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,f){if(!(p<0||p>=this._line.length))return f?(this._line.loadCell(p,f),f):this._line.loadCell(p,new y.CellData)}translateToString(p,f,x){return this._line.translateToString(p,f,x)}}},8285:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const y=h(8771),p=h(8460),f=h(844);class x extends f.Disposable{constructor(j){super(),this._core=j,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new y.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new y.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw 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)}}c.BufferNamespaceApi=x},7975:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,y){return this._core.registerCsiHandler(h,(p=>y(p.toArray())))}addCsiHandler(h,y){return this.registerCsiHandler(h,y)}registerDcsHandler(h,y){return this._core.registerDcsHandler(h,((p,f)=>y(p,f.toArray())))}addDcsHandler(h,y){return this.registerDcsHandler(h,y)}registerEscHandler(h,y){return this._core.registerEscHandler(h,y)}addEscHandler(h,y){return this.registerEscHandler(h,y)}registerOscHandler(h,y){return this._core.registerOscHandler(h,y)}addOscHandler(h,y){return this.registerOscHandler(h,y)}}},7090:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(w,c,h){var y=this&&this.__decorate||function(g,b,v,S){var N,T=arguments.length,D=T<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,b,v,S);else for(var O=g.length-1;O>=0;O--)(N=g[O])&&(D=(T<3?N(D):T>3?N(b,v,D):N(b,v))||D);return T>3&&D&&Object.defineProperty(b,v,D),D},p=this&&this.__param||function(g,b){return function(v,S){b(v,S,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const f=h(8460),x=h(844),C=h(5295),j=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let E=c.BufferService=class extends x.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(g,this))}resize(g,b){this.cols=g,this.rows=b,this.buffers.resize(g,b),this._onResize.fire({cols:g,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,b=!1){const v=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===g.fg&&S.getBg(0)===g.bg||(S=v.getBlankLine(g,b),this._cachedBlankLine=S),S.isWrapped=b;const N=v.ybase+v.scrollTop,T=v.ybase+v.scrollBottom;if(v.scrollTop===0){const D=v.lines.isFull;T===v.lines.length-1?D?v.lines.recycle().copyFrom(S):v.lines.push(S.clone()):v.lines.splice(T+1,0,S.clone()),D?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const D=T-N+1;v.lines.shiftElements(N+1,D-1,-1),v.lines.set(T,S.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(g,b,v){const S=this.buffer;if(g<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else g+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const N=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+g,S.ybase),0),N!==S.ydisp&&(b||this._onScroll.fire(S.ydisp))}};c.BufferService=E=y([p(0,j.IOptionsService)],E)},7994:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,y){this._charsets[h]=y,this.glevel===h&&(this.charset=y)}}},1753:function(w,c,h){var y=this&&this.__decorate||function(S,N,T,D){var O,k=arguments.length,L=k<3?N:D===null?D=Object.getOwnPropertyDescriptor(N,T):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,N,T,D);else for(var V=S.length-1;V>=0;V--)(O=S[V])&&(L=(k<3?O(L):k>3?O(N,T,L):O(N,T))||L);return k>3&&L&&Object.defineProperty(N,T,L),L},p=this&&this.__param||function(S,N){return function(T,D){N(T,D,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const f=h(2585),x=h(8460),C=h(844),j={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function E(S,N){let T=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(T|=64,T|=S.action):(T|=3&S.button,4&S.button&&(T|=64),8&S.button&&(T|=128),S.action===32?T|=32:S.action!==0||N||(T|=3)),T}const g=String.fromCharCode,b={DEFAULT:S=>{const N=[E(S,!1)+32,S.col+32,S.row+32];return N[0]>255||N[1]>255||N[2]>255?"":`\x1B[M${g(N[0])}${g(N[1])}${g(N[2])}`},SGR:S=>{const N=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${E(S,!0)};${S.col};${S.row}${N}`},SGR_PIXELS:S=>{const N=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${E(S,!0)};${S.x};${S.y}${N}`}};let v=c.CoreMouseService=class extends C.Disposable{constructor(S,N){super(),this._bufferService=S,this._coreService=N,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new x.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(j))this.addProtocol(T,j[T]);for(const T of Object.keys(b))this.addEncoding(T,b[T]);this.reset()}addProtocol(S,N){this._protocols[S]=N}addEncoding(S,N){this._encodings[S]=N}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const N=this._encodings[this._activeEncoding](S);return N&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(N):this._coreService.triggerDataEvent(N,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,N,T){if(T){if(S.x!==N.x||S.y!==N.y)return!1}else if(S.col!==N.col||S.row!==N.row)return!1;return S.button===N.button&&S.action===N.action&&S.ctrl===N.ctrl&&S.alt===N.alt&&S.shift===N.shift}};c.CoreMouseService=v=y([p(0,f.IBufferService),p(1,f.ICoreService)],v)},6975:function(w,c,h){var y=this&&this.__decorate||function(v,S,N,T){var D,O=arguments.length,k=O<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(v,S,N,T);else for(var L=v.length-1;L>=0;L--)(D=v[L])&&(k=(O<3?D(k):O>3?D(S,N,k):D(S,N))||k);return O>3&&k&&Object.defineProperty(S,N,k),k},p=this&&this.__param||function(v,S){return function(N,T){S(N,T,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const f=h(1439),x=h(8460),C=h(844),j=h(2585),E=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=c.CoreService=class extends C.Disposable{constructor(v,S,N){super(),this._bufferService=v,this._logService=S,this._optionsService=N,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(E),this.decPrivateModes=(0,f.clone)(g)}reset(){this.modes=(0,f.clone)(E),this.decPrivateModes=(0,f.clone)(g)}triggerDataEvent(v,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const N=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&N.ybase!==N.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(v))}};c.CoreService=b=y([p(0,j.IBufferService),p(1,j.ILogService),p(2,j.IOptionsService)],b)},9074:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const y=h(8055),p=h(8460),f=h(844),x=h(6106);let C=0,j=0;class E extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((v=>v?.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const S=new g(v);if(S){const N=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),N.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,S,N){let T=0,D=0;for(const O of this._decorations.getKeyIterator(S))T=O.options.x??0,D=T+(O.options.width??1),v>=T&&v<D&&(!N||(O.options.layer??"bottom")===N)&&(yield O)}forEachDecorationAtCell(v,S,N,T){this._decorations.forEachByKey(S,(D=>{C=D.options.x??0,j=C+(D.options.width??1),v>=C&&v<j&&(!N||(D.options.layer??"bottom")===N)&&T(D)}))}}c.DecorationService=E;class g extends f.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=y.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=y.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const y=h(2585),p=h(8343);class f{constructor(...C){this._entries=new Map;for(const[j,E]of C)this.set(j,E)}set(C,j){const E=this._entries.get(C);return this._entries.set(C,j),E}forEach(C){for(const[j,E]of this._entries.entries())C(j,E)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}c.ServiceCollection=f,c.InstantiationService=class{constructor(){this._services=new f,this._services.set(y.IInstantiationService,this)}setService(x,C){this._services.set(x,C)}getService(x){return this._services.get(x)}createInstance(x,...C){const j=(0,p.getServiceDependencies)(x).sort(((b,v)=>b.index-v.index)),E=[];for(const b of j){const v=this._services.get(b.id);if(!v)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${b.id}.`);E.push(v)}const g=j.length>0?j[0].index:C.length;if(C.length!==g)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${g+1} conflicts with ${C.length} static arguments`);return new x(...C,...E)}}},7866:function(w,c,h){var y=this&&this.__decorate||function(g,b,v,S){var N,T=arguments.length,D=T<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,b,v,S);else for(var O=g.length-1;O>=0;O--)(N=g[O])&&(D=(T<3?N(D):T>3?N(b,v,D):N(b,v))||D);return T>3&&D&&Object.defineProperty(b,v,D),D},p=this&&this.__param||function(g,b){return function(v,S){b(v,S,g)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const f=h(844),x=h(2585),C={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let j,E=c.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=x.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),j=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let b=0;b<g.length;b++)typeof g[b]=="function"&&(g[b]=g[b]())}_log(g,b,v){this._evalLazyOptionalParams(v),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...v)}trace(g,...b){this._logLevel<=x.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,g,b)}debug(g,...b){this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,g,b)}info(g,...b){this._logLevel<=x.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,g,b)}warn(g,...b){this._logLevel<=x.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,g,b)}error(g,...b){this._logLevel<=x.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,g,b)}};c.LogService=E=y([p(0,x.IOptionsService)],E),c.setTraceLogger=function(g){j=g},c.traceCall=function(g,b,v){if(typeof v.value!="function")throw new Error("not supported");const S=v.value;v.value=function(...N){if(j.logLevel!==x.LogLevelEnum.TRACE)return S.apply(this,N);j.trace(`GlyphRenderer#${S.name}(${N.map((D=>JSON.stringify(D))).join(", ")})`);const T=S.apply(this,N);return j.trace(`GlyphRenderer#${S.name} return`,T),T}}},7302:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const y=h(8460),p=h(844),f=h(6114);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const x=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends p.Disposable{constructor(E){super(),this._onOptionChange=this.register(new y.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...c.DEFAULT_OPTIONS};for(const b in E)if(b in g)try{const v=E[b];g[b]=this._sanitizeAndValidateOption(b,v)}catch(v){console.error(v)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(E,g){return this.onOptionChange((b=>{b===E&&g(this.rawOptions[E])}))}onMultipleOptionChange(E,g){return this.onOptionChange((b=>{E.indexOf(b)!==-1&&g()}))}_setupOptions(){const E=b=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},g=(b,v)=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);v=this._sanitizeAndValidateOption(b,v),this.rawOptions[b]!==v&&(this.rawOptions[b]=v,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const v={get:E.bind(this,b),set:g.bind(this,b)};Object.defineProperty(this.options,b,v)}}_sanitizeAndValidateOption(E,g){switch(E){case"cursorStyle":if(g||(g=c.DEFAULT_OPTIONS[E]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${E}`);break;case"wordSeparator":g||(g=c.DEFAULT_OPTIONS[E]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=x.includes(g)?g:c.DEFAULT_OPTIONS[E];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${E} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${E} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${E} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${E} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}c.OptionsService=C},2660:function(w,c,h){var y=this&&this.__decorate||function(C,j,E,g){var b,v=arguments.length,S=v<3?j:g===null?g=Object.getOwnPropertyDescriptor(j,E):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(C,j,E,g);else for(var N=C.length-1;N>=0;N--)(b=C[N])&&(S=(v<3?b(S):v>3?b(j,E,S):b(j,E))||S);return v>3&&S&&Object.defineProperty(j,E,S),S},p=this&&this.__param||function(C,j){return function(E,g){j(E,g,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const f=h(2585);let x=c.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const j=this._bufferService.buffer;if(C.id===void 0){const N=j.addMarker(j.ybase+j.y),T={data:C,id:this._nextId++,lines:[N]};return N.onDispose((()=>this._removeMarkerFromLink(T,N))),this._dataByLinkId.set(T.id,T),T.id}const E=C,g=this._getEntryIdKey(E),b=this._entriesWithId.get(g);if(b)return this.addLineToLink(b.id,j.ybase+j.y),b.id;const v=j.addMarker(j.ybase+j.y),S={id:this._nextId++,key:this._getEntryIdKey(E),data:E,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(S,v))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(C,j){const E=this._dataByLinkId.get(C);if(E&&E.lines.every((g=>g.line!==j))){const g=this._bufferService.buffer.addMarker(j);E.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(E,g)))}}getLinkData(C){return this._dataByLinkId.get(C)?.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,j){const E=C.lines.indexOf(j);E!==-1&&(C.lines.splice(E,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};c.OscLinkService=x=y([p(0,f.IBufferService)],x)},8343:(w,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const h="di$target",y="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(p){return p[y]||[]},c.createDecorator=function(p){if(c.serviceRegistry.has(p))return c.serviceRegistry.get(p);const f=function(x,C,j){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(E,g,b){g[h]===g?g[y].push({id:E,index:b}):(g[y]=[{id:E,index:b}],g[h]=g)})(f,x,j)};return f.toString=()=>p,c.serviceRegistry.set(p,f),f}},2585:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const y=h(8343);var p;c.IBufferService=(0,y.createDecorator)("BufferService"),c.ICoreMouseService=(0,y.createDecorator)("CoreMouseService"),c.ICoreService=(0,y.createDecorator)("CoreService"),c.ICharsetService=(0,y.createDecorator)("CharsetService"),c.IInstantiationService=(0,y.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(p||(c.LogLevelEnum=p={})),c.ILogService=(0,y.createDecorator)("LogService"),c.IOptionsService=(0,y.createDecorator)("OptionsService"),c.IOscLinkService=(0,y.createDecorator)("OscLinkService"),c.IUnicodeService=(0,y.createDecorator)("UnicodeService"),c.IDecorationService=(0,y.createDecorator)("DecorationService")},1480:(w,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const y=h(8460),p=h(225);class f{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,j,E=!1){return(16777215&C)<<3|(3&j)<<1|(E?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new y.EventEmitter,this.onChange=this._onChange.event;const C=new p.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let j=0,E=0;const g=C.length;for(let b=0;b<g;++b){let v=C.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=g)return j+this.wcwidth(v);const T=C.charCodeAt(b);56320<=T&&T<=57343?v=1024*(v-55296)+T-56320+65536:j+=this.wcwidth(T)}const S=this.charProperties(v,E);let N=f.extractWidth(S);f.extractShouldJoin(S)&&(N-=f.extractWidth(E)),j+=N,E=S}return j}charProperties(C,j){return this._activeProvider.charProperties(C,j)}}c.UnicodeService=f}},o={};function d(w){var c=o[w];if(c!==void 0)return c.exports;var h=o[w]={exports:{}};return l[w].call(h.exports,h,h.exports,d),h.exports}var _={};return(()=>{var w=_;Object.defineProperty(w,"__esModule",{value:!0}),w.Terminal=void 0;const c=d(9042),h=d(3236),y=d(844),p=d(5741),f=d(8285),x=d(7975),C=d(7090),j=["cols","rows"];class E extends y.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const v=N=>this._core.options[N],S=(N,T)=>{this._checkReadonlyOptions(N),this._core.options[N]=T};for(const N in this._core.options){const T={get:v.bind(this,N),set:S.bind(this,N)};Object.defineProperty(this._publicOptions,N,T)}}_checkReadonlyOptions(b){if(j.includes(b))throw new Error(`Option "${b}" 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 x.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const v in b)this._publicOptions[v]=b[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,v=!0){this._core.input(b,v)}resize(b,v){this._verifyIntegers(b,v),this._core.resize(b,v)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,v,S){this._verifyIntegers(b,v,S),this._core.select(b,v,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,v){this._verifyIntegers(b,v),this._core.selectLines(b,v)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,v){this._core.write(b,v)}writeln(b,v){this._core.write(b),this._core.write(`\r
30
- `,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}w.Terminal=E})(),_})()))})(af)),af.exports}var yT=_T(),lf={exports:{}},yb;function bT(){return yb||(yb=1,(function(s,n){(function(l,o){s.exports=o()})(self,(()=>(()=>{var l={};return(()=>{var o=l;Object.defineProperty(o,"__esModule",{value:!0}),o.FitAddon=void 0,o.FitAddon=class{activate(d){this._terminal=d}dispose(){}fit(){const d=this.proposeDimensions();if(!d||!this._terminal||isNaN(d.cols)||isNaN(d.rows))return;const _=this._terminal._core;this._terminal.rows===d.rows&&this._terminal.cols===d.cols||(_._renderService.clear(),this._terminal.resize(d.cols,d.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const d=this._terminal._core,_=d._renderService.dimensions;if(_.css.cell.width===0||_.css.cell.height===0)return;const w=this._terminal.options.scrollback===0?0:d.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),y=Math.max(0,parseInt(c.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),f=h-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),x=y-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-w;return{cols:Math.max(2,Math.floor(x/_.css.cell.width)),rows:Math.max(1,Math.floor(f/_.css.cell.height))}}}})(),l})()))})(lf)),lf.exports}var ST=bT(),of={exports:{}},bb;function xT(){return bb||(bb=1,(function(s,n){(function(l,o){s.exports=o()})(self,(()=>(()=>{var l={6:(w,c)=>{function h(p){try{const f=new URL(p),x=f.password&&f.username?`${f.protocol}//${f.username}:${f.password}@${f.host}`:f.username?`${f.protocol}//${f.username}@${f.host}`:`${f.protocol}//${f.host}`;return p.toLocaleLowerCase().startsWith(x.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(p,f,x,C={}){this._terminal=p,this._regex=f,this._handler=x,this._options=C}provideLinks(p,f){const x=y.computeLink(p,this._regex,this._terminal,this._handler);f(this._addCallbacks(x))}_addCallbacks(p){return p.map((f=>(f.leave=this._options.leave,f.hover=(x,C)=>{if(this._options.hover){const{range:j}=f;this._options.hover(x,C,j)}},f)))}};class y{static computeLink(f,x,C,j){const E=new RegExp(x.source,(x.flags||"")+"g"),[g,b]=y._getWindowedLineStrings(f-1,C),v=g.join("");let S;const N=[];for(;S=E.exec(v);){const T=S[0];if(!h(T))continue;const[D,O]=y._mapStrIdx(C,b,0,S.index),[k,L]=y._mapStrIdx(C,D,O,T.length);if(D===-1||O===-1||k===-1||L===-1)continue;const V={start:{x:O+1,y:D+1},end:{x:L,y:k+1}};N.push({range:V,text:T,activate:j})}return N}static _getWindowedLineStrings(f,x){let C,j=f,E=f,g=0,b="";const v=[];if(C=x.buffer.active.getLine(f)){const S=C.translateToString(!0);if(C.isWrapped&&S[0]!==" "){for(g=0;(C=x.buffer.active.getLine(--j))&&g<2048&&(b=C.translateToString(!0),g+=b.length,v.push(b),C.isWrapped&&b.indexOf(" ")===-1););v.reverse()}for(v.push(S),g=0;(C=x.buffer.active.getLine(++E))&&C.isWrapped&&g<2048&&(b=C.translateToString(!0),g+=b.length,v.push(b),b.indexOf(" ")===-1););}return[v,j]}static _mapStrIdx(f,x,C,j){const E=f.buffer.active,g=E.getNullCell();let b=C;for(;j;){const v=E.getLine(x);if(!v)return[-1,-1];for(let S=b;S<v.length;++S){v.getCell(S,g);const N=g.getChars();if(g.getWidth()&&(j-=N.length||1,S===v.length-1&&N==="")){const T=E.getLine(x+1);T&&T.isWrapped&&(T.getCell(0,g),g.getWidth()===2&&(j+=1))}if(j<0)return[x,S]}x++,b=0}return[x,b]}}c.LinkComputer=y}},o={};function d(w){var c=o[w];if(c!==void 0)return c.exports;var h=o[w]={exports:{}};return l[w](h,h.exports,d),h.exports}var _={};return(()=>{var w=_;Object.defineProperty(w,"__esModule",{value:!0}),w.WebLinksAddon=void 0;const c=d(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(p,f){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}w.WebLinksAddon=class{constructor(p=y,f={}){this._handler=p,this._options=f}activate(p){this._terminal=p;const f=this._options,x=f.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,x,this._handler,f))}dispose(){this._linkProvider?.dispose()}}})(),_})()))})(of)),of.exports}var wT=xT();function CT(s){try{const n=new URL(s);return n.protocol==="http:"||n.protocol==="https:"?n.toString():null}catch{return null}}function Sb(s){const n=CT(s);n&&window.open(n,"_blank","noopener,noreferrer")}const ET=()=>new TextDecoder("utf-8");function Xr(s){return getComputedStyle(document.documentElement).getPropertyValue(s).trim()}function xb(){const s=n=>Xr(`--term-${n}`)||void 0;return{background:Xr("--bg-card"),foreground:Xr("--t-base"),cursor:Xr("--primary"),cursorAccent:Xr("--bg-card"),selectionBackground:Xr("--primary-ring"),black:s("black"),red:s("red"),green:s("green"),yellow:s("yellow"),blue:s("blue"),magenta:s("magenta"),cyan:s("cyan"),white:s("white"),brightBlack:s("bright-black"),brightRed:s("bright-red"),brightGreen:s("bright-green"),brightYellow:s("bright-yellow"),brightBlue:s("bright-blue"),brightMagenta:s("bright-magenta"),brightCyan:s("bright-cyan"),brightWhite:s("bright-white")}}function NT(s){const n=atob(s),l=new Uint8Array(n.length);for(let o=0;o<n.length;o++)l[o]=n.charCodeAt(o);return l}class jT{tabs=[];activeKey=null;version=0;listeners=new Set;wired=new WeakMap;decoders=new Map;themeObserver;subscribe=n=>(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.version;get list(){return this.tabs}get active(){return this.tabs.find(n=>n.key===this.activeKey)??this.tabs[0]??null}changed(){this.version++,this.listeners.forEach(n=>n())}activate(n){this.activeKey=n,this.changed()}watchTheme(){this.themeObserver||(this.themeObserver=new MutationObserver(()=>{const n=xb();for(const l of this.tabs)l.term&&(l.term.options.theme=n)}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}))}wire(n){if(this.wired.has(n))return;const l=n.on(b2,d=>{const _=y2.safeParse(d);if(!_.success)return;const w=this.tabs.find(y=>y.shellId===_.data.shellId);if(!w)return;const c=NT(_.data.data);if(w.term){w.term.write(c,()=>this.ack(w,c.length));return}this.ack(w,c.length);let h=this.decoders.get(w.key);h||this.decoders.set(w.key,h=ET()),this.dumbReceive(w,h.decode(c,{stream:!0}))}),o=n.on(x2,d=>{const _=S2.safeParse(d);if(!_.success)return;const w=this.tabs.find(c=>c.shellId===_.data.shellId);w&&(w.state=_.data.error?"disconnected":"exited",w.note=_.data.error??(typeof _.data.code=="number"?`The shell exited with code ${_.data.code}.`:"The shell ended."),w.term?.write(`\r
30
+ `,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}w.Terminal=E})(),_})()))})(af)),af.exports}var bT=yT(),lf={exports:{}},Sb;function ST(){return Sb||(Sb=1,(function(s,n){(function(l,o){s.exports=o()})(self,(()=>(()=>{var l={};return(()=>{var o=l;Object.defineProperty(o,"__esModule",{value:!0}),o.FitAddon=void 0,o.FitAddon=class{activate(d){this._terminal=d}dispose(){}fit(){const d=this.proposeDimensions();if(!d||!this._terminal||isNaN(d.cols)||isNaN(d.rows))return;const _=this._terminal._core;this._terminal.rows===d.rows&&this._terminal.cols===d.cols||(_._renderService.clear(),this._terminal.resize(d.cols,d.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const d=this._terminal._core,_=d._renderService.dimensions;if(_.css.cell.width===0||_.css.cell.height===0)return;const w=this._terminal.options.scrollback===0?0:d.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),y=Math.max(0,parseInt(c.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),f=h-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),x=y-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-w;return{cols:Math.max(2,Math.floor(x/_.css.cell.width)),rows:Math.max(1,Math.floor(f/_.css.cell.height))}}}})(),l})()))})(lf)),lf.exports}var xT=ST(),of={exports:{}},xb;function wT(){return xb||(xb=1,(function(s,n){(function(l,o){s.exports=o()})(self,(()=>(()=>{var l={6:(w,c)=>{function h(p){try{const f=new URL(p),x=f.password&&f.username?`${f.protocol}//${f.username}:${f.password}@${f.host}`:f.username?`${f.protocol}//${f.username}@${f.host}`:`${f.protocol}//${f.host}`;return p.toLocaleLowerCase().startsWith(x.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(c,"__esModule",{value:!0}),c.LinkComputer=c.WebLinkProvider=void 0,c.WebLinkProvider=class{constructor(p,f,x,C={}){this._terminal=p,this._regex=f,this._handler=x,this._options=C}provideLinks(p,f){const x=y.computeLink(p,this._regex,this._terminal,this._handler);f(this._addCallbacks(x))}_addCallbacks(p){return p.map((f=>(f.leave=this._options.leave,f.hover=(x,C)=>{if(this._options.hover){const{range:j}=f;this._options.hover(x,C,j)}},f)))}};class y{static computeLink(f,x,C,j){const E=new RegExp(x.source,(x.flags||"")+"g"),[g,b]=y._getWindowedLineStrings(f-1,C),v=g.join("");let S;const N=[];for(;S=E.exec(v);){const T=S[0];if(!h(T))continue;const[D,O]=y._mapStrIdx(C,b,0,S.index),[k,L]=y._mapStrIdx(C,D,O,T.length);if(D===-1||O===-1||k===-1||L===-1)continue;const V={start:{x:O+1,y:D+1},end:{x:L,y:k+1}};N.push({range:V,text:T,activate:j})}return N}static _getWindowedLineStrings(f,x){let C,j=f,E=f,g=0,b="";const v=[];if(C=x.buffer.active.getLine(f)){const S=C.translateToString(!0);if(C.isWrapped&&S[0]!==" "){for(g=0;(C=x.buffer.active.getLine(--j))&&g<2048&&(b=C.translateToString(!0),g+=b.length,v.push(b),C.isWrapped&&b.indexOf(" ")===-1););v.reverse()}for(v.push(S),g=0;(C=x.buffer.active.getLine(++E))&&C.isWrapped&&g<2048&&(b=C.translateToString(!0),g+=b.length,v.push(b),b.indexOf(" ")===-1););}return[v,j]}static _mapStrIdx(f,x,C,j){const E=f.buffer.active,g=E.getNullCell();let b=C;for(;j;){const v=E.getLine(x);if(!v)return[-1,-1];for(let S=b;S<v.length;++S){v.getCell(S,g);const N=g.getChars();if(g.getWidth()&&(j-=N.length||1,S===v.length-1&&N==="")){const T=E.getLine(x+1);T&&T.isWrapped&&(T.getCell(0,g),g.getWidth()===2&&(j+=1))}if(j<0)return[x,S]}x++,b=0}return[x,b]}}c.LinkComputer=y}},o={};function d(w){var c=o[w];if(c!==void 0)return c.exports;var h=o[w]={exports:{}};return l[w](h,h.exports,d),h.exports}var _={};return(()=>{var w=_;Object.defineProperty(w,"__esModule",{value:!0}),w.WebLinksAddon=void 0;const c=d(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(p,f){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=f}else console.warn("Opening link blocked as opener could not be cleared")}w.WebLinksAddon=class{constructor(p=y,f={}){this._handler=p,this._options=f}activate(p){this._terminal=p;const f=this._options,x=f.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new c.WebLinkProvider(this._terminal,x,this._handler,f))}dispose(){this._linkProvider?.dispose()}}})(),_})()))})(of)),of.exports}var CT=wT();function ET(s){try{const n=new URL(s);return n.protocol==="http:"||n.protocol==="https:"?n.toString():null}catch{return null}}function wb(s){const n=ET(s);n&&window.open(n,"_blank","noopener,noreferrer")}const NT=()=>new TextDecoder("utf-8");function Xr(s){return getComputedStyle(document.documentElement).getPropertyValue(s).trim()}function Cb(){const s=n=>Xr(`--term-${n}`)||void 0;return{background:Xr("--bg-card"),foreground:Xr("--t-base"),cursor:Xr("--primary"),cursorAccent:Xr("--bg-card"),selectionBackground:Xr("--primary-ring"),black:s("black"),red:s("red"),green:s("green"),yellow:s("yellow"),blue:s("blue"),magenta:s("magenta"),cyan:s("cyan"),white:s("white"),brightBlack:s("bright-black"),brightRed:s("bright-red"),brightGreen:s("bright-green"),brightYellow:s("bright-yellow"),brightBlue:s("bright-blue"),brightMagenta:s("bright-magenta"),brightCyan:s("bright-cyan"),brightWhite:s("bright-white")}}function jT(s){const n=atob(s),l=new Uint8Array(n.length);for(let o=0;o<n.length;o++)l[o]=n.charCodeAt(o);return l}class TT{tabs=[];activeKey=null;version=0;listeners=new Set;wired=new WeakMap;decoders=new Map;themeObserver;subscribe=n=>(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.version;get list(){return this.tabs}get active(){return this.tabs.find(n=>n.key===this.activeKey)??this.tabs[0]??null}changed(){this.version++,this.listeners.forEach(n=>n())}activate(n){this.activeKey=n,this.changed()}watchTheme(){this.themeObserver||(this.themeObserver=new MutationObserver(()=>{const n=Cb();for(const l of this.tabs)l.term&&(l.term.options.theme=n)}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}))}wire(n){if(this.wired.has(n))return;const l=n.on(S2,d=>{const _=b2.safeParse(d);if(!_.success)return;const w=this.tabs.find(y=>y.shellId===_.data.shellId);if(!w)return;const c=jT(_.data.data);if(w.term){w.term.write(c,()=>this.ack(w,c.length));return}this.ack(w,c.length);let h=this.decoders.get(w.key);h||this.decoders.set(w.key,h=NT()),this.dumbReceive(w,h.decode(c,{stream:!0}))}),o=n.on(w2,d=>{const _=x2.safeParse(d);if(!_.success)return;const w=this.tabs.find(c=>c.shellId===_.data.shellId);w&&(w.state=_.data.error?"disconnected":"exited",w.note=_.data.error??(typeof _.data.code=="number"?`The shell exited with code ${_.data.code}.`:"The shell ended."),w.term?.write(`\r
31
31
  \x1B[2m[${w.note}]\x1B[0m\r
32
- `),this.changed())});this.wired.set(n,()=>{l(),o()})}acks=new Map;ack(n,l){let o=this.acks.get(n.key);o||this.acks.set(n.key,o={bytes:0}),o.bytes+=l;const d=()=>{if(clearTimeout(o.timer),o.timer=void 0,!o.bytes||!n.shellId)return;const _=o.bytes;o.bytes=0,n.client.call("shell.ack",{shellId:n.shellId,bytes:_}).catch(()=>{})};o.bytes>=128*1024?d():o.timer??=setTimeout(d,50)}dumbReceive(n,l){const o=n.dumb[n.dumb.length-1];if(!o||o.status!==void 0)return;const d=o.output+l,_=new RegExp(`command-${o.id}:(\\d+)\\r?\\n`).exec(d);_?(o.status=Number(_[1]),o.output=d.slice(0,_.index)):o.output=d.slice(-256*1024),n.dumb=[...n.dumb],this.changed()}async open(n,l){this.watchTheme(),this.wire(n);const o=document.createElement("div");o.className="term-host";const d={key:crypto.randomUUID(),deviceId:l.deviceId,deviceName:l.deviceName,device:l.device,title:l.deviceName,state:"connecting",pty:l.pty!==!1,client:n,host:o,dumb:[]};return this.tabs=[...this.tabs,d],this.activeKey=d.key,this.changed(),await this.start(d,l.rows,l.cols),d}async start(n,l,o){n.state="connecting",n.note=void 0,this.changed();try{const d=await n.client.call("shell.open",{device:n.device,rows:l,cols:o,pty:n.pty},4e4);if(!this.tabs.includes(n)){n.client.call("shell.close",{shellId:d.shellId}).catch(()=>{});return}n.shellId=d.shellId,n.pty=d.pty,n.title=d.title,n.state="open",d.pty?this.attachTerm(n,l,o):n.dumb=[]}catch(d){n.state="failed",n.note=xt(d).message}this.changed()}attachTerm(n,l,o){if(n.term){n.term.resize(o,l);return}const d=new yT.Terminal({rows:l,cols:o,scrollback:5e3,fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!1,theme:xb(),linkHandler:{activate:(c,h)=>Sb(h),allowNonHttpProtocols:!1}}),_=new ST.FitAddon;d.loadAddon(_),d.loadAddon(new wT.WebLinksAddon((c,h)=>Sb(h))),d.open(n.host),d.attachCustomKeyEventHandler(c=>{if(c.type==="keydown"&&c.ctrlKey&&c.shiftKey&&c.key.toLowerCase()==="c"){const h=d.getSelection();return h&&navigator.clipboard.writeText(h).catch(()=>{}),!1}return!0}),d.onData(c=>this.write(n,c));let w;d.onResize(({rows:c,cols:h})=>{clearTimeout(w),w=setTimeout(()=>{n.shellId&&n.state==="open"&&n.client.call("shell.resize",{shellId:n.shellId,rows:c,cols:h}).catch(()=>{})},120)}),d.onTitleChange(c=>{c&&(n.title=c,this.changed())}),n.term=d,n.fit=_}write(n,l){n.state!=="open"||!n.shellId||n.client.call("shell.write",{shellId:n.shellId,data:l}).catch(()=>{})}sendDumb(n,l){const o=l.trim();if(!o||n.state!=="open")return;const d=crypto.randomUUID().slice(0,8);n.dumb=[...n.dumb.slice(-199),{id:d,input:o,output:""}],this.changed(),this.write(n,`${o}
32
+ `),this.changed())});this.wired.set(n,()=>{l(),o()})}acks=new Map;ack(n,l){let o=this.acks.get(n.key);o||this.acks.set(n.key,o={bytes:0}),o.bytes+=l;const d=()=>{if(clearTimeout(o.timer),o.timer=void 0,!o.bytes||!n.shellId)return;const _=o.bytes;o.bytes=0,n.client.call("shell.ack",{shellId:n.shellId,bytes:_}).catch(()=>{})};o.bytes>=128*1024?d():o.timer??=setTimeout(d,50)}dumbReceive(n,l){const o=n.dumb[n.dumb.length-1];if(!o||o.status!==void 0)return;const d=o.output+l,_=new RegExp(`command-${o.id}:(\\d+)\\r?\\n`).exec(d);_?(o.status=Number(_[1]),o.output=d.slice(0,_.index)):o.output=d.slice(-256*1024),n.dumb=[...n.dumb],this.changed()}async open(n,l){this.watchTheme(),this.wire(n);const o=document.createElement("div");o.className="term-host";const d={key:crypto.randomUUID(),deviceId:l.deviceId,deviceName:l.deviceName,device:l.device,title:l.deviceName,state:"connecting",pty:l.pty!==!1,client:n,host:o,dumb:[]};return this.tabs=[...this.tabs,d],this.activeKey=d.key,this.changed(),await this.start(d,l.rows,l.cols),d}async start(n,l,o){n.state="connecting",n.note=void 0,this.changed();try{const d=await n.client.call("shell.open",{device:n.device,rows:l,cols:o,pty:n.pty},4e4);if(!this.tabs.includes(n)){n.client.call("shell.close",{shellId:d.shellId}).catch(()=>{});return}n.shellId=d.shellId,n.pty=d.pty,n.title=d.title,n.state="open",d.pty?this.attachTerm(n,l,o):n.dumb=[]}catch(d){n.state="failed",n.note=xt(d).message}this.changed()}attachTerm(n,l,o){if(n.term){n.term.resize(o,l);return}const d=new bT.Terminal({rows:l,cols:o,scrollback:5e3,fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontSize:13,cursorBlink:!0,allowProposedApi:!1,theme:Cb(),linkHandler:{activate:(c,h)=>wb(h),allowNonHttpProtocols:!1}}),_=new xT.FitAddon;d.loadAddon(_),d.loadAddon(new CT.WebLinksAddon((c,h)=>wb(h))),d.open(n.host),d.attachCustomKeyEventHandler(c=>{if(c.type==="keydown"&&c.ctrlKey&&c.shiftKey&&c.key.toLowerCase()==="c"){const h=d.getSelection();return h&&navigator.clipboard.writeText(h).catch(()=>{}),!1}return!0}),d.onData(c=>this.write(n,c));let w;d.onResize(({rows:c,cols:h})=>{clearTimeout(w),w=setTimeout(()=>{n.shellId&&n.state==="open"&&n.client.call("shell.resize",{shellId:n.shellId,rows:c,cols:h}).catch(()=>{})},120)}),d.onTitleChange(c=>{c&&(n.title=c,this.changed())}),n.term=d,n.fit=_}write(n,l){n.state!=="open"||!n.shellId||n.client.call("shell.write",{shellId:n.shellId,data:l}).catch(()=>{})}sendDumb(n,l){const o=l.trim();if(!o||n.state!=="open")return;const d=crypto.randomUUID().slice(0,8);n.dumb=[...n.dumb.slice(-199),{id:d,input:o,output:""}],this.changed(),this.write(n,`${o}
33
33
  echo command-${d}:$?
34
34
  `)}async restart(n,l){n.client=l,this.wire(l),n.shellId=void 0;const o=n.term?.rows??24,d=n.term?.cols??80;n.term?.write(`\r
35
35
  \x1B[2m[Reconnecting…]\x1B[0m\r
36
36
  `),await this.start(n,o,d)}markDisconnected(n){let l=!1;for(const o of this.tabs)o.client!==n&&(o.state==="open"||o.state==="connecting")&&(o.state="disconnected",o.note="The connection to the bridge was lost.",o.term?.write(`\r
37
37
  \x1B[2m[${o.note}]\x1B[0m\r
38
- `),l=!0);l&&this.changed()}close(n){const l=this.tabs.findIndex(d=>d.key===n);if(l<0)return;const o=this.tabs[l];o.shellId&&(o.state==="open"||o.state==="connecting")&&o.client.call("shell.close",{shellId:o.shellId}).catch(()=>{}),o.term?.dispose(),o.host.remove(),this.decoders.delete(o.key),clearTimeout(this.acks.get(o.key)?.timer),this.acks.delete(o.key),this.tabs=this.tabs.filter(d=>d!==o),this.activeKey===n&&(this.activeKey=this.tabs[Math.max(0,l-1)]?.key??null),this.changed()}}const ei=new jT,wb={w:7.8,h:17};function TT(){M.useSyncExternalStore(ei.subscribe,ei.getSnapshot);const{devices:s,active:n}=Mt(),{client:l,ready:o}=ut(),{toast:d}=jt(),[_,w]=M.useState(null),c={current:_},h=ei.list,y=ei.active;M.useEffect(()=>ei.markDisconnected(o?l:null),[l,o]),M.useLayoutEffect(()=>{const C=c.current;if(!C)return;const j=y?.term?y.host:null;if(j&&j.parentElement!==C&&C.replaceChildren(j),j||C.replaceChildren(),y?.term&&y.fit){try{y.fit.fit()}catch{}y.term.focus()}},[_,y?.key,y?.term]),M.useEffect(()=>{const C=c.current;if(!C)return;const j=new ResizeObserver(()=>{const E=ei.active;if(E?.fit&&E.host.parentElement===C)try{E.fit.fit()}catch{}});return j.observe(C),()=>j.disconnect()},[_]);const p=()=>{if(y?.term)return{rows:y.term.rows,cols:y.term.cols};const C=c.current?.getBoundingClientRect();return{rows:Math.max(10,Math.floor(((C?.height??400)-16)/wb.h)),cols:Math.max(40,Math.floor(((C?.width??800)-16)/wb.w))}},f=async(C,j=!0)=>{if(!l)return;const E=await ei.open(l,{deviceId:C.id,deviceName:C.name,device:gt(C),...p(),pty:j});E.state==="failed"&&d({kind:"danger",title:`Couldn’t open a terminal on ${C.name}`,text:E.note})},x=(s??[]).filter(C=>C.id!==n?.id);return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Device",title:"Terminal",sub:r.jsxs(r.Fragment,{children:["A shell on your TV. Tabs stay open while you use other pages; closing or reloading this browser tab ends them. Copy with"," ",r.jsx("kbd",{children:"Ctrl"}),"+",r.jsx("kbd",{children:"Shift"}),"+",r.jsx("kbd",{children:"C"}),"."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:n,children:r.jsxs("section",{className:"card col-12 term-card",children:[r.jsxs("div",{className:"term-bar",children:[r.jsx("div",{className:"term-tabs",role:"tablist","aria-label":"Terminals",children:h.map(C=>r.jsxs("div",{className:`term-tab${C.key===y?.key?" is-active":""}`,children:[r.jsxs("button",{type:"button",role:"tab","aria-selected":C.key===y?.key,className:"term-tab-btn",onClick:()=>ei.activate(C.key),title:`${C.deviceName} — ${C.title}`,children:[r.jsx("span",{className:`term-dot is-${C.state}`,"aria-hidden":"true"}),r.jsx("span",{className:"term-tab-title",children:C.deviceName}),!C.pty&&C.state!=="connecting"&&r.jsx("span",{className:"term-tab-tag",children:"simple"})]}),r.jsx("button",{type:"button",className:"term-tab-close",onClick:()=>ei.close(C.key),"aria-label":`Close ${C.deviceName} terminal`,children:r.jsx(ce,{name:"x",strokeWidth:2})})]},C.key))}),r.jsxs("div",{className:"term-new",children:[r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-primary",onClick:()=>n&&f(n),disabled:!n||!o,title:n?`New terminal on ${n.name}`:void 0,children:[r.jsx(ce,{name:"plus"})," ",r.jsx("span",{className:"hide-sm",children:"New terminal"})]}),r.jsx(Ic,{label:"More terminal options",menuClassName:"dd-menu--compact",floating:!0,trigger:({toggle:C,...j})=>r.jsx("button",{type:"button",className:"btn btn--icon btn--sm btn--ghost",onClick:C,"aria-label":"More terminal options",disabled:!o,...j,children:r.jsx(ce,{name:"chevDown"})}),children:C=>r.jsxs(r.Fragment,{children:[x.length>0&&r.jsx("div",{className:"dd-section-label",children:"Open on another TV"}),x.map(j=>r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>(C(),f(j)),children:[r.jsx(ce,{name:"tv"}),r.jsxs("span",{className:"dd-menu-text",children:[r.jsx("span",{children:j.name}),r.jsx("span",{className:"dd-menu-sub mono",children:[xl(j.info?.modelName),j.host].filter(Boolean).join(" · ")})]})]},j.id)),x.length>0&&r.jsx("div",{className:"dd-divider"}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",disabled:!n,onClick:()=>(C(),n&&f(n,!1)),children:[r.jsx(ce,{name:"terminal"}),r.jsxs("span",{className:"dd-menu-text",children:[r.jsx("span",{children:"Simple shell (no PTY)"}),r.jsx("span",{className:"dd-menu-sub",children:"Command and output only"})]})]})]})})]})]}),r.jsx("div",{className:"term-body",children:y?r.jsxs(r.Fragment,{children:[y.state!=="open"&&y.state!=="connecting"&&r.jsx(kT,{tab:y}),y.state==="connecting"&&!y.term&&r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsxs("p",{children:["Connecting to ",y.deviceName,"…"]})]}),!y.pty&&y.state!=="connecting"&&y.state!=="failed"&&r.jsx(RT,{tab:y}),r.jsx("div",{ref:w,className:`term-stage${y.term?"":" is-empty"}`})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"terminal"})}),r.jsx("h3",{children:"No terminal open"}),r.jsxs("p",{children:["Open a shell on ",n?r.jsx(ii,{device:n}):"a TV"," to run commands on it."]}),n&&r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>f(n),disabled:!o,children:[r.jsx(ce,{name:"terminal"})," Open a terminal on ",n.name]})]})})]})})})]})}function kT({tab:s}){const{client:n,ready:l}=ut(),o=s.state==="exited"?"info":s.state==="failed"?"danger":"warning",d=s.state==="exited"?"The shell has ended":s.state==="failed"?`Couldn’t open a shell on ${s.deviceName}`:"Disconnected";return r.jsx("div",{className:"term-banner",children:r.jsxs($e,{kind:o,title:d,action:r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",disabled:!l||!n,onClick:()=>n&&ei.restart(s,n),children:[r.jsx(ce,{name:"refresh"})," ",s.state==="failed"?"Try again":"Reconnect"]}),children:[s.note,s.state==="failed"&&r.jsx("div",{className:"alert-hint",children:"Make sure the TV is on. Right after it starts, SSH can take a minute or two to come up."})]})})}function RT({tab:s}){const[n,l]=M.useState(""),[o,d]=M.useState([]),[_,w]=M.useState(-1),c=M.useRef(null),h=M.useRef(null),y=s.dumb.length>0&&s.dumb[s.dumb.length-1].status===void 0;M.useEffect(()=>{c.current?.scrollTo({top:c.current.scrollHeight})},[s.dumb]),M.useEffect(()=>h.current?.focus(),[s.key]);const p=f=>{f.preventDefault(),n.trim()&&(ei.sendDumb(s,n),d(x=>[...x.filter(C=>C!==n.trim()),n.trim()].slice(-50)),w(-1),l(""))};return r.jsxs("div",{className:"term-dumb",children:[r.jsxs($e,{kind:"info",title:"Simple shell",children:["This shell has no terminal (PTY), so full-screen programs like ",r.jsx("span",{className:"mono",children:"top"})," or ",r.jsx("span",{className:"mono",children:"vi"})," won’t work."]}),r.jsxs("div",{className:"term-dumb-log",ref:c,"aria-live":"polite",children:[s.dumb.length===0&&r.jsx("div",{className:"muted",children:"Type a command below."}),s.dumb.map(f=>r.jsxs("div",{className:"term-dumb-entry",children:[r.jsxs("div",{className:"term-dumb-cmd",children:[r.jsx("span",{className:"cons-ps1",children:"$"})," ",f.input,r.jsx("span",{className:`term-dumb-status${f.status===void 0?"":f.status===0?" is-ok":" is-err"}`,children:f.status===void 0?r.jsx("span",{className:"spinner sm"}):`exit ${f.status}`})]}),f.output&&r.jsx("pre",{className:"term-dumb-out",children:f.output.replace(/\n$/,"")})]},f.id))]}),r.jsxs("form",{className:"term-dumb-form",onSubmit:p,children:[r.jsx("span",{className:"cons-ps1","aria-hidden":"true",children:"$"}),r.jsx("input",{ref:h,className:"input mono","aria-label":"Command",value:n,disabled:s.state!=="open",placeholder:y?"Waiting for the last command…":"Command",onChange:f=>l(f.target.value),onKeyDown:f=>{if(f.key==="ArrowUp"&&o.length){f.preventDefault();const x=_<0?o.length-1:Math.max(0,_-1);w(x),l(o[x])}else if(f.key==="ArrowDown"&&_>=0){f.preventDefault();const x=_+1;x>=o.length?(w(-1),l("")):(w(x),l(o[x]))}},spellCheck:!1,autoComplete:"off"}),r.jsx("button",{type:"submit",className:"btn btn--primary btn--sm",disabled:s.state!=="open"||!n.trim(),children:"Run"})]})]})}const Dc=["emerg","alert","crit","err","warning","notice","info","debug"];function Cb(s){const n=Dc.indexOf(xm(s));return n<0?Dc.indexOf("info"):n}function xm(s){const n=s.toLowerCase();return n==="warn"?"warning":n==="error"?"err":n==="panic"?"emerg":Dc.includes(n)?n:"info"}function DT(s,n){let l=0,o=!1;for(let d=n;d<s.length;d++){const _=s[d];if(o)_==="\\"?d++:_==='"'&&(o=!1);else if(_==='"')o=!0;else if(_==="{"||_==="[")l++;else if((_==="}"||_==="]")&&(l--,l===0))return d}return-1}const AT=/^(?<datetime>[\w:.\-+]+) \[(?<monotonic>\d+\.\d+)\] (?<facility>\S+)\.(?<level>\S+) (?<process>\S+) \[(?:(?<pid>\d+)(?::(?<tid>\d+))?)?\] (?<context>\S+) (?<msgid>\S+) (?<remaining>\{.*)$/;function OT(s,n,l=()=>new Date().toISOString()){const o=s.trimEnd();if(!o.trim())return null;const d=AT.exec(o);if(!d?.groups){const p=/^(\d{4}-\d\d-\d\dT[\d:.]+(?:Z|[+-]\d\d:?\d\d)?)\s+(.*)$/.exec(o);return{seq:n,raw:o,time:p?p[1]:l(),level:"info",message:p?p[2]:o}}const _=d.groups,w=_.remaining,c=DT(w,0);let h,y=w;if(c>0){try{const p=JSON.parse(w.slice(0,c+1));p&&typeof p=="object"&&!Array.isArray(p)&&(h=p)}catch{}y=w.slice(c+1).trim()}return{seq:n,raw:o,time:_.datetime,monotonic:parseFloat(_.monotonic),level:xm(_.level),facility:_.facility,process:_.process,..._.pid?{pid:_.tid?`${_.pid}:${_.tid}`:_.pid}:{},context:_.context,msgid:_.msgid,message:y,...h&&Object.keys(h).length?{extras:h}:{}}}const LT=/^(?<facility>\S+)\s*:(?<level>\S+)\s*:\s*\[\s*(?<monotonic>\d+\.\d+)\]\s+(?:(?<context>[^\s:][^:]{0,60}?): )?(?<message>.*)$/,MT=/^(?:<(?<prio>\d+)>)?\[\s*(?<monotonic>\d+\.\d+)\]\s+(?:(?<context>[^\s:][^:]{0,60}?): )?(?<message>.*)$/,BT=["emerg","alert","crit","err","warning","notice","info","debug"];function IT(s,n){const l=s.trimEnd();if(!l.trim())return null;const o=LT.exec(l);if(o?.groups){const _=o.groups;return{seq:n,raw:l,monotonic:parseFloat(_.monotonic),level:xm(_.level),facility:_.facility,..._.context?{context:_.context}:{},message:_.message}}const d=MT.exec(l);if(d?.groups){const _=d.groups;return{seq:n,raw:l,monotonic:parseFloat(_.monotonic),level:_.prio?BT[Number(_.prio)&7]:"info",..._.context?{context:_.context}:{},message:_.message}}return{seq:n,raw:l,level:"info",message:l}}function HT(s){if(s.time){const n=/T(\d\d:\d\d:\d\d(?:\.\d{1,3})?)/.exec(s.time);return n?n[1]:s.time}return s.monotonic!==void 0?s.monotonic.toFixed(3):""}function UT(s){const n=s.replace(/[\x00-\x1f]/g,"/").replace(/\.gz$/,"");let l=-1,o="";for(const C of["/usr/palm/applications/","/var/palm/jail/"])if(l=n.indexOf(C),l>=0){o=C;break}let d="",_="",w="",c=n.replace(/\//g,"_");const h=/.*____(.+)\.(\d+)\..+$/.exec(n);if(h){const C=n.indexOf("/"),j=n.lastIndexOf("____");d=h[1],_=h[2],w=n.substring(C,j),c=w.replace(/\//g,"_")}if(l<0)return d&&_&&w?{title:`${d} (${_})`,summary:w,saveName:cf(c)}:{title:"Unknown crash",summary:n,saveName:cf(c)};const y=n.substring(l+o.length),p=y.indexOf("/"),f=y.lastIndexOf("/"),x=y.substring(0,p>0?p:void 0);if(f>0){const C=y.lastIndexOf("____");C>0&&(w=y.substring(f+1,C))}return{title:_?`${x} (${_})`:x,summary:w,saveName:cf(c)}}const cf=s=>s.replace(/^_+/,"").replace(/[^A-Za-z0-9._-]+/g,"_").slice(0,120)||"crash";function Eb(s){const n=s.trim();if(!n.startsWith("{"))return null;try{const l=JSON.parse(n);return!l||typeof l!="object"||typeof l.type!="string"?null:l}catch{return null}}function zT(s){const n={text:[],sender:[],destination:[],exclude:{text:[],sender:[],destination:[]}};for(const l of s.match(/-?(?:\w+:)?(?:"[^"]*"|\S+)/g)??[]){const o=l.startsWith("-")&&l.length>1,d=o?l.slice(1):l,_=/^(sender|destination):(.*)$/.exec(d),w=o?n.exclude:n,c=(_?_[2]:d).replace(/^"|"$/g,"");c&&(_?w[_[1]].push(c):w.text.push(c.toLowerCase()))}return n}function $T(s,n){const l=(d,_)=>d.some(w=>_===w||_.startsWith(`${w}`));if(l(n.exclude.sender,s.sender)||l(n.exclude.destination,s.destination)||n.sender.length&&!l(n.sender,s.sender)||n.destination.length&&!l(n.destination,s.destination))return!1;const o=`${s.name} ${s.sender} ${s.information}`.toLowerCase();return n.exclude.text.some(d=>o.includes(d))?!1:n.text.every(d=>o.includes(d))}const Nb=s=>s.rawPayload??(s.payload===void 0?"":JSON.stringify(s.payload));function jb(s){switch(s.type){case"return":return`${s.destinationUniqueName}:${s.senderUniqueName}:${s.replyToken}`;case"callCancel":return`${s.senderUniqueName}:${s.destinationUniqueName}:${s.payload?.token}`;default:return`${s.senderUniqueName}:${s.destinationUniqueName}:${s.token}`}}const PT=s=>`${s.destination??""}${(s.methodCategory??"").replace(/\/+$/,"")}/${s.method??""}`,FT=500;class Tb{constructor(n=2e4){this.max=n}max;calls=[];byKey=new Map;keyOf=new WeakMap;nextId=1;add(n){if(n.transport!==void 0&&n.transport!=="TX")return!1;if(n.type==="call"){const l={...n,information:Nb(n)},o={id:this.nextId++,name:PT(n),sender:n.sender??"",destination:n.destination??"",information:l.information,messages:[l],status:"pending"},d=jb(n);if(this.calls.push(o),this.byKey.set(d,o),this.keyOf.set(o,d),this.calls.length>this.max)for(const _ of this.calls.splice(0,this.calls.length-this.max)){const w=this.keyOf.get(_);w!==void 0&&this.byKey.get(w)===_&&this.byKey.delete(w)}return!0}if(n.type==="return"||n.type==="callCancel"){const l=this.byKey.get(jb(n));if(!l)return!1;if(l.messages.push({...n,information:Nb(n)}),l.messages.length>FT+1&&(l.messages.splice(1,1),l.skipped=(l.skipped??0)+1),n.type==="callCancel")l.status==="pending"&&(l.status="cancelled");else if(l.status==="pending"||l.status==="ok"||l.status==="cancelled"){const o=n.payload?.returnValue;l.status=o===!1?"error":"ok"}return!0}return!1}}const VT=24*3600*1e3;function rS(s,n,l,o={}){const{client:d,ready:_}=ut(),[w,c]=M.useState({phase:"idle",dropped:0}),h=M.useRef(null),y=M.useRef(l);y.current=l;const p=o.lines,f=M.useRef(s);f.current=s;const x=s?.id,C=M.useRef(null),j=M.useCallback(()=>{const g=h.current;h.current=null,C.current?.(),C.current=null,g&&(c(b=>b.phase==="running"?{...b,phase:"stopped"}:b),d&&d.call("logs.stop",{opId:g}).catch(()=>{}))},[d]),E=M.useCallback(()=>{const g=f.current;if(!d||!g||g.id!==x)return;j();const b=ea();h.current=b,c({phase:"running",dropped:0});const v=d.on(E2,S=>{const N=C2.safeParse(S);!N.success||N.data.opId!==b||h.current!==b||(N.data.lines.length&&y.current(N.data.lines),N.data.dropped&&c(T=>({...T,dropped:T.dropped+N.data.dropped})))});C.current=v,d.call("logs.stream",{device:gt(g),source:n,opId:b,...p!==void 0?{lines:p}:{}},VT).then(S=>{h.current===b&&c(N=>({...N,phase:S.stopped?"stopped":"ended"}))}).catch(S=>{h.current===b&&c(N=>({...N,phase:"error",error:S}))}).finally(()=>{v(),C.current===v&&(C.current=null),h.current===b&&(h.current=null)})},[d,x,n,p,j]);return M.useEffect(()=>()=>j(),[j,x]),{state:w,start:E,stop:j,ready:_}}function kb(s,n,l){let o=0,d=s.length;for(;o<d;){const _=o+d>>1;n(s[_])<l?o=_+1:d=_}return o}function aS({items:s,rowHeight:n,render:l,keyOf:o,label:d,className:_="",header:w,empty:c}){const h=M.useRef(null),[y,p]=M.useState(0),[f,x]=M.useState(400),[C,j]=M.useState(!0),[E,g]=M.useState(null),b=M.useRef(s);M.useLayoutEffect(()=>{const L=h.current;if(!L)return;const V=new ResizeObserver(()=>x(L.clientHeight));return V.observe(L),x(L.clientHeight),()=>V.disconnect()},[]);const v=M.useCallback(()=>{const L=h.current;L&&(L.scrollTop=L.scrollHeight,p(L.scrollTop))},[]);M.useLayoutEffect(()=>{const L=b.current;b.current=s;const V=h.current;if(!V||L===s)return;if(C){v();return}const q=Math.min(L.length-1,Math.floor(V.scrollTop/n)),Y=L[q];if(Y===void 0)return;const P=V.scrollTop-q*n,Q=kb(s,o,o(Y));Q!==q&&(V.scrollTop=Q*n+P,p(V.scrollTop))},[s,C,v,n,o]);const S=()=>{const L=h.current;if(!L)return;p(L.scrollTop);const V=L.scrollHeight-L.scrollTop-L.clientHeight<n*1.5;if(V!==C){j(V);const q=s[s.length-1];g(V||q===void 0?null:o(q))}},N=!C&&E!==null?s.length-kb(s,o,E+1):0,T=s.length*n,D=Math.max(0,Math.floor(y/n)-10),O=Math.min(s.length,Math.ceil((y+f)/n)+10),k=s.slice(D,O);return r.jsxs("div",{className:`vlist ${_}`,children:[w,r.jsx("div",{className:"vlist-scroll",ref:h,onScroll:S,role:"log","aria-label":d,"aria-live":"off",tabIndex:0,children:s.length===0?c:r.jsx("div",{style:{height:T,position:"relative"},children:r.jsx("div",{style:{position:"absolute",top:D*n,left:0,right:0},children:k.map((L,V)=>r.jsx("div",{className:"vlist-row",style:{height:n},children:l(L,D+V)},o(L)))})})}),!C&&s.length>0&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary vlist-jump",onClick:()=>{j(!0),g(null),v()},children:[r.jsx(ce,{name:"updown"})," ",N>0?`${N.toLocaleString()} new — jump to latest`:"Jump to latest"]})]})}const uc=1e4,qT=24,uf={emerg:"EMERG",alert:"ALERT",crit:"CRIT",err:"ERROR",warning:"WARN",notice:"NOTICE",info:"INFO",debug:"DEBUG"};function lS({device:s,source:n,parse:l,columns:o,history:d,clearLabel:_,label:w}){const{call:c}=ut(),{confirm:h,toast:y}=jt(),p=M.useRef([]),f=M.useRef(0),[x,C]=M.useState([]),[j,E]=M.useState(!1),[g,b]=M.useState(""),[v,S]=M.useState("debug"),[N,T]=M.useState(null),D=M.useRef(0),O=M.useRef(j);O.current=j;const k=M.useCallback(()=>{D.current||(D.current=requestAnimationFrame(()=>{D.current=0,O.current||C(p.current.slice())}))},[]);M.useEffect(()=>()=>cancelAnimationFrame(D.current),[]);const L=M.useCallback($=>{for(const J of $){const z=l(J,++f.current);z&&p.current.push(z)}p.current.length>uc&&p.current.splice(0,p.current.length-uc),k()},[l,k]),{state:V,start:q,ready:Y}=rS(s,n,L,d!==void 0?{lines:d}:{}),P=M.useCallback(()=>{p.current=[],C([]),T(null),q()},[q]);M.useEffect(()=>{Y&&P()},[Y,P]),M.useEffect(()=>{j||C(p.current.slice())},[j]);const Q=M.useMemo(()=>{const $=Cb(v),J=g.trim().toLowerCase();return x.filter(z=>Cb(z.level)<=$&&(!J||z.raw.toLowerCase().includes(J)))},[x,v,g]),he=async()=>{if(await h({title:n==="syslog"?"Clear the system log on the TV?":"Clear the kernel log on the TV?",message:r.jsxs("p",{children:[n==="syslog"?"This empties /var/log/messages on the TV.":"This empties the kernel ring buffer (dmesg -c)."," It can’t be undone."]}),confirmText:"Clear",danger:!0}))try{await c("logs.clear",{device:gt(s),source:n}),y({kind:"success",title:n==="syslog"?"System log cleared":"Kernel log cleared"}),P()}catch(J){y({kind:"danger",title:"Couldn’t clear the log",text:xt(J).message})}},ne=()=>{const $=p.current.map(z=>z.raw).join(`
38
+ `),l=!0);l&&this.changed()}close(n){const l=this.tabs.findIndex(d=>d.key===n);if(l<0)return;const o=this.tabs[l];o.shellId&&(o.state==="open"||o.state==="connecting")&&o.client.call("shell.close",{shellId:o.shellId}).catch(()=>{}),o.term?.dispose(),o.host.remove(),this.decoders.delete(o.key),clearTimeout(this.acks.get(o.key)?.timer),this.acks.delete(o.key),this.tabs=this.tabs.filter(d=>d!==o),this.activeKey===n&&(this.activeKey=this.tabs[Math.max(0,l-1)]?.key??null),this.changed()}}const ei=new TT,Eb={w:7.8,h:17};function kT(){M.useSyncExternalStore(ei.subscribe,ei.getSnapshot);const{devices:s,active:n}=Mt(),{client:l,ready:o}=ut(),{toast:d}=jt(),[_,w]=M.useState(null),c={current:_},h=ei.list,y=ei.active;M.useEffect(()=>ei.markDisconnected(o?l:null),[l,o]),M.useLayoutEffect(()=>{const C=c.current;if(!C)return;const j=y?.term?y.host:null;if(j&&j.parentElement!==C&&C.replaceChildren(j),j||C.replaceChildren(),y?.term&&y.fit){try{y.fit.fit()}catch{}y.term.focus()}},[_,y?.key,y?.term]),M.useEffect(()=>{const C=c.current;if(!C)return;const j=new ResizeObserver(()=>{const E=ei.active;if(E?.fit&&E.host.parentElement===C)try{E.fit.fit()}catch{}});return j.observe(C),()=>j.disconnect()},[_]);const p=()=>{if(y?.term)return{rows:y.term.rows,cols:y.term.cols};const C=c.current?.getBoundingClientRect();return{rows:Math.max(10,Math.floor(((C?.height??400)-16)/Eb.h)),cols:Math.max(40,Math.floor(((C?.width??800)-16)/Eb.w))}},f=async(C,j=!0)=>{if(!l)return;const E=await ei.open(l,{deviceId:C.id,deviceName:C.name,device:gt(C),...p(),pty:j});E.state==="failed"&&d({kind:"danger",title:`Couldn’t open a terminal on ${C.name}`,text:E.note})},x=(s??[]).filter(C=>C.id!==n?.id);return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Device",title:"Terminal",sub:r.jsxs(r.Fragment,{children:["A shell on your TV. Tabs stay open while you use other pages; closing or reloading this browser tab ends them. Copy with"," ",r.jsx("kbd",{children:"Ctrl"}),"+",r.jsx("kbd",{children:"Shift"}),"+",r.jsx("kbd",{children:"C"}),"."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:n,children:r.jsxs("section",{className:"card col-12 term-card",children:[r.jsxs("div",{className:"term-bar",children:[r.jsx("div",{className:"term-tabs",role:"tablist","aria-label":"Terminals",children:h.map(C=>r.jsxs("div",{className:`term-tab${C.key===y?.key?" is-active":""}`,children:[r.jsxs("button",{type:"button",role:"tab","aria-selected":C.key===y?.key,className:"term-tab-btn",onClick:()=>ei.activate(C.key),title:`${C.deviceName} — ${C.title}`,children:[r.jsx("span",{className:`term-dot is-${C.state}`,"aria-hidden":"true"}),r.jsx("span",{className:"term-tab-title",children:C.deviceName}),!C.pty&&C.state!=="connecting"&&r.jsx("span",{className:"term-tab-tag",children:"simple"})]}),r.jsx("button",{type:"button",className:"term-tab-close",onClick:()=>ei.close(C.key),"aria-label":`Close ${C.deviceName} terminal`,children:r.jsx(ce,{name:"x",strokeWidth:2})})]},C.key))}),r.jsxs("div",{className:"term-new",children:[r.jsxs("button",{type:"button",className:"btn btn--sm btn--soft-primary",onClick:()=>n&&f(n),disabled:!n||!o,title:n?`New terminal on ${n.name}`:void 0,children:[r.jsx(ce,{name:"plus"})," ",r.jsx("span",{className:"hide-sm",children:"New terminal"})]}),r.jsx(Ic,{label:"More terminal options",menuClassName:"dd-menu--compact",floating:!0,trigger:({toggle:C,...j})=>r.jsx("button",{type:"button",className:"btn btn--icon btn--sm btn--ghost",onClick:C,"aria-label":"More terminal options",disabled:!o,...j,children:r.jsx(ce,{name:"chevDown"})}),children:C=>r.jsxs(r.Fragment,{children:[x.length>0&&r.jsx("div",{className:"dd-section-label",children:"Open on another TV"}),x.map(j=>r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",onClick:()=>(C(),f(j)),children:[r.jsx(ce,{name:"tv"}),r.jsxs("span",{className:"dd-menu-text",children:[r.jsx("span",{children:j.name}),r.jsx("span",{className:"dd-menu-sub mono",children:[xl(j.info?.modelName),j.host].filter(Boolean).join(" · ")})]})]},j.id)),x.length>0&&r.jsx("div",{className:"dd-divider"}),r.jsxs("button",{type:"button",role:"menuitem",className:"dd-menu-item",disabled:!n,onClick:()=>(C(),n&&f(n,!1)),children:[r.jsx(ce,{name:"terminal"}),r.jsxs("span",{className:"dd-menu-text",children:[r.jsx("span",{children:"Simple shell (no PTY)"}),r.jsx("span",{className:"dd-menu-sub",children:"Command and output only"})]})]})]})})]})]}),r.jsx("div",{className:"term-body",children:y?r.jsxs(r.Fragment,{children:[y.state!=="open"&&y.state!=="connecting"&&r.jsx(RT,{tab:y}),y.state==="connecting"&&!y.term&&r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsxs("p",{children:["Connecting to ",y.deviceName,"…"]})]}),!y.pty&&y.state!=="connecting"&&y.state!=="failed"&&r.jsx(DT,{tab:y}),r.jsx("div",{ref:w,className:`term-stage${y.term?"":" is-empty"}`})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"terminal"})}),r.jsx("h3",{children:"No terminal open"}),r.jsxs("p",{children:["Open a shell on ",n?r.jsx(ii,{device:n}):"a TV"," to run commands on it."]}),n&&r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>f(n),disabled:!o,children:[r.jsx(ce,{name:"terminal"})," Open a terminal on ",n.name]})]})})]})})})]})}function RT({tab:s}){const{client:n,ready:l}=ut(),o=s.state==="exited"?"info":s.state==="failed"?"danger":"warning",d=s.state==="exited"?"The shell has ended":s.state==="failed"?`Couldn’t open a shell on ${s.deviceName}`:"Disconnected";return r.jsx("div",{className:"term-banner",children:r.jsxs($e,{kind:o,title:d,action:r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",disabled:!l||!n,onClick:()=>n&&ei.restart(s,n),children:[r.jsx(ce,{name:"refresh"})," ",s.state==="failed"?"Try again":"Reconnect"]}),children:[s.note,s.state==="failed"&&r.jsx("div",{className:"alert-hint",children:"Make sure the TV is on. Right after it starts, SSH can take a minute or two to come up."})]})})}function DT({tab:s}){const[n,l]=M.useState(""),[o,d]=M.useState([]),[_,w]=M.useState(-1),c=M.useRef(null),h=M.useRef(null),y=s.dumb.length>0&&s.dumb[s.dumb.length-1].status===void 0;M.useEffect(()=>{c.current?.scrollTo({top:c.current.scrollHeight})},[s.dumb]),M.useEffect(()=>h.current?.focus(),[s.key]);const p=f=>{f.preventDefault(),n.trim()&&(ei.sendDumb(s,n),d(x=>[...x.filter(C=>C!==n.trim()),n.trim()].slice(-50)),w(-1),l(""))};return r.jsxs("div",{className:"term-dumb",children:[r.jsxs($e,{kind:"info",title:"Simple shell",children:["This shell has no terminal (PTY), so full-screen programs like ",r.jsx("span",{className:"mono",children:"top"})," or ",r.jsx("span",{className:"mono",children:"vi"})," won’t work."]}),r.jsxs("div",{className:"term-dumb-log",ref:c,"aria-live":"polite",children:[s.dumb.length===0&&r.jsx("div",{className:"muted",children:"Type a command below."}),s.dumb.map(f=>r.jsxs("div",{className:"term-dumb-entry",children:[r.jsxs("div",{className:"term-dumb-cmd",children:[r.jsx("span",{className:"cons-ps1",children:"$"})," ",f.input,r.jsx("span",{className:`term-dumb-status${f.status===void 0?"":f.status===0?" is-ok":" is-err"}`,children:f.status===void 0?r.jsx("span",{className:"spinner sm"}):`exit ${f.status}`})]}),f.output&&r.jsx("pre",{className:"term-dumb-out",children:f.output.replace(/\n$/,"")})]},f.id))]}),r.jsxs("form",{className:"term-dumb-form",onSubmit:p,children:[r.jsx("span",{className:"cons-ps1","aria-hidden":"true",children:"$"}),r.jsx("input",{ref:h,className:"input mono","aria-label":"Command",value:n,disabled:s.state!=="open",placeholder:y?"Waiting for the last command…":"Command",onChange:f=>l(f.target.value),onKeyDown:f=>{if(f.key==="ArrowUp"&&o.length){f.preventDefault();const x=_<0?o.length-1:Math.max(0,_-1);w(x),l(o[x])}else if(f.key==="ArrowDown"&&_>=0){f.preventDefault();const x=_+1;x>=o.length?(w(-1),l("")):(w(x),l(o[x]))}},spellCheck:!1,autoComplete:"off"}),r.jsx("button",{type:"submit",className:"btn btn--primary btn--sm",disabled:s.state!=="open"||!n.trim(),children:"Run"})]})]})}const Dc=["emerg","alert","crit","err","warning","notice","info","debug"];function Nb(s){const n=Dc.indexOf(Cm(s));return n<0?Dc.indexOf("info"):n}function Cm(s){const n=s.toLowerCase();return n==="warn"?"warning":n==="error"?"err":n==="panic"?"emerg":Dc.includes(n)?n:"info"}function AT(s,n){let l=0,o=!1;for(let d=n;d<s.length;d++){const _=s[d];if(o)_==="\\"?d++:_==='"'&&(o=!1);else if(_==='"')o=!0;else if(_==="{"||_==="[")l++;else if((_==="}"||_==="]")&&(l--,l===0))return d}return-1}const OT=/^(?<datetime>[\w:.\-+]+) \[(?<monotonic>\d+\.\d+)\] (?<facility>\S+)\.(?<level>\S+) (?<process>\S+) \[(?:(?<pid>\d+)(?::(?<tid>\d+))?)?\] (?<context>\S+) (?<msgid>\S+) (?<remaining>\{.*)$/;function LT(s,n,l=()=>new Date().toISOString()){const o=s.trimEnd();if(!o.trim())return null;const d=OT.exec(o);if(!d?.groups){const p=/^(\d{4}-\d\d-\d\dT[\d:.]+(?:Z|[+-]\d\d:?\d\d)?)\s+(.*)$/.exec(o);return{seq:n,raw:o,time:p?p[1]:l(),level:"info",message:p?p[2]:o}}const _=d.groups,w=_.remaining,c=AT(w,0);let h,y=w;if(c>0){try{const p=JSON.parse(w.slice(0,c+1));p&&typeof p=="object"&&!Array.isArray(p)&&(h=p)}catch{}y=w.slice(c+1).trim()}return{seq:n,raw:o,time:_.datetime,monotonic:parseFloat(_.monotonic),level:Cm(_.level),facility:_.facility,process:_.process,..._.pid?{pid:_.tid?`${_.pid}:${_.tid}`:_.pid}:{},context:_.context,msgid:_.msgid,message:y,...h&&Object.keys(h).length?{extras:h}:{}}}const MT=/^(?<facility>\S+)\s*:(?<level>\S+)\s*:\s*\[\s*(?<monotonic>\d+\.\d+)\]\s+(?:(?<context>[^\s:][^:]{0,60}?): )?(?<message>.*)$/,BT=/^(?:<(?<prio>\d+)>)?\[\s*(?<monotonic>\d+\.\d+)\]\s+(?:(?<context>[^\s:][^:]{0,60}?): )?(?<message>.*)$/,IT=["emerg","alert","crit","err","warning","notice","info","debug"];function HT(s,n){const l=s.trimEnd();if(!l.trim())return null;const o=MT.exec(l);if(o?.groups){const _=o.groups;return{seq:n,raw:l,monotonic:parseFloat(_.monotonic),level:Cm(_.level),facility:_.facility,..._.context?{context:_.context}:{},message:_.message}}const d=BT.exec(l);if(d?.groups){const _=d.groups;return{seq:n,raw:l,monotonic:parseFloat(_.monotonic),level:_.prio?IT[Number(_.prio)&7]:"info",..._.context?{context:_.context}:{},message:_.message}}return{seq:n,raw:l,level:"info",message:l}}function UT(s){if(s.time){const n=/T(\d\d:\d\d:\d\d(?:\.\d{1,3})?)/.exec(s.time);return n?n[1]:s.time}return s.monotonic!==void 0?s.monotonic.toFixed(3):""}function zT(s){const n=s.replace(/[\x00-\x1f]/g,"/").replace(/\.gz$/,"");let l=-1,o="";for(const C of["/usr/palm/applications/","/var/palm/jail/"])if(l=n.indexOf(C),l>=0){o=C;break}let d="",_="",w="",c=n.replace(/\//g,"_");const h=/.*____(.+)\.(\d+)\..+$/.exec(n);if(h){const C=n.indexOf("/"),j=n.lastIndexOf("____");d=h[1],_=h[2],w=n.substring(C,j),c=w.replace(/\//g,"_")}if(l<0)return d&&_&&w?{title:`${d} (${_})`,summary:w,saveName:cf(c)}:{title:"Unknown crash",summary:n,saveName:cf(c)};const y=n.substring(l+o.length),p=y.indexOf("/"),f=y.lastIndexOf("/"),x=y.substring(0,p>0?p:void 0);if(f>0){const C=y.lastIndexOf("____");C>0&&(w=y.substring(f+1,C))}return{title:_?`${x} (${_})`:x,summary:w,saveName:cf(c)}}const cf=s=>s.replace(/^_+/,"").replace(/[^A-Za-z0-9._-]+/g,"_").slice(0,120)||"crash";function jb(s){const n=s.trim();if(!n.startsWith("{"))return null;try{const l=JSON.parse(n);return!l||typeof l!="object"||typeof l.type!="string"?null:l}catch{return null}}function $T(s){const n={text:[],sender:[],destination:[],exclude:{text:[],sender:[],destination:[]}};for(const l of s.match(/-?(?:\w+:)?(?:"[^"]*"|\S+)/g)??[]){const o=l.startsWith("-")&&l.length>1,d=o?l.slice(1):l,_=/^(sender|destination):(.*)$/.exec(d),w=o?n.exclude:n,c=(_?_[2]:d).replace(/^"|"$/g,"");c&&(_?w[_[1]].push(c):w.text.push(c.toLowerCase()))}return n}function PT(s,n){const l=(d,_)=>d.some(w=>_===w||_.startsWith(`${w}`));if(l(n.exclude.sender,s.sender)||l(n.exclude.destination,s.destination)||n.sender.length&&!l(n.sender,s.sender)||n.destination.length&&!l(n.destination,s.destination))return!1;const o=`${s.name} ${s.sender} ${s.information}`.toLowerCase();return n.exclude.text.some(d=>o.includes(d))?!1:n.text.every(d=>o.includes(d))}const Tb=s=>s.rawPayload??(s.payload===void 0?"":JSON.stringify(s.payload));function kb(s){switch(s.type){case"return":return`${s.destinationUniqueName}:${s.senderUniqueName}:${s.replyToken}`;case"callCancel":return`${s.senderUniqueName}:${s.destinationUniqueName}:${s.payload?.token}`;default:return`${s.senderUniqueName}:${s.destinationUniqueName}:${s.token}`}}const FT=s=>`${s.destination??""}${(s.methodCategory??"").replace(/\/+$/,"")}/${s.method??""}`,VT=500;class Rb{constructor(n=2e4){this.max=n}max;calls=[];byKey=new Map;keyOf=new WeakMap;nextId=1;add(n){if(n.transport!==void 0&&n.transport!=="TX")return!1;if(n.type==="call"){const l={...n,information:Tb(n)},o={id:this.nextId++,name:FT(n),sender:n.sender??"",destination:n.destination??"",information:l.information,messages:[l],status:"pending"},d=kb(n);if(this.calls.push(o),this.byKey.set(d,o),this.keyOf.set(o,d),this.calls.length>this.max)for(const _ of this.calls.splice(0,this.calls.length-this.max)){const w=this.keyOf.get(_);w!==void 0&&this.byKey.get(w)===_&&this.byKey.delete(w)}return!0}if(n.type==="return"||n.type==="callCancel"){const l=this.byKey.get(kb(n));if(!l)return!1;if(l.messages.push({...n,information:Tb(n)}),l.messages.length>VT+1&&(l.messages.splice(1,1),l.skipped=(l.skipped??0)+1),n.type==="callCancel")l.status==="pending"&&(l.status="cancelled");else if(l.status==="pending"||l.status==="ok"||l.status==="cancelled"){const o=n.payload?.returnValue;l.status=o===!1?"error":"ok"}return!0}return!1}}const qT=24*3600*1e3;function aS(s,n,l,o={}){const{client:d,ready:_}=ut(),[w,c]=M.useState({phase:"idle",dropped:0}),h=M.useRef(null),y=M.useRef(l);y.current=l;const p=o.lines,f=M.useRef(s);f.current=s;const x=s?.id,C=M.useRef(null),j=M.useCallback(()=>{const g=h.current;h.current=null,C.current?.(),C.current=null,g&&(c(b=>b.phase==="running"?{...b,phase:"stopped"}:b),d&&d.call("logs.stop",{opId:g}).catch(()=>{}))},[d]),E=M.useCallback(()=>{const g=f.current;if(!d||!g||g.id!==x)return;j();const b=ea();h.current=b,c({phase:"running",dropped:0});const v=d.on(N2,S=>{const N=E2.safeParse(S);!N.success||N.data.opId!==b||h.current!==b||(N.data.lines.length&&y.current(N.data.lines),N.data.dropped&&c(T=>({...T,dropped:T.dropped+N.data.dropped})))});C.current=v,d.call("logs.stream",{device:gt(g),source:n,opId:b,...p!==void 0?{lines:p}:{}},qT).then(S=>{h.current===b&&c(N=>({...N,phase:S.stopped?"stopped":"ended"}))}).catch(S=>{h.current===b&&c(N=>({...N,phase:"error",error:S}))}).finally(()=>{v(),C.current===v&&(C.current=null),h.current===b&&(h.current=null)})},[d,x,n,p,j]);return M.useEffect(()=>()=>j(),[j,x]),{state:w,start:E,stop:j,ready:_}}function Db(s,n,l){let o=0,d=s.length;for(;o<d;){const _=o+d>>1;n(s[_])<l?o=_+1:d=_}return o}function lS({items:s,rowHeight:n,render:l,keyOf:o,label:d,className:_="",header:w,empty:c}){const h=M.useRef(null),[y,p]=M.useState(0),[f,x]=M.useState(400),[C,j]=M.useState(!0),[E,g]=M.useState(null),b=M.useRef(s);M.useLayoutEffect(()=>{const L=h.current;if(!L)return;const V=new ResizeObserver(()=>x(L.clientHeight));return V.observe(L),x(L.clientHeight),()=>V.disconnect()},[]);const v=M.useCallback(()=>{const L=h.current;L&&(L.scrollTop=L.scrollHeight,p(L.scrollTop))},[]);M.useLayoutEffect(()=>{const L=b.current;b.current=s;const V=h.current;if(!V||L===s)return;if(C){v();return}const q=Math.min(L.length-1,Math.floor(V.scrollTop/n)),Y=L[q];if(Y===void 0)return;const P=V.scrollTop-q*n,Q=Db(s,o,o(Y));Q!==q&&(V.scrollTop=Q*n+P,p(V.scrollTop))},[s,C,v,n,o]);const S=()=>{const L=h.current;if(!L)return;p(L.scrollTop);const V=L.scrollHeight-L.scrollTop-L.clientHeight<n*1.5;if(V!==C){j(V);const q=s[s.length-1];g(V||q===void 0?null:o(q))}},N=!C&&E!==null?s.length-Db(s,o,E+1):0,T=s.length*n,D=Math.max(0,Math.floor(y/n)-10),O=Math.min(s.length,Math.ceil((y+f)/n)+10),k=s.slice(D,O);return r.jsxs("div",{className:`vlist ${_}`,children:[w,r.jsx("div",{className:"vlist-scroll",ref:h,onScroll:S,role:"log","aria-label":d,"aria-live":"off",tabIndex:0,children:s.length===0?c:r.jsx("div",{style:{height:T,position:"relative"},children:r.jsx("div",{style:{position:"absolute",top:D*n,left:0,right:0},children:k.map((L,V)=>r.jsx("div",{className:"vlist-row",style:{height:n},children:l(L,D+V)},o(L)))})})}),!C&&s.length>0&&r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary vlist-jump",onClick:()=>{j(!0),g(null),v()},children:[r.jsx(ce,{name:"updown"})," ",N>0?`${N.toLocaleString()} new — jump to latest`:"Jump to latest"]})]})}const uc=1e4,KT=24,uf={emerg:"EMERG",alert:"ALERT",crit:"CRIT",err:"ERROR",warning:"WARN",notice:"NOTICE",info:"INFO",debug:"DEBUG"};function oS({device:s,source:n,parse:l,columns:o,history:d,clearLabel:_,label:w}){const{call:c}=ut(),{confirm:h,toast:y}=jt(),p=M.useRef([]),f=M.useRef(0),[x,C]=M.useState([]),[j,E]=M.useState(!1),[g,b]=M.useState(""),[v,S]=M.useState("debug"),[N,T]=M.useState(null),D=M.useRef(0),O=M.useRef(j);O.current=j;const k=M.useCallback(()=>{D.current||(D.current=requestAnimationFrame(()=>{D.current=0,O.current||C(p.current.slice())}))},[]);M.useEffect(()=>()=>cancelAnimationFrame(D.current),[]);const L=M.useCallback($=>{for(const J of $){const z=l(J,++f.current);z&&p.current.push(z)}p.current.length>uc&&p.current.splice(0,p.current.length-uc),k()},[l,k]),{state:V,start:q,ready:Y}=aS(s,n,L,d!==void 0?{lines:d}:{}),P=M.useCallback(()=>{p.current=[],C([]),T(null),q()},[q]);M.useEffect(()=>{Y&&P()},[Y,P]),M.useEffect(()=>{j||C(p.current.slice())},[j]);const Q=M.useMemo(()=>{const $=Nb(v),J=g.trim().toLowerCase();return x.filter(z=>Nb(z.level)<=$&&(!J||z.raw.toLowerCase().includes(J)))},[x,v,g]),he=async()=>{if(await h({title:n==="syslog"?"Clear the system log on the TV?":"Clear the kernel log on the TV?",message:r.jsxs("p",{children:[n==="syslog"?"This empties /var/log/messages on the TV.":"This empties the kernel ring buffer (dmesg -c)."," It can’t be undone."]}),confirmText:"Clear",danger:!0}))try{await c("logs.clear",{device:gt(s),source:n}),y({kind:"success",title:n==="syslog"?"System log cleared":"Kernel log cleared"}),P()}catch(J){y({kind:"danger",title:"Couldn’t clear the log",text:xt(J).message})}},ne=()=>{const $=p.current.map(z=>z.raw).join(`
39
39
  `),J=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);Cn(new Blob([`${$}
40
- `],{type:"text/plain"}),`${s.name.replace(/[^A-Za-z0-9._-]+/g,"-")}-${n}-${J}.log`)},W=KT(),I=M.useMemo(()=>new Set(o.filter($=>$.optional&&x.some(J=>$.get(J))).map($=>$.key)),[o,x]),A=o.filter($=>!(W&&$.wide)&&(!$.optional||I.has($.key))),B={gridTemplateColumns:A.map($=>$.width).join(" ")},F=V.phase==="running";return r.jsxs("section",{className:"card col-12 log-card",children:[r.jsxs("div",{className:"data-toolbar log-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left",children:[r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Filter lines…",value:g,onChange:$=>b($.target.value),"aria-label":"Filter lines"})]}),r.jsxs("label",{className:"log-level-pick",children:[r.jsx("span",{className:"muted",children:"Level"}),r.jsx("select",{className:"select",value:v,onChange:$=>S($.target.value),"aria-label":"Lowest level to show",children:[...Dc].reverse().map($=>r.jsx("option",{value:$,children:$==="debug"?"All":`${uf[$][0]}${uf[$].slice(1).toLowerCase()} and worse`},$))})]})]}),r.jsxs("div",{className:"data-toolbar-right",children:[r.jsxs("span",{className:`log-status ${V.phase}`,role:"status",children:[r.jsx("span",{className:"dot"}),F?j?"Paused":"Live":V.phase==="error"?"Stopped":V.phase==="idle"?"Starting…":"Ended"]}),F?r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>E($=>!$),"aria-pressed":j,children:[r.jsx(ce,{name:j?"play":"clock"})," ",j?"Resume":"Pause"]}):r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:P,disabled:!Y,children:[r.jsx(ce,{name:"refresh"})," Restart"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:ne,disabled:!x.length,children:[r.jsx(ce,{name:"download"})," Save"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>{p.current=[],C([]),T(null)},title:"Empty this view (the TV’s log is kept)",children:[r.jsx(ce,{name:"x"})," Clear view"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost btn--danger-ghost",onClick:he,disabled:!Y,children:[r.jsx(ce,{name:"trash"})," ",_,"…"]})]})]}),V.phase==="error"&&r.jsx(Nt,{error:V.error,title:"Couldn’t follow the log",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:P,children:"Try again"})}),V.dropped>0&&r.jsxs($e,{kind:"warning",title:"Some lines were skipped",children:["The log was busier than the bridge forwards (",V.dropped.toLocaleString()," lines skipped). Save it on the TV instead if you need every line."]}),r.jsx(aS,{items:Q,rowHeight:qT,keyOf:$=>$.seq,label:w,className:"log-list",header:r.jsx("div",{className:"log-row log-head",style:B,children:A.map($=>r.jsx("span",{children:$.label},$.key))}),empty:r.jsx("div",{className:"log-empty muted",children:V.phase==="running"||V.phase==="idle"?x.length?"No lines match the filter.":"Waiting for log lines…":x.length?"No lines match the filter.":"Nothing to show."}),render:$=>r.jsx("button",{type:"button",className:`log-row lvl-${$.level}${N?.seq===$.seq?" is-selected":""}`,style:B,onClick:()=>T(N?.seq===$.seq?null:$),children:A.map(J=>r.jsx("span",{className:`log-c-${J.key}`,children:J.key==="level"?uf[$.level]:J.get($)??""},J.key))})}),r.jsxs("div",{className:"data-foot",children:[r.jsxs("span",{children:[Q.length.toLocaleString()," of ",x.length.toLocaleString()," lines",x.length>=uc?` (the newest ${uc.toLocaleString()} are kept)`:""]}),r.jsx("span",{className:"muted",children:"Click a line for details."})]}),N&&r.jsx(GT,{entry:N,onClose:()=>T(null)})]})}function KT(){return dm("(max-width: 720px)")}function GT({entry:s,onClose:n}){const{toast:l}=jt(),o=[["Time",s.time],["Since boot",s.monotonic!==void 0?`${s.monotonic.toFixed(6)} s`:void 0],["Level",s.level],["Facility",s.facility],["Process",s.process?`${s.process}${s.pid?` [${s.pid}]`:""}`:void 0],["Context",s.context],["Message ID",s.msgid]];return r.jsxs("div",{className:"log-details",children:[r.jsxs("div",{className:"log-details-head",children:[r.jsx("b",{children:"Line details"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>navigator.clipboard.writeText(s.raw).then(()=>l({kind:"success",title:"Line copied"}),()=>l({kind:"danger",title:"Couldn’t copy"})),children:[r.jsx(ce,{name:"copy"})," Copy line"]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon",onClick:n,"aria-label":"Close details",children:r.jsx(ce,{name:"x"})})]}),r.jsx("dl",{className:"kv",children:o.filter(([,d])=>d).map(([d,_])=>r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:d}),r.jsx("dd",{className:"mono",children:_})]},d))}),r.jsx("pre",{className:"log-details-msg",children:s.message}),s.extras&&r.jsx("pre",{className:"log-details-json",children:JSON.stringify(s.extras,null,2)})]})}const YT=[{key:"time",label:"Time",width:"88px",get:s=>HT(s)},{key:"level",label:"Level",width:"52px",get:s=>s.level},{key:"process",label:"Process",width:"minmax(80px, 160px)",get:s=>s.process??s.context,wide:!0},{key:"msgid",label:"Message ID",width:"minmax(80px, 170px)",get:s=>s.msgid,wide:!0},{key:"message",label:"Message",width:"minmax(0, 1fr)",get:s=>s.extras?`${s.message} ${JSON.stringify(s.extras)}`:s.message}],ZT=[{key:"time",label:"Since boot",width:"100px",get:s=>s.monotonic!==void 0?s.monotonic.toFixed(3):""},{key:"level",label:"Level",width:"58px",get:s=>s.level},{key:"facility",label:"Facility",width:"64px",get:s=>s.facility,wide:!0},{key:"context",label:"Source",width:"minmax(80px, 170px)",get:s=>s.context,wide:!0,optional:!0},{key:"message",label:"Message",width:"minmax(0, 1fr)",get:s=>s.message}];function wm({device:s,what:n,children:l}){return s.username==="root"?r.jsx(r.Fragment,{children:l}):r.jsx("section",{className:"card col-12",children:r.jsxs($e,{kind:"info",title:"Needs a rooted TV",children:[n," is only available when you are logged in as root (a rooted TV with Homebrew Channel). Developer Mode logins can still read ",r.jsx(Jt,{to:"/debug/crashes",children:"crash reports"}),"."]})})}const XT=(s,n)=>OT(s,n);function WT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"System",accent:"log",sub:r.jsxs(r.Fragment,{children:["Live ",r.jsx("span",{className:"mono",children:"/var/log/messages"}),s?r.jsxs(r.Fragment,{children:[" from ",r.jsx(ii,{device:s})]}):null,". Developer logging is switched on when it starts. Set what gets logged in"," ",r.jsx(Jt,{to:"/debug/pmlog",children:"Log levels"}),"."]}),actions:r.jsxs(Jt,{to:"/debug/pmlog",className:"btn btn--ghost",children:[r.jsx(ce,{name:"cog"})," Log levels"]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(wm,{device:s,what:"The system log",children:r.jsx(lS,{device:s,source:"syslog",parse:XT,columns:YT,history:100,clearLabel:"Clear on TV",label:"System log"},s.id)})})})]})}function QT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Kernel",accent:"log",sub:r.jsxs(r.Fragment,{children:["The kernel ring buffer (",r.jsx("span",{className:"mono",children:"dmesg"}),")",s?r.jsxs(r.Fragment,{children:[" of ",r.jsx(ii,{device:s})]}):null,", followed live."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(wm,{device:s,what:"The kernel log",children:r.jsx(lS,{device:s,source:"dmesg",parse:IT,columns:ZT,clearLabel:"Clear on TV",label:"Kernel log"},s.id)})})})]})}const Ff=[{level:"none",label:"None"},{level:"debug",label:"Debug"},{level:"info",label:"Info"},{level:"notice",label:"Notice"},{level:"warning",label:"Warning"},{level:"err",label:"Error"},{level:"crit",label:"Critical"},{level:"alert",label:"Alert"},{level:"emerg",label:"Emergency"}];function JT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Log",accent:"levels",sub:r.jsxs(r.Fragment,{children:["How much each PmLog context writes to the ",r.jsx(Jt,{to:"/debug/logs",children:"system log"}),s?r.jsxs(r.Fragment,{children:[" on ",r.jsx(ii,{device:s})]}):null,". Changes last until the TV restarts."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(wm,{device:s,what:"Setting log levels",children:r.jsx(ek,{device:s},s.id)})})})]})}function ek({device:s}){const{ready:n,call:l}=ut(),{toast:o}=jt(),d=En(),_=["pmlog",s.id],w=ss({queryKey:_,queryFn:async()=>(await l("pmlog.show",{device:gt(s)})).contexts,enabled:n}),[c,h]=M.useState(""),[y,p]=M.useState(null),[f,x]=M.useState(""),[C,j]=M.useState("debug"),E=w.data??[],g=M.useMemo(()=>{const N=c.trim().toLowerCase();return E.filter(T=>!N||T.name.toLowerCase().includes(N))},[E,c]),b=async(N,T)=>{p(N);try{const{changed:D}=await l("pmlog.set",{device:gt(s),context:N,level:T});d.setQueryData(_,(O=[])=>{const k=O.map(L=>D.includes(L.name)?{...L,level:T}:L);for(const L of D)k.some(V=>V.name===L)||k.push({name:L,level:T});return k}),D.length?N==="*"&&o({kind:"success",title:`All contexts set to ${T}`}):o({kind:"warning",title:"Nothing changed",text:`PmLogCtl didn’t report any change for ${N}.`})}catch(D){o({kind:"danger",title:"Couldn’t set the level",text:xt(D).message})}finally{p(null)}},v=C0.safeParse(f.trim()).success,S=async N=>{N.preventDefault(),v&&(await b(f.trim(),C),x(""))};return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"card col-8",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsx("div",{className:"data-toolbar-left",children:r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Filter contexts…",value:c,onChange:N=>h(N.target.value),"aria-label":"Filter contexts"})]})}),r.jsxs("div",{className:"data-toolbar-right",children:[w.data&&r.jsxs("span",{className:"muted count-label",children:[g.length," of ",E.length]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>w.refetch(),disabled:!n||w.isFetching,"aria-label":"Reload",children:r.jsx(ce,{name:"refresh"})})]})]}),w.error?r.jsx(Nt,{error:w.error,title:"Couldn’t read the log levels",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>w.refetch(),children:"Retry"})}):w.data?r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table pmlog-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Context"}),r.jsx("th",{children:"Level"})]})}),r.jsxs("tbody",{children:[r.jsxs("tr",{className:"pmlog-all",children:[r.jsx("td",{children:r.jsxs("label",{htmlFor:"pmlog-all",children:[r.jsx("b",{children:"All contexts"})," ",r.jsx("span",{className:"muted",children:"(sets every context)"})]})}),r.jsx("td",{children:r.jsxs("select",{id:"pmlog-all",className:"select select--sm",value:"",disabled:y!==null,onChange:N=>N.target.value&&b("*",N.target.value),children:[r.jsx("option",{value:"",children:"Choose…"}),Ff.map(N=>r.jsx("option",{value:N.level,children:N.label},N.level))]})})]}),g.map(N=>r.jsxs("tr",{children:[r.jsx("td",{className:"mono",children:r.jsx("label",{htmlFor:`pmlog-${N.name}`,children:N.name})}),r.jsxs("td",{children:[r.jsx(Rb,{id:`pmlog-${N.name}`,value:N.level,disabled:y!==null,onChange:T=>b(N.name,T)}),y===N.name&&r.jsx("span",{className:"spinner sm"})]})]},N.name))]})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Reading PmLog contexts…"})]})]}),r.jsxs("section",{className:"card col-4",children:[r.jsx("div",{className:"card-head",children:r.jsxs("div",{className:"card-title-wrap",children:[r.jsx("span",{className:"eyebrow",children:"PmLogCtl"}),r.jsx("h2",{className:"card-title",children:"Set a context"})]})}),r.jsxs("form",{className:"stack",onSubmit:S,children:[r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"pmlog-ctx",children:"Context"}),r.jsx("input",{id:"pmlog-ctx",className:`input mono${f&&!v?" is-invalid":""}`,placeholder:"* for all",value:f,onChange:N=>x(N.target.value),autoComplete:"off",spellCheck:!1}),f&&!v&&r.jsx("span",{className:"field-error",children:"Letters, digits and . _ - < > * only."})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"pmlog-level",children:"Level"}),r.jsx(Rb,{id:"pmlog-level",value:C,onChange:j})]}),r.jsxs("button",{type:"submit",className:"btn btn--primary",disabled:!n||!v||y!==null,children:[r.jsx(ce,{name:"check"})," Set level"]}),r.jsx("p",{className:"muted small",children:"For contexts that aren’t listed yet, e.g. an app’s own context. “Debug” logs the most, “None” turns a context off."})]})]})]})}function Rb({id:s,value:n,onChange:l,disabled:o}){const d=Ff.some(_=>_.level===n);return r.jsxs("select",{id:s,className:"select select--sm",value:n,disabled:o,onChange:_=>l(_.target.value),children:[!d&&r.jsx("option",{value:n,children:n}),Ff.map(_=>r.jsx("option",{value:_.level,children:_.label},_.level))]})}const tk=s=>{const n=s;return!!n&&typeof n.id=="string"&&typeof n.deviceId=="string"&&typeof n.at=="number"&&n.blob instanceof Blob},oS=()=>Sl.forEach(s=>s());async function sk(s){const n=await ir();return(await zc(n.transaction(As,"readonly").objectStore(As).index("deviceId").getAll(IDBKeyRange.only(s)))).filter(tk).sort((o,d)=>o.at-d.at)}async function ik(s,n,l){const o={id:crypto.randomUUID(),deviceId:s,at:Date.now(),method:l,blob:n},d=await ir();return await zc(d.transaction(As,"readwrite").objectStore(As).add(o)),oS(),o}async function nk(s){if(!s.length)return;const n=await ir();await new Promise((l,o)=>{const d=n.transaction(As,"readwrite");for(const _ of s)d.objectStore(As).delete(_);d.oncomplete=()=>l(),d.onerror=()=>o(d.error)}),oS()}function rk(s){const[n,l]=M.useState({id:s,shots:null,error:null});return M.useEffect(()=>{let o=!0;const d=()=>sk(s).then(_=>o&&l({id:s,shots:_,error:null}),_=>o&&l({id:s,shots:[],error:_}));return d(),Sl.add(d),()=>{o=!1,Sl.delete(d)}},[s]),n.id===s?n:{shots:null,error:null}}function ak(s){const[n,l]=M.useState(()=>new Map);return M.useEffect(()=>{const o=new Map((s??[]).map(d=>[d.id,URL.createObjectURL(d.blob)]));return l(o),()=>o.forEach(d=>URL.revokeObjectURL(d))},[s]),n}const lk=s=>s.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"tv";function hf(s,n){const l=new Date(n.at).toISOString().replace(/[:.]/g,"-").slice(0,19);return`${lk(s)}-${l}.png`}function Ac(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function ok(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Crash",accent:"reports",sub:r.jsxs(r.Fragment,{children:["When a native app or service crashes",s?r.jsxs(r.Fragment,{children:[" on ",r.jsx(ii,{device:s})]}):null,", its report shows up here. They are kept in the TV’s /tmp, so a restart clears them."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(ck,{device:s},s.id)})})]})}function ck({device:s}){const{ready:n,call:l}=ut(),{confirm:o,toast:d}=jt(),_=En(),w=["crashes",s.id],c=ss({queryKey:w,queryFn:()=>l("crashes.list",{device:gt(s)}),enabled:n}),[h,y]=M.useState(null),p=M.useMemo(()=>(c.data?.reports??[]).map(C=>({...C,...UT(C.name)})),[c.data]),f=async(C,j)=>{try{const{text:E,truncated:g}=j??await l("crashes.read",{device:gt(s),path:C.path},6e4);Cn(new Blob([`${E}
41
- `],{type:"text/plain"}),`${C.saveName}.txt`),g&&d({kind:"warning",title:"Saved the first 2 MB only",text:"The report is longer; download the whole file from the Files page."})}catch(E){d({kind:"danger",title:"Couldn’t read the crash report",text:xt(E).message})}},x=async C=>{if(await o({title:"Delete this crash report?",message:r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"mono",children:C.title}),r.jsx("p",{children:"It is deleted from the TV. This can’t be undone."})]}),confirmText:"Delete",danger:!0}))try{await l("crashes.delete",{device:gt(s),path:C.path}),h?.path===C.path&&y(null),await _.invalidateQueries({queryKey:w})}catch(E){d({kind:"danger",title:"Couldn’t delete the crash report",text:xt(E).message})}};return r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsx("div",{className:"data-toolbar-left",children:c.data?.dir&&r.jsx("span",{className:"muted mono small",children:c.data.dir})}),r.jsxs("div",{className:"data-toolbar-right",children:[c.data&&r.jsxs("span",{className:"muted count-label",children:[p.length," ",p.length===1?"report":"reports"]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>c.refetch(),disabled:!n||c.isFetching,"aria-label":"Reload",children:r.jsx(ce,{name:"refresh"})})]})]}),c.error?r.jsx(Nt,{error:c.error,title:"Couldn’t find crash reports",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>c.refetch(),children:"Retry"})}):c.data?p.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"check"})}),r.jsx("h3",{children:"No crash reports"}),r.jsx("p",{children:"If a native application crashes, its crash report will be available here."})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table crash-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Crash"}),r.jsx("th",{className:"hide-sm",children:"When"}),r.jsx("th",{className:"hide-sm files-num",children:"Size"}),r.jsx("th",{"aria-label":"Actions"})]})}),r.jsx("tbody",{children:p.map(C=>r.jsxs("tr",{children:[r.jsx("td",{children:r.jsxs("button",{type:"button",className:"crash-open",onClick:()=>y(C),children:[r.jsx("span",{className:"crash-title",children:C.title}),C.summary&&r.jsx("span",{className:"crash-summary mono",children:C.summary})]})}),r.jsx("td",{className:"hide-sm nowrap",children:C.mtime?new Date(C.mtime).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):"—"}),r.jsx("td",{className:"hide-sm files-num nowrap",children:Ac(C.size)}),r.jsx("td",{children:r.jsxs("div",{className:"row-actions",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>y(C),children:"View"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon",onClick:()=>f(C),"aria-label":`Download ${C.title}`,title:"Download",children:r.jsx(ce,{name:"download"})}),C.writable&&r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon btn--danger-ghost",onClick:()=>x(C),"aria-label":`Delete ${C.title}`,title:"Delete",children:r.jsx(ce,{name:"trash"})})]})})]},C.path))})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Looking for crash reports…"})]}),h&&r.jsx(uk,{device:s,report:h,onClose:()=>y(null),onDownload:C=>f(h,C)})]})}function uk({device:s,report:n,onClose:l,onDownload:o}){const{ready:d,call:_}=ut(),{toast:w}=jt(),c=ss({queryKey:["crash",s.id,n.path],queryFn:()=>_("crashes.read",{device:gt(s),path:n.path},6e4),enabled:d,staleTime:1/0}),h=()=>c.data&&navigator.clipboard.writeText(c.data.text).then(()=>w({kind:"success",title:"Crash report copied"}),()=>w({kind:"danger",title:"Couldn’t copy"}));return r.jsxs(si,{open:!0,onClose:l,size:"lg",title:n.title,footer:r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:h,disabled:!c.data,children:[r.jsx(ce,{name:"copy"})," Copy"]}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>c.data&&o(c.data),disabled:!c.data,children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsx("span",{className:"spacer"}),r.jsx("button",{type:"button",className:"btn btn--primary",onClick:l,children:"Close"})]}),children:[n.summary&&r.jsx("p",{className:"muted mono small",children:n.summary}),c.error?r.jsx(Nt,{error:c.error,title:"Couldn’t read the crash report"}):c.data?r.jsxs(r.Fragment,{children:[c.data.truncated&&r.jsx($e,{kind:"warning",title:"Shortened",children:"This report is very long; only the first 2 MB are shown. Download it from the Files page for the whole file."}),r.jsx("pre",{className:"crash-text",children:c.data.text||"(empty)"})]}):r.jsx("div",{className:"empty-state",children:r.jsx("span",{className:"spinner"})})]})}const hk=32*1024*1024,dk=26;function fk(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Luna",accent:"monitor",sub:r.jsxs(r.Fragment,{children:["Every call on the luna service bus",s?r.jsxs(r.Fragment,{children:[" of ",r.jsx(ii,{device:s})]}):null,", with its replies — what apps ask the system and what it answers."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(mk,{device:s},s.id)})})]})}function mk({device:s}){const{toast:n}=jt(),l=M.useRef(new Tb),o=M.useRef([]),d=M.useRef(0),_=I=>{o.current.push(I),d.current+=I.length;let A=0;for(;d.current>hk&&A<o.current.length-1;)d.current-=o.current[A++].length;A&&o.current.splice(0,A)},[w,c]=M.useState(0),[h,y]=M.useState("none"),[p,f]=M.useState(""),[x,C]=M.useState(""),[j,E]=M.useState(null),g=M.useRef(0),b=M.useRef(null),v=s.username==="root",S=M.useCallback(()=>{g.current||(g.current=requestAnimationFrame(()=>{g.current=0,c(I=>I+1)}))},[]);M.useEffect(()=>()=>cancelAnimationFrame(g.current),[]);const N=M.useCallback(I=>{for(const A of I){const B=Eb(A);B&&(_(A),l.current.add(B))}S()},[S]),{state:T,start:D,stop:O,ready:k}=rS(s,"lsmonitor",N),L=T.phase==="running"&&h==="live",V=()=>{l.current=new Tb,o.current=[],d.current=0,E(null),c(I=>I+1)},q=()=>{V(),y("live"),D()},Y=async I=>{const A=I.target.files?.[0];if(I.target.value="",!!A){O();try{const B=await A.text();V();let F=0;for(const $ of B.split(`
42
- `)){if(!$.trim())continue;const J=Eb($);if(!J){F++;continue}_($),l.current.add(J)}y("file"),f(A.name),c($=>$+1),F&&n({kind:"warning",title:`${F} lines skipped`,text:"They weren’t ls-monitor JSON messages."})}catch(B){n({kind:"danger",title:"Couldn’t open the file",text:xt(B).message})}}},P=()=>{const I=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);Cn(new Blob([`${o.current.join(`
40
+ `],{type:"text/plain"}),`${s.name.replace(/[^A-Za-z0-9._-]+/g,"-")}-${n}-${J}.log`)},W=GT(),I=M.useMemo(()=>new Set(o.filter($=>$.optional&&x.some(J=>$.get(J))).map($=>$.key)),[o,x]),A=o.filter($=>!(W&&$.wide)&&(!$.optional||I.has($.key))),B={gridTemplateColumns:A.map($=>$.width).join(" ")},F=V.phase==="running";return r.jsxs("section",{className:"card col-12 log-card",children:[r.jsxs("div",{className:"data-toolbar log-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left",children:[r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Filter lines…",value:g,onChange:$=>b($.target.value),"aria-label":"Filter lines"})]}),r.jsxs("label",{className:"log-level-pick",children:[r.jsx("span",{className:"muted",children:"Level"}),r.jsx("select",{className:"select",value:v,onChange:$=>S($.target.value),"aria-label":"Lowest level to show",children:[...Dc].reverse().map($=>r.jsx("option",{value:$,children:$==="debug"?"All":`${uf[$][0]}${uf[$].slice(1).toLowerCase()} and worse`},$))})]})]}),r.jsxs("div",{className:"data-toolbar-right",children:[r.jsxs("span",{className:`log-status ${V.phase}`,role:"status",children:[r.jsx("span",{className:"dot"}),F?j?"Paused":"Live":V.phase==="error"?"Stopped":V.phase==="idle"?"Starting…":"Ended"]}),F?r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>E($=>!$),"aria-pressed":j,children:[r.jsx(ce,{name:j?"play":"clock"})," ",j?"Resume":"Pause"]}):r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:P,disabled:!Y,children:[r.jsx(ce,{name:"refresh"})," Restart"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:ne,disabled:!x.length,children:[r.jsx(ce,{name:"download"})," Save"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>{p.current=[],C([]),T(null)},title:"Empty this view (the TV’s log is kept)",children:[r.jsx(ce,{name:"x"})," Clear view"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost btn--danger-ghost",onClick:he,disabled:!Y,children:[r.jsx(ce,{name:"trash"})," ",_,"…"]})]})]}),V.phase==="error"&&r.jsx(Nt,{error:V.error,title:"Couldn’t follow the log",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:P,children:"Try again"})}),V.dropped>0&&r.jsxs($e,{kind:"warning",title:"Some lines were skipped",children:["The log was busier than the bridge forwards (",V.dropped.toLocaleString()," lines skipped). Save it on the TV instead if you need every line."]}),r.jsx(lS,{items:Q,rowHeight:KT,keyOf:$=>$.seq,label:w,className:"log-list",header:r.jsx("div",{className:"log-row log-head",style:B,children:A.map($=>r.jsx("span",{children:$.label},$.key))}),empty:r.jsx("div",{className:"log-empty muted",children:V.phase==="running"||V.phase==="idle"?x.length?"No lines match the filter.":"Waiting for log lines…":x.length?"No lines match the filter.":"Nothing to show."}),render:$=>r.jsx("button",{type:"button",className:`log-row lvl-${$.level}${N?.seq===$.seq?" is-selected":""}`,style:B,onClick:()=>T(N?.seq===$.seq?null:$),children:A.map(J=>r.jsx("span",{className:`log-c-${J.key}`,children:J.key==="level"?uf[$.level]:J.get($)??""},J.key))})}),r.jsxs("div",{className:"data-foot",children:[r.jsxs("span",{children:[Q.length.toLocaleString()," of ",x.length.toLocaleString()," lines",x.length>=uc?` (the newest ${uc.toLocaleString()} are kept)`:""]}),r.jsx("span",{className:"muted",children:"Click a line for details."})]}),N&&r.jsx(YT,{entry:N,onClose:()=>T(null)})]})}function GT(){return mm("(max-width: 720px)")}function YT({entry:s,onClose:n}){const{toast:l}=jt(),o=[["Time",s.time],["Since boot",s.monotonic!==void 0?`${s.monotonic.toFixed(6)} s`:void 0],["Level",s.level],["Facility",s.facility],["Process",s.process?`${s.process}${s.pid?` [${s.pid}]`:""}`:void 0],["Context",s.context],["Message ID",s.msgid]];return r.jsxs("div",{className:"log-details",children:[r.jsxs("div",{className:"log-details-head",children:[r.jsx("b",{children:"Line details"}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>navigator.clipboard.writeText(s.raw).then(()=>l({kind:"success",title:"Line copied"}),()=>l({kind:"danger",title:"Couldn’t copy"})),children:[r.jsx(ce,{name:"copy"})," Copy line"]}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon",onClick:n,"aria-label":"Close details",children:r.jsx(ce,{name:"x"})})]}),r.jsx("dl",{className:"kv",children:o.filter(([,d])=>d).map(([d,_])=>r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:d}),r.jsx("dd",{className:"mono",children:_})]},d))}),r.jsx("pre",{className:"log-details-msg",children:s.message}),s.extras&&r.jsx("pre",{className:"log-details-json",children:JSON.stringify(s.extras,null,2)})]})}const ZT=[{key:"time",label:"Time",width:"88px",get:s=>UT(s)},{key:"level",label:"Level",width:"52px",get:s=>s.level},{key:"process",label:"Process",width:"minmax(80px, 160px)",get:s=>s.process??s.context,wide:!0},{key:"msgid",label:"Message ID",width:"minmax(80px, 170px)",get:s=>s.msgid,wide:!0},{key:"message",label:"Message",width:"minmax(0, 1fr)",get:s=>s.extras?`${s.message} ${JSON.stringify(s.extras)}`:s.message}],XT=[{key:"time",label:"Since boot",width:"100px",get:s=>s.monotonic!==void 0?s.monotonic.toFixed(3):""},{key:"level",label:"Level",width:"58px",get:s=>s.level},{key:"facility",label:"Facility",width:"64px",get:s=>s.facility,wide:!0},{key:"context",label:"Source",width:"minmax(80px, 170px)",get:s=>s.context,wide:!0,optional:!0},{key:"message",label:"Message",width:"minmax(0, 1fr)",get:s=>s.message}];function Em({device:s,what:n,children:l}){return s.username==="root"?r.jsx(r.Fragment,{children:l}):r.jsx("section",{className:"card col-12",children:r.jsxs($e,{kind:"info",title:"Needs a rooted TV",children:[n," is only available when you are logged in as root (a rooted TV with Homebrew Channel). Developer Mode logins can still read ",r.jsx(Jt,{to:"/debug/crashes",children:"crash reports"}),"."]})})}const WT=(s,n)=>LT(s,n);function QT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"System",accent:"log",sub:r.jsxs(r.Fragment,{children:["Live ",r.jsx("span",{className:"mono",children:"/var/log/messages"}),s?r.jsxs(r.Fragment,{children:[" from ",r.jsx(ii,{device:s})]}):null,". Developer logging is switched on when it starts. Set what gets logged in"," ",r.jsx(Jt,{to:"/debug/pmlog",children:"Log levels"}),"."]}),actions:r.jsxs(Jt,{to:"/debug/pmlog",className:"btn btn--ghost",children:[r.jsx(ce,{name:"cog"})," Log levels"]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(Em,{device:s,what:"The system log",children:r.jsx(oS,{device:s,source:"syslog",parse:WT,columns:ZT,history:100,clearLabel:"Clear on TV",label:"System log"},s.id)})})})]})}function JT(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Kernel",accent:"log",sub:r.jsxs(r.Fragment,{children:["The kernel ring buffer (",r.jsx("span",{className:"mono",children:"dmesg"}),")",s?r.jsxs(r.Fragment,{children:[" of ",r.jsx(ii,{device:s})]}):null,", followed live."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(Em,{device:s,what:"The kernel log",children:r.jsx(oS,{device:s,source:"dmesg",parse:HT,columns:XT,clearLabel:"Clear on TV",label:"Kernel log"},s.id)})})})]})}const Vf=[{level:"none",label:"None"},{level:"debug",label:"Debug"},{level:"info",label:"Info"},{level:"notice",label:"Notice"},{level:"warning",label:"Warning"},{level:"err",label:"Error"},{level:"crit",label:"Critical"},{level:"alert",label:"Alert"},{level:"emerg",label:"Emergency"}];function ek(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Log",accent:"levels",sub:r.jsxs(r.Fragment,{children:["How much each PmLog context writes to the ",r.jsx(Jt,{to:"/debug/logs",children:"system log"}),s?r.jsxs(r.Fragment,{children:[" on ",r.jsx(ii,{device:s})]}):null,". Changes last until the TV restarts."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(Em,{device:s,what:"Setting log levels",children:r.jsx(tk,{device:s},s.id)})})})]})}function tk({device:s}){const{ready:n,call:l}=ut(),{toast:o}=jt(),d=En(),_=["pmlog",s.id],w=ss({queryKey:_,queryFn:async()=>(await l("pmlog.show",{device:gt(s)})).contexts,enabled:n}),[c,h]=M.useState(""),[y,p]=M.useState(null),[f,x]=M.useState(""),[C,j]=M.useState("debug"),E=w.data??[],g=M.useMemo(()=>{const N=c.trim().toLowerCase();return E.filter(T=>!N||T.name.toLowerCase().includes(N))},[E,c]),b=async(N,T)=>{p(N);try{const{changed:D}=await l("pmlog.set",{device:gt(s),context:N,level:T});d.setQueryData(_,(O=[])=>{const k=O.map(L=>D.includes(L.name)?{...L,level:T}:L);for(const L of D)k.some(V=>V.name===L)||k.push({name:L,level:T});return k}),D.length?N==="*"&&o({kind:"success",title:`All contexts set to ${T}`}):o({kind:"warning",title:"Nothing changed",text:`PmLogCtl didn’t report any change for ${N}.`})}catch(D){o({kind:"danger",title:"Couldn’t set the level",text:xt(D).message})}finally{p(null)}},v=N0.safeParse(f.trim()).success,S=async N=>{N.preventDefault(),v&&(await b(f.trim(),C),x(""))};return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"card col-8",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsx("div",{className:"data-toolbar-left",children:r.jsxs("div",{className:"input-icon",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input",type:"search",placeholder:"Filter contexts…",value:c,onChange:N=>h(N.target.value),"aria-label":"Filter contexts"})]})}),r.jsxs("div",{className:"data-toolbar-right",children:[w.data&&r.jsxs("span",{className:"muted count-label",children:[g.length," of ",E.length]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>w.refetch(),disabled:!n||w.isFetching,"aria-label":"Reload",children:r.jsx(ce,{name:"refresh"})})]})]}),w.error?r.jsx(Nt,{error:w.error,title:"Couldn’t read the log levels",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>w.refetch(),children:"Retry"})}):w.data?r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table pmlog-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Context"}),r.jsx("th",{children:"Level"})]})}),r.jsxs("tbody",{children:[r.jsxs("tr",{className:"pmlog-all",children:[r.jsx("td",{children:r.jsxs("label",{htmlFor:"pmlog-all",children:[r.jsx("b",{children:"All contexts"})," ",r.jsx("span",{className:"muted",children:"(sets every context)"})]})}),r.jsx("td",{children:r.jsxs("select",{id:"pmlog-all",className:"select select--sm",value:"",disabled:y!==null,onChange:N=>N.target.value&&b("*",N.target.value),children:[r.jsx("option",{value:"",children:"Choose…"}),Vf.map(N=>r.jsx("option",{value:N.level,children:N.label},N.level))]})})]}),g.map(N=>r.jsxs("tr",{children:[r.jsx("td",{className:"mono",children:r.jsx("label",{htmlFor:`pmlog-${N.name}`,children:N.name})}),r.jsxs("td",{children:[r.jsx(Ab,{id:`pmlog-${N.name}`,value:N.level,disabled:y!==null,onChange:T=>b(N.name,T)}),y===N.name&&r.jsx("span",{className:"spinner sm"})]})]},N.name))]})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Reading PmLog contexts…"})]})]}),r.jsxs("section",{className:"card col-4",children:[r.jsx("div",{className:"card-head",children:r.jsxs("div",{className:"card-title-wrap",children:[r.jsx("span",{className:"eyebrow",children:"PmLogCtl"}),r.jsx("h2",{className:"card-title",children:"Set a context"})]})}),r.jsxs("form",{className:"stack",onSubmit:S,children:[r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"pmlog-ctx",children:"Context"}),r.jsx("input",{id:"pmlog-ctx",className:`input mono${f&&!v?" is-invalid":""}`,placeholder:"* for all",value:f,onChange:N=>x(N.target.value),autoComplete:"off",spellCheck:!1}),f&&!v&&r.jsx("span",{className:"field-error",children:"Letters, digits and . _ - < > * only."})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{className:"field-label",htmlFor:"pmlog-level",children:"Level"}),r.jsx(Ab,{id:"pmlog-level",value:C,onChange:j})]}),r.jsxs("button",{type:"submit",className:"btn btn--primary",disabled:!n||!v||y!==null,children:[r.jsx(ce,{name:"check"})," Set level"]}),r.jsx("p",{className:"muted small",children:"For contexts that aren’t listed yet, e.g. an app’s own context. “Debug” logs the most, “None” turns a context off."})]})]})]})}function Ab({id:s,value:n,onChange:l,disabled:o}){const d=Vf.some(_=>_.level===n);return r.jsxs("select",{id:s,className:"select select--sm",value:n,disabled:o,onChange:_=>l(_.target.value),children:[!d&&r.jsx("option",{value:n,children:n}),Vf.map(_=>r.jsx("option",{value:_.level,children:_.label},_.level))]})}const sk=s=>{const n=s;return!!n&&typeof n.id=="string"&&typeof n.deviceId=="string"&&typeof n.at=="number"&&n.blob instanceof Blob},cS=()=>Sl.forEach(s=>s());async function ik(s){const n=await ir();return(await zc(n.transaction(As,"readonly").objectStore(As).index("deviceId").getAll(IDBKeyRange.only(s)))).filter(sk).sort((o,d)=>o.at-d.at)}async function nk(s,n,l){const o={id:crypto.randomUUID(),deviceId:s,at:Date.now(),method:l,blob:n},d=await ir();return await zc(d.transaction(As,"readwrite").objectStore(As).add(o)),cS(),o}async function rk(s){if(!s.length)return;const n=await ir();await new Promise((l,o)=>{const d=n.transaction(As,"readwrite");for(const _ of s)d.objectStore(As).delete(_);d.oncomplete=()=>l(),d.onerror=()=>o(d.error)}),cS()}function ak(s){const[n,l]=M.useState({id:s,shots:null,error:null});return M.useEffect(()=>{let o=!0;const d=()=>ik(s).then(_=>o&&l({id:s,shots:_,error:null}),_=>o&&l({id:s,shots:[],error:_}));return d(),Sl.add(d),()=>{o=!1,Sl.delete(d)}},[s]),n.id===s?n:{shots:null,error:null}}function lk(s){const[n,l]=M.useState(()=>new Map);return M.useEffect(()=>{const o=new Map((s??[]).map(d=>[d.id,URL.createObjectURL(d.blob)]));return l(o),()=>o.forEach(d=>URL.revokeObjectURL(d))},[s]),n}const ok=s=>s.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"tv";function hf(s,n){const l=new Date(n.at).toISOString().replace(/[:.]/g,"-").slice(0,19);return`${ok(s)}-${l}.png`}function Ac(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(0)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function ck(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Crash",accent:"reports",sub:r.jsxs(r.Fragment,{children:["When a native app or service crashes",s?r.jsxs(r.Fragment,{children:[" on ",r.jsx(ii,{device:s})]}):null,", its report shows up here. They are kept in the TV’s /tmp, so a restart clears them."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(uk,{device:s},s.id)})})]})}function uk({device:s}){const{ready:n,call:l}=ut(),{confirm:o,toast:d}=jt(),_=En(),w=["crashes",s.id],c=ss({queryKey:w,queryFn:()=>l("crashes.list",{device:gt(s)}),enabled:n}),[h,y]=M.useState(null),p=M.useMemo(()=>(c.data?.reports??[]).map(C=>({...C,...zT(C.name)})),[c.data]),f=async(C,j)=>{try{const{text:E,truncated:g}=j??await l("crashes.read",{device:gt(s),path:C.path},6e4);Cn(new Blob([`${E}
41
+ `],{type:"text/plain"}),`${C.saveName}.txt`),g&&d({kind:"warning",title:"Saved the first 2 MB only",text:"The report is longer; download the whole file from the Files page."})}catch(E){d({kind:"danger",title:"Couldn’t read the crash report",text:xt(E).message})}},x=async C=>{if(await o({title:"Delete this crash report?",message:r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"mono",children:C.title}),r.jsx("p",{children:"It is deleted from the TV. This can’t be undone."})]}),confirmText:"Delete",danger:!0}))try{await l("crashes.delete",{device:gt(s),path:C.path}),h?.path===C.path&&y(null),await _.invalidateQueries({queryKey:w})}catch(E){d({kind:"danger",title:"Couldn’t delete the crash report",text:xt(E).message})}};return r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsx("div",{className:"data-toolbar-left",children:c.data?.dir&&r.jsx("span",{className:"muted mono small",children:c.data.dir})}),r.jsxs("div",{className:"data-toolbar-right",children:[c.data&&r.jsxs("span",{className:"muted count-label",children:[p.length," ",p.length===1?"report":"reports"]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>c.refetch(),disabled:!n||c.isFetching,"aria-label":"Reload",children:r.jsx(ce,{name:"refresh"})})]})]}),c.error?r.jsx(Nt,{error:c.error,title:"Couldn’t find crash reports",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>c.refetch(),children:"Retry"})}):c.data?p.length===0?r.jsxs("div",{className:"empty-state",children:[r.jsx("div",{className:"empty-icon",children:r.jsx(ce,{name:"check"})}),r.jsx("h3",{children:"No crash reports"}),r.jsx("p",{children:"If a native application crashes, its crash report will be available here."})]}):r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table crash-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Crash"}),r.jsx("th",{className:"hide-sm",children:"When"}),r.jsx("th",{className:"hide-sm files-num",children:"Size"}),r.jsx("th",{"aria-label":"Actions"})]})}),r.jsx("tbody",{children:p.map(C=>r.jsxs("tr",{children:[r.jsx("td",{children:r.jsxs("button",{type:"button",className:"crash-open",onClick:()=>y(C),children:[r.jsx("span",{className:"crash-title",children:C.title}),C.summary&&r.jsx("span",{className:"crash-summary mono",children:C.summary})]})}),r.jsx("td",{className:"hide-sm nowrap",children:C.mtime?new Date(C.mtime).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):"—"}),r.jsx("td",{className:"hide-sm files-num nowrap",children:Ac(C.size)}),r.jsx("td",{children:r.jsxs("div",{className:"row-actions",children:[r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>y(C),children:"View"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon",onClick:()=>f(C),"aria-label":`Download ${C.title}`,title:"Download",children:r.jsx(ce,{name:"download"})}),C.writable&&r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon btn--danger-ghost",onClick:()=>x(C),"aria-label":`Delete ${C.title}`,title:"Delete",children:r.jsx(ce,{name:"trash"})})]})})]},C.path))})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Looking for crash reports…"})]}),h&&r.jsx(hk,{device:s,report:h,onClose:()=>y(null),onDownload:C=>f(h,C)})]})}function hk({device:s,report:n,onClose:l,onDownload:o}){const{ready:d,call:_}=ut(),{toast:w}=jt(),c=ss({queryKey:["crash",s.id,n.path],queryFn:()=>_("crashes.read",{device:gt(s),path:n.path},6e4),enabled:d,staleTime:1/0}),h=()=>c.data&&navigator.clipboard.writeText(c.data.text).then(()=>w({kind:"success",title:"Crash report copied"}),()=>w({kind:"danger",title:"Couldn’t copy"}));return r.jsxs(si,{open:!0,onClose:l,size:"lg",title:n.title,footer:r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:h,disabled:!c.data,children:[r.jsx(ce,{name:"copy"})," Copy"]}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>c.data&&o(c.data),disabled:!c.data,children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsx("span",{className:"spacer"}),r.jsx("button",{type:"button",className:"btn btn--primary",onClick:l,children:"Close"})]}),children:[n.summary&&r.jsx("p",{className:"muted mono small",children:n.summary}),c.error?r.jsx(Nt,{error:c.error,title:"Couldn’t read the crash report"}):c.data?r.jsxs(r.Fragment,{children:[c.data.truncated&&r.jsx($e,{kind:"warning",title:"Shortened",children:"This report is very long; only the first 2 MB are shown. Download it from the Files page for the whole file."}),r.jsx("pre",{className:"crash-text",children:c.data.text||"(empty)"})]}):r.jsx("div",{className:"empty-state",children:r.jsx("span",{className:"spinner"})})]})}const dk=32*1024*1024,fk=26;function mk(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Debug",title:"Luna",accent:"monitor",sub:r.jsxs(r.Fragment,{children:["Every call on the luna service bus",s?r.jsxs(r.Fragment,{children:[" of ",r.jsx(ii,{device:s})]}):null,", with its replies — what apps ask the system and what it answers."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(pk,{device:s},s.id)})})]})}function pk({device:s}){const{toast:n}=jt(),l=M.useRef(new Rb),o=M.useRef([]),d=M.useRef(0),_=I=>{o.current.push(I),d.current+=I.length;let A=0;for(;d.current>dk&&A<o.current.length-1;)d.current-=o.current[A++].length;A&&o.current.splice(0,A)},[w,c]=M.useState(0),[h,y]=M.useState("none"),[p,f]=M.useState(""),[x,C]=M.useState(""),[j,E]=M.useState(null),g=M.useRef(0),b=M.useRef(null),v=s.username==="root",S=M.useCallback(()=>{g.current||(g.current=requestAnimationFrame(()=>{g.current=0,c(I=>I+1)}))},[]);M.useEffect(()=>()=>cancelAnimationFrame(g.current),[]);const N=M.useCallback(I=>{for(const A of I){const B=jb(A);B&&(_(A),l.current.add(B))}S()},[S]),{state:T,start:D,stop:O,ready:k}=aS(s,"lsmonitor",N),L=T.phase==="running"&&h==="live",V=()=>{l.current=new Rb,o.current=[],d.current=0,E(null),c(I=>I+1)},q=()=>{V(),y("live"),D()},Y=async I=>{const A=I.target.files?.[0];if(I.target.value="",!!A){O();try{const B=await A.text();V();let F=0;for(const $ of B.split(`
42
+ `)){if(!$.trim())continue;const J=jb($);if(!J){F++;continue}_($),l.current.add(J)}y("file"),f(A.name),c($=>$+1),F&&n({kind:"warning",title:`${F} lines skipped`,text:"They weren’t ls-monitor JSON messages."})}catch(B){n({kind:"danger",title:"Couldn’t open the file",text:xt(B).message})}}},P=()=>{const I=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);Cn(new Blob([`${o.current.join(`
43
43
  `)}
44
- `],{type:"application/x-ndjson"}),`${s.name.replace(/[^A-Za-z0-9._-]+/g,"-")}-ls-monitor-${I}.jsonl`)},Q=M.useMemo(()=>zT(x),[x]),he=M.useMemo(()=>l.current.calls.filter(I=>$T(I,Q)),[Q,w]),ne=j!==null?l.current.calls.find(I=>I.id===j)??null:null,W=l.current.calls.length;return r.jsxs("section",{className:"card col-12 log-card",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsx("div",{className:"data-toolbar-left",children:r.jsxs("div",{className:"input-icon monitor-search",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input mono",type:"search",placeholder:"text sender:com.webos.app.home destination:… -sender:…",value:x,onChange:I=>C(I.target.value),"aria-label":"Filter calls (sender:, destination:, - to exclude)",spellCheck:!1})]})}),r.jsxs("div",{className:"data-toolbar-right",children:[h!=="none"&&r.jsxs("span",{className:`log-status ${L?"running":"ended"}`,role:"status",children:[r.jsx("span",{className:"dot"}),L?"Capturing":h==="file"?p:"Stopped"]}),L?r.jsxs("button",{type:"button",className:"btn btn--sm btn--danger",onClick:O,children:[r.jsx(ce,{name:"x"})," Stop"]}):r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",onClick:q,disabled:!k||!v,title:v?void 0:"Needs a rooted TV",children:[r.jsx(ce,{name:"play"})," ",h==="live"?"Capture again":"Start capture"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>b.current?.click(),disabled:L,children:[r.jsx(ce,{name:"folder"})," Open…"]}),r.jsx("input",{ref:b,type:"file",accept:".jsonl,.json,.txt,application/x-ndjson",hidden:!0,onChange:Y}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:P,disabled:!o.current.length,children:[r.jsx(ce,{name:"download"})," Save"]})]})]}),!v&&r.jsx($e,{kind:"info",title:"Capturing needs a rooted TV",children:"ls-monitor only runs as root. You can still open a capture saved earlier (.jsonl)."}),T.phase==="error"&&h==="live"&&r.jsx(Nt,{error:T.error,title:"The capture stopped"}),T.dropped>0&&r.jsxs($e,{kind:"warning",title:"Some messages were skipped",children:["The bus was busier than the bridge forwards (",T.dropped.toLocaleString()," lines skipped). Filtering doesn’t reduce this — it happens before."]}),r.jsxs("div",{className:`monitor${ne?" has-details":""}`,children:[r.jsx(aS,{items:he,rowHeight:dk,keyOf:I=>I.id,label:"Luna calls",className:"log-list monitor-list",header:r.jsxs("div",{className:"log-row log-head monitor-row",children:[r.jsx("span",{children:"Call"}),!ne&&r.jsx("span",{className:"hide-sm",children:"Sender"}),!ne&&r.jsx("span",{className:"hide-sm",children:"Payload"})]}),empty:r.jsx("div",{className:"log-empty muted",children:h==="none"?"Start a capture to watch the bus, or open a saved one.":W?"No calls match the filter.":L?"Waiting for calls…":"No calls."}),render:I=>r.jsxs("button",{type:"button",className:`log-row monitor-row${I.id===j?" is-selected":""}`,onClick:()=>E(I.id===j?null:I.id),children:[r.jsxs("span",{className:"monitor-name",children:[r.jsx("span",{className:`call-dot ${I.status}`,role:"img",title:Db[I.status],"aria-label":Db[I.status]}),I.name]}),!ne&&r.jsx("span",{className:"hide-sm",children:I.sender}),!ne&&r.jsx("span",{className:"hide-sm mono",children:I.information})]})}),ne&&r.jsx(pk,{entry:ne,onClose:()=>E(null)})]}),r.jsxs("div",{className:"data-foot",children:[r.jsxs("span",{children:[he.length.toLocaleString()," of ",W.toLocaleString()," calls"]}),r.jsx("span",{className:"muted",children:"Filter: words, sender:…, destination:…, put - in front to exclude."})]})]})}const Db={pending:"No reply yet",ok:"Replied",error:"Replied with an error",cancelled:"Cancelled"},Ab={call:"→",return:"←",callCancel:"×"};function pk({entry:s,onClose:n}){const[l,o]=M.useState(0);M.useEffect(()=>o(0),[s.id]);const d=s.messages[l]??s.messages[0];return r.jsxs("div",{className:"monitor-details",role:"region","aria-label":"Call details",children:[r.jsxs("div",{className:"log-details-head",children:[r.jsx("b",{className:"mono monitor-details-name",children:s.name}),r.jsx("span",{className:"spacer"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon",onClick:n,"aria-label":"Close details",children:r.jsx(ce,{name:"x"})})]}),s.skipped?r.jsxs("p",{className:"muted small",children:[s.skipped.toLocaleString()," older replies not kept."]}):null,r.jsx("ol",{className:"monitor-messages",children:s.messages.map((_,w)=>r.jsx("li",{children:r.jsxs("button",{type:"button",className:`monitor-msg${w===l?" is-selected":""}`,onClick:()=>o(w),"aria-pressed":w===l,children:[r.jsx("span",{className:"monitor-arrow",role:"img","aria-label":_.type==="call"?"Call":_.type==="return"?"Reply":_.type==="callCancel"?"Cancel":_.type,children:(Object.hasOwn(Ab,_.type)?Ab[_.type]:void 0)??"•"}),r.jsx("span",{className:"mono",children:_.information||"(no payload)"})]})},w))}),d&&r.jsxs("div",{className:"monitor-msg-detail",children:[r.jsxs("dl",{className:"kv",children:[r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:"Type"}),r.jsx("dd",{children:d.type})]}),r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:"Sender"}),r.jsx("dd",{className:"mono",children:d.sender})]}),r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:"Destination"}),r.jsxs("dd",{className:"mono",children:[d.destination,d.methodCategory&&d.methodCategory!=="/"?d.methodCategory:"",d.method?`/${d.method}`:""]})]})]}),d.payload!==void 0&&r.jsx("pre",{className:"log-details-json",children:JSON.stringify(d.payload,null,2)}),d.rawPayload&&r.jsx("pre",{className:"log-details-json",children:d.rawPayload})]})]})}const Vf={Modern:{label:"Modern",target:"2022 and newer TVs, the fastest",webos:"webOS 22+"},Normal:{label:"Normal",target:"2021 and newer TVs",webos:"webOS 6+"},Legacy:{label:"Legacy",target:"2018–2020 TVs",webos:"webOS 4–5"},"Ultra-Legacy":{label:"Ultra Legacy",target:"2014–2017 TVs",webos:"webOS 1–3"},"Ultra-Legacy-NoService":{label:"Ultra Legacy, no service",target:"Ultra Legacy without Litefin’s background service — if Ultra Legacy won’t start",webos:""}},Ob=Object.keys(Vf),Wr=s=>(Object.hasOwn(Vf,s)?Vf[s]:void 0)??{label:s.replace(/-/g," "),target:"",webos:""};function gk(s){const n=new Set(s.flatMap(d=>d.assets.map(_=>_.variant))),l=Ob.filter(d=>n.has(d)),o=[...n].filter(d=>!Ob.includes(d)).sort();return[...l,...o]}function vk(s){const n=Number(/^(\d+)/.exec(s??"")?.[1]);return!Number.isFinite(n)||n<=0?null:n>=7?"Modern":n>=6?"Normal":n>=4?"Legacy":"Ultra-Legacy"}function df(s,n){const l=s.split(/[.-]/).map(d=>Number(d)),o=n.split(/[.-]/).map(d=>Number(d));for(let d=0;d<Math.max(l.length,o.length);d++){const _=l[d]??0,w=o[d]??0;if(Number.isNaN(_)||Number.isNaN(w))return s.localeCompare(n);if(_!==w)return _-w}return 0}const Lb=["litefin-releases"];function _k(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Apps",title:"Litefin",accent:"repo",sub:r.jsxs(r.Fragment,{children:["Every webOS build of the last ",k2," ",r.jsx("b",{children:"Litefin"})," releases (a lightweight Jellyfin client), straight from"," ",r.jsx("a",{href:Af,target:"_blank",rel:"noopener noreferrer",children:"its GitHub releases"}),". The Homebrew repository only has one build per version."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(yk,{device:s},s.id)})})]})}function yk({device:s}){const{ready:n,call:l}=ut(),{confirm:o,toast:d}=jt(),_=En(),w=ss({queryKey:Lb,queryFn:()=>l("litefin.list",{},6e4),enabled:n,staleTime:5*6e4,retry:!1}),c=Vc(s),h=qc(s,c.data),[y,p]=M.useState(!1),f=M.useMemo(()=>w.data?.releases??[],[w.data]),x=M.useMemo(()=>gk(f),[f]),C=c.data?.find(v=>v.id===T2),j=vk(s.info?.osVersion),E=f[0],g=async()=>{p(!0);try{_.setQueryData(Lb,await l("litefin.list",{refresh:!0},6e4)),c.refetch()}catch(v){d({kind:"danger",title:"Couldn’t refresh the releases",text:xt(v).message})}finally{p(!1)}},b=async(v,S)=>{const N=`Litefin ${v.version} (${Wr(S).label})`;if(c.data){if(C){const T=C.version&&df(v.version,C.version)<0;if(!await o({title:`Replace Litefin on ${s.name}?`,message:r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["Litefin ",C.version?r.jsxs("b",{children:["v",C.version]}):null," is installed. Every Litefin build is the same app, so installing"," ",r.jsx("b",{children:N})," replaces it."]}),T&&r.jsx("p",{children:"This is an older version than the one installed."})]}),confirmText:"Install"}))return}}else if(!await o({title:`Install ${N}?`,message:r.jsxs("p",{children:["The apps on ",s.name," couldn’t be read, so it isn’t known whether Litefin is installed. If it is, this replaces it."]}),confirmText:"Install"}))return;await h.installLitefin(v.tag,S,N)};return r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left litefin-status",children:[r.jsx("span",{className:"device-av",children:r.jsx(ce,{name:"tv"})}),r.jsxs("span",{children:[c.isLoading?r.jsxs("span",{className:"muted",children:["Checking ",s.name,"…"]}):C?r.jsxs(r.Fragment,{children:["Litefin ",r.jsxs("b",{className:"mono",children:["v",C.version]})," is installed on ",r.jsx(ii,{device:s}),E&&C.version&&df(E.version,C.version)>0&&r.jsxs("span",{className:"badge warning litefin-badge",children:["v",E.version," available"]})]}):r.jsxs(r.Fragment,{children:["Litefin isn’t installed on ",r.jsx(ii,{device:s})]}),j&&r.jsxs("span",{className:"muted litefin-suggest",children:[" ","· Suggested for this TV: ",r.jsx("b",{children:Wr(j).label})]})]})]}),r.jsxs("div",{className:"data-toolbar-right",children:[w.data&&r.jsxs("span",{className:"muted count-label",children:[f.length," releases"]}),r.jsxs("a",{className:"btn btn--ghost btn--sm",href:Af,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"github"})," GitHub"]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:g,disabled:!n||y,"aria-label":"Refresh",title:"Check GitHub again",children:y?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"refresh"})})]})]}),w.data?.stale&&r.jsx($e,{kind:"warning",title:"Showing the list from earlier",children:w.data.stale}),w.error?r.jsx(Nt,{error:w.error,title:"Couldn’t load Litefin’s releases",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>w.refetch(),children:"Retry"})}):w.data?f.length?r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table litefin-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{scope:"col",children:"Release"}),x.map(v=>{const S=Wr(v);return r.jsxs("th",{className:v===j?"is-suggested":void 0,scope:"col",children:[r.jsx("span",{className:"litefin-variant",children:S.label}),(S.webos||S.target)&&r.jsx("span",{className:"litefin-variant-sub",children:S.webos||"If Ultra Legacy won’t start"}),v===j&&r.jsx("span",{className:"badge success litefin-badge",children:"Suggested"})]},v)})]})}),r.jsx("tbody",{children:f.map((v,S)=>{const N=!!C?.version&&df(C.version,v.version)===0;return r.jsxs("tr",{children:[r.jsxs("th",{scope:"row",className:"litefin-release",children:[r.jsxs("span",{className:"litefin-version mono",children:["v",v.version]}),S===0&&r.jsx("span",{className:"badge info litefin-badge",children:"Latest"}),N&&r.jsx("span",{className:"badge success litefin-badge",children:"Installed"}),r.jsxs("span",{className:"litefin-date muted",children:[v.publishedAt?new Date(v.publishedAt).toLocaleDateString(void 0,{dateStyle:"medium"}):""," ·"," ",r.jsx("a",{href:`${Af}/tag/${encodeURIComponent(v.tag)}`,target:"_blank",rel:"noopener noreferrer",children:"Notes"})]})]}),x.map(T=>{const D=v.assets.find(k=>k.variant===T),O=`Install Litefin ${v.version} ${Wr(T).label}`;return r.jsx("td",{className:T===j?"is-suggested":void 0,children:D?r.jsxs("div",{className:"litefin-cell",children:[r.jsxs("button",{type:"button",className:`btn btn--sm ${T===j&&S===0?"btn--primary":"btn--ghost"}`,onClick:()=>b(v,T),disabled:!n||h.busy||c.isLoading,"aria-label":O,title:D.name,children:[r.jsx(ce,{name:"download"})," Install"]}),r.jsx("span",{className:"muted litefin-size",children:D.size?Ac(D.size):""})]}):r.jsxs("span",{className:"muted",children:[r.jsx("span",{"aria-hidden":"true",children:"—"}),r.jsxs("span",{className:"sr-only",children:["No ",Wr(T).label," build"]})]})},T)})]},v.tag)})})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("h3",{children:"No releases with webOS builds"}),r.jsx("p",{children:"GitHub lists no published Litefin release with a webOS IPK right now."})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Reading Litefin’s releases from GitHub…"})]}),w.data&&f.length>0&&r.jsxs("div",{className:"litefin-help",children:[r.jsx("b",{children:"Which build?"}),r.jsx("ul",{className:"plain-list litefin-help-list",children:x.map(v=>{const S=Wr(v);return r.jsxs("li",{children:[r.jsx("b",{children:S.label}),S.target||S.webos?` — ${[S.target,S.webos].filter(Boolean).join(", ")}`:""]},v)})}),r.jsxs("p",{className:"muted",children:["If you are unsure, try ",r.jsx("b",{children:"Normal"})," first. If the app feels sluggish or fails to load, move down to ",r.jsx("b",{children:"Legacy"}),". All builds are the same app, so installing one replaces the other."]})]}),h.dialog]})}let hc=null;function bk(s){if(!hc){hc=new Uint32Array(256);for(let l=0;l<256;l++){let o=l;for(let d=0;d<8;d++)o=o&1?3988292384^o>>>1:o>>>1;hc[l]=o>>>0}}let n=4294967295;for(let l=0;l<s.length;l++)n=hc[(n^s[l])&255]^n>>>8;return(n^4294967295)>>>0}function Sk(s){return{time:s.getHours()<<11|s.getMinutes()<<5|Math.floor(s.getSeconds()/2),date:Math.max(0,s.getFullYear()-1980)<<9|s.getMonth()+1<<5|s.getDate()}}function xk(s){const n=new TextEncoder,l=[],o=[];let d=0;for(const c of s){const h=n.encode(c.name),y=bk(c.data),{time:p,date:f}=Sk(c.date??new Date),x=new DataView(new ArrayBuffer(30));x.setUint32(0,67324752,!0),x.setUint16(4,20,!0),x.setUint16(6,2048,!0),x.setUint16(8,0,!0),x.setUint16(10,p,!0),x.setUint16(12,f,!0),x.setUint32(14,y,!0),x.setUint32(18,c.data.length,!0),x.setUint32(22,c.data.length,!0),x.setUint16(26,h.length,!0),x.setUint16(28,0,!0),l.push(x.buffer,h,c.data);const C=new DataView(new ArrayBuffer(46));C.setUint32(0,33639248,!0),C.setUint16(4,20,!0),C.setUint16(6,20,!0),C.setUint16(8,2048,!0),C.setUint16(10,0,!0),C.setUint16(12,p,!0),C.setUint16(14,f,!0),C.setUint32(16,y,!0),C.setUint32(20,c.data.length,!0),C.setUint32(24,c.data.length,!0),C.setUint16(28,h.length,!0),C.setUint32(42,d,!0);const j=new Uint8Array(46+h.length);j.set(new Uint8Array(C.buffer),0),j.set(h,46),o.push(j),d+=30+h.length+c.data.length}const _=o.reduce((c,h)=>c+h.length,0),w=new DataView(new ArrayBuffer(22));return w.setUint32(0,101010256,!0),w.setUint16(8,s.length,!0),w.setUint16(10,s.length,!0),w.setUint32(12,_,!0),w.setUint32(16,d,!0),new Blob([...l,...o,w.buffer],{type:"application/zip"})}const cS=[{id:"DISPLAY",label:"Everything"},{id:"VIDEO",label:"Video only"},{id:"GRAPHIC",label:"UI only"}],wk=s=>cS.find(n=>n.id===s)?.label??s,ff=s=>new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"});function Ck({device:s,className:n}){const{ready:l,call:o}=ut(),{confirm:d,toast:_}=jt(),[w,c]=M.useState("DISPLAY"),[h,y]=M.useState(!1),[p,f]=M.useState(null),{shots:x,error:C}=rk(s.id),j=ak(x),[E,g]=M.useState(null),[b,v]=M.useState(new Set),S=M.useRef(null),N=s.username==="root",T=x??[],D=E?T.findIndex(I=>I.id===E):-1,O=D>=0?D:T.length-1,k=T[O],L=T.filter(I=>b.has(I.id)),V=T.reduce((I,A)=>I+A.blob.size,0);M.useEffect(()=>{const I=S.current?.querySelector(".shot-thumb.is-current"),A=S.current;!I||!A||(I.offsetLeft<A.scrollLeft?A.scrollLeft=I.offsetLeft-8:I.offsetLeft+I.offsetWidth>A.scrollLeft+A.clientWidth&&(A.scrollLeft=I.offsetLeft+I.offsetWidth-A.clientWidth+8))},[k?.id,T.length]);const q=async()=>{y(!0),f(null);try{const I=await o("device.screenshot",{device:gt(s),method:w},6e4),A=atob(I.base64),B=new Uint8Array(A.length);for(let $=0;$<A.length;$++)B[$]=A.charCodeAt($);const F=await ik(s.id,new Blob([B],{type:I.mime}),w);g(F.id)}catch(I){f(I)}finally{y(!1)}},Y=I=>{const A=T[Math.max(0,Math.min(T.length-1,I))];A&&g(A.id)},P=I=>{const A={ArrowLeft:O-1,ArrowRight:O+1,Home:0,End:T.length-1}[I.key];A!==void 0&&(I.preventDefault(),Y(A))},Q=I=>v(A=>{const B=new Set(A);return B.has(I)?B.delete(I):B.add(I),B}),he=T.length>0&&L.length===T.length,ne=async I=>{if(I.length){if(I.length===1){Cn(I[0].blob,hf(s.name,I[0]));return}try{const A=new Map,B=await Promise.all(I.map(async $=>{let J=hf(s.name,$);const z=(A.get(J)??0)+1;return A.set(J,z),z>1&&(J=J.replace(/\.png$/,`-${z}.png`)),{name:J,data:new Uint8Array(await $.blob.arrayBuffer()),date:new Date($.at)}})),F=hf(s.name,{at:Date.now()}).replace(/\.png$/,"");Cn(xk(B),`${F}-screenshots.zip`)}catch(A){_({kind:"danger",title:"Couldn’t make the zip file",text:xt(A).message})}}},W=async I=>{if(!I.length||!await d({title:I.length===1?"Delete this screenshot?":I.length===T.length?`Delete all ${I.length} screenshots?`:`Delete ${I.length} screenshots?`,message:r.jsx("p",{children:"They are removed from this browser. Download any you want to keep first. Nothing on the TV is affected."}),confirmText:"Delete",danger:!0}))return;const B=new Set(I.map(F=>F.id));if(k&&B.has(k.id)){const F=T.slice(O+1).find(J=>!B.has(J.id)),$=T.slice(0,O).reverse().find(J=>!B.has(J.id));g((F??$)?.id??null)}v(F=>new Set([...F].filter($=>!B.has($))));try{await nk([...B])}catch(F){_({kind:"danger",title:"Couldn’t delete the screenshots",text:xt(F).message})}};return r.jsx($i,{eyebrow:"Screen",title:"Screenshots",className:n,children:r.jsxs("div",{className:"stack",children:[N?r.jsxs("div",{className:"row",children:[r.jsx("div",{className:"tabs pills",role:"group","aria-label":"What to capture",children:cS.map(I=>r.jsx("button",{type:"button","aria-pressed":w===I.id,className:`tab${w===I.id?" is-active":""}`,onClick:()=>c(I.id),children:I.label},I.id))}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:q,disabled:h||!l,children:[h?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"image"})," Take screenshot"]})]}):r.jsx($e,{kind:"info",title:"Needs a rooted TV",children:"Screenshots use the TV’s capture service, which only root can call. Developer Mode logins can’t take them."}),p!==null&&r.jsx(Nt,{error:p,title:"Couldn’t take a screenshot"}),C!==null&&r.jsx(Nt,{error:C,title:"Couldn’t read the saved screenshots"}),k?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"shots-viewer",tabIndex:0,role:"group","aria-label":"Screenshot viewer — use the arrow keys for older and newer",onKeyDown:P,children:[j.get(k.id)?r.jsx("img",{src:j.get(k.id),alt:`Screenshot of ${s.name}, ${ff(k.at)}`}):r.jsx("div",{className:"shots-viewer-blank"}),r.jsx("button",{type:"button",className:"shots-nav prev",onClick:()=>Y(O-1),disabled:O<=0,"aria-label":"Older screenshot",title:"Older (←)",children:r.jsx(ce,{name:"left"})}),r.jsx("button",{type:"button",className:"shots-nav next",onClick:()=>Y(O+1),disabled:O>=T.length-1,"aria-label":"Newer screenshot",title:"Newer (→)",children:r.jsx(ce,{name:"right"})})]}),r.jsxs("div",{className:"shots-meta",children:[r.jsxs("span",{className:"badge",children:[O+1," of ",T.length]}),r.jsxs("span",{className:"muted",children:[ff(k.at)," · ",wk(k.method)," · ",Ac(k.blob.size)]}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>ne([k]),children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>W([k]),"aria-label":"Delete this screenshot",children:[r.jsx(ce,{name:"trash"})," Delete"]})]}),T.length>1&&r.jsx("ol",{className:"shots-strip",ref:S,"aria-label":"All screenshots, oldest first",children:T.map((I,A)=>{const B=I.id===k.id,F=b.has(I.id);return r.jsxs("li",{className:`shot-thumb${B?" is-current":""}${F?" is-selected":""}`,children:[r.jsx("button",{type:"button",className:"shot-thumb-btn",onClick:()=>g(I.id),"aria-current":B||void 0,"aria-label":`Show screenshot ${A+1}, ${ff(I.at)}`,children:j.get(I.id)&&r.jsx("img",{src:j.get(I.id),alt:""})}),r.jsxs("label",{className:"check shot-thumb-check",children:[r.jsx("input",{type:"checkbox",checked:F,onChange:()=>Q(I.id),"aria-label":`Select screenshot ${A+1}`}),r.jsx("span",{className:"box"})]})]},I.id)})}),r.jsxs("div",{className:"shots-bar",children:[r.jsxs("label",{className:"check",children:[r.jsx("input",{type:"checkbox",checked:he,ref:I=>{I&&(I.indeterminate=L.length>0&&!he)},onChange:()=>v(he?new Set:new Set(T.map(I=>I.id))),"aria-label":"Select all screenshots"}),r.jsx("span",{className:"box"}),r.jsx("span",{children:L.length?`${L.length} selected`:"Select all"})]}),r.jsxs("span",{className:"muted",children:[T.length," ",T.length===1?"screenshot":"screenshots"," · ",Ac(V),", kept in this browser"]}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>ne(L.length?L:T),children:[r.jsx(ce,{name:"download"})," ",L.length?`Download ${L.length}`:"Download all",(L.length||T.length)>1?" (.zip)":""]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost btn--danger-ghost",onClick:()=>W(L.length?L:T),children:[r.jsx(ce,{name:"trash"})," ",L.length?`Delete ${L.length}`:"Delete all","…"]})]})]}):N&&x!==null&&r.jsxs("div",{className:"screenshot screenshot--empty",children:[r.jsx(ce,{name:"image"}),r.jsx("span",{children:"“Everything” is what’s on screen; “Video only” and “UI only” capture one layer. Screenshots are kept in this browser, not on the TV."})]})]})})}const Ek=s=>`https://developer.lge.com/secure/ResetDevModeSession.dev?sessionToken=${encodeURIComponent(s)}`,dl=s=>`'${s.replace(/'/g,"'\\''")}'`,Nk=s=>s.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"tv",jk=/^-----BEGIN [A-Z0-9 ]+-----\n[A-Za-z0-9+/=:,\- \n]+\n-----END [A-Z0-9 ]+-----$/;function Tk(s){const{host:n,port:l,username:o}=s;return!Hc(o)||!K2(n)||n.startsWith("-")||!Number.isInteger(l)||l<1||l>65535?null:{host:n.replace(/^\[(.*)\]$/,"$1"),port:l,username:o}}const kk="[private key hidden]",Rk="[passphrase hidden]";function Mb(s,n={}){if(s.auth.kind!=="key")return null;const l=Tk(s);if(!l)return null;const o=s.auth.privateKey.replace(/\r\n?/g,`
45
- `).trim();if(!jk.test(o))return null;const d=n.redact&&s.auth.passphrase?Rk:s.auth.passphrase??"",_=n.redact?kk:o;return`#!/bin/sh
44
+ `],{type:"application/x-ndjson"}),`${s.name.replace(/[^A-Za-z0-9._-]+/g,"-")}-ls-monitor-${I}.jsonl`)},Q=M.useMemo(()=>$T(x),[x]),he=M.useMemo(()=>l.current.calls.filter(I=>PT(I,Q)),[Q,w]),ne=j!==null?l.current.calls.find(I=>I.id===j)??null:null,W=l.current.calls.length;return r.jsxs("section",{className:"card col-12 log-card",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsx("div",{className:"data-toolbar-left",children:r.jsxs("div",{className:"input-icon monitor-search",children:[r.jsx("span",{className:"ico",children:r.jsx(ce,{name:"search"})}),r.jsx("input",{className:"input mono",type:"search",placeholder:"text sender:com.webos.app.home destination:… -sender:…",value:x,onChange:I=>C(I.target.value),"aria-label":"Filter calls (sender:, destination:, - to exclude)",spellCheck:!1})]})}),r.jsxs("div",{className:"data-toolbar-right",children:[h!=="none"&&r.jsxs("span",{className:`log-status ${L?"running":"ended"}`,role:"status",children:[r.jsx("span",{className:"dot"}),L?"Capturing":h==="file"?p:"Stopped"]}),L?r.jsxs("button",{type:"button",className:"btn btn--sm btn--danger",onClick:O,children:[r.jsx(ce,{name:"x"})," Stop"]}):r.jsxs("button",{type:"button",className:"btn btn--sm btn--primary",onClick:q,disabled:!k||!v,title:v?void 0:"Needs a rooted TV",children:[r.jsx(ce,{name:"play"})," ",h==="live"?"Capture again":"Start capture"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>b.current?.click(),disabled:L,children:[r.jsx(ce,{name:"folder"})," Open…"]}),r.jsx("input",{ref:b,type:"file",accept:".jsonl,.json,.txt,application/x-ndjson",hidden:!0,onChange:Y}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:P,disabled:!o.current.length,children:[r.jsx(ce,{name:"download"})," Save"]})]})]}),!v&&r.jsx($e,{kind:"info",title:"Capturing needs a rooted TV",children:"ls-monitor only runs as root. You can still open a capture saved earlier (.jsonl)."}),T.phase==="error"&&h==="live"&&r.jsx(Nt,{error:T.error,title:"The capture stopped"}),T.dropped>0&&r.jsxs($e,{kind:"warning",title:"Some messages were skipped",children:["The bus was busier than the bridge forwards (",T.dropped.toLocaleString()," lines skipped). Filtering doesn’t reduce this — it happens before."]}),r.jsxs("div",{className:`monitor${ne?" has-details":""}`,children:[r.jsx(lS,{items:he,rowHeight:fk,keyOf:I=>I.id,label:"Luna calls",className:"log-list monitor-list",header:r.jsxs("div",{className:"log-row log-head monitor-row",children:[r.jsx("span",{children:"Call"}),!ne&&r.jsx("span",{className:"hide-sm",children:"Sender"}),!ne&&r.jsx("span",{className:"hide-sm",children:"Payload"})]}),empty:r.jsx("div",{className:"log-empty muted",children:h==="none"?"Start a capture to watch the bus, or open a saved one.":W?"No calls match the filter.":L?"Waiting for calls…":"No calls."}),render:I=>r.jsxs("button",{type:"button",className:`log-row monitor-row${I.id===j?" is-selected":""}`,onClick:()=>E(I.id===j?null:I.id),children:[r.jsxs("span",{className:"monitor-name",children:[r.jsx("span",{className:`call-dot ${I.status}`,role:"img",title:Ob[I.status],"aria-label":Ob[I.status]}),I.name]}),!ne&&r.jsx("span",{className:"hide-sm",children:I.sender}),!ne&&r.jsx("span",{className:"hide-sm mono",children:I.information})]})}),ne&&r.jsx(gk,{entry:ne,onClose:()=>E(null)})]}),r.jsxs("div",{className:"data-foot",children:[r.jsxs("span",{children:[he.length.toLocaleString()," of ",W.toLocaleString()," calls"]}),r.jsx("span",{className:"muted",children:"Filter: words, sender:…, destination:…, put - in front to exclude."})]})]})}const Ob={pending:"No reply yet",ok:"Replied",error:"Replied with an error",cancelled:"Cancelled"},Lb={call:"→",return:"←",callCancel:"×"};function gk({entry:s,onClose:n}){const[l,o]=M.useState(0);M.useEffect(()=>o(0),[s.id]);const d=s.messages[l]??s.messages[0];return r.jsxs("div",{className:"monitor-details",role:"region","aria-label":"Call details",children:[r.jsxs("div",{className:"log-details-head",children:[r.jsx("b",{className:"mono monitor-details-name",children:s.name}),r.jsx("span",{className:"spacer"}),r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost btn--icon",onClick:n,"aria-label":"Close details",children:r.jsx(ce,{name:"x"})})]}),s.skipped?r.jsxs("p",{className:"muted small",children:[s.skipped.toLocaleString()," older replies not kept."]}):null,r.jsx("ol",{className:"monitor-messages",children:s.messages.map((_,w)=>r.jsx("li",{children:r.jsxs("button",{type:"button",className:`monitor-msg${w===l?" is-selected":""}`,onClick:()=>o(w),"aria-pressed":w===l,children:[r.jsx("span",{className:"monitor-arrow",role:"img","aria-label":_.type==="call"?"Call":_.type==="return"?"Reply":_.type==="callCancel"?"Cancel":_.type,children:(Object.hasOwn(Lb,_.type)?Lb[_.type]:void 0)??"•"}),r.jsx("span",{className:"mono",children:_.information||"(no payload)"})]})},w))}),d&&r.jsxs("div",{className:"monitor-msg-detail",children:[r.jsxs("dl",{className:"kv",children:[r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:"Type"}),r.jsx("dd",{children:d.type})]}),r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:"Sender"}),r.jsx("dd",{className:"mono",children:d.sender})]}),r.jsxs("div",{className:"kv-pair",children:[r.jsx("dt",{children:"Destination"}),r.jsxs("dd",{className:"mono",children:[d.destination,d.methodCategory&&d.methodCategory!=="/"?d.methodCategory:"",d.method?`/${d.method}`:""]})]})]}),d.payload!==void 0&&r.jsx("pre",{className:"log-details-json",children:JSON.stringify(d.payload,null,2)}),d.rawPayload&&r.jsx("pre",{className:"log-details-json",children:d.rawPayload})]})]})}const qf={Modern:{label:"Modern",target:"2022 and newer TVs, the fastest",webos:"webOS 22+"},Normal:{label:"Normal",target:"2021 and newer TVs",webos:"webOS 6+"},Legacy:{label:"Legacy",target:"2018–2020 TVs",webos:"webOS 4–5"},"Ultra-Legacy":{label:"Ultra Legacy",target:"2014–2017 TVs",webos:"webOS 1–3"},"Ultra-Legacy-NoService":{label:"Ultra Legacy, no service",target:"Ultra Legacy without Litefin’s background service — if Ultra Legacy won’t start",webos:""}},Mb=Object.keys(qf),Wr=s=>(Object.hasOwn(qf,s)?qf[s]:void 0)??{label:s.replace(/-/g," "),target:"",webos:""};function vk(s){const n=new Set(s.flatMap(d=>d.assets.map(_=>_.variant))),l=Mb.filter(d=>n.has(d)),o=[...n].filter(d=>!Mb.includes(d)).sort();return[...l,...o]}function _k(s){const n=Number(/^(\d+)/.exec(s??"")?.[1]);return!Number.isFinite(n)||n<=0?null:n>=7?"Modern":n>=6?"Normal":n>=4?"Legacy":"Ultra-Legacy"}function df(s,n){const l=s.split(/[.-]/).map(d=>Number(d)),o=n.split(/[.-]/).map(d=>Number(d));for(let d=0;d<Math.max(l.length,o.length);d++){const _=l[d]??0,w=o[d]??0;if(Number.isNaN(_)||Number.isNaN(w))return s.localeCompare(n);if(_!==w)return _-w}return 0}const Bb=["litefin-releases"];function yk(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Apps",title:"Litefin",accent:"repo",sub:r.jsxs(r.Fragment,{children:["Every webOS build of the last ",R2," ",r.jsx("b",{children:"Litefin"})," releases (a lightweight Jellyfin client), straight from"," ",r.jsx("a",{href:Af,target:"_blank",rel:"noopener noreferrer",children:"its GitHub releases"}),". The Homebrew repository only has one build per version."]})}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(bk,{device:s},s.id)})})]})}function bk({device:s}){const{ready:n,call:l}=ut(),{confirm:o,toast:d}=jt(),_=En(),w=ss({queryKey:Bb,queryFn:()=>l("litefin.list",{},6e4),enabled:n,staleTime:5*6e4,retry:!1}),c=Vc(s),h=qc(s,c.data),[y,p]=M.useState(!1),f=M.useMemo(()=>w.data?.releases??[],[w.data]),x=M.useMemo(()=>vk(f),[f]),C=c.data?.find(v=>v.id===k2),j=_k(s.info?.osVersion),E=f[0],g=async()=>{p(!0);try{_.setQueryData(Bb,await l("litefin.list",{refresh:!0},6e4)),c.refetch()}catch(v){d({kind:"danger",title:"Couldn’t refresh the releases",text:xt(v).message})}finally{p(!1)}},b=async(v,S)=>{const N=`Litefin ${v.version} (${Wr(S).label})`;if(c.data){if(C){const T=C.version&&df(v.version,C.version)<0;if(!await o({title:`Replace Litefin on ${s.name}?`,message:r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["Litefin ",C.version?r.jsxs("b",{children:["v",C.version]}):null," is installed. Every Litefin build is the same app, so installing"," ",r.jsx("b",{children:N})," replaces it."]}),T&&r.jsx("p",{children:"This is an older version than the one installed."})]}),confirmText:"Install"}))return}}else if(!await o({title:`Install ${N}?`,message:r.jsxs("p",{children:["The apps on ",s.name," couldn’t be read, so it isn’t known whether Litefin is installed. If it is, this replaces it."]}),confirmText:"Install"}))return;await h.installLitefin(v.tag,S,N)};return r.jsxs("section",{className:"card col-12",children:[r.jsxs("div",{className:"data-toolbar",children:[r.jsxs("div",{className:"data-toolbar-left litefin-status",children:[r.jsx("span",{className:"device-av",children:r.jsx(ce,{name:"tv"})}),r.jsxs("span",{children:[c.isLoading?r.jsxs("span",{className:"muted",children:["Checking ",s.name,"…"]}):C?r.jsxs(r.Fragment,{children:["Litefin ",r.jsxs("b",{className:"mono",children:["v",C.version]})," is installed on ",r.jsx(ii,{device:s}),E&&C.version&&df(E.version,C.version)>0&&r.jsxs("span",{className:"badge warning litefin-badge",children:["v",E.version," available"]})]}):r.jsxs(r.Fragment,{children:["Litefin isn’t installed on ",r.jsx(ii,{device:s})]}),j&&r.jsxs("span",{className:"muted litefin-suggest",children:[" ","· Suggested for this TV: ",r.jsx("b",{children:Wr(j).label})]})]})]}),r.jsxs("div",{className:"data-toolbar-right",children:[w.data&&r.jsxs("span",{className:"muted count-label",children:[f.length," releases"]}),r.jsxs("a",{className:"btn btn--ghost btn--sm",href:Af,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"github"})," GitHub"]}),r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:g,disabled:!n||y,"aria-label":"Refresh",title:"Check GitHub again",children:y?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"refresh"})})]})]}),w.data?.stale&&r.jsx($e,{kind:"warning",title:"Showing the list from earlier",children:w.data.stale}),w.error?r.jsx(Nt,{error:w.error,title:"Couldn’t load Litefin’s releases",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>w.refetch(),children:"Retry"})}):w.data?f.length?r.jsx("div",{className:"table-scroll",children:r.jsxs("table",{className:"data-table litefin-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{scope:"col",children:"Release"}),x.map(v=>{const S=Wr(v);return r.jsxs("th",{className:v===j?"is-suggested":void 0,scope:"col",children:[r.jsx("span",{className:"litefin-variant",children:S.label}),(S.webos||S.target)&&r.jsx("span",{className:"litefin-variant-sub",children:S.webos||"If Ultra Legacy won’t start"}),v===j&&r.jsx("span",{className:"badge success litefin-badge",children:"Suggested"})]},v)})]})}),r.jsx("tbody",{children:f.map((v,S)=>{const N=!!C?.version&&df(C.version,v.version)===0;return r.jsxs("tr",{children:[r.jsxs("th",{scope:"row",className:"litefin-release",children:[r.jsxs("span",{className:"litefin-version mono",children:["v",v.version]}),S===0&&r.jsx("span",{className:"badge info litefin-badge",children:"Latest"}),N&&r.jsx("span",{className:"badge success litefin-badge",children:"Installed"}),r.jsxs("span",{className:"litefin-date muted",children:[v.publishedAt?new Date(v.publishedAt).toLocaleDateString(void 0,{dateStyle:"medium"}):""," ·"," ",r.jsx("a",{href:`${Af}/tag/${encodeURIComponent(v.tag)}`,target:"_blank",rel:"noopener noreferrer",children:"Notes"})]})]}),x.map(T=>{const D=v.assets.find(k=>k.variant===T),O=`Install Litefin ${v.version} ${Wr(T).label}`;return r.jsx("td",{className:T===j?"is-suggested":void 0,children:D?r.jsxs("div",{className:"litefin-cell",children:[r.jsxs("button",{type:"button",className:`btn btn--sm ${T===j&&S===0?"btn--primary":"btn--ghost"}`,onClick:()=>b(v,T),disabled:!n||h.busy||c.isLoading,"aria-label":O,title:D.name,children:[r.jsx(ce,{name:"download"})," Install"]}),r.jsx("span",{className:"muted litefin-size",children:D.size?Ac(D.size):""})]}):r.jsxs("span",{className:"muted",children:[r.jsx("span",{"aria-hidden":"true",children:"—"}),r.jsxs("span",{className:"sr-only",children:["No ",Wr(T).label," build"]})]})},T)})]},v.tag)})})]})}):r.jsxs("div",{className:"empty-state",children:[r.jsx("h3",{children:"No releases with webOS builds"}),r.jsx("p",{children:"GitHub lists no published Litefin release with a webOS IPK right now."})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Reading Litefin’s releases from GitHub…"})]}),w.data&&f.length>0&&r.jsxs("div",{className:"litefin-help",children:[r.jsx("b",{children:"Which build?"}),r.jsx("ul",{className:"plain-list litefin-help-list",children:x.map(v=>{const S=Wr(v);return r.jsxs("li",{children:[r.jsx("b",{children:S.label}),S.target||S.webos?` — ${[S.target,S.webos].filter(Boolean).join(", ")}`:""]},v)})}),r.jsxs("p",{className:"muted",children:["If you are unsure, try ",r.jsx("b",{children:"Normal"})," first. If the app feels sluggish or fails to load, move down to ",r.jsx("b",{children:"Legacy"}),". All builds are the same app, so installing one replaces the other."]})]}),h.dialog]})}let hc=null;function Sk(s){if(!hc){hc=new Uint32Array(256);for(let l=0;l<256;l++){let o=l;for(let d=0;d<8;d++)o=o&1?3988292384^o>>>1:o>>>1;hc[l]=o>>>0}}let n=4294967295;for(let l=0;l<s.length;l++)n=hc[(n^s[l])&255]^n>>>8;return(n^4294967295)>>>0}function xk(s){return{time:s.getHours()<<11|s.getMinutes()<<5|Math.floor(s.getSeconds()/2),date:Math.max(0,s.getFullYear()-1980)<<9|s.getMonth()+1<<5|s.getDate()}}function wk(s){const n=new TextEncoder,l=[],o=[];let d=0;for(const c of s){const h=n.encode(c.name),y=Sk(c.data),{time:p,date:f}=xk(c.date??new Date),x=new DataView(new ArrayBuffer(30));x.setUint32(0,67324752,!0),x.setUint16(4,20,!0),x.setUint16(6,2048,!0),x.setUint16(8,0,!0),x.setUint16(10,p,!0),x.setUint16(12,f,!0),x.setUint32(14,y,!0),x.setUint32(18,c.data.length,!0),x.setUint32(22,c.data.length,!0),x.setUint16(26,h.length,!0),x.setUint16(28,0,!0),l.push(x.buffer,h,c.data);const C=new DataView(new ArrayBuffer(46));C.setUint32(0,33639248,!0),C.setUint16(4,20,!0),C.setUint16(6,20,!0),C.setUint16(8,2048,!0),C.setUint16(10,0,!0),C.setUint16(12,p,!0),C.setUint16(14,f,!0),C.setUint32(16,y,!0),C.setUint32(20,c.data.length,!0),C.setUint32(24,c.data.length,!0),C.setUint16(28,h.length,!0),C.setUint32(42,d,!0);const j=new Uint8Array(46+h.length);j.set(new Uint8Array(C.buffer),0),j.set(h,46),o.push(j),d+=30+h.length+c.data.length}const _=o.reduce((c,h)=>c+h.length,0),w=new DataView(new ArrayBuffer(22));return w.setUint32(0,101010256,!0),w.setUint16(8,s.length,!0),w.setUint16(10,s.length,!0),w.setUint32(12,_,!0),w.setUint32(16,d,!0),new Blob([...l,...o,w.buffer],{type:"application/zip"})}const uS=[{id:"DISPLAY",label:"Everything"},{id:"VIDEO",label:"Video only"},{id:"GRAPHIC",label:"UI only"}],Ck=s=>uS.find(n=>n.id===s)?.label??s,ff=s=>new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"});function Ek({device:s,className:n}){const{ready:l,call:o}=ut(),{confirm:d,toast:_}=jt(),[w,c]=M.useState("DISPLAY"),[h,y]=M.useState(!1),[p,f]=M.useState(null),{shots:x,error:C}=ak(s.id),j=lk(x),[E,g]=M.useState(null),[b,v]=M.useState(new Set),S=M.useRef(null),N=s.username==="root",T=x??[],D=E?T.findIndex(I=>I.id===E):-1,O=D>=0?D:T.length-1,k=T[O],L=T.filter(I=>b.has(I.id)),V=T.reduce((I,A)=>I+A.blob.size,0);M.useEffect(()=>{const I=S.current?.querySelector(".shot-thumb.is-current"),A=S.current;!I||!A||(I.offsetLeft<A.scrollLeft?A.scrollLeft=I.offsetLeft-8:I.offsetLeft+I.offsetWidth>A.scrollLeft+A.clientWidth&&(A.scrollLeft=I.offsetLeft+I.offsetWidth-A.clientWidth+8))},[k?.id,T.length]);const q=async()=>{y(!0),f(null);try{const I=await o("device.screenshot",{device:gt(s),method:w},6e4),A=atob(I.base64),B=new Uint8Array(A.length);for(let $=0;$<A.length;$++)B[$]=A.charCodeAt($);const F=await nk(s.id,new Blob([B],{type:I.mime}),w);g(F.id)}catch(I){f(I)}finally{y(!1)}},Y=I=>{const A=T[Math.max(0,Math.min(T.length-1,I))];A&&g(A.id)},P=I=>{const A={ArrowLeft:O-1,ArrowRight:O+1,Home:0,End:T.length-1}[I.key];A!==void 0&&(I.preventDefault(),Y(A))},Q=I=>v(A=>{const B=new Set(A);return B.has(I)?B.delete(I):B.add(I),B}),he=T.length>0&&L.length===T.length,ne=async I=>{if(I.length){if(I.length===1){Cn(I[0].blob,hf(s.name,I[0]));return}try{const A=new Map,B=await Promise.all(I.map(async $=>{let J=hf(s.name,$);const z=(A.get(J)??0)+1;return A.set(J,z),z>1&&(J=J.replace(/\.png$/,`-${z}.png`)),{name:J,data:new Uint8Array(await $.blob.arrayBuffer()),date:new Date($.at)}})),F=hf(s.name,{at:Date.now()}).replace(/\.png$/,"");Cn(wk(B),`${F}-screenshots.zip`)}catch(A){_({kind:"danger",title:"Couldn’t make the zip file",text:xt(A).message})}}},W=async I=>{if(!I.length||!await d({title:I.length===1?"Delete this screenshot?":I.length===T.length?`Delete all ${I.length} screenshots?`:`Delete ${I.length} screenshots?`,message:r.jsx("p",{children:"They are removed from this browser. Download any you want to keep first. Nothing on the TV is affected."}),confirmText:"Delete",danger:!0}))return;const B=new Set(I.map(F=>F.id));if(k&&B.has(k.id)){const F=T.slice(O+1).find(J=>!B.has(J.id)),$=T.slice(0,O).reverse().find(J=>!B.has(J.id));g((F??$)?.id??null)}v(F=>new Set([...F].filter($=>!B.has($))));try{await rk([...B])}catch(F){_({kind:"danger",title:"Couldn’t delete the screenshots",text:xt(F).message})}};return r.jsx($i,{eyebrow:"Screen",title:"Screenshots",className:n,children:r.jsxs("div",{className:"stack",children:[N?r.jsxs("div",{className:"row",children:[r.jsx("div",{className:"tabs pills",role:"group","aria-label":"What to capture",children:uS.map(I=>r.jsx("button",{type:"button","aria-pressed":w===I.id,className:`tab${w===I.id?" is-active":""}`,onClick:()=>c(I.id),children:I.label},I.id))}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:q,disabled:h||!l,children:[h?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"image"})," Take screenshot"]})]}):r.jsx($e,{kind:"info",title:"Needs a rooted TV",children:"Screenshots use the TV’s capture service, which only root can call. Developer Mode logins can’t take them."}),p!==null&&r.jsx(Nt,{error:p,title:"Couldn’t take a screenshot"}),C!==null&&r.jsx(Nt,{error:C,title:"Couldn’t read the saved screenshots"}),k?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"shots-viewer",tabIndex:0,role:"group","aria-label":"Screenshot viewer — use the arrow keys for older and newer",onKeyDown:P,children:[j.get(k.id)?r.jsx("img",{src:j.get(k.id),alt:`Screenshot of ${s.name}, ${ff(k.at)}`}):r.jsx("div",{className:"shots-viewer-blank"}),r.jsx("button",{type:"button",className:"shots-nav prev",onClick:()=>Y(O-1),disabled:O<=0,"aria-label":"Older screenshot",title:"Older (←)",children:r.jsx(ce,{name:"left"})}),r.jsx("button",{type:"button",className:"shots-nav next",onClick:()=>Y(O+1),disabled:O>=T.length-1,"aria-label":"Newer screenshot",title:"Newer (→)",children:r.jsx(ce,{name:"right"})})]}),r.jsxs("div",{className:"shots-meta",children:[r.jsxs("span",{className:"badge",children:[O+1," of ",T.length]}),r.jsxs("span",{className:"muted",children:[ff(k.at)," · ",Ck(k.method)," · ",Ac(k.blob.size)]}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>ne([k]),children:[r.jsx(ce,{name:"download"})," Download"]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>W([k]),"aria-label":"Delete this screenshot",children:[r.jsx(ce,{name:"trash"})," Delete"]})]}),T.length>1&&r.jsx("ol",{className:"shots-strip",ref:S,"aria-label":"All screenshots, oldest first",children:T.map((I,A)=>{const B=I.id===k.id,F=b.has(I.id);return r.jsxs("li",{className:`shot-thumb${B?" is-current":""}${F?" is-selected":""}`,children:[r.jsx("button",{type:"button",className:"shot-thumb-btn",onClick:()=>g(I.id),"aria-current":B||void 0,"aria-label":`Show screenshot ${A+1}, ${ff(I.at)}`,children:j.get(I.id)&&r.jsx("img",{src:j.get(I.id),alt:""})}),r.jsxs("label",{className:"check shot-thumb-check",children:[r.jsx("input",{type:"checkbox",checked:F,onChange:()=>Q(I.id),"aria-label":`Select screenshot ${A+1}`}),r.jsx("span",{className:"box"})]})]},I.id)})}),r.jsxs("div",{className:"shots-bar",children:[r.jsxs("label",{className:"check",children:[r.jsx("input",{type:"checkbox",checked:he,ref:I=>{I&&(I.indeterminate=L.length>0&&!he)},onChange:()=>v(he?new Set:new Set(T.map(I=>I.id))),"aria-label":"Select all screenshots"}),r.jsx("span",{className:"box"}),r.jsx("span",{children:L.length?`${L.length} selected`:"Select all"})]}),r.jsxs("span",{className:"muted",children:[T.length," ",T.length===1?"screenshot":"screenshots"," · ",Ac(V),", kept in this browser"]}),r.jsx("span",{className:"spacer"}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>ne(L.length?L:T),children:[r.jsx(ce,{name:"download"})," ",L.length?`Download ${L.length}`:"Download all",(L.length||T.length)>1?" (.zip)":""]}),r.jsxs("button",{type:"button",className:"btn btn--sm btn--ghost btn--danger-ghost",onClick:()=>W(L.length?L:T),children:[r.jsx(ce,{name:"trash"})," ",L.length?`Delete ${L.length}`:"Delete all","…"]})]})]}):N&&x!==null&&r.jsxs("div",{className:"screenshot screenshot--empty",children:[r.jsx(ce,{name:"image"}),r.jsx("span",{children:"“Everything” is what’s on screen; “Video only” and “UI only” capture one layer. Screenshots are kept in this browser, not on the TV."})]})]})})}const Nk=s=>`https://developer.lge.com/secure/ResetDevModeSession.dev?sessionToken=${encodeURIComponent(s)}`,dl=s=>`'${s.replace(/'/g,"'\\''")}'`,jk=s=>s.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"tv",Tk=/^-----BEGIN [A-Z0-9 ]+-----\n[A-Za-z0-9+/=:,\- \n]+\n-----END [A-Z0-9 ]+-----$/;function kk(s){const{host:n,port:l,username:o}=s;return!Hc(o)||!G2(n)||n.startsWith("-")||!Number.isInteger(l)||l<1||l>65535?null:{host:n.replace(/^\[(.*)\]$/,"$1"),port:l,username:o}}const Rk="[private key hidden]",Dk="[passphrase hidden]";function Ib(s,n={}){if(s.auth.kind!=="key")return null;const l=kk(s);if(!l)return null;const o=s.auth.privateKey.replace(/\r\n?/g,`
45
+ `).trim();if(!Tk.test(o))return null;const d=n.redact&&s.auth.passphrase?Dk:s.auth.passphrase??"",_=n.redact?Rk:o;return`#!/bin/sh
46
46
  # Renews the webOS Developer Mode session of "${s.name.replace(/[\r\n"]/g," ")}".
47
47
  # Made by LG Dev Manager. Run it on a computer on the same network as the TV, e.g. once a day with cron:
48
48
  # 15 4 * * * sh /path/to/this/script.sh
@@ -51,7 +51,7 @@ echo command-${d}:$?
51
51
  # WARNING: this file contains the TV's private SSH key. Keep it private, and don't run it as root.
52
52
  # If $SESSION_TOKEN_CACHE is a symlink, its target will be overwritten.
53
53
 
54
- DEVICE_NAME=${dl(Nk(s.name))}
54
+ DEVICE_NAME=${dl(jk(s.name))}
55
55
  DEVICE_HOST=${dl(l.host)}
56
56
  DEVICE_PORT=${dl(String(l.port))}
57
57
  DEVICE_USERNAME=${dl(l.username)}
@@ -105,5 +105,5 @@ fi
105
105
  CHECK_RESULT=$(curl --max-time 3 -s "https://developer.lge.com/secure/ResetDevModeSession.dev?sessionToken=$SESSION_TOKEN")
106
106
 
107
107
  echo "\${CHECK_RESULT}"
108
- `}function Dk(s){const n=/^(\d+):(\d+):(\d+)$/.exec(s??"");return n?((Number(n[1])*60+Number(n[2]))*60+Number(n[3]))*1e3:null}function Ak(s){const n=Math.max(0,Math.floor(s/1e3)),l=o=>String(o).padStart(2,"0");return`${l(Math.floor(n/3600))}:${l(Math.floor(n%3600/60))}:${l(n%60)}`}function Ok(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Device",title:"Device",accent:"info",sub:s?r.jsxs(r.Fragment,{children:["Details of ",r.jsx("b",{children:s.name}),"."]}):"Details of your TV."}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(Lk,{device:s},`${s.id}:${s.updatedAt}`)})})]})}function Lk({device:s}){const n=s.username==="prisoner";return r.jsxs(r.Fragment,{children:[r.jsx(Mk,{device:s}),n?r.jsx(Hk,{device:s}):r.jsx(Ib,{device:s}),r.jsx(Ck,{device:s,className:n?"col-8":"col-12"}),n&&r.jsx(Ib,{device:s})]})}function Mk({device:s}){const{ready:n,call:l}=ut(),o=M.useMemo(()=>gt(s),[s]),d=ss({queryKey:["device-info",s.id,s.updatedAt],queryFn:async()=>{const c=await l("device.info",{device:o},4e4);return pm(s.id,Uc(s,c)).catch(()=>{}),c},enabled:n,staleTime:6e4,retry:!1}),_=d.data,w=gm(_?.modelName);return r.jsx($i,{eyebrow:"Device",title:_?.modelName?xl(_.modelName)??_.modelName:s.name,className:"col-8",action:r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>d.refetch(),disabled:d.isFetching,"aria-label":"Refresh",title:"Refresh",children:r.jsx(ce,{name:"refresh",className:d.isFetching?"spin":void 0})}),children:d.error?r.jsx(Nt,{error:d.error,title:"Couldn’t read the TV’s details",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>d.refetch(),children:"Retry"})}):_?r.jsxs("div",{className:"info-device",children:[r.jsxs("div",{className:"info-device-art","aria-hidden":"true",children:[r.jsx(ce,{name:"tv"}),w&&r.jsx("span",{children:w})]}),r.jsxs("dl",{className:"kv info-kv",children:[r.jsx("dt",{children:"Model"}),r.jsx("dd",{className:"mono",children:_.modelName??"—"}),r.jsx("dt",{children:"webOS"}),r.jsx("dd",{children:Rc(_.osVersion)??"—"}),r.jsx("dt",{children:"Firmware"}),r.jsx("dd",{className:"mono",children:_.firmwareVersion??"—"}),r.jsx("dt",{children:"OTA ID"}),r.jsx("dd",{className:"mono",children:_.otaId??"—"}),r.jsx("dt",{children:"SoC"}),r.jsx("dd",{className:"mono",children:_.socName??"—"}),r.jsx("dt",{children:"Address"}),r.jsxs("dd",{className:"mono",children:[s.host,":",s.port]}),r.jsx("dt",{children:"Logged in as"}),r.jsxs("dd",{children:[r.jsx("span",{className:"mono",children:s.username})," ",r.jsx("span",{className:`badge ${s.mode==="rooted"?"purple":"info"}`,children:s.mode==="rooted"?"Rooted":"Dev Mode"})]})]})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsxs("p",{children:["Asking ",s.name,"…"]})]})})}function Bk(s,n){const l=Dk(s),[o,d]=M.useState(Date.now());return M.useEffect(()=>{if(l===null)return;d(Date.now());const w=setInterval(()=>d(Date.now()),1e3);return()=>clearInterval(w)},[l]),l===null?null:{left:Math.min(l,Math.max(0,l-(o-n))),ends:new Date(n+l)}}const Ik=1e3*3600*1e3;function Hk({device:s}){const{ready:n,call:l}=ut(),{toast:o}=jt(),d=M.useMemo(()=>gt(s),[s]),[_,w]=M.useState(!1),[c,h]=M.useState(!1),y=M.useRef(void 0);M.useEffect(()=>()=>clearTimeout(y.current),[]);const p=ss({queryKey:["devmode",s.id,s.updatedAt],queryFn:async()=>({...await l("devmode.status",{device:d},4e4),at:Date.now()}),enabled:n,staleTime:6e4,retry:!1}),f=Bk(p.data?.remaining,p.data?.at??Date.now()),x=async()=>{w(!0);try{await l("devmode.renew",{device:d},4e4),o({kind:"success",title:"Developer Mode session renewed",text:"LG may take a moment to show the new time."}),clearTimeout(y.current),y.current=setTimeout(()=>p.refetch(),1500)}catch(E){o({kind:"danger",title:"Couldn’t renew the session",text:xt(E).message})}finally{w(!1)}},C=f?Math.min(100,Math.round(f.left/Ik*100)):0,j=f?f.left<72*3600*1e3:!1;return r.jsxs($i,{eyebrow:"Developer Mode",title:"Session",className:"col-4",children:[p.error&&r.jsx(Nt,{error:p.error,title:"Couldn’t check the session",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>p.refetch(),children:"Retry"})}),p.data?p.data.token?r.jsxs("div",{className:"stack",children:[f?r.jsxs("div",{className:"devmode-time",children:[r.jsx("div",{className:`devmode-countdown mono${j?" is-low":""}`,role:"timer","aria-label":"Time left",children:Ak(f.left)}),r.jsx("div",{className:"progress thin",role:"progressbar","aria-label":"Session left","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":C,children:r.jsx("div",{className:`progress-fill${j?" danger":""}`,style:{width:`${C}%`}})}),r.jsxs("div",{className:"muted devmode-ends",children:["Ends ",f.ends.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}),". The time shown on the TV only updates when it restarts."]})]}):r.jsx($e,{kind:"warning",title:"Time left unknown",children:p.data.problem??"LG didn’t say how long is left."}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:x,disabled:_||!n,children:[_?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"refresh"})," Renew now"]}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>h(!0),children:[r.jsx(ce,{name:"clock"})," Renew automatically…"]})]})]}):r.jsx($e,{kind:"warning",title:"No Developer Mode token",children:"The TV has no valid Developer Mode session token. Open the Developer Mode app on the TV and sign in again."}):!p.error&&r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Checking…"})]}),p.data?.token&&r.jsx(Uk,{open:c,onClose:()=>h(!1),device:s,token:p.data.token})]})}function Bb({text:s,label:n}){const{toast:l}=jt();return r.jsxs("div",{className:"copybox",children:[r.jsx("code",{className:"mono",children:s}),r.jsx("button",{type:"button",className:"btn btn--icon btn--sm btn--ghost","aria-label":`Copy ${n}`,title:"Copy",onClick:()=>navigator.clipboard.writeText(s).then(()=>l({kind:"success",title:`${n} copied`}),()=>l({kind:"warning",title:"Copy failed",text:"Select the text and copy it by hand."})),children:r.jsx(ce,{name:"copy"})})]})}function Uk({open:s,onClose:n,device:l,token:o}){const[d,_]=M.useState("url"),{toast:w}=jt(),c=Ek(o),h=M.useMemo(()=>Mb(l),[l]),[y,p]=M.useState(!1),f=M.useMemo(()=>y?h:Mb(l,{redact:!0}),[y,h,l]),x=`renew-devmode-${l.name.replace(/[^A-Za-z0-9._-]+/g,"-")||"tv"}.sh`;return r.jsx(si,{open:s,onClose:n,size:"lg",title:"Renew Developer Mode automatically",children:r.jsxs("div",{className:"stack",children:[r.jsx("div",{className:"tabs pills",role:"group","aria-label":"Ways to renew",children:[["url","Renew URL"],["script","Shell script"],["ifttt","IFTTT"]].map(([C,j])=>r.jsx("button",{type:"button","aria-pressed":d===C,className:`tab${d===C?" is-active":""}`,onClick:()=>_(C),children:j},C))}),d==="url"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{children:"Opening this address renews the session for another 1000 hours. Anything that can open a URL on a schedule can keep Developer Mode alive with it."}),r.jsx(Bb,{text:c,label:"Renew URL"}),r.jsx($e,{kind:"warning",children:"Anyone with this URL can renew your TV’s session. It changes when you sign in to Developer Mode again."})]}),d==="script"&&(h?r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["A shell script for macOS or Linux (or WSL). It logs in to the TV to read the current token, then renews. Run it on a computer on the same network as the TV, for example daily with ",r.jsx("span",{className:"mono",children:"cron"})," (run it as"," ",r.jsxs("span",{className:"mono",children:["sh ",x]}),", or ",r.jsx("span",{className:"mono",children:"chmod 700"})," it first)."]}),r.jsx($e,{kind:"danger",title:"Contains this TV’s private key",children:"Keep the script private — it can log in to the TV."}),r.jsx("pre",{className:"file-preview-text renew-script",children:f}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>p(C=>!C),"aria-pressed":y,children:[r.jsx(ce,{name:"key"})," ",y?"Hide key":"Show key"]}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>navigator.clipboard.writeText(h).then(()=>w({kind:"success",title:"Script copied"}),()=>w({kind:"warning",title:"Copy failed"})),children:[r.jsx(ce,{name:"copy"})," Copy"]}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>Cn(new Blob([h],{type:"text/x-shellscript"}),x),children:[r.jsx(ce,{name:"download"})," Download ",x]})]})]}):r.jsx($e,{kind:"info",children:"The script needs the TV’s SSH key in the usual PEM / OpenSSH form, and an address and user name the add-TV form accepts. This TV’s saved settings don’t have that — edit the TV, or use the renew URL instead."})),d==="ifttt"&&r.jsxs(r.Fragment,{children:[r.jsx($e,{kind:"warning",children:"IFTTT’s webhook action is no longer free."}),r.jsxs("ol",{className:"plain-list numbered",children:[r.jsxs("li",{children:["Create an applet at ",r.jsx("a",{href:"https://ifttt.com/create",target:"_blank",rel:"noopener noreferrer",children:"ifttt.com/create"}),"."]}),r.jsxs("li",{children:["Pick ",r.jsx("b",{children:"Date & Time"})," as the trigger, then ",r.jsx("b",{children:"Every day at"})," or ",r.jsx("b",{children:"Every hour at"}),"."]}),r.jsxs("li",{children:["Pick ",r.jsx("b",{children:"Webhooks"})," as the action, with this URL:"]})]}),r.jsx(Bb,{text:c,label:"Renew URL"}),r.jsx("p",{className:"muted",children:"Then create the action and save the applet. If it stops working, open this page again for the new URL."})]})]})})}function Ib({device:s}){const n=Vc(s),l=J0(s),o=Q0(),d=qc(s,n.data),_=En(),w=n.data?.find(y=>y.id===kf),c=o.byId.get(kf),h=w&&c?.manifest?X0(c.manifest.version,w.version)===!0:!1;return r.jsxs($i,{eyebrow:"Homebrew",title:"Homebrew Channel",className:"col-4",children:[n.error?r.jsx(Nt,{error:n.error,title:"Couldn’t read the installed apps"}):n.data?r.jsxs("div",{className:"stack",children:[r.jsxs("dl",{className:"kv",children:[r.jsx("dt",{children:"Installed"}),r.jsx("dd",{children:w?r.jsxs("span",{className:"mono",children:["v",w.version]}):"No"}),r.jsx("dt",{children:"Root"}),r.jsx("dd",{children:l.data?l.data.root?r.jsx("span",{className:"badge success",children:"Rooted"}):r.jsx("span",{className:"badge",children:"Not rooted"}):"—"}),c?.manifest&&r.jsxs(r.Fragment,{children:[r.jsx("dt",{children:"Latest"}),r.jsxs("dd",{className:"mono",children:["v",c.manifest.version]})]})]}),r.jsxs("div",{className:"row",children:[c?.manifest&&(!w||h)&&r.jsxs("button",{type:"button",className:"btn btn--primary",disabled:d.busy,onClick:async()=>{await d.installFromRepo(c,{update:!!w}),_.invalidateQueries({queryKey:["hbchannel",s.id]})},children:[r.jsx(ce,{name:"download"})," ",w?`Update to v${c.manifest.version}`:"Install"]}),r.jsxs("a",{className:"btn btn--ghost",href:"https://github.com/webosbrew/webos-homebrew-channel",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"github"})," GitHub"]})]})]}):r.jsx("div",{className:"empty-state",children:r.jsx("span",{className:"spinner"})}),d.dialog]})}function zk(){return r.jsx(lj,{},_s().key)}const $k=new yE({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});function Pk(){const{status:s}=Pi();return r.jsx(dc,{to:s.state==="unpaired"?"/bridge":"/apps/installed",replace:!0})}function Fk(){return r.jsx(GC,{client:$k,children:r.jsx($2,{children:r.jsx(F2,{children:r.jsx(IC,{children:r.jsx(fC,{children:r.jsxs(Ot,{element:r.jsx(HN,{}),children:[r.jsx(Ot,{index:!0,element:r.jsx(Pk,{})}),r.jsx(Ot,{path:"bridge",element:r.jsx(zN,{})}),r.jsx(Ot,{path:"devices",element:r.jsx(WN,{})}),r.jsx(Ot,{path:"devices/new",element:r.jsx(zk,{})}),r.jsx(Ot,{path:"apps",element:r.jsx(dc,{to:"/apps/installed",replace:!0})}),r.jsx(Ot,{path:"apps/installed",element:r.jsx(Jj,{})}),r.jsx(Ot,{path:"apps/homebrew",element:r.jsx(tT,{})}),r.jsx(Ot,{path:"apps/litefin",element:r.jsx(_k,{})}),r.jsx(Ot,{path:"files",element:r.jsx(pT,{})}),r.jsx(Ot,{path:"terminal",element:r.jsx(TT,{})}),r.jsx(Ot,{path:"info",element:r.jsx(Ok,{})}),r.jsx(Ot,{path:"debug",element:r.jsx(dc,{to:"/debug/logs",replace:!0})}),r.jsx(Ot,{path:"debug/logs",element:r.jsx(WT,{})}),r.jsx(Ot,{path:"debug/pmlog",element:r.jsx(JT,{})}),r.jsx(Ot,{path:"debug/dmesg",element:r.jsx(QT,{})}),r.jsx(Ot,{path:"debug/crashes",element:r.jsx(ok,{})}),r.jsx(Ot,{path:"debug/luna",element:r.jsx(fk,{})}),r.jsx(Ot,{path:"*",element:r.jsx(dc,{to:"/",replace:!0})})]})})})})})})}const Vk=()=>document.documentElement.hasAttribute("data-framed");function qk(){const s=window.location.href;return r.jsx("div",{className:"standalone-notice",children:r.jsx($i,{eyebrow:"LG Dev Manager",title:"Open LG Dev Manager in its own tab",children:r.jsxs("div",{className:"stack",children:[r.jsx("p",{className:"muted",style:{margin:0,fontSize:13,lineHeight:1.6},children:"For your TVs’ safety, LG Dev Manager doesn’t run inside another website."}),r.jsx("div",{className:"row",children:r.jsx("a",{className:"btn btn--primary",href:s,target:"_top",children:"Open LG Dev Manager"})})]})})})}uw.createRoot(document.getElementById("root")).render(r.jsx(M.StrictMode,{children:Vk()?r.jsx(qk,{}):r.jsx(V0,{fullPage:!0,children:r.jsx(Fk,{})})}));
109
- //# sourceMappingURL=index-DmYG3adw.js.map
108
+ `}function Ak(s){const n=/^(\d+):(\d+):(\d+)$/.exec(s??"");return n?((Number(n[1])*60+Number(n[2]))*60+Number(n[3]))*1e3:null}function Ok(s){const n=Math.max(0,Math.floor(s/1e3)),l=o=>String(o).padStart(2,"0");return`${l(Math.floor(n/3600))}:${l(Math.floor(n%3600/60))}:${l(n%60)}`}function Lk(){const{active:s}=Mt();return r.jsxs(r.Fragment,{children:[r.jsx(ys,{eyebrow:"Device",title:"Device",accent:"info",sub:s?r.jsxs(r.Fragment,{children:["Details of ",r.jsx("b",{children:s.name}),"."]}):"Details of your TV."}),r.jsx("div",{className:"grid",children:r.jsx(ri,{device:s,children:s&&r.jsx(Mk,{device:s},`${s.id}:${s.updatedAt}`)})})]})}function Mk({device:s}){const n=s.username==="prisoner";return r.jsxs(r.Fragment,{children:[r.jsx(Bk,{device:s}),n?r.jsx(Uk,{device:s}):r.jsx(Ub,{device:s}),r.jsx(Ek,{device:s,className:n?"col-8":"col-12"}),n&&r.jsx(Ub,{device:s})]})}function Bk({device:s}){const{ready:n,call:l}=ut(),o=M.useMemo(()=>gt(s),[s]),d=ss({queryKey:["device-info",s.id,s.updatedAt],queryFn:async()=>{const c=await l("device.info",{device:o},4e4);return vm(s.id,Uc(s,c)).catch(()=>{}),c},enabled:n,staleTime:6e4,retry:!1}),_=d.data,w=_m(_?.modelName);return r.jsx($i,{eyebrow:"Device",title:_?.modelName?xl(_.modelName)??_.modelName:s.name,className:"col-8",action:r.jsx("button",{type:"button",className:"btn btn--icon btn--ghost",onClick:()=>d.refetch(),disabled:d.isFetching,"aria-label":"Refresh",title:"Refresh",children:r.jsx(ce,{name:"refresh",className:d.isFetching?"spin":void 0})}),children:d.error?r.jsx(Nt,{error:d.error,title:"Couldn’t read the TV’s details",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>d.refetch(),children:"Retry"})}):_?r.jsxs("div",{className:"info-device",children:[r.jsxs("div",{className:"info-device-art","aria-hidden":"true",children:[r.jsx(ce,{name:"tv"}),w&&r.jsx("span",{children:w})]}),r.jsxs("dl",{className:"kv info-kv",children:[r.jsx("dt",{children:"Model"}),r.jsx("dd",{className:"mono",children:_.modelName??"—"}),r.jsx("dt",{children:"webOS"}),r.jsx("dd",{children:Rc(_.osVersion)??"—"}),r.jsx("dt",{children:"Firmware"}),r.jsx("dd",{className:"mono",children:_.firmwareVersion??"—"}),r.jsx("dt",{children:"OTA ID"}),r.jsx("dd",{className:"mono",children:_.otaId??"—"}),r.jsx("dt",{children:"SoC"}),r.jsx("dd",{className:"mono",children:_.socName??"—"}),r.jsx("dt",{children:"Address"}),r.jsxs("dd",{className:"mono",children:[s.host,":",s.port]}),r.jsx("dt",{children:"Logged in as"}),r.jsxs("dd",{children:[r.jsx("span",{className:"mono",children:s.username})," ",r.jsx("span",{className:`badge ${s.mode==="rooted"?"purple":"info"}`,children:s.mode==="rooted"?"Rooted":"Dev Mode"})]})]})]}):r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsxs("p",{children:["Asking ",s.name,"…"]})]})})}function Ik(s,n){const l=Ak(s),[o,d]=M.useState(Date.now());return M.useEffect(()=>{if(l===null)return;d(Date.now());const w=setInterval(()=>d(Date.now()),1e3);return()=>clearInterval(w)},[l]),l===null?null:{left:Math.min(l,Math.max(0,l-(o-n))),ends:new Date(n+l)}}const Hk=1e3*3600*1e3;function Uk({device:s}){const{ready:n,call:l}=ut(),{toast:o}=jt(),d=M.useMemo(()=>gt(s),[s]),[_,w]=M.useState(!1),[c,h]=M.useState(!1),y=M.useRef(void 0);M.useEffect(()=>()=>clearTimeout(y.current),[]);const p=ss({queryKey:["devmode",s.id,s.updatedAt],queryFn:async()=>({...await l("devmode.status",{device:d},4e4),at:Date.now()}),enabled:n,staleTime:6e4,retry:!1}),f=Ik(p.data?.remaining,p.data?.at??Date.now()),x=async()=>{w(!0);try{await l("devmode.renew",{device:d},4e4),o({kind:"success",title:"Developer Mode session renewed",text:"LG may take a moment to show the new time."}),clearTimeout(y.current),y.current=setTimeout(()=>p.refetch(),1500)}catch(E){o({kind:"danger",title:"Couldn’t renew the session",text:xt(E).message})}finally{w(!1)}},C=f?Math.min(100,Math.round(f.left/Hk*100)):0,j=f?f.left<72*3600*1e3:!1;return r.jsxs($i,{eyebrow:"Developer Mode",title:"Session",className:"col-4",children:[p.error&&r.jsx(Nt,{error:p.error,title:"Couldn’t check the session",action:r.jsx("button",{type:"button",className:"btn btn--sm btn--ghost",onClick:()=>p.refetch(),children:"Retry"})}),p.data?p.data.token?r.jsxs("div",{className:"stack",children:[f?r.jsxs("div",{className:"devmode-time",children:[r.jsx("div",{className:`devmode-countdown mono${j?" is-low":""}`,role:"timer","aria-label":"Time left",children:Ok(f.left)}),r.jsx("div",{className:"progress thin",role:"progressbar","aria-label":"Session left","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":C,children:r.jsx("div",{className:`progress-fill${j?" danger":""}`,style:{width:`${C}%`}})}),r.jsxs("div",{className:"muted devmode-ends",children:["Ends ",f.ends.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}),". The time shown on the TV only updates when it restarts."]})]}):r.jsx($e,{kind:"warning",title:"Time left unknown",children:p.data.problem??"LG didn’t say how long is left."}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:x,disabled:_||!n,children:[_?r.jsx("span",{className:"spinner sm"}):r.jsx(ce,{name:"refresh"})," Renew now"]}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>h(!0),children:[r.jsx(ce,{name:"clock"})," Renew automatically…"]})]})]}):r.jsx($e,{kind:"warning",title:"No Developer Mode token",children:"The TV has no valid Developer Mode session token. Open the Developer Mode app on the TV and sign in again."}):!p.error&&r.jsxs("div",{className:"empty-state",children:[r.jsx("span",{className:"spinner"}),r.jsx("p",{children:"Checking…"})]}),p.data?.token&&r.jsx(zk,{open:c,onClose:()=>h(!1),device:s,token:p.data.token})]})}function Hb({text:s,label:n}){const{toast:l}=jt();return r.jsxs("div",{className:"copybox",children:[r.jsx("code",{className:"mono",children:s}),r.jsx("button",{type:"button",className:"btn btn--icon btn--sm btn--ghost","aria-label":`Copy ${n}`,title:"Copy",onClick:()=>navigator.clipboard.writeText(s).then(()=>l({kind:"success",title:`${n} copied`}),()=>l({kind:"warning",title:"Copy failed",text:"Select the text and copy it by hand."})),children:r.jsx(ce,{name:"copy"})})]})}function zk({open:s,onClose:n,device:l,token:o}){const[d,_]=M.useState("url"),{toast:w}=jt(),c=Nk(o),h=M.useMemo(()=>Ib(l),[l]),[y,p]=M.useState(!1),f=M.useMemo(()=>y?h:Ib(l,{redact:!0}),[y,h,l]),x=`renew-devmode-${l.name.replace(/[^A-Za-z0-9._-]+/g,"-")||"tv"}.sh`;return r.jsx(si,{open:s,onClose:n,size:"lg",title:"Renew Developer Mode automatically",children:r.jsxs("div",{className:"stack",children:[r.jsx("div",{className:"tabs pills",role:"group","aria-label":"Ways to renew",children:[["url","Renew URL"],["script","Shell script"],["ifttt","IFTTT"]].map(([C,j])=>r.jsx("button",{type:"button","aria-pressed":d===C,className:`tab${d===C?" is-active":""}`,onClick:()=>_(C),children:j},C))}),d==="url"&&r.jsxs(r.Fragment,{children:[r.jsx("p",{children:"Opening this address renews the session for another 1000 hours. Anything that can open a URL on a schedule can keep Developer Mode alive with it."}),r.jsx(Hb,{text:c,label:"Renew URL"}),r.jsx($e,{kind:"warning",children:"Anyone with this URL can renew your TV’s session. It changes when you sign in to Developer Mode again."})]}),d==="script"&&(h?r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["A shell script for macOS or Linux (or WSL). It logs in to the TV to read the current token, then renews. Run it on a computer on the same network as the TV, for example daily with ",r.jsx("span",{className:"mono",children:"cron"})," (run it as"," ",r.jsxs("span",{className:"mono",children:["sh ",x]}),", or ",r.jsx("span",{className:"mono",children:"chmod 700"})," it first)."]}),r.jsx($e,{kind:"danger",title:"Contains this TV’s private key",children:"Keep the script private — it can log in to the TV."}),r.jsx("pre",{className:"file-preview-text renew-script",children:f}),r.jsxs("div",{className:"row",children:[r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>p(C=>!C),"aria-pressed":y,children:[r.jsx(ce,{name:"key"})," ",y?"Hide key":"Show key"]}),r.jsxs("button",{type:"button",className:"btn btn--ghost",onClick:()=>navigator.clipboard.writeText(h).then(()=>w({kind:"success",title:"Script copied"}),()=>w({kind:"warning",title:"Copy failed"})),children:[r.jsx(ce,{name:"copy"})," Copy"]}),r.jsxs("button",{type:"button",className:"btn btn--primary",onClick:()=>Cn(new Blob([h],{type:"text/x-shellscript"}),x),children:[r.jsx(ce,{name:"download"})," Download ",x]})]})]}):r.jsx($e,{kind:"info",children:"The script needs the TV’s SSH key in the usual PEM / OpenSSH form, and an address and user name the add-TV form accepts. This TV’s saved settings don’t have that — edit the TV, or use the renew URL instead."})),d==="ifttt"&&r.jsxs(r.Fragment,{children:[r.jsx($e,{kind:"warning",children:"IFTTT’s webhook action is no longer free."}),r.jsxs("ol",{className:"plain-list numbered",children:[r.jsxs("li",{children:["Create an applet at ",r.jsx("a",{href:"https://ifttt.com/create",target:"_blank",rel:"noopener noreferrer",children:"ifttt.com/create"}),"."]}),r.jsxs("li",{children:["Pick ",r.jsx("b",{children:"Date & Time"})," as the trigger, then ",r.jsx("b",{children:"Every day at"})," or ",r.jsx("b",{children:"Every hour at"}),"."]}),r.jsxs("li",{children:["Pick ",r.jsx("b",{children:"Webhooks"})," as the action, with this URL:"]})]}),r.jsx(Hb,{text:c,label:"Renew URL"}),r.jsx("p",{className:"muted",children:"Then create the action and save the applet. If it stops working, open this page again for the new URL."})]})]})})}function Ub({device:s}){const n=Vc(s),l=eS(s),o=J0(),d=qc(s,n.data),_=En(),w=n.data?.find(y=>y.id===kf),c=o.byId.get(kf),h=w&&c?.manifest?W0(c.manifest.version,w.version)===!0:!1;return r.jsxs($i,{eyebrow:"Homebrew",title:"Homebrew Channel",className:"col-4",children:[n.error?r.jsx(Nt,{error:n.error,title:"Couldn’t read the installed apps"}):n.data?r.jsxs("div",{className:"stack",children:[r.jsxs("dl",{className:"kv",children:[r.jsx("dt",{children:"Installed"}),r.jsx("dd",{children:w?r.jsxs("span",{className:"mono",children:["v",w.version]}):"No"}),r.jsx("dt",{children:"Root"}),r.jsx("dd",{children:l.data?l.data.root?r.jsx("span",{className:"badge success",children:"Rooted"}):r.jsx("span",{className:"badge",children:"Not rooted"}):"—"}),c?.manifest&&r.jsxs(r.Fragment,{children:[r.jsx("dt",{children:"Latest"}),r.jsxs("dd",{className:"mono",children:["v",c.manifest.version]})]})]}),r.jsxs("div",{className:"row",children:[c?.manifest&&(!w||h)&&r.jsxs("button",{type:"button",className:"btn btn--primary",disabled:d.busy,onClick:async()=>{await d.installFromRepo(c,{update:!!w}),_.invalidateQueries({queryKey:["hbchannel",s.id]})},children:[r.jsx(ce,{name:"download"})," ",w?`Update to v${c.manifest.version}`:"Install"]}),r.jsxs("a",{className:"btn btn--ghost",href:"https://github.com/webosbrew/webos-homebrew-channel",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ce,{name:"github"})," GitHub"]})]})]}):r.jsx("div",{className:"empty-state",children:r.jsx("span",{className:"spinner"})}),d.dialog]})}function $k(){return r.jsx(oj,{},_s().key)}const Pk=new bE({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});function Fk(){const{status:s}=Pi();return r.jsx(dc,{to:s.state==="unpaired"?"/bridge":"/apps/installed",replace:!0})}function Vk(){return r.jsx(YC,{client:Pk,children:r.jsx(P2,{children:r.jsx(V2,{children:r.jsx(HC,{children:r.jsx(mC,{children:r.jsxs(Ot,{element:r.jsx(UN,{}),children:[r.jsx(Ot,{index:!0,element:r.jsx(Fk,{})}),r.jsx(Ot,{path:"bridge",element:r.jsx($N,{})}),r.jsx(Ot,{path:"devices",element:r.jsx(QN,{})}),r.jsx(Ot,{path:"devices/new",element:r.jsx($k,{})}),r.jsx(Ot,{path:"apps",element:r.jsx(dc,{to:"/apps/installed",replace:!0})}),r.jsx(Ot,{path:"apps/installed",element:r.jsx(eT,{})}),r.jsx(Ot,{path:"apps/homebrew",element:r.jsx(sT,{})}),r.jsx(Ot,{path:"apps/litefin",element:r.jsx(yk,{})}),r.jsx(Ot,{path:"files",element:r.jsx(gT,{})}),r.jsx(Ot,{path:"terminal",element:r.jsx(kT,{})}),r.jsx(Ot,{path:"info",element:r.jsx(Lk,{})}),r.jsx(Ot,{path:"debug",element:r.jsx(dc,{to:"/debug/logs",replace:!0})}),r.jsx(Ot,{path:"debug/logs",element:r.jsx(QT,{})}),r.jsx(Ot,{path:"debug/pmlog",element:r.jsx(ek,{})}),r.jsx(Ot,{path:"debug/dmesg",element:r.jsx(JT,{})}),r.jsx(Ot,{path:"debug/crashes",element:r.jsx(ck,{})}),r.jsx(Ot,{path:"debug/luna",element:r.jsx(mk,{})}),r.jsx(Ot,{path:"*",element:r.jsx(dc,{to:"/",replace:!0})})]})})})})})})}const qk=()=>document.documentElement.hasAttribute("data-framed");function Kk(){const s=window.location.href;return r.jsx("div",{className:"standalone-notice",children:r.jsx($i,{eyebrow:"LG Dev Manager",title:"Open LG Dev Manager in its own tab",children:r.jsxs("div",{className:"stack",children:[r.jsx("p",{className:"muted",style:{margin:0,fontSize:13,lineHeight:1.6},children:"For your TVs’ safety, LG Dev Manager doesn’t run inside another website."}),r.jsx("div",{className:"row",children:r.jsx("a",{className:"btn btn--primary",href:s,target:"_top",children:"Open LG Dev Manager"})})]})})})}hw.createRoot(document.getElementById("root")).render(r.jsx(M.StrictMode,{children:qk()?r.jsx(Kk,{}):r.jsx(q0,{fullPage:!0,children:r.jsx(Vk,{})})}));
109
+ //# sourceMappingURL=index-CWU_4o5k.js.map