0pflow 0.1.0-dev.b4bf1ab → 0.1.0-dev.bdfaa95

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 (254) hide show
  1. package/dist/__tests__/discover.integration.test.d.ts +2 -0
  2. package/dist/__tests__/discover.integration.test.d.ts.map +1 -0
  3. package/dist/__tests__/discover.integration.test.js +137 -0
  4. package/dist/__tests__/discover.integration.test.js.map +1 -0
  5. package/dist/__tests__/factory.test.js +13 -0
  6. package/dist/__tests__/factory.test.js.map +1 -1
  7. package/dist/__tests__/integration.e2e.test.js +2 -1
  8. package/dist/__tests__/integration.e2e.test.js.map +1 -1
  9. package/dist/__tests__/integration.test.js +87 -82
  10. package/dist/__tests__/integration.test.js.map +1 -1
  11. package/dist/agent.d.ts +7 -0
  12. package/dist/agent.d.ts.map +1 -1
  13. package/dist/agent.js +75 -10
  14. package/dist/agent.js.map +1 -1
  15. package/dist/cli/__tests__/discovery.test.js +1 -1
  16. package/dist/cli/__tests__/discovery.test.js.map +1 -1
  17. package/dist/cli/app.d.ts +6 -0
  18. package/dist/cli/app.d.ts.map +1 -1
  19. package/dist/cli/app.js +27 -0
  20. package/dist/cli/app.js.map +1 -1
  21. package/dist/cli/deploy.d.ts +27 -0
  22. package/dist/cli/deploy.d.ts.map +1 -0
  23. package/dist/cli/deploy.js +332 -0
  24. package/dist/cli/deploy.js.map +1 -0
  25. package/dist/cli/discovery.d.ts +10 -0
  26. package/dist/cli/discovery.d.ts.map +1 -1
  27. package/dist/cli/discovery.js +42 -0
  28. package/dist/cli/discovery.js.map +1 -1
  29. package/dist/cli/env.js +1 -1
  30. package/dist/cli/env.js.map +1 -1
  31. package/dist/cli/index.d.ts.map +1 -1
  32. package/dist/cli/index.js +142 -11
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/cli/install.d.ts +4 -0
  35. package/dist/cli/install.d.ts.map +1 -1
  36. package/dist/cli/install.js +63 -32
  37. package/dist/cli/install.js.map +1 -1
  38. package/dist/cli/mcp/config.d.ts +0 -1
  39. package/dist/cli/mcp/config.d.ts.map +1 -1
  40. package/dist/cli/mcp/config.js +2 -4
  41. package/dist/cli/mcp/config.js.map +1 -1
  42. package/dist/cli/mcp/lib/scaffolding.d.ts +33 -0
  43. package/dist/cli/mcp/lib/scaffolding.d.ts.map +1 -0
  44. package/dist/cli/mcp/lib/scaffolding.js +231 -0
  45. package/dist/cli/mcp/lib/scaffolding.js.map +1 -0
  46. package/dist/cli/mcp/lib/templates.d.ts +1 -0
  47. package/dist/cli/mcp/lib/templates.d.ts.map +1 -1
  48. package/dist/cli/mcp/lib/templates.js.map +1 -1
  49. package/dist/cli/mcp/tools/createApp.d.ts +1 -0
  50. package/dist/cli/mcp/tools/createApp.d.ts.map +1 -1
  51. package/dist/cli/mcp/tools/createApp.js +12 -55
  52. package/dist/cli/mcp/tools/createApp.js.map +1 -1
  53. package/dist/cli/mcp/tools/createDatabase.d.ts.map +1 -1
  54. package/dist/cli/mcp/tools/createDatabase.js +2 -41
  55. package/dist/cli/mcp/tools/createDatabase.js.map +1 -1
  56. package/dist/cli/mcp/tools/getConnectionInfo.d.ts +19 -0
  57. package/dist/cli/mcp/tools/getConnectionInfo.d.ts.map +1 -0
  58. package/dist/cli/mcp/tools/getConnectionInfo.js +111 -0
  59. package/dist/cli/mcp/tools/getConnectionInfo.js.map +1 -0
  60. package/dist/cli/mcp/tools/getRun.d.ts +22 -0
  61. package/dist/cli/mcp/tools/getRun.d.ts.map +1 -0
  62. package/dist/cli/mcp/tools/getRun.js +80 -0
  63. package/dist/cli/mcp/tools/getRun.js.map +1 -0
  64. package/dist/cli/mcp/tools/getTrace.d.ts +32 -0
  65. package/dist/cli/mcp/tools/getTrace.d.ts.map +1 -0
  66. package/dist/cli/mcp/tools/getTrace.js +104 -0
  67. package/dist/cli/mcp/tools/getTrace.js.map +1 -0
  68. package/dist/cli/mcp/tools/index.d.ts +94 -1
  69. package/dist/cli/mcp/tools/index.d.ts.map +1 -1
  70. package/dist/cli/mcp/tools/index.js +16 -0
  71. package/dist/cli/mcp/tools/index.js.map +1 -1
  72. package/dist/cli/mcp/tools/listIntegrations.d.ts +14 -0
  73. package/dist/cli/mcp/tools/listIntegrations.d.ts.map +1 -0
  74. package/dist/cli/mcp/tools/listIntegrations.js +53 -0
  75. package/dist/cli/mcp/tools/listIntegrations.js.map +1 -0
  76. package/dist/cli/mcp/tools/listRuns.d.ts +21 -0
  77. package/dist/cli/mcp/tools/listRuns.d.ts.map +1 -0
  78. package/dist/cli/mcp/tools/listRuns.js +72 -0
  79. package/dist/cli/mcp/tools/listRuns.js.map +1 -0
  80. package/dist/cli/mcp/tools/listWorkflows.d.ts +15 -0
  81. package/dist/cli/mcp/tools/listWorkflows.d.ts.map +1 -0
  82. package/dist/cli/mcp/tools/listWorkflows.js +45 -0
  83. package/dist/cli/mcp/tools/listWorkflows.js.map +1 -0
  84. package/dist/cli/mcp/tools/runNode.d.ts +17 -0
  85. package/dist/cli/mcp/tools/runNode.d.ts.map +1 -0
  86. package/dist/cli/mcp/tools/runNode.js +74 -0
  87. package/dist/cli/mcp/tools/runNode.js.map +1 -0
  88. package/dist/cli/mcp/tools/runWorkflow.d.ts +16 -0
  89. package/dist/cli/mcp/tools/runWorkflow.d.ts.map +1 -0
  90. package/dist/cli/mcp/tools/runWorkflow.js +66 -0
  91. package/dist/cli/mcp/tools/runWorkflow.js.map +1 -0
  92. package/dist/cli/mcp/tools/setupAppSchema.d.ts +1 -1
  93. package/dist/cli/mcp/tools/setupAppSchema.d.ts.map +1 -1
  94. package/dist/cli/mcp/tools/setupAppSchema.js +11 -129
  95. package/dist/cli/mcp/tools/setupAppSchema.js.map +1 -1
  96. package/dist/cli/mcp/tools/utils.d.ts +7 -0
  97. package/dist/cli/mcp/tools/utils.d.ts.map +1 -0
  98. package/dist/cli/mcp/tools/utils.js +28 -0
  99. package/dist/cli/mcp/tools/utils.js.map +1 -0
  100. package/dist/cli/run.d.ts +2 -0
  101. package/dist/cli/run.d.ts.map +1 -0
  102. package/dist/cli/run.js +560 -0
  103. package/dist/cli/run.js.map +1 -0
  104. package/dist/cli/trace.d.ts +5 -0
  105. package/dist/cli/trace.d.ts.map +1 -1
  106. package/dist/cli/trace.js +1 -1
  107. package/dist/cli/trace.js.map +1 -1
  108. package/dist/connections/cloud-auth.d.ts +46 -0
  109. package/dist/connections/cloud-auth.d.ts.map +1 -0
  110. package/dist/connections/cloud-auth.js +247 -0
  111. package/dist/connections/cloud-auth.js.map +1 -0
  112. package/dist/connections/cloud-client.d.ts +25 -0
  113. package/dist/connections/cloud-client.d.ts.map +1 -0
  114. package/dist/connections/cloud-client.js +59 -0
  115. package/dist/connections/cloud-client.js.map +1 -0
  116. package/dist/connections/cloud-integration-provider.d.ts +22 -0
  117. package/dist/connections/cloud-integration-provider.d.ts.map +1 -0
  118. package/dist/connections/cloud-integration-provider.js +41 -0
  119. package/dist/connections/cloud-integration-provider.js.map +1 -0
  120. package/dist/connections/connection-labels.d.ts +14 -0
  121. package/dist/connections/connection-labels.d.ts.map +1 -0
  122. package/dist/connections/connection-labels.js +46 -0
  123. package/dist/connections/connection-labels.js.map +1 -0
  124. package/dist/connections/index.d.ts +12 -0
  125. package/dist/connections/index.d.ts.map +1 -0
  126. package/dist/connections/index.js +10 -0
  127. package/dist/connections/index.js.map +1 -0
  128. package/dist/connections/integration-provider.d.ts +39 -0
  129. package/dist/connections/integration-provider.d.ts.map +1 -0
  130. package/dist/connections/integration-provider.js +20 -0
  131. package/dist/connections/integration-provider.js.map +1 -0
  132. package/dist/connections/local-integration-provider.d.ts +29 -0
  133. package/dist/connections/local-integration-provider.d.ts.map +1 -0
  134. package/dist/connections/local-integration-provider.js +70 -0
  135. package/dist/connections/local-integration-provider.js.map +1 -0
  136. package/dist/connections/nango-client.d.ts +14 -0
  137. package/dist/connections/nango-client.d.ts.map +1 -0
  138. package/dist/connections/nango-client.js +50 -0
  139. package/dist/connections/nango-client.js.map +1 -0
  140. package/dist/connections/resolver.d.ts +26 -0
  141. package/dist/connections/resolver.d.ts.map +1 -0
  142. package/dist/connections/resolver.js +48 -0
  143. package/dist/connections/resolver.js.map +1 -0
  144. package/dist/connections/schema.d.ts +8 -0
  145. package/dist/connections/schema.d.ts.map +1 -0
  146. package/dist/connections/schema.js +31 -0
  147. package/dist/connections/schema.js.map +1 -0
  148. package/dist/context.d.ts.map +1 -1
  149. package/dist/context.js +4 -0
  150. package/dist/context.js.map +1 -1
  151. package/dist/dev-ui/api.d.ts +18 -0
  152. package/dist/dev-ui/api.d.ts.map +1 -0
  153. package/dist/dev-ui/api.js +273 -0
  154. package/dist/dev-ui/api.js.map +1 -0
  155. package/dist/dev-ui/dag/extractor.d.ts +19 -0
  156. package/dist/dev-ui/dag/extractor.d.ts.map +1 -0
  157. package/dist/dev-ui/dag/extractor.js +716 -0
  158. package/dist/dev-ui/dag/extractor.js.map +1 -0
  159. package/dist/dev-ui/dag/types.d.ts +42 -0
  160. package/dist/dev-ui/dag/types.d.ts.map +1 -0
  161. package/dist/dev-ui/dag/types.js +2 -0
  162. package/dist/dev-ui/dag/types.js.map +1 -0
  163. package/dist/dev-ui/deploy-api.d.ts +14 -0
  164. package/dist/dev-ui/deploy-api.d.ts.map +1 -0
  165. package/dist/dev-ui/deploy-api.js +112 -0
  166. package/dist/dev-ui/deploy-api.js.map +1 -0
  167. package/dist/dev-ui/dev-server.d.ts +18 -0
  168. package/dist/dev-ui/dev-server.d.ts.map +1 -0
  169. package/dist/dev-ui/dev-server.js +273 -0
  170. package/dist/dev-ui/dev-server.js.map +1 -0
  171. package/dist/dev-ui/index.d.ts +3 -0
  172. package/dist/dev-ui/index.d.ts.map +1 -0
  173. package/dist/dev-ui/index.js +2 -0
  174. package/dist/dev-ui/index.js.map +1 -0
  175. package/dist/dev-ui/pty.d.ts +16 -0
  176. package/dist/dev-ui/pty.d.ts.map +1 -0
  177. package/dist/dev-ui/pty.js +87 -0
  178. package/dist/dev-ui/pty.js.map +1 -0
  179. package/dist/dev-ui/watcher.d.ts +12 -0
  180. package/dist/dev-ui/watcher.d.ts.map +1 -0
  181. package/dist/dev-ui/watcher.js +166 -0
  182. package/dist/dev-ui/watcher.js.map +1 -0
  183. package/dist/dev-ui/ws.d.ts +52 -0
  184. package/dist/dev-ui/ws.d.ts.map +1 -0
  185. package/dist/dev-ui/ws.js +32 -0
  186. package/dist/dev-ui/ws.js.map +1 -0
  187. package/dist/dev-ui-client/assets/index-CFhxfKAk.js +176 -0
  188. package/dist/dev-ui-client/assets/index-D9wFwfPp.css +32 -0
  189. package/dist/dev-ui-client/assets/index-DAKTQEvj.js +1 -0
  190. package/dist/dev-ui-client/index.html +13 -0
  191. package/dist/discover.d.ts +15 -0
  192. package/dist/discover.d.ts.map +1 -0
  193. package/dist/discover.js +32 -0
  194. package/dist/discover.js.map +1 -0
  195. package/dist/factory.d.ts.map +1 -1
  196. package/dist/factory.js +37 -13
  197. package/dist/factory.js.map +1 -1
  198. package/dist/index.d.ts +6 -1
  199. package/dist/index.d.ts.map +1 -1
  200. package/dist/index.js +6 -0
  201. package/dist/index.js.map +1 -1
  202. package/dist/node.d.ts +1 -0
  203. package/dist/node.d.ts.map +1 -1
  204. package/dist/node.js +1 -0
  205. package/dist/node.js.map +1 -1
  206. package/dist/nodes/agent/executor.d.ts +2 -0
  207. package/dist/nodes/agent/executor.d.ts.map +1 -1
  208. package/dist/nodes/agent/executor.js +11 -1
  209. package/dist/nodes/agent/executor.js.map +1 -1
  210. package/dist/registry-gen.d.ts +6 -0
  211. package/dist/registry-gen.d.ts.map +1 -0
  212. package/dist/registry-gen.js +146 -0
  213. package/dist/registry-gen.js.map +1 -0
  214. package/dist/types.d.ts +21 -3
  215. package/dist/types.d.ts.map +1 -1
  216. package/dist/workflow.d.ts +22 -0
  217. package/dist/workflow.d.ts.map +1 -1
  218. package/dist/workflow.js +113 -3
  219. package/dist/workflow.js.map +1 -1
  220. package/package.json +30 -6
  221. package/templates/app/.dockerignore +6 -0
  222. package/templates/app/.env.example +13 -0
  223. package/templates/app/Dockerfile +34 -0
  224. package/templates/app/README.md +29 -0
  225. package/templates/app/biome.jsonc +81 -0
  226. package/templates/app/dbos-config.yaml +6 -0
  227. package/templates/app/drizzle.config.ts +12 -0
  228. package/templates/app/generated/registry.ts +8 -0
  229. package/templates/app/next.config.js +13 -0
  230. package/templates/app/package.json +57 -0
  231. package/templates/app/postcss.config.js +5 -0
  232. package/templates/app/public/favicon.ico +0 -0
  233. package/templates/app/src/app/_components/.gitkeep +0 -0
  234. package/templates/app/src/app/api/trpc/[trpc]/route.ts +34 -0
  235. package/templates/app/src/app/api/workflow/[name]/route.ts +37 -0
  236. package/templates/app/src/app/layout.tsx +29 -0
  237. package/templates/app/src/app/page.tsx +18 -0
  238. package/templates/app/src/env.js +46 -0
  239. package/templates/app/src/instrumentation.ts +6 -0
  240. package/templates/app/src/lib/pflow.ts +28 -0
  241. package/templates/app/src/server/api/root.ts +21 -0
  242. package/templates/app/src/server/api/routers/.gitkeep +0 -0
  243. package/templates/app/src/server/api/trpc.ts +106 -0
  244. package/templates/app/src/server/db/index.ts +18 -0
  245. package/templates/app/src/server/db/schema.ts +14 -0
  246. package/templates/app/src/styles/globals.css +6 -0
  247. package/templates/app/src/styles/globals.css.orange +126 -0
  248. package/templates/app/src/trpc/query-client.ts +25 -0
  249. package/templates/app/src/trpc/react.tsx +78 -0
  250. package/templates/app/src/trpc/server.ts +30 -0
  251. package/templates/app/tsconfig.check.json +23 -0
  252. package/templates/app/tsconfig.json +42 -0
  253. package/templates/app/tsconfig.server.json +5 -0
  254. package/templates/app/tsconfig.test.json +21 -0
@@ -0,0 +1,176 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function i(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(l){if(l.ep)return;l.ep=!0;const a=i(l);fetch(l.href,a)}})();function nh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hd={exports:{}},Ho={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ly;function AE(){if(ly)return Ho;ly=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(r,l,a){var c=null;if(a!==void 0&&(c=""+a),l.key!==void 0&&(c=""+l.key),"key"in l){a={};for(var h in l)h!=="key"&&(a[h]=l[h])}else a=l;return l=a.ref,{$$typeof:e,type:r,key:c,ref:l!==void 0?l:null,props:a}}return Ho.Fragment=t,Ho.jsx=i,Ho.jsxs=i,Ho}var oy;function NE(){return oy||(oy=1,Hd.exports=AE()),Hd.exports}var k=NE(),Pd={exports:{}},De={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var ay;function DE(){if(ay)return De;ay=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=v&&L[v]||L["@@iterator"],typeof L=="function"?L:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,E={};function w(L,$,N){this.props=L,this.context=$,this.refs=E,this.updater=N||S}w.prototype.isReactComponent={},w.prototype.setState=function(L,$){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,$,"setState")},w.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function z(){}z.prototype=w.prototype;function C(L,$,N){this.props=L,this.context=$,this.refs=E,this.updater=N||S}var T=C.prototype=new z;T.constructor=C,b(T,w.prototype),T.isPureReactComponent=!0;var I=Array.isArray;function B(){}var U={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function G(L,$,N){var ee=N.ref;return{$$typeof:e,type:L,key:$,ref:ee!==void 0?ee:null,props:N}}function ne(L,$){return G(L.type,$,L.props)}function V(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function j(L){var $={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(N){return $[N]})}var F=/\/+/g;function R(L,$){return typeof L=="object"&&L!==null&&L.key!=null?j(""+L.key):$.toString(36)}function O(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(B,B):(L.status="pending",L.then(function($){L.status==="pending"&&(L.status="fulfilled",L.value=$)},function($){L.status==="pending"&&(L.status="rejected",L.reason=$)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function M(L,$,N,ee,ce){var oe=typeof L;(oe==="undefined"||oe==="boolean")&&(L=null);var fe=!1;if(L===null)fe=!0;else switch(oe){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(L.$$typeof){case e:case t:fe=!0;break;case m:return fe=L._init,M(fe(L._payload),$,N,ee,ce)}}if(fe)return ce=ce(L),fe=ee===""?"."+R(L,0):ee,I(ce)?(N="",fe!=null&&(N=fe.replace(F,"$&/")+"/"),M(ce,$,N,"",function(Ce){return Ce})):ce!=null&&(V(ce)&&(ce=ne(ce,N+(ce.key==null||L&&L.key===ce.key?"":(""+ce.key).replace(F,"$&/")+"/")+fe)),$.push(ce)),1;fe=0;var he=ee===""?".":ee+":";if(I(L))for(var pe=0;pe<L.length;pe++)ee=L[pe],oe=he+R(ee,pe),fe+=M(ee,$,N,oe,ce);else if(pe=y(L),typeof pe=="function")for(L=pe.call(L),pe=0;!(ee=L.next()).done;)ee=ee.value,oe=he+R(ee,pe++),fe+=M(ee,$,N,oe,ce);else if(oe==="object"){if(typeof L.then=="function")return M(O(L),$,N,ee,ce);throw $=String(L),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return fe}function P(L,$,N){if(L==null)return L;var ee=[],ce=0;return M(L,ee,"","",function(oe){return $.call(N,oe,ce++)}),ee}function H(L){if(L._status===-1){var $=L._result;$=$(),$.then(function(N){(L._status===0||L._status===-1)&&(L._status=1,L._result=N)},function(N){(L._status===0||L._status===-1)&&(L._status=2,L._result=N)}),L._status===-1&&(L._status=0,L._result=$)}if(L._status===1)return L._result.default;throw L._result}var Y=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},A={map:P,forEach:function(L,$,N){P(L,function(){$.apply(this,arguments)},N)},count:function(L){var $=0;return P(L,function(){$++}),$},toArray:function(L){return P(L,function($){return $})||[]},only:function(L){if(!V(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return De.Activity=g,De.Children=A,De.Component=w,De.Fragment=i,De.Profiler=l,De.PureComponent=C,De.StrictMode=r,De.Suspense=d,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,De.__COMPILER_RUNTIME={__proto__:null,c:function(L){return U.H.useMemoCache(L)}},De.cache=function(L){return function(){return L.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(L,$,N){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ee=b({},L.props),ce=L.key;if($!=null)for(oe in $.key!==void 0&&(ce=""+$.key),$)!X.call($,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&$.ref===void 0||(ee[oe]=$[oe]);var oe=arguments.length-2;if(oe===1)ee.children=N;else if(1<oe){for(var fe=Array(oe),he=0;he<oe;he++)fe[he]=arguments[he+2];ee.children=fe}return G(L.type,ce,ee)},De.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:a,_context:L},L},De.createElement=function(L,$,N){var ee,ce={},oe=null;if($!=null)for(ee in $.key!==void 0&&(oe=""+$.key),$)X.call($,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(ce[ee]=$[ee]);var fe=arguments.length-2;if(fe===1)ce.children=N;else if(1<fe){for(var he=Array(fe),pe=0;pe<fe;pe++)he[pe]=arguments[pe+2];ce.children=he}if(L&&L.defaultProps)for(ee in fe=L.defaultProps,fe)ce[ee]===void 0&&(ce[ee]=fe[ee]);return G(L,oe,ce)},De.createRef=function(){return{current:null}},De.forwardRef=function(L){return{$$typeof:h,render:L}},De.isValidElement=V,De.lazy=function(L){return{$$typeof:m,_payload:{_status:-1,_result:L},_init:H}},De.memo=function(L,$){return{$$typeof:f,type:L,compare:$===void 0?null:$}},De.startTransition=function(L){var $=U.T,N={};U.T=N;try{var ee=L(),ce=U.S;ce!==null&&ce(N,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(B,Y)}catch(oe){Y(oe)}finally{$!==null&&N.types!==null&&($.types=N.types),U.T=$}},De.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},De.use=function(L){return U.H.use(L)},De.useActionState=function(L,$,N){return U.H.useActionState(L,$,N)},De.useCallback=function(L,$){return U.H.useCallback(L,$)},De.useContext=function(L){return U.H.useContext(L)},De.useDebugValue=function(){},De.useDeferredValue=function(L,$){return U.H.useDeferredValue(L,$)},De.useEffect=function(L,$){return U.H.useEffect(L,$)},De.useEffectEvent=function(L){return U.H.useEffectEvent(L)},De.useId=function(){return U.H.useId()},De.useImperativeHandle=function(L,$,N){return U.H.useImperativeHandle(L,$,N)},De.useInsertionEffect=function(L,$){return U.H.useInsertionEffect(L,$)},De.useLayoutEffect=function(L,$){return U.H.useLayoutEffect(L,$)},De.useMemo=function(L,$){return U.H.useMemo(L,$)},De.useOptimistic=function(L,$){return U.H.useOptimistic(L,$)},De.useReducer=function(L,$,N){return U.H.useReducer(L,$,N)},De.useRef=function(L){return U.H.useRef(L)},De.useState=function(L){return U.H.useState(L)},De.useSyncExternalStore=function(L,$,N){return U.H.useSyncExternalStore(L,$,N)},De.useTransition=function(){return U.H.useTransition()},De.version="19.2.4",De}var cy;function Ea(){return cy||(cy=1,Pd.exports=DE()),Pd.exports}var q=Ea();const RE=nh(q);var Id={exports:{}},Po={},jd={exports:{}},Ud={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var uy;function BE(){return uy||(uy=1,(function(e){function t(M,P){var H=M.length;M.push(P);e:for(;0<H;){var Y=H-1>>>1,A=M[Y];if(0<l(A,P))M[Y]=P,M[H]=A,H=Y;else break e}}function i(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var P=M[0],H=M.pop();if(H!==P){M[0]=H;e:for(var Y=0,A=M.length,L=A>>>1;Y<L;){var $=2*(Y+1)-1,N=M[$],ee=$+1,ce=M[ee];if(0>l(N,H))ee<A&&0>l(ce,N)?(M[Y]=ce,M[ee]=H,Y=ee):(M[Y]=N,M[$]=H,Y=$);else if(ee<A&&0>l(ce,H))M[Y]=ce,M[ee]=H,Y=ee;else break e}}return P}function l(M,P){var H=M.sortIndex-P.sortIndex;return H!==0?H:M.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var c=Date,h=c.now();e.unstable_now=function(){return c.now()-h}}var d=[],f=[],m=1,g=null,v=3,y=!1,S=!1,b=!1,E=!1,w=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(M){for(var P=i(f);P!==null;){if(P.callback===null)r(f);else if(P.startTime<=M)r(f),P.sortIndex=P.expirationTime,t(d,P);else break;P=i(f)}}function I(M){if(b=!1,T(M),!S)if(i(d)!==null)S=!0,B||(B=!0,j());else{var P=i(f);P!==null&&O(I,P.startTime-M)}}var B=!1,U=-1,X=5,G=-1;function ne(){return E?!0:!(e.unstable_now()-G<X)}function V(){if(E=!1,B){var M=e.unstable_now();G=M;var P=!0;try{e:{S=!1,b&&(b=!1,z(U),U=-1),y=!0;var H=v;try{t:{for(T(M),g=i(d);g!==null&&!(g.expirationTime>M&&ne());){var Y=g.callback;if(typeof Y=="function"){g.callback=null,v=g.priorityLevel;var A=Y(g.expirationTime<=M);if(M=e.unstable_now(),typeof A=="function"){g.callback=A,T(M),P=!0;break t}g===i(d)&&r(d),T(M)}else r(d);g=i(d)}if(g!==null)P=!0;else{var L=i(f);L!==null&&O(I,L.startTime-M),P=!1}}break e}finally{g=null,v=H,y=!1}P=void 0}}finally{P?j():B=!1}}}var j;if(typeof C=="function")j=function(){C(V)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,R=F.port2;F.port1.onmessage=V,j=function(){R.postMessage(null)}}else j=function(){w(V,0)};function O(M,P){U=w(function(){M(e.unstable_now())},P)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(M){switch(v){case 1:case 2:case 3:var P=3;break;default:P=v}var H=v;v=P;try{return M()}finally{v=H}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(M,P){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var H=v;v=M;try{return P()}finally{v=H}},e.unstable_scheduleCallback=function(M,P,H){var Y=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?Y+H:Y):H=Y,M){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=H+A,M={id:m++,callback:P,priorityLevel:M,startTime:H,expirationTime:A,sortIndex:-1},H>Y?(M.sortIndex=H,t(f,M),i(d)===null&&M===i(f)&&(b?(z(U),U=-1):b=!0,O(I,H-Y))):(M.sortIndex=A,t(d,M),S||y||(S=!0,B||(B=!0,j()))),M},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(M){var P=v;return function(){var H=v;v=P;try{return M.apply(this,arguments)}finally{v=H}}}})(Ud)),Ud}var hy;function LE(){return hy||(hy=1,jd.exports=BE()),jd.exports}var qd={exports:{}},ii={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var fy;function zE(){if(fy)return ii;fy=1;var e=Ea();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)f+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},l=Symbol.for("react.portal");function a(d,f,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:d,containerInfo:f,implementation:m}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return ii.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ii.createPortal=function(d,f){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return a(d,f,null,m)},ii.flushSync=function(d){var f=c.T,m=r.p;try{if(c.T=null,r.p=2,d)return d()}finally{c.T=f,r.p=m,r.d.f()}},ii.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},ii.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},ii.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var m=f.as,g=h(m,f.crossOrigin),v=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;m==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:y}):m==="script"&&r.d.X(d,{crossOrigin:g,integrity:v,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},ii.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var m=h(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},ii.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var m=f.as,g=h(m,f.crossOrigin);r.d.L(d,m,{crossOrigin:g,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})}},ii.preloadModule=function(d,f){if(typeof d=="string")if(f){var m=h(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},ii.requestFormReset=function(d){r.d.r(d)},ii.unstable_batchedUpdates=function(d,f){return d(f)},ii.useFormState=function(d,f,m){return c.H.useFormState(d,f,m)},ii.useFormStatus=function(){return c.H.useHostTransitionStatus()},ii.version="19.2.4",ii}var dy;function hb(){if(dy)return qd.exports;dy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),qd.exports=zE(),qd.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var py;function OE(){if(py)return Po;py=1;var e=LE(),t=Ea(),i=hb();function r(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function a(n){var s=n,o=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(o=s.return),n=s.return;while(n)}return s.tag===3?o:null}function c(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function h(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function d(n){if(a(n)!==n)throw Error(r(188))}function f(n){var s=n.alternate;if(!s){if(s=a(n),s===null)throw Error(r(188));return s!==n?null:n}for(var o=n,u=s;;){var p=o.return;if(p===null)break;var _=p.alternate;if(_===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===_.child){for(_=p.child;_;){if(_===o)return d(p),n;if(_===u)return d(p),s;_=_.sibling}throw Error(r(188))}if(o.return!==u.return)o=p,u=_;else{for(var x=!1,D=p.child;D;){if(D===o){x=!0,o=p,u=_;break}if(D===u){x=!0,u=p,o=_;break}D=D.sibling}if(!x){for(D=_.child;D;){if(D===o){x=!0,o=_,u=p;break}if(D===u){x=!0,u=_,o=p;break}D=D.sibling}if(!x)throw Error(r(189))}}if(o.alternate!==u)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?n:s}function m(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=m(n),s!==null)return s;n=n.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function j(n){return n===null||typeof n!="object"?null:(n=V&&n[V]||n["@@iterator"],typeof n=="function"?n:null)}var F=Symbol.for("react.client.reference");function R(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===F?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case b:return"Fragment";case w:return"Profiler";case E:return"StrictMode";case I:return"Suspense";case B:return"SuspenseList";case G:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case C:return n.displayName||"Context";case z:return(n._context.displayName||"Context")+".Consumer";case T:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case U:return s=n.displayName||null,s!==null?s:R(n.type)||"Memo";case X:s=n._payload,n=n._init;try{return R(n(s))}catch{}}return null}var O=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},Y=[],A=-1;function L(n){return{current:n}}function $(n){0>A||(n.current=Y[A],Y[A]=null,A--)}function N(n,s){A++,Y[A]=n.current,n.current=s}var ee=L(null),ce=L(null),oe=L(null),fe=L(null);function he(n,s){switch(N(oe,s),N(ce,n),N(ee,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?Av(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=Av(s),n=Nv(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}$(ee),N(ee,n)}function pe(){$(ee),$(ce),$(oe)}function Ce(n){n.memoizedState!==null&&N(fe,n);var s=ee.current,o=Nv(s,n.type);s!==o&&(N(ce,n),N(ee,o))}function xe(n){ce.current===n&&($(ee),$(ce)),fe.current===n&&($(fe),Bo._currentValue=H)}var Se,me;function Ne(n){if(Se===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Se=s&&s[1]||"",me=-1<o.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Se+n+me}var $e=!1;function ze(n,s){if(!n||$e)return"";$e=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(ie){var te=ie}Reflect.construct(n,[],ae)}else{try{ae.call()}catch(ie){te=ie}n.call(ae.prototype)}}else{try{throw Error()}catch(ie){te=ie}(ae=n())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(ie){if(ie&&te&&typeof ie.stack=="string")return[ie.stack,te.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=u.DetermineComponentFrameRoot(),x=_[0],D=_[1];if(x&&D){var W=x.split(`
44
+ `),J=D.split(`
45
+ `);for(p=u=0;u<W.length&&!W[u].includes("DetermineComponentFrameRoot");)u++;for(;p<J.length&&!J[p].includes("DetermineComponentFrameRoot");)p++;if(u===W.length||p===J.length)for(u=W.length-1,p=J.length-1;1<=u&&0<=p&&W[u]!==J[p];)p--;for(;1<=u&&0<=p;u--,p--)if(W[u]!==J[p]){if(u!==1||p!==1)do if(u--,p--,0>p||W[u]!==J[p]){var se=`
46
+ `+W[u].replace(" at new "," at ");return n.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",n.displayName)),se}while(1<=u&&0<=p);break}}}finally{$e=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Ne(o):""}function St(n,s){switch(n.tag){case 26:case 27:case 5:return Ne(n.type);case 16:return Ne("Lazy");case 13:return n.child!==s&&s!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return ze(n.type,!1);case 11:return ze(n.type.render,!1);case 1:return ze(n.type,!0);case 31:return Ne("Activity");default:return""}}function Ci(n){try{var s="",o=null;do s+=St(n,o),o=n,n=n.return;while(n);return s}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var Jt=Object.prototype.hasOwnProperty,ui=e.unstable_scheduleCallback,Qi=e.unstable_cancelCallback,Nn=e.unstable_shouldYield,Dn=e.unstable_requestPaint,Lt=e.unstable_now,ar=e.unstable_getCurrentPriorityLevel,re=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,ke=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,si=e.log,Ji=e.unstable_setDisableYieldValue,$t=null,bt=null;function ei(n){if(typeof si=="function"&&Ji(n),bt&&typeof bt.setStrictMode=="function")try{bt.setStrictMode($t,n)}catch{}}var Ze=Math.clz32?Math.clz32:Ch,hn=Math.log,Ei=Math.LN2;function Ch(n){return n>>>=0,n===0?32:31-(hn(n)/Ei|0)|0}var Ls=256,zs=262144,Os=4194304;function Rn(n){var s=n&42;if(s!==0)return s;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Hs(n,s,o){var u=n.pendingLanes;if(u===0)return 0;var p=0,_=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var D=u&134217727;return D!==0?(u=D&~_,u!==0?p=Rn(u):(x&=D,x!==0?p=Rn(x):o||(o=D&~n,o!==0&&(p=Rn(o))))):(D=u&~_,D!==0?p=Rn(D):x!==0?p=Rn(x):o||(o=u&~n,o!==0&&(p=Rn(o)))),p===0?0:s!==0&&s!==p&&(s&_)===0&&(_=p&-p,o=s&-s,_>=o||_===32&&(o&4194048)!==0)?s:p}function Gr(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function Eh(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Pa(){var n=Os;return Os<<=1,(Os&62914560)===0&&(Os=4194304),n}function Vl(n){for(var s=[],o=0;31>o;o++)s.push(n);return s}function Zr(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function kh(n,s,o,u,p,_){var x=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var D=n.entanglements,W=n.expirationTimes,J=n.hiddenUpdates;for(o=x&~o;0<o;){var se=31-Ze(o),ae=1<<se;D[se]=0,W[se]=-1;var te=J[se];if(te!==null)for(J[se]=null,se=0;se<te.length;se++){var ie=te[se];ie!==null&&(ie.lane&=-536870913)}o&=~ae}u!==0&&Ia(n,u,0),_!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=_&~(x&~s))}function Ia(n,s,o){n.pendingLanes|=s,n.suspendedLanes&=~s;var u=31-Ze(s);n.entangledLanes|=s,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function ja(n,s){var o=n.entangledLanes|=s;for(n=n.entanglements;o;){var u=31-Ze(o),p=1<<u;p&s|n[u]&s&&(n[u]|=s),o&=~p}}function Ua(n,s){var o=s&-s;return o=(o&42)!==0?1:Fl(o),(o&(n.suspendedLanes|s))!==0?0:o}function Fl(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Yl(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function qa(){var n=P.p;return n!==0?n:(n=window.event,n===void 0?32:Jv(n.type))}function Va(n,s){var o=P.p;try{return P.p=n,s()}finally{P.p=o}}var fn=Math.random().toString(36).slice(2),zt="__reactFiber$"+fn,ti="__reactProps$"+fn,Bn="__reactContainer$"+fn,Ps="__reactEvents$"+fn,Fa="__reactListeners$"+fn,Mh="__reactHandles$"+fn,Ya="__reactResources$"+fn,Qr="__reactMarker$"+fn;function $l(n){delete n[zt],delete n[ti],delete n[Ps],delete n[Fa],delete n[Mh]}function cr(n){var s=n[zt];if(s)return s;for(var o=n.parentNode;o;){if(s=o[Bn]||o[zt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(n=Hv(n);n!==null;){if(o=n[zt])return o;n=Hv(n)}return s}n=o,o=n.parentNode}return null}function ur(n){if(n=n[zt]||n[Bn]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function hr(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(r(33))}function fr(n){var s=n[Ya];return s||(s=n[Ya]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Et(n){n[Qr]=!0}var $a=new Set,Wa={};function Ln(n,s){dr(n,s),dr(n+"Capture",s)}function dr(n,s){for(Wa[n]=s,n=0;n<s.length;n++)$a.add(s[n])}var Th=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]*$"),Wl={},Xa={};function Ah(n){return Jt.call(Xa,n)?!0:Jt.call(Wl,n)?!1:Th.test(n)?Xa[n]=!0:(Wl[n]=!0,!1)}function Is(n,s,o){if(Ah(s))if(o===null)n.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+o)}}function js(n,s,o){if(o===null)n.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+o)}}function en(n,s,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(s,o,""+u)}}function hi(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Ka(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Nh(n,s,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,_=u.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return p.call(this)},set:function(x){o=""+x,_.call(this,x)}}),Object.defineProperty(n,s,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(x){o=""+x},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function pr(n){if(!n._valueTracker){var s=Ka(n)?"checked":"value";n._valueTracker=Nh(n,s,""+n[s])}}function Ga(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var o=s.getValue(),u="";return n&&(u=Ka(n)?n.checked?"true":"false":n.value),n=u,n!==o?(s.setValue(n),!0):!1}function Jr(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Dh=/[\n"\\]/g;function fi(n){return n.replace(Dh,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function es(n,s,o,u,p,_,x,D){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),s!=null?x==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+hi(s)):n.value!==""+hi(s)&&(n.value=""+hi(s)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),s!=null?Xl(n,x,hi(s)):o!=null?Xl(n,x,hi(o)):u!=null&&n.removeAttribute("value"),p==null&&_!=null&&(n.defaultChecked=!!_),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?n.name=""+hi(D):n.removeAttribute("name")}function Za(n,s,o,u,p,_,x,D){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(n.type=_),s!=null||o!=null){if(!(_!=="submit"&&_!=="reset"||s!=null)){pr(n);return}o=o!=null?""+hi(o):"",s=s!=null?""+hi(s):o,D||s===n.value||(n.value=s),n.defaultValue=s}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=D?n.checked:!!u,n.defaultChecked=!!u,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),pr(n)}function Xl(n,s,o){s==="number"&&Jr(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function zn(n,s,o,u){if(n=n.options,s){s={};for(var p=0;p<o.length;p++)s["$"+o[p]]=!0;for(o=0;o<n.length;o++)p=s.hasOwnProperty("$"+n[o].value),n[o].selected!==p&&(n[o].selected=p),p&&u&&(n[o].defaultSelected=!0)}else{for(o=""+hi(o),s=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,u&&(n[p].defaultSelected=!0);return}s!==null||n[p].disabled||(s=n[p])}s!==null&&(s.selected=!0)}}function Cm(n,s,o){if(s!=null&&(s=""+hi(s),s!==n.value&&(n.value=s),o==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=o!=null?""+hi(o):""}function Em(n,s,o,u){if(s==null){if(u!=null){if(o!=null)throw Error(r(92));if(O(u)){if(1<u.length)throw Error(r(93));u=u[0]}o=u}o==null&&(o=""),s=o}o=hi(s),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),pr(n)}function Us(n,s){if(s){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=s;return}}n.textContent=s}var CC=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 km(n,s,o){var u=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":u?n.setProperty(s,o):typeof o!="number"||o===0||CC.has(s)?s==="float"?n.cssFloat=o:n[s]=(""+o).trim():n[s]=o+"px"}function Mm(n,s,o){if(s!=null&&typeof s!="object")throw Error(r(62));if(n=n.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var p in s)u=s[p],s.hasOwnProperty(p)&&o[p]!==u&&km(n,p,u)}else for(var _ in s)s.hasOwnProperty(_)&&km(n,_,s[_])}function Rh(n){if(n.indexOf("-")===-1)return!1;switch(n){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 EC=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),kC=/^[\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 Qa(n){return kC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function On(){}var Bh=null;function Lh(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qs=null,Vs=null;function Tm(n){var s=ur(n);if(s&&(n=s.stateNode)){var o=n[ti]||null;e:switch(n=s.stateNode,s.type){case"input":if(es(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+fi(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var u=o[s];if(u!==n&&u.form===n.form){var p=u[ti]||null;if(!p)throw Error(r(90));es(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(s=0;s<o.length;s++)u=o[s],u.form===n.form&&Ga(u)}break e;case"textarea":Cm(n,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&zn(n,!!o.multiple,s,!1)}}}var zh=!1;function Am(n,s,o){if(zh)return n(s,o);zh=!0;try{var u=n(s);return u}finally{if(zh=!1,(qs!==null||Vs!==null)&&(Ic(),qs&&(s=qs,n=Vs,Vs=qs=null,Tm(s),n)))for(s=0;s<n.length;s++)Tm(n[s])}}function Kl(n,s){var o=n.stateNode;if(o===null)return null;var u=o[ti]||null;if(u===null)return null;o=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var Hn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oh=!1;if(Hn)try{var Gl={};Object.defineProperty(Gl,"passive",{get:function(){Oh=!0}}),window.addEventListener("test",Gl,Gl),window.removeEventListener("test",Gl,Gl)}catch{Oh=!1}var gr=null,Hh=null,Ja=null;function Nm(){if(Ja)return Ja;var n,s=Hh,o=s.length,u,p="value"in gr?gr.value:gr.textContent,_=p.length;for(n=0;n<o&&s[n]===p[n];n++);var x=o-n;for(u=1;u<=x&&s[o-u]===p[_-u];u++);return Ja=p.slice(n,1<u?1-u:void 0)}function ec(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function tc(){return!0}function Dm(){return!1}function di(n){function s(o,u,p,_,x){this._reactName=o,this._targetInst=p,this.type=u,this.nativeEvent=_,this.target=x,this.currentTarget=null;for(var D in n)n.hasOwnProperty(D)&&(o=n[D],this[D]=o?o(_):_[D]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?tc:Dm,this.isPropagationStopped=Dm,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=tc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=tc)},persist:function(){},isPersistent:tc}),s}var ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ic=di(ts),Zl=g({},ts,{view:0,detail:0}),MC=di(Zl),Ph,Ih,Ql,nc=g({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uh,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ql&&(Ql&&n.type==="mousemove"?(Ph=n.screenX-Ql.screenX,Ih=n.screenY-Ql.screenY):Ih=Ph=0,Ql=n),Ph)},movementY:function(n){return"movementY"in n?n.movementY:Ih}}),Rm=di(nc),TC=g({},nc,{dataTransfer:0}),AC=di(TC),NC=g({},Zl,{relatedTarget:0}),jh=di(NC),DC=g({},ts,{animationName:0,elapsedTime:0,pseudoElement:0}),RC=di(DC),BC=g({},ts,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),LC=di(BC),zC=g({},ts,{data:0}),Bm=di(zC),OC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},HC={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"},PC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IC(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=PC[n])?!!s[n]:!1}function Uh(){return IC}var jC=g({},Zl,{key:function(n){if(n.key){var s=OC[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=ec(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?HC[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uh,charCode:function(n){return n.type==="keypress"?ec(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ec(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),UC=di(jC),qC=g({},nc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lm=di(qC),VC=g({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uh}),FC=di(VC),YC=g({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),$C=di(YC),WC=g({},nc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),XC=di(WC),KC=g({},ts,{newState:0,oldState:0}),GC=di(KC),ZC=[9,13,27,32],qh=Hn&&"CompositionEvent"in window,Jl=null;Hn&&"documentMode"in document&&(Jl=document.documentMode);var QC=Hn&&"TextEvent"in window&&!Jl,zm=Hn&&(!qh||Jl&&8<Jl&&11>=Jl),Om=" ",Hm=!1;function Pm(n,s){switch(n){case"keyup":return ZC.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Im(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Fs=!1;function JC(n,s){switch(n){case"compositionend":return Im(s);case"keypress":return s.which!==32?null:(Hm=!0,Om);case"textInput":return n=s.data,n===Om&&Hm?null:n;default:return null}}function e2(n,s){if(Fs)return n==="compositionend"||!qh&&Pm(n,s)?(n=Nm(),Ja=Hh=gr=null,Fs=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return zm&&s.locale!=="ko"?null:s.data;default:return null}}var t2={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 jm(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!t2[n.type]:s==="textarea"}function Um(n,s,o,u){qs?Vs?Vs.push(u):Vs=[u]:qs=u,s=$c(s,"onChange"),0<s.length&&(o=new ic("onChange","change",null,o,u),n.push({event:o,listeners:s}))}var eo=null,to=null;function i2(n){wv(n,0)}function rc(n){var s=hr(n);if(Ga(s))return n}function qm(n,s){if(n==="change")return s}var Vm=!1;if(Hn){var Vh;if(Hn){var Fh="oninput"in document;if(!Fh){var Fm=document.createElement("div");Fm.setAttribute("oninput","return;"),Fh=typeof Fm.oninput=="function"}Vh=Fh}else Vh=!1;Vm=Vh&&(!document.documentMode||9<document.documentMode)}function Ym(){eo&&(eo.detachEvent("onpropertychange",$m),to=eo=null)}function $m(n){if(n.propertyName==="value"&&rc(to)){var s=[];Um(s,to,n,Lh(n)),Am(i2,s)}}function n2(n,s,o){n==="focusin"?(Ym(),eo=s,to=o,eo.attachEvent("onpropertychange",$m)):n==="focusout"&&Ym()}function r2(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return rc(to)}function s2(n,s){if(n==="click")return rc(s)}function l2(n,s){if(n==="input"||n==="change")return rc(s)}function o2(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var ki=typeof Object.is=="function"?Object.is:o2;function io(n,s){if(ki(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var o=Object.keys(n),u=Object.keys(s);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var p=o[u];if(!Jt.call(s,p)||!ki(n[p],s[p]))return!1}return!0}function Wm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Xm(n,s){var o=Wm(n);n=0;for(var u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=s&&u>=s)return{node:o,offset:s-n};n=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Wm(o)}}function Km(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Km(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Gm(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=Jr(n.document);s instanceof n.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)n=s.contentWindow;else break;s=Jr(n.document)}return s}function Yh(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var a2=Hn&&"documentMode"in document&&11>=document.documentMode,Ys=null,$h=null,no=null,Wh=!1;function Zm(n,s,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Wh||Ys==null||Ys!==Jr(u)||(u=Ys,"selectionStart"in u&&Yh(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),no&&io(no,u)||(no=u,u=$c($h,"onSelect"),0<u.length&&(s=new ic("onSelect","select",null,s,o),n.push({event:s,listeners:u}),s.target=Ys)))}function is(n,s){var o={};return o[n.toLowerCase()]=s.toLowerCase(),o["Webkit"+n]="webkit"+s,o["Moz"+n]="moz"+s,o}var $s={animationend:is("Animation","AnimationEnd"),animationiteration:is("Animation","AnimationIteration"),animationstart:is("Animation","AnimationStart"),transitionrun:is("Transition","TransitionRun"),transitionstart:is("Transition","TransitionStart"),transitioncancel:is("Transition","TransitionCancel"),transitionend:is("Transition","TransitionEnd")},Xh={},Qm={};Hn&&(Qm=document.createElement("div").style,"AnimationEvent"in window||(delete $s.animationend.animation,delete $s.animationiteration.animation,delete $s.animationstart.animation),"TransitionEvent"in window||delete $s.transitionend.transition);function ns(n){if(Xh[n])return Xh[n];if(!$s[n])return n;var s=$s[n],o;for(o in s)if(s.hasOwnProperty(o)&&o in Qm)return Xh[n]=s[o];return n}var Jm=ns("animationend"),e_=ns("animationiteration"),t_=ns("animationstart"),c2=ns("transitionrun"),u2=ns("transitionstart"),h2=ns("transitioncancel"),i_=ns("transitionend"),n_=new Map,Kh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Kh.push("scrollEnd");function tn(n,s){n_.set(n,s),Ln(s,[n])}var sc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ii=[],Ws=0,Gh=0;function lc(){for(var n=Ws,s=Gh=Ws=0;s<n;){var o=Ii[s];Ii[s++]=null;var u=Ii[s];Ii[s++]=null;var p=Ii[s];Ii[s++]=null;var _=Ii[s];if(Ii[s++]=null,u!==null&&p!==null){var x=u.pending;x===null?p.next=p:(p.next=x.next,x.next=p),u.pending=p}_!==0&&r_(o,p,_)}}function oc(n,s,o,u){Ii[Ws++]=n,Ii[Ws++]=s,Ii[Ws++]=o,Ii[Ws++]=u,Gh|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Zh(n,s,o,u){return oc(n,s,o,u),ac(n)}function rs(n,s){return oc(n,null,null,s),ac(n)}function r_(n,s,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var p=!1,_=n.return;_!==null;)_.childLanes|=o,u=_.alternate,u!==null&&(u.childLanes|=o),_.tag===22&&(n=_.stateNode,n===null||n._visibility&1||(p=!0)),n=_,_=_.return;return n.tag===3?(_=n.stateNode,p&&s!==null&&(p=31-Ze(o),n=_.hiddenUpdates,u=n[p],u===null?n[p]=[s]:u.push(s),s.lane=o|536870912),_):null}function ac(n){if(50<ko)throw ko=0,od=null,Error(r(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var Xs={};function f2(n,s,o,u){this.tag=n,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(n,s,o,u){return new f2(n,s,o,u)}function Qh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Pn(n,s){var o=n.alternate;return o===null?(o=Mi(n.tag,s,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=s,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,s=n.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function s_(n,s){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,s=o.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function cc(n,s,o,u,p,_){var x=0;if(u=n,typeof n=="function")Qh(n)&&(x=1);else if(typeof n=="string")x=_E(n,o,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case G:return n=Mi(31,o,s,p),n.elementType=G,n.lanes=_,n;case b:return ss(o.children,p,_,s);case E:x=8,p|=24;break;case w:return n=Mi(12,o,s,p|2),n.elementType=w,n.lanes=_,n;case I:return n=Mi(13,o,s,p),n.elementType=I,n.lanes=_,n;case B:return n=Mi(19,o,s,p),n.elementType=B,n.lanes=_,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case C:x=10;break e;case z:x=9;break e;case T:x=11;break e;case U:x=14;break e;case X:x=16,u=null;break e}x=29,o=Error(r(130,n===null?"null":typeof n,"")),u=null}return s=Mi(x,o,s,p),s.elementType=n,s.type=u,s.lanes=_,s}function ss(n,s,o,u){return n=Mi(7,n,u,s),n.lanes=o,n}function Jh(n,s,o){return n=Mi(6,n,null,s),n.lanes=o,n}function l_(n){var s=Mi(18,null,null,0);return s.stateNode=n,s}function ef(n,s,o){return s=Mi(4,n.children!==null?n.children:[],n.key,s),s.lanes=o,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var o_=new WeakMap;function ji(n,s){if(typeof n=="object"&&n!==null){var o=o_.get(n);return o!==void 0?o:(s={value:n,source:s,stack:Ci(s)},o_.set(n,s),s)}return{value:n,source:s,stack:Ci(s)}}var Ks=[],Gs=0,uc=null,ro=0,Ui=[],qi=0,mr=null,dn=1,pn="";function In(n,s){Ks[Gs++]=ro,Ks[Gs++]=uc,uc=n,ro=s}function a_(n,s,o){Ui[qi++]=dn,Ui[qi++]=pn,Ui[qi++]=mr,mr=n;var u=dn;n=pn;var p=32-Ze(u)-1;u&=~(1<<p),o+=1;var _=32-Ze(s)+p;if(30<_){var x=p-p%5;_=(u&(1<<x)-1).toString(32),u>>=x,p-=x,dn=1<<32-Ze(s)+p|o<<p|u,pn=_+n}else dn=1<<_|o<<p|u,pn=n}function tf(n){n.return!==null&&(In(n,1),a_(n,1,0))}function nf(n){for(;n===uc;)uc=Ks[--Gs],Ks[Gs]=null,ro=Ks[--Gs],Ks[Gs]=null;for(;n===mr;)mr=Ui[--qi],Ui[qi]=null,pn=Ui[--qi],Ui[qi]=null,dn=Ui[--qi],Ui[qi]=null}function c_(n,s){Ui[qi++]=dn,Ui[qi++]=pn,Ui[qi++]=mr,dn=s.id,pn=s.overflow,mr=n}var Wt=null,ot=null,Ve=!1,_r=null,Vi=!1,rf=Error(r(519));function vr(n){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw so(ji(s,n)),rf}function u_(n){var s=n.stateNode,o=n.type,u=n.memoizedProps;switch(s[zt]=n,s[ti]=u,o){case"dialog":je("cancel",s),je("close",s);break;case"iframe":case"object":case"embed":je("load",s);break;case"video":case"audio":for(o=0;o<To.length;o++)je(To[o],s);break;case"source":je("error",s);break;case"img":case"image":case"link":je("error",s),je("load",s);break;case"details":je("toggle",s);break;case"input":je("invalid",s),Za(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":je("invalid",s);break;case"textarea":je("invalid",s),Em(s,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||u.suppressHydrationWarning===!0||Mv(s.textContent,o)?(u.popover!=null&&(je("beforetoggle",s),je("toggle",s)),u.onScroll!=null&&je("scroll",s),u.onScrollEnd!=null&&je("scrollend",s),u.onClick!=null&&(s.onclick=On),s=!0):s=!1,s||vr(n,!0)}function h_(n){for(Wt=n.return;Wt;)switch(Wt.tag){case 5:case 31:case 13:Vi=!1;return;case 27:case 3:Vi=!0;return;default:Wt=Wt.return}}function Zs(n){if(n!==Wt)return!1;if(!Ve)return h_(n),Ve=!0,!1;var s=n.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||xd(n.type,n.memoizedProps)),o=!o),o&&ot&&vr(n),h_(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));ot=Ov(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));ot=Ov(n)}else s===27?(s=ot,Rr(n.type)?(n=Md,Md=null,ot=n):ot=s):ot=Wt?Yi(n.stateNode.nextSibling):null;return!0}function ls(){ot=Wt=null,Ve=!1}function sf(){var n=_r;return n!==null&&(_i===null?_i=n:_i.push.apply(_i,n),_r=null),n}function so(n){_r===null?_r=[n]:_r.push(n)}var lf=L(null),os=null,jn=null;function yr(n,s,o){N(lf,s._currentValue),s._currentValue=o}function Un(n){n._currentValue=lf.current,$(lf)}function of(n,s,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),n===o)break;n=n.return}}function af(n,s,o,u){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var _=p.dependencies;if(_!==null){var x=p.child;_=_.firstContext;e:for(;_!==null;){var D=_;_=p;for(var W=0;W<s.length;W++)if(D.context===s[W]){_.lanes|=o,D=_.alternate,D!==null&&(D.lanes|=o),of(_.return,o,n),u||(x=null);break e}_=D.next}}else if(p.tag===18){if(x=p.return,x===null)throw Error(r(341));x.lanes|=o,_=x.alternate,_!==null&&(_.lanes|=o),of(x,o,n),x=null}else x=p.child;if(x!==null)x.return=p;else for(x=p;x!==null;){if(x===n){x=null;break}if(p=x.sibling,p!==null){p.return=x.return,x=p;break}x=x.return}p=x}}function Qs(n,s,o,u){n=null;for(var p=s,_=!1;p!==null;){if(!_){if((p.flags&524288)!==0)_=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var x=p.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var D=p.type;ki(p.pendingProps.value,x.value)||(n!==null?n.push(D):n=[D])}}else if(p===fe.current){if(x=p.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(Bo):n=[Bo])}p=p.return}n!==null&&af(s,n,o,u),s.flags|=262144}function hc(n){for(n=n.firstContext;n!==null;){if(!ki(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function as(n){os=n,jn=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Xt(n){return f_(os,n)}function fc(n,s){return os===null&&as(n),f_(n,s)}function f_(n,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},jn===null){if(n===null)throw Error(r(308));jn=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else jn=jn.next=s;return o}var d2=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){s.aborted=!0,n.forEach(function(o){return o()})}},p2=e.unstable_scheduleCallback,g2=e.unstable_NormalPriority,kt={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cf(){return{controller:new d2,data:new Map,refCount:0}}function lo(n){n.refCount--,n.refCount===0&&p2(g2,function(){n.controller.abort()})}var oo=null,uf=0,Js=0,el=null;function m2(n,s){if(oo===null){var o=oo=[];uf=0,Js=dd(),el={status:"pending",value:void 0,then:function(u){o.push(u)}}}return uf++,s.then(d_,d_),s}function d_(){if(--uf===0&&oo!==null){el!==null&&(el.status="fulfilled");var n=oo;oo=null,Js=0,el=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function _2(n,s){var o=[],u={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){u.status="fulfilled",u.value=s;for(var p=0;p<o.length;p++)(0,o[p])(s)},function(p){for(u.status="rejected",u.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),u}var p_=M.S;M.S=function(n,s){Z0=Lt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&m2(n,s),p_!==null&&p_(n,s)};var cs=L(null);function hf(){var n=cs.current;return n!==null?n:rt.pooledCache}function dc(n,s){s===null?N(cs,cs.current):N(cs,s.pool)}function g_(){var n=hf();return n===null?null:{parent:kt._currentValue,pool:n}}var tl=Error(r(460)),ff=Error(r(474)),pc=Error(r(542)),gc={then:function(){}};function m_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function __(n,s,o){switch(o=n[o],o===void 0?n.push(s):o!==s&&(s.then(On,On),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,y_(n),n;default:if(typeof s.status=="string")s.then(On,On);else{if(n=rt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=s,n.status="pending",n.then(function(u){if(s.status==="pending"){var p=s;p.status="fulfilled",p.value=u}},function(u){if(s.status==="pending"){var p=s;p.status="rejected",p.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,y_(n),n}throw hs=s,tl}}function us(n){try{var s=n._init;return s(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(hs=o,tl):o}}var hs=null;function v_(){if(hs===null)throw Error(r(459));var n=hs;return hs=null,n}function y_(n){if(n===tl||n===pc)throw Error(r(483))}var il=null,ao=0;function mc(n){var s=ao;return ao+=1,il===null&&(il=[]),__(il,n,s)}function co(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function _c(n,s){throw s.$$typeof===v?Error(r(525)):(n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function S_(n){function s(Z,K){if(n){var Q=Z.deletions;Q===null?(Z.deletions=[K],Z.flags|=16):Q.push(K)}}function o(Z,K){if(!n)return null;for(;K!==null;)s(Z,K),K=K.sibling;return null}function u(Z){for(var K=new Map;Z!==null;)Z.key!==null?K.set(Z.key,Z):K.set(Z.index,Z),Z=Z.sibling;return K}function p(Z,K){return Z=Pn(Z,K),Z.index=0,Z.sibling=null,Z}function _(Z,K,Q){return Z.index=Q,n?(Q=Z.alternate,Q!==null?(Q=Q.index,Q<K?(Z.flags|=67108866,K):Q):(Z.flags|=67108866,K)):(Z.flags|=1048576,K)}function x(Z){return n&&Z.alternate===null&&(Z.flags|=67108866),Z}function D(Z,K,Q,le){return K===null||K.tag!==6?(K=Jh(Q,Z.mode,le),K.return=Z,K):(K=p(K,Q),K.return=Z,K)}function W(Z,K,Q,le){var Ee=Q.type;return Ee===b?se(Z,K,Q.props.children,le,Q.key):K!==null&&(K.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===X&&us(Ee)===K.type)?(K=p(K,Q.props),co(K,Q),K.return=Z,K):(K=cc(Q.type,Q.key,Q.props,null,Z.mode,le),co(K,Q),K.return=Z,K)}function J(Z,K,Q,le){return K===null||K.tag!==4||K.stateNode.containerInfo!==Q.containerInfo||K.stateNode.implementation!==Q.implementation?(K=ef(Q,Z.mode,le),K.return=Z,K):(K=p(K,Q.children||[]),K.return=Z,K)}function se(Z,K,Q,le,Ee){return K===null||K.tag!==7?(K=ss(Q,Z.mode,le,Ee),K.return=Z,K):(K=p(K,Q),K.return=Z,K)}function ae(Z,K,Q){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=Jh(""+K,Z.mode,Q),K.return=Z,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case y:return Q=cc(K.type,K.key,K.props,null,Z.mode,Q),co(Q,K),Q.return=Z,Q;case S:return K=ef(K,Z.mode,Q),K.return=Z,K;case X:return K=us(K),ae(Z,K,Q)}if(O(K)||j(K))return K=ss(K,Z.mode,Q,null),K.return=Z,K;if(typeof K.then=="function")return ae(Z,mc(K),Q);if(K.$$typeof===C)return ae(Z,fc(Z,K),Q);_c(Z,K)}return null}function te(Z,K,Q,le){var Ee=K!==null?K.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Ee!==null?null:D(Z,K,""+Q,le);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return Q.key===Ee?W(Z,K,Q,le):null;case S:return Q.key===Ee?J(Z,K,Q,le):null;case X:return Q=us(Q),te(Z,K,Q,le)}if(O(Q)||j(Q))return Ee!==null?null:se(Z,K,Q,le,null);if(typeof Q.then=="function")return te(Z,K,mc(Q),le);if(Q.$$typeof===C)return te(Z,K,fc(Z,Q),le);_c(Z,Q)}return null}function ie(Z,K,Q,le,Ee){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return Z=Z.get(Q)||null,D(K,Z,""+le,Ee);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return Z=Z.get(le.key===null?Q:le.key)||null,W(K,Z,le,Ee);case S:return Z=Z.get(le.key===null?Q:le.key)||null,J(K,Z,le,Ee);case X:return le=us(le),ie(Z,K,Q,le,Ee)}if(O(le)||j(le))return Z=Z.get(Q)||null,se(K,Z,le,Ee,null);if(typeof le.then=="function")return ie(Z,K,Q,mc(le),Ee);if(le.$$typeof===C)return ie(Z,K,Q,fc(K,le),Ee);_c(K,le)}return null}function ye(Z,K,Q,le){for(var Ee=null,We=null,be=K,Be=K=0,qe=null;be!==null&&Be<Q.length;Be++){be.index>Be?(qe=be,be=null):qe=be.sibling;var Xe=te(Z,be,Q[Be],le);if(Xe===null){be===null&&(be=qe);break}n&&be&&Xe.alternate===null&&s(Z,be),K=_(Xe,K,Be),We===null?Ee=Xe:We.sibling=Xe,We=Xe,be=qe}if(Be===Q.length)return o(Z,be),Ve&&In(Z,Be),Ee;if(be===null){for(;Be<Q.length;Be++)be=ae(Z,Q[Be],le),be!==null&&(K=_(be,K,Be),We===null?Ee=be:We.sibling=be,We=be);return Ve&&In(Z,Be),Ee}for(be=u(be);Be<Q.length;Be++)qe=ie(be,Z,Be,Q[Be],le),qe!==null&&(n&&qe.alternate!==null&&be.delete(qe.key===null?Be:qe.key),K=_(qe,K,Be),We===null?Ee=qe:We.sibling=qe,We=qe);return n&&be.forEach(function(Hr){return s(Z,Hr)}),Ve&&In(Z,Be),Ee}function Me(Z,K,Q,le){if(Q==null)throw Error(r(151));for(var Ee=null,We=null,be=K,Be=K=0,qe=null,Xe=Q.next();be!==null&&!Xe.done;Be++,Xe=Q.next()){be.index>Be?(qe=be,be=null):qe=be.sibling;var Hr=te(Z,be,Xe.value,le);if(Hr===null){be===null&&(be=qe);break}n&&be&&Hr.alternate===null&&s(Z,be),K=_(Hr,K,Be),We===null?Ee=Hr:We.sibling=Hr,We=Hr,be=qe}if(Xe.done)return o(Z,be),Ve&&In(Z,Be),Ee;if(be===null){for(;!Xe.done;Be++,Xe=Q.next())Xe=ae(Z,Xe.value,le),Xe!==null&&(K=_(Xe,K,Be),We===null?Ee=Xe:We.sibling=Xe,We=Xe);return Ve&&In(Z,Be),Ee}for(be=u(be);!Xe.done;Be++,Xe=Q.next())Xe=ie(be,Z,Be,Xe.value,le),Xe!==null&&(n&&Xe.alternate!==null&&be.delete(Xe.key===null?Be:Xe.key),K=_(Xe,K,Be),We===null?Ee=Xe:We.sibling=Xe,We=Xe);return n&&be.forEach(function(TE){return s(Z,TE)}),Ve&&In(Z,Be),Ee}function it(Z,K,Q,le){if(typeof Q=="object"&&Q!==null&&Q.type===b&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:e:{for(var Ee=Q.key;K!==null;){if(K.key===Ee){if(Ee=Q.type,Ee===b){if(K.tag===7){o(Z,K.sibling),le=p(K,Q.props.children),le.return=Z,Z=le;break e}}else if(K.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===X&&us(Ee)===K.type){o(Z,K.sibling),le=p(K,Q.props),co(le,Q),le.return=Z,Z=le;break e}o(Z,K);break}else s(Z,K);K=K.sibling}Q.type===b?(le=ss(Q.props.children,Z.mode,le,Q.key),le.return=Z,Z=le):(le=cc(Q.type,Q.key,Q.props,null,Z.mode,le),co(le,Q),le.return=Z,Z=le)}return x(Z);case S:e:{for(Ee=Q.key;K!==null;){if(K.key===Ee)if(K.tag===4&&K.stateNode.containerInfo===Q.containerInfo&&K.stateNode.implementation===Q.implementation){o(Z,K.sibling),le=p(K,Q.children||[]),le.return=Z,Z=le;break e}else{o(Z,K);break}else s(Z,K);K=K.sibling}le=ef(Q,Z.mode,le),le.return=Z,Z=le}return x(Z);case X:return Q=us(Q),it(Z,K,Q,le)}if(O(Q))return ye(Z,K,Q,le);if(j(Q)){if(Ee=j(Q),typeof Ee!="function")throw Error(r(150));return Q=Ee.call(Q),Me(Z,K,Q,le)}if(typeof Q.then=="function")return it(Z,K,mc(Q),le);if(Q.$$typeof===C)return it(Z,K,fc(Z,Q),le);_c(Z,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,K!==null&&K.tag===6?(o(Z,K.sibling),le=p(K,Q),le.return=Z,Z=le):(o(Z,K),le=Jh(Q,Z.mode,le),le.return=Z,Z=le),x(Z)):o(Z,K)}return function(Z,K,Q,le){try{ao=0;var Ee=it(Z,K,Q,le);return il=null,Ee}catch(be){if(be===tl||be===pc)throw be;var We=Mi(29,be,null,Z.mode);return We.lanes=le,We.return=Z,We}finally{}}}var fs=S_(!0),b_=S_(!1),Sr=!1;function df(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function pf(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function br(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function xr(n,s,o){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(Ke&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,s=ac(n),r_(n,null,o),s}return oc(n,u,s,o),ac(n)}function uo(n,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var u=s.lanes;u&=n.pendingLanes,o|=u,s.lanes=o,ja(n,o)}}function gf(n,s){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,_=null;if(o=o.firstBaseUpdate,o!==null){do{var x={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};_===null?p=_=x:_=_.next=x,o=o.next}while(o!==null);_===null?p=_=s:_=_.next=s}else p=_=s;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:_,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=s:n.next=s,o.lastBaseUpdate=s}var mf=!1;function ho(){if(mf){var n=el;if(n!==null)throw n}}function fo(n,s,o,u){mf=!1;var p=n.updateQueue;Sr=!1;var _=p.firstBaseUpdate,x=p.lastBaseUpdate,D=p.shared.pending;if(D!==null){p.shared.pending=null;var W=D,J=W.next;W.next=null,x===null?_=J:x.next=J,x=W;var se=n.alternate;se!==null&&(se=se.updateQueue,D=se.lastBaseUpdate,D!==x&&(D===null?se.firstBaseUpdate=J:D.next=J,se.lastBaseUpdate=W))}if(_!==null){var ae=p.baseState;x=0,se=J=W=null,D=_;do{var te=D.lane&-536870913,ie=te!==D.lane;if(ie?(Ue&te)===te:(u&te)===te){te!==0&&te===Js&&(mf=!0),se!==null&&(se=se.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var ye=n,Me=D;te=s;var it=o;switch(Me.tag){case 1:if(ye=Me.payload,typeof ye=="function"){ae=ye.call(it,ae,te);break e}ae=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Me.payload,te=typeof ye=="function"?ye.call(it,ae,te):ye,te==null)break e;ae=g({},ae,te);break e;case 2:Sr=!0}}te=D.callback,te!==null&&(n.flags|=64,ie&&(n.flags|=8192),ie=p.callbacks,ie===null?p.callbacks=[te]:ie.push(te))}else ie={lane:te,tag:D.tag,payload:D.payload,callback:D.callback,next:null},se===null?(J=se=ie,W=ae):se=se.next=ie,x|=te;if(D=D.next,D===null){if(D=p.shared.pending,D===null)break;ie=D,D=ie.next,ie.next=null,p.lastBaseUpdate=ie,p.shared.pending=null}}while(!0);se===null&&(W=ae),p.baseState=W,p.firstBaseUpdate=J,p.lastBaseUpdate=se,_===null&&(p.shared.lanes=0),Mr|=x,n.lanes=x,n.memoizedState=ae}}function x_(n,s){if(typeof n!="function")throw Error(r(191,n));n.call(s)}function w_(n,s){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)x_(o[n],s)}var nl=L(null),vc=L(0);function C_(n,s){n=Gn,N(vc,n),N(nl,s),Gn=n|s.baseLanes}function _f(){N(vc,Gn),N(nl,nl.current)}function vf(){Gn=vc.current,$(nl),$(vc)}var Ti=L(null),Fi=null;function wr(n){var s=n.alternate;N(xt,xt.current&1),N(Ti,n),Fi===null&&(s===null||nl.current!==null||s.memoizedState!==null)&&(Fi=n)}function yf(n){N(xt,xt.current),N(Ti,n),Fi===null&&(Fi=n)}function E_(n){n.tag===22?(N(xt,xt.current),N(Ti,n),Fi===null&&(Fi=n)):Cr()}function Cr(){N(xt,xt.current),N(Ti,Ti.current)}function Ai(n){$(Ti),Fi===n&&(Fi=null),$(xt)}var xt=L(0);function yc(n){for(var s=n;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Ed(o)||kd(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var qn=0,Re=null,et=null,Mt=null,Sc=!1,rl=!1,ds=!1,bc=0,po=0,sl=null,v2=0;function mt(){throw Error(r(321))}function Sf(n,s){if(s===null)return!1;for(var o=0;o<s.length&&o<n.length;o++)if(!ki(n[o],s[o]))return!1;return!0}function bf(n,s,o,u,p,_){return qn=_,Re=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=n===null||n.memoizedState===null?a0:Of,ds=!1,_=o(u,p),ds=!1,rl&&(_=M_(s,o,u,p)),k_(n),_}function k_(n){M.H=_o;var s=et!==null&&et.next!==null;if(qn=0,Mt=et=Re=null,Sc=!1,po=0,sl=null,s)throw Error(r(300));n===null||Tt||(n=n.dependencies,n!==null&&hc(n)&&(Tt=!0))}function M_(n,s,o,u){Re=n;var p=0;do{if(rl&&(sl=null),po=0,rl=!1,25<=p)throw Error(r(301));if(p+=1,Mt=et=null,n.updateQueue!=null){var _=n.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}M.H=c0,_=s(o,u)}while(rl);return _}function y2(){var n=M.H,s=n.useState()[0];return s=typeof s.then=="function"?go(s):s,n=n.useState()[0],(et!==null?et.memoizedState:null)!==n&&(Re.flags|=1024),s}function xf(){var n=bc!==0;return bc=0,n}function wf(n,s,o){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~o}function Cf(n){if(Sc){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}Sc=!1}qn=0,Mt=et=Re=null,rl=!1,po=bc=0,sl=null}function li(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Re.memoizedState=Mt=n:Mt=Mt.next=n,Mt}function wt(){if(et===null){var n=Re.alternate;n=n!==null?n.memoizedState:null}else n=et.next;var s=Mt===null?Re.memoizedState:Mt.next;if(s!==null)Mt=s,et=n;else{if(n===null)throw Re.alternate===null?Error(r(467)):Error(r(310));et=n,n={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},Mt===null?Re.memoizedState=Mt=n:Mt=Mt.next=n}return Mt}function xc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function go(n){var s=po;return po+=1,sl===null&&(sl=[]),n=__(sl,n,s),s=Re,(Mt===null?s.memoizedState:Mt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?a0:Of),n}function wc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return go(n);if(n.$$typeof===C)return Xt(n)}throw Error(r(438,String(n)))}function Ef(n){var s=null,o=Re.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var u=Re.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(p){return p.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=xc(),Re.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(n),u=0;u<n;u++)o[u]=ne;return s.index++,o}function Vn(n,s){return typeof s=="function"?s(n):s}function Cc(n){var s=wt();return kf(s,et,n)}function kf(n,s,o){var u=n.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var p=n.baseQueue,_=u.pending;if(_!==null){if(p!==null){var x=p.next;p.next=_.next,_.next=x}s.baseQueue=p=_,u.pending=null}if(_=n.baseState,p===null)n.memoizedState=_;else{s=p.next;var D=x=null,W=null,J=s,se=!1;do{var ae=J.lane&-536870913;if(ae!==J.lane?(Ue&ae)===ae:(qn&ae)===ae){var te=J.revertLane;if(te===0)W!==null&&(W=W.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ae===Js&&(se=!0);else if((qn&te)===te){J=J.next,te===Js&&(se=!0);continue}else ae={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},W===null?(D=W=ae,x=_):W=W.next=ae,Re.lanes|=te,Mr|=te;ae=J.action,ds&&o(_,ae),_=J.hasEagerState?J.eagerState:o(_,ae)}else te={lane:ae,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},W===null?(D=W=te,x=_):W=W.next=te,Re.lanes|=ae,Mr|=ae;J=J.next}while(J!==null&&J!==s);if(W===null?x=_:W.next=D,!ki(_,n.memoizedState)&&(Tt=!0,se&&(o=el,o!==null)))throw o;n.memoizedState=_,n.baseState=x,n.baseQueue=W,u.lastRenderedState=_}return p===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function Mf(n){var s=wt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=n;var u=o.dispatch,p=o.pending,_=s.memoizedState;if(p!==null){o.pending=null;var x=p=p.next;do _=n(_,x.action),x=x.next;while(x!==p);ki(_,s.memoizedState)||(Tt=!0),s.memoizedState=_,s.baseQueue===null&&(s.baseState=_),o.lastRenderedState=_}return[_,u]}function T_(n,s,o){var u=Re,p=wt(),_=Ve;if(_){if(o===void 0)throw Error(r(407));o=o()}else o=s();var x=!ki((et||p).memoizedState,o);if(x&&(p.memoizedState=o,Tt=!0),p=p.queue,Nf(D_.bind(null,u,p,n),[n]),p.getSnapshot!==s||x||Mt!==null&&Mt.memoizedState.tag&1){if(u.flags|=2048,ll(9,{destroy:void 0},N_.bind(null,u,p,o,s),null),rt===null)throw Error(r(349));_||(qn&127)!==0||A_(u,s,o)}return o}function A_(n,s,o){n.flags|=16384,n={getSnapshot:s,value:o},s=Re.updateQueue,s===null?(s=xc(),Re.updateQueue=s,s.stores=[n]):(o=s.stores,o===null?s.stores=[n]:o.push(n))}function N_(n,s,o,u){s.value=o,s.getSnapshot=u,R_(s)&&B_(n)}function D_(n,s,o){return o(function(){R_(s)&&B_(n)})}function R_(n){var s=n.getSnapshot;n=n.value;try{var o=s();return!ki(n,o)}catch{return!0}}function B_(n){var s=rs(n,2);s!==null&&vi(s,n,2)}function Tf(n){var s=li();if(typeof n=="function"){var o=n;if(n=o(),ds){ei(!0);try{o()}finally{ei(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:n},s}function L_(n,s,o,u){return n.baseState=o,kf(n,et,typeof u=="function"?u:Vn)}function S2(n,s,o,u,p){if(Mc(n))throw Error(r(485));if(n=s.action,n!==null){var _={payload:p,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){_.listeners.push(x)}};M.T!==null?o(!0):_.isTransition=!1,u(_),o=s.pending,o===null?(_.next=s.pending=_,z_(s,_)):(_.next=o.next,s.pending=o.next=_)}}function z_(n,s){var o=s.action,u=s.payload,p=n.state;if(s.isTransition){var _=M.T,x={};M.T=x;try{var D=o(p,u),W=M.S;W!==null&&W(x,D),O_(n,s,D)}catch(J){Af(n,s,J)}finally{_!==null&&x.types!==null&&(_.types=x.types),M.T=_}}else try{_=o(p,u),O_(n,s,_)}catch(J){Af(n,s,J)}}function O_(n,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){H_(n,s,u)},function(u){return Af(n,s,u)}):H_(n,s,o)}function H_(n,s,o){s.status="fulfilled",s.value=o,P_(s),n.state=o,s=n.pending,s!==null&&(o=s.next,o===s?n.pending=null:(o=o.next,s.next=o,z_(n,o)))}function Af(n,s,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=o,P_(s),s=s.next;while(s!==u)}n.action=null}function P_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function I_(n,s){return s}function j_(n,s){if(Ve){var o=rt.formState;if(o!==null){e:{var u=Re;if(Ve){if(ot){t:{for(var p=ot,_=Vi;p.nodeType!==8;){if(!_){p=null;break t}if(p=Yi(p.nextSibling),p===null){p=null;break t}}_=p.data,p=_==="F!"||_==="F"?p:null}if(p){ot=Yi(p.nextSibling),u=p.data==="F!";break e}}vr(u)}u=!1}u&&(s=o[0])}}return o=li(),o.memoizedState=o.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:I_,lastRenderedState:s},o.queue=u,o=s0.bind(null,Re,u),u.dispatch=o,u=Tf(!1),_=zf.bind(null,Re,!1,u.queue),u=li(),p={state:s,dispatch:null,action:n,pending:null},u.queue=p,o=S2.bind(null,Re,p,_,o),p.dispatch=o,u.memoizedState=n,[s,o,!1]}function U_(n){var s=wt();return q_(s,et,n)}function q_(n,s,o){if(s=kf(n,s,I_)[0],n=Cc(Vn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=go(s)}catch(x){throw x===tl?pc:x}else u=s;s=wt();var p=s.queue,_=p.dispatch;return o!==s.memoizedState&&(Re.flags|=2048,ll(9,{destroy:void 0},b2.bind(null,p,o),null)),[u,_,n]}function b2(n,s){n.action=s}function V_(n){var s=wt(),o=et;if(o!==null)return q_(s,o,n);wt(),s=s.memoizedState,o=wt();var u=o.queue.dispatch;return o.memoizedState=n,[s,u,!1]}function ll(n,s,o,u){return n={tag:n,create:o,deps:u,inst:s,next:null},s=Re.updateQueue,s===null&&(s=xc(),Re.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,s.lastEffect=n),n}function F_(){return wt().memoizedState}function Ec(n,s,o,u){var p=li();Re.flags|=n,p.memoizedState=ll(1|s,{destroy:void 0},o,u===void 0?null:u)}function kc(n,s,o,u){var p=wt();u=u===void 0?null:u;var _=p.memoizedState.inst;et!==null&&u!==null&&Sf(u,et.memoizedState.deps)?p.memoizedState=ll(s,_,o,u):(Re.flags|=n,p.memoizedState=ll(1|s,_,o,u))}function Y_(n,s){Ec(8390656,8,n,s)}function Nf(n,s){kc(2048,8,n,s)}function x2(n){Re.flags|=4;var s=Re.updateQueue;if(s===null)s=xc(),Re.updateQueue=s,s.events=[n];else{var o=s.events;o===null?s.events=[n]:o.push(n)}}function $_(n){var s=wt().memoizedState;return x2({ref:s,nextImpl:n}),function(){if((Ke&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function W_(n,s){return kc(4,2,n,s)}function X_(n,s){return kc(4,4,n,s)}function K_(n,s){if(typeof s=="function"){n=n();var o=s(n);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function G_(n,s,o){o=o!=null?o.concat([n]):null,kc(4,4,K_.bind(null,s,n),o)}function Df(){}function Z_(n,s){var o=wt();s=s===void 0?null:s;var u=o.memoizedState;return s!==null&&Sf(s,u[1])?u[0]:(o.memoizedState=[n,s],n)}function Q_(n,s){var o=wt();s=s===void 0?null:s;var u=o.memoizedState;if(s!==null&&Sf(s,u[1]))return u[0];if(u=n(),ds){ei(!0);try{n()}finally{ei(!1)}}return o.memoizedState=[u,s],u}function Rf(n,s,o){return o===void 0||(qn&1073741824)!==0&&(Ue&261930)===0?n.memoizedState=s:(n.memoizedState=o,n=J0(),Re.lanes|=n,Mr|=n,o)}function J_(n,s,o,u){return ki(o,s)?o:nl.current!==null?(n=Rf(n,o,u),ki(n,s)||(Tt=!0),n):(qn&42)===0||(qn&1073741824)!==0&&(Ue&261930)===0?(Tt=!0,n.memoizedState=o):(n=J0(),Re.lanes|=n,Mr|=n,s)}function e0(n,s,o,u,p){var _=P.p;P.p=_!==0&&8>_?_:8;var x=M.T,D={};M.T=D,zf(n,!1,s,o);try{var W=p(),J=M.S;if(J!==null&&J(D,W),W!==null&&typeof W=="object"&&typeof W.then=="function"){var se=_2(W,u);mo(n,s,se,Ri(n))}else mo(n,s,u,Ri(n))}catch(ae){mo(n,s,{then:function(){},status:"rejected",reason:ae},Ri())}finally{P.p=_,x!==null&&D.types!==null&&(x.types=D.types),M.T=x}}function w2(){}function Bf(n,s,o,u){if(n.tag!==5)throw Error(r(476));var p=t0(n).queue;e0(n,p,s,H,o===null?w2:function(){return i0(n),o(u)})}function t0(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:H},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:o},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function i0(n){var s=t0(n);s.next===null&&(s=n.alternate.memoizedState),mo(n,s.next.queue,{},Ri())}function Lf(){return Xt(Bo)}function n0(){return wt().memoizedState}function r0(){return wt().memoizedState}function C2(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var o=Ri();n=br(o);var u=xr(s,n,o);u!==null&&(vi(u,s,o),uo(u,s,o)),s={cache:cf()},n.payload=s;return}s=s.return}}function E2(n,s,o){var u=Ri();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Mc(n)?l0(s,o):(o=Zh(n,s,o,u),o!==null&&(vi(o,n,u),o0(o,s,u)))}function s0(n,s,o){var u=Ri();mo(n,s,o,u)}function mo(n,s,o,u){var p={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Mc(n))l0(s,p);else{var _=n.alternate;if(n.lanes===0&&(_===null||_.lanes===0)&&(_=s.lastRenderedReducer,_!==null))try{var x=s.lastRenderedState,D=_(x,o);if(p.hasEagerState=!0,p.eagerState=D,ki(D,x))return oc(n,s,p,0),rt===null&&lc(),!1}catch{}finally{}if(o=Zh(n,s,p,u),o!==null)return vi(o,n,u),o0(o,s,u),!0}return!1}function zf(n,s,o,u){if(u={lane:2,revertLane:dd(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Mc(n)){if(s)throw Error(r(479))}else s=Zh(n,o,u,2),s!==null&&vi(s,n,2)}function Mc(n){var s=n.alternate;return n===Re||s!==null&&s===Re}function l0(n,s){rl=Sc=!0;var o=n.pending;o===null?s.next=s:(s.next=o.next,o.next=s),n.pending=s}function o0(n,s,o){if((o&4194048)!==0){var u=s.lanes;u&=n.pendingLanes,o|=u,s.lanes=o,ja(n,o)}}var _o={readContext:Xt,use:wc,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useLayoutEffect:mt,useInsertionEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useSyncExternalStore:mt,useId:mt,useHostTransitionStatus:mt,useFormState:mt,useActionState:mt,useOptimistic:mt,useMemoCache:mt,useCacheRefresh:mt};_o.useEffectEvent=mt;var a0={readContext:Xt,use:wc,useCallback:function(n,s){return li().memoizedState=[n,s===void 0?null:s],n},useContext:Xt,useEffect:Y_,useImperativeHandle:function(n,s,o){o=o!=null?o.concat([n]):null,Ec(4194308,4,K_.bind(null,s,n),o)},useLayoutEffect:function(n,s){return Ec(4194308,4,n,s)},useInsertionEffect:function(n,s){Ec(4,2,n,s)},useMemo:function(n,s){var o=li();s=s===void 0?null:s;var u=n();if(ds){ei(!0);try{n()}finally{ei(!1)}}return o.memoizedState=[u,s],u},useReducer:function(n,s,o){var u=li();if(o!==void 0){var p=o(s);if(ds){ei(!0);try{o(s)}finally{ei(!1)}}}else p=s;return u.memoizedState=u.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},u.queue=n,n=n.dispatch=E2.bind(null,Re,n),[u.memoizedState,n]},useRef:function(n){var s=li();return n={current:n},s.memoizedState=n},useState:function(n){n=Tf(n);var s=n.queue,o=s0.bind(null,Re,s);return s.dispatch=o,[n.memoizedState,o]},useDebugValue:Df,useDeferredValue:function(n,s){var o=li();return Rf(o,n,s)},useTransition:function(){var n=Tf(!1);return n=e0.bind(null,Re,n.queue,!0,!1),li().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,o){var u=Re,p=li();if(Ve){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),rt===null)throw Error(r(349));(Ue&127)!==0||A_(u,s,o)}p.memoizedState=o;var _={value:o,getSnapshot:s};return p.queue=_,Y_(D_.bind(null,u,_,n),[n]),u.flags|=2048,ll(9,{destroy:void 0},N_.bind(null,u,_,o,s),null),o},useId:function(){var n=li(),s=rt.identifierPrefix;if(Ve){var o=pn,u=dn;o=(u&~(1<<32-Ze(u)-1)).toString(32)+o,s="_"+s+"R_"+o,o=bc++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=v2++,s="_"+s+"r_"+o.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:Lf,useFormState:j_,useActionState:j_,useOptimistic:function(n){var s=li();s.memoizedState=s.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=zf.bind(null,Re,!0,o),o.dispatch=s,[n,s]},useMemoCache:Ef,useCacheRefresh:function(){return li().memoizedState=C2.bind(null,Re)},useEffectEvent:function(n){var s=li(),o={impl:n};return s.memoizedState=o,function(){if((Ke&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},Of={readContext:Xt,use:wc,useCallback:Z_,useContext:Xt,useEffect:Nf,useImperativeHandle:G_,useInsertionEffect:W_,useLayoutEffect:X_,useMemo:Q_,useReducer:Cc,useRef:F_,useState:function(){return Cc(Vn)},useDebugValue:Df,useDeferredValue:function(n,s){var o=wt();return J_(o,et.memoizedState,n,s)},useTransition:function(){var n=Cc(Vn)[0],s=wt().memoizedState;return[typeof n=="boolean"?n:go(n),s]},useSyncExternalStore:T_,useId:n0,useHostTransitionStatus:Lf,useFormState:U_,useActionState:U_,useOptimistic:function(n,s){var o=wt();return L_(o,et,n,s)},useMemoCache:Ef,useCacheRefresh:r0};Of.useEffectEvent=$_;var c0={readContext:Xt,use:wc,useCallback:Z_,useContext:Xt,useEffect:Nf,useImperativeHandle:G_,useInsertionEffect:W_,useLayoutEffect:X_,useMemo:Q_,useReducer:Mf,useRef:F_,useState:function(){return Mf(Vn)},useDebugValue:Df,useDeferredValue:function(n,s){var o=wt();return et===null?Rf(o,n,s):J_(o,et.memoizedState,n,s)},useTransition:function(){var n=Mf(Vn)[0],s=wt().memoizedState;return[typeof n=="boolean"?n:go(n),s]},useSyncExternalStore:T_,useId:n0,useHostTransitionStatus:Lf,useFormState:V_,useActionState:V_,useOptimistic:function(n,s){var o=wt();return et!==null?L_(o,et,n,s):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:Ef,useCacheRefresh:r0};c0.useEffectEvent=$_;function Hf(n,s,o,u){s=n.memoizedState,o=o(u,s),o=o==null?s:g({},s,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Pf={enqueueSetState:function(n,s,o){n=n._reactInternals;var u=Ri(),p=br(u);p.payload=s,o!=null&&(p.callback=o),s=xr(n,p,u),s!==null&&(vi(s,n,u),uo(s,n,u))},enqueueReplaceState:function(n,s,o){n=n._reactInternals;var u=Ri(),p=br(u);p.tag=1,p.payload=s,o!=null&&(p.callback=o),s=xr(n,p,u),s!==null&&(vi(s,n,u),uo(s,n,u))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var o=Ri(),u=br(o);u.tag=2,s!=null&&(u.callback=s),s=xr(n,u,o),s!==null&&(vi(s,n,o),uo(s,n,o))}};function u0(n,s,o,u,p,_,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,_,x):s.prototype&&s.prototype.isPureReactComponent?!io(o,u)||!io(p,_):!0}function h0(n,s,o,u){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,u),s.state!==n&&Pf.enqueueReplaceState(s,s.state,null)}function ps(n,s){var o=s;if("ref"in s){o={};for(var u in s)u!=="ref"&&(o[u]=s[u])}if(n=n.defaultProps){o===s&&(o=g({},o));for(var p in n)o[p]===void 0&&(o[p]=n[p])}return o}function f0(n){sc(n)}function d0(n){console.error(n)}function p0(n){sc(n)}function Tc(n,s){try{var o=n.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function g0(n,s,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function If(n,s,o){return o=br(o),o.tag=3,o.payload={element:null},o.callback=function(){Tc(n,s)},o}function m0(n){return n=br(n),n.tag=3,n}function _0(n,s,o,u){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var _=u.value;n.payload=function(){return p(_)},n.callback=function(){g0(s,o,u)}}var x=o.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){g0(s,o,u),typeof p!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var D=u.stack;this.componentDidCatch(u.value,{componentStack:D!==null?D:""})})}function k2(n,s,o,u,p){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=o.alternate,s!==null&&Qs(s,o,p,!0),o=Ti.current,o!==null){switch(o.tag){case 31:case 13:return Fi===null?jc():o.alternate===null&&_t===0&&(_t=3),o.flags&=-257,o.flags|=65536,o.lanes=p,u===gc?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([u]):s.add(u),ud(n,u,p)),!1;case 22:return o.flags|=65536,u===gc?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([u]):o.add(u)),ud(n,u,p)),!1}throw Error(r(435,o.tag))}return ud(n,u,p),jc(),!1}if(Ve)return s=Ti.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=p,u!==rf&&(n=Error(r(422),{cause:u}),so(ji(n,o)))):(u!==rf&&(s=Error(r(423),{cause:u}),so(ji(s,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,u=ji(u,o),p=If(n.stateNode,u,p),gf(n,p),_t!==4&&(_t=2)),!1;var _=Error(r(520),{cause:u});if(_=ji(_,o),Eo===null?Eo=[_]:Eo.push(_),_t!==4&&(_t=2),s===null)return!0;u=ji(u,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=If(o.stateNode,u,n),gf(o,n),!1;case 1:if(s=o.type,_=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Tr===null||!Tr.has(_))))return o.flags|=65536,p&=-p,o.lanes|=p,p=m0(p),_0(p,n,o,u),gf(o,p),!1}o=o.return}while(o!==null);return!1}var jf=Error(r(461)),Tt=!1;function Kt(n,s,o,u){s.child=n===null?b_(s,null,o,u):fs(s,n.child,o,u)}function v0(n,s,o,u,p){o=o.render;var _=s.ref;if("ref"in u){var x={};for(var D in u)D!=="ref"&&(x[D]=u[D])}else x=u;return as(s),u=bf(n,s,o,x,_,p),D=xf(),n!==null&&!Tt?(wf(n,s,p),Fn(n,s,p)):(Ve&&D&&tf(s),s.flags|=1,Kt(n,s,u,p),s.child)}function y0(n,s,o,u,p){if(n===null){var _=o.type;return typeof _=="function"&&!Qh(_)&&_.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=_,S0(n,s,_,u,p)):(n=cc(o.type,null,u,s,s.mode,p),n.ref=s.ref,n.return=s,s.child=n)}if(_=n.child,!Xf(n,p)){var x=_.memoizedProps;if(o=o.compare,o=o!==null?o:io,o(x,u)&&n.ref===s.ref)return Fn(n,s,p)}return s.flags|=1,n=Pn(_,u),n.ref=s.ref,n.return=s,s.child=n}function S0(n,s,o,u,p){if(n!==null){var _=n.memoizedProps;if(io(_,u)&&n.ref===s.ref)if(Tt=!1,s.pendingProps=u=_,Xf(n,p))(n.flags&131072)!==0&&(Tt=!0);else return s.lanes=n.lanes,Fn(n,s,p)}return Uf(n,s,o,u,p)}function b0(n,s,o,u){var p=u.children,_=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((s.flags&128)!==0){if(_=_!==null?_.baseLanes|o:o,n!==null){for(u=s.child=n.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~_}else u=0,s.child=null;return x0(n,s,_,o,u)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&dc(s,_!==null?_.cachePool:null),_!==null?C_(s,_):_f(),E_(s);else return u=s.lanes=536870912,x0(n,s,_!==null?_.baseLanes|o:o,o,u)}else _!==null?(dc(s,_.cachePool),C_(s,_),Cr(),s.memoizedState=null):(n!==null&&dc(s,null),_f(),Cr());return Kt(n,s,p,o),s.child}function vo(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function x0(n,s,o,u,p){var _=hf();return _=_===null?null:{parent:kt._currentValue,pool:_},s.memoizedState={baseLanes:o,cachePool:_},n!==null&&dc(s,null),_f(),E_(s),n!==null&&Qs(n,s,u,!0),s.childLanes=p,null}function Ac(n,s){return s=Dc({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function w0(n,s,o){return fs(s,n.child,null,o),n=Ac(s,s.pendingProps),n.flags|=2,Ai(s),s.memoizedState=null,n}function M2(n,s,o){var u=s.pendingProps,p=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Ve){if(u.mode==="hidden")return n=Ac(s,u),s.lanes=536870912,vo(null,n);if(yf(s),(n=ot)?(n=zv(n,Vi),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:mr!==null?{id:dn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},o=l_(n),o.return=s,s.child=o,Wt=s,ot=null)):n=null,n===null)throw vr(s);return s.lanes=536870912,null}return Ac(s,u)}var _=n.memoizedState;if(_!==null){var x=_.dehydrated;if(yf(s),p)if(s.flags&256)s.flags&=-257,s=w0(n,s,o);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(r(558));else if(Tt||Qs(n,s,o,!1),p=(o&n.childLanes)!==0,Tt||p){if(u=rt,u!==null&&(x=Ua(u,o),x!==0&&x!==_.retryLane))throw _.retryLane=x,rs(n,x),vi(u,n,x),jf;jc(),s=w0(n,s,o)}else n=_.treeContext,ot=Yi(x.nextSibling),Wt=s,Ve=!0,_r=null,Vi=!1,n!==null&&c_(s,n),s=Ac(s,u),s.flags|=4096;return s}return n=Pn(n.child,{mode:u.mode,children:u.children}),n.ref=s.ref,s.child=n,n.return=s,n}function Nc(n,s){var o=s.ref;if(o===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(n===null||n.ref!==o)&&(s.flags|=4194816)}}function Uf(n,s,o,u,p){return as(s),o=bf(n,s,o,u,void 0,p),u=xf(),n!==null&&!Tt?(wf(n,s,p),Fn(n,s,p)):(Ve&&u&&tf(s),s.flags|=1,Kt(n,s,o,p),s.child)}function C0(n,s,o,u,p,_){return as(s),s.updateQueue=null,o=M_(s,u,o,p),k_(n),u=xf(),n!==null&&!Tt?(wf(n,s,_),Fn(n,s,_)):(Ve&&u&&tf(s),s.flags|=1,Kt(n,s,o,_),s.child)}function E0(n,s,o,u,p){if(as(s),s.stateNode===null){var _=Xs,x=o.contextType;typeof x=="object"&&x!==null&&(_=Xt(x)),_=new o(u,_),s.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Pf,s.stateNode=_,_._reactInternals=s,_=s.stateNode,_.props=u,_.state=s.memoizedState,_.refs={},df(s),x=o.contextType,_.context=typeof x=="object"&&x!==null?Xt(x):Xs,_.state=s.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(Hf(s,o,x,u),_.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(x=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),x!==_.state&&Pf.enqueueReplaceState(_,_.state,null),fo(s,u,_,p),ho(),_.state=s.memoizedState),typeof _.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(n===null){_=s.stateNode;var D=s.memoizedProps,W=ps(o,D);_.props=W;var J=_.context,se=o.contextType;x=Xs,typeof se=="object"&&se!==null&&(x=Xt(se));var ae=o.getDerivedStateFromProps;se=typeof ae=="function"||typeof _.getSnapshotBeforeUpdate=="function",D=s.pendingProps!==D,se||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(D||J!==x)&&h0(s,_,u,x),Sr=!1;var te=s.memoizedState;_.state=te,fo(s,u,_,p),ho(),J=s.memoizedState,D||te!==J||Sr?(typeof ae=="function"&&(Hf(s,o,ae,u),J=s.memoizedState),(W=Sr||u0(s,o,W,u,te,J,x))?(se||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(s.flags|=4194308)):(typeof _.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=J),_.props=u,_.state=J,_.context=x,u=W):(typeof _.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{_=s.stateNode,pf(n,s),x=s.memoizedProps,se=ps(o,x),_.props=se,ae=s.pendingProps,te=_.context,J=o.contextType,W=Xs,typeof J=="object"&&J!==null&&(W=Xt(J)),D=o.getDerivedStateFromProps,(J=typeof D=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(x!==ae||te!==W)&&h0(s,_,u,W),Sr=!1,te=s.memoizedState,_.state=te,fo(s,u,_,p),ho();var ie=s.memoizedState;x!==ae||te!==ie||Sr||n!==null&&n.dependencies!==null&&hc(n.dependencies)?(typeof D=="function"&&(Hf(s,o,D,u),ie=s.memoizedState),(se=Sr||u0(s,o,se,u,te,ie,W)||n!==null&&n.dependencies!==null&&hc(n.dependencies))?(J||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(u,ie,W),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(u,ie,W)),typeof _.componentDidUpdate=="function"&&(s.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof _.componentDidUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=ie),_.props=u,_.state=ie,_.context=W,u=se):(typeof _.componentDidUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=1024),u=!1)}return _=u,Nc(n,s),u=(s.flags&128)!==0,_||u?(_=s.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:_.render(),s.flags|=1,n!==null&&u?(s.child=fs(s,n.child,null,p),s.child=fs(s,null,o,p)):Kt(n,s,o,p),s.memoizedState=_.state,n=s.child):n=Fn(n,s,p),n}function k0(n,s,o,u){return ls(),s.flags|=256,Kt(n,s,o,u),s.child}var qf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vf(n){return{baseLanes:n,cachePool:g_()}}function Ff(n,s,o){return n=n!==null?n.childLanes&~o:0,s&&(n|=Di),n}function M0(n,s,o){var u=s.pendingProps,p=!1,_=(s.flags&128)!==0,x;if((x=_)||(x=n!==null&&n.memoizedState===null?!1:(xt.current&2)!==0),x&&(p=!0,s.flags&=-129),x=(s.flags&32)!==0,s.flags&=-33,n===null){if(Ve){if(p?wr(s):Cr(),(n=ot)?(n=zv(n,Vi),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:mr!==null?{id:dn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},o=l_(n),o.return=s,s.child=o,Wt=s,ot=null)):n=null,n===null)throw vr(s);return kd(n)?s.lanes=32:s.lanes=536870912,null}var D=u.children;return u=u.fallback,p?(Cr(),p=s.mode,D=Dc({mode:"hidden",children:D},p),u=ss(u,p,o,null),D.return=s,u.return=s,D.sibling=u,s.child=D,u=s.child,u.memoizedState=Vf(o),u.childLanes=Ff(n,x,o),s.memoizedState=qf,vo(null,u)):(wr(s),Yf(s,D))}var W=n.memoizedState;if(W!==null&&(D=W.dehydrated,D!==null)){if(_)s.flags&256?(wr(s),s.flags&=-257,s=$f(n,s,o)):s.memoizedState!==null?(Cr(),s.child=n.child,s.flags|=128,s=null):(Cr(),D=u.fallback,p=s.mode,u=Dc({mode:"visible",children:u.children},p),D=ss(D,p,o,null),D.flags|=2,u.return=s,D.return=s,u.sibling=D,s.child=u,fs(s,n.child,null,o),u=s.child,u.memoizedState=Vf(o),u.childLanes=Ff(n,x,o),s.memoizedState=qf,s=vo(null,u));else if(wr(s),kd(D)){if(x=D.nextSibling&&D.nextSibling.dataset,x)var J=x.dgst;x=J,u=Error(r(419)),u.stack="",u.digest=x,so({value:u,source:null,stack:null}),s=$f(n,s,o)}else if(Tt||Qs(n,s,o,!1),x=(o&n.childLanes)!==0,Tt||x){if(x=rt,x!==null&&(u=Ua(x,o),u!==0&&u!==W.retryLane))throw W.retryLane=u,rs(n,u),vi(x,n,u),jf;Ed(D)||jc(),s=$f(n,s,o)}else Ed(D)?(s.flags|=192,s.child=n.child,s=null):(n=W.treeContext,ot=Yi(D.nextSibling),Wt=s,Ve=!0,_r=null,Vi=!1,n!==null&&c_(s,n),s=Yf(s,u.children),s.flags|=4096);return s}return p?(Cr(),D=u.fallback,p=s.mode,W=n.child,J=W.sibling,u=Pn(W,{mode:"hidden",children:u.children}),u.subtreeFlags=W.subtreeFlags&65011712,J!==null?D=Pn(J,D):(D=ss(D,p,o,null),D.flags|=2),D.return=s,u.return=s,u.sibling=D,s.child=u,vo(null,u),u=s.child,D=n.child.memoizedState,D===null?D=Vf(o):(p=D.cachePool,p!==null?(W=kt._currentValue,p=p.parent!==W?{parent:W,pool:W}:p):p=g_(),D={baseLanes:D.baseLanes|o,cachePool:p}),u.memoizedState=D,u.childLanes=Ff(n,x,o),s.memoizedState=qf,vo(n.child,u)):(wr(s),o=n.child,n=o.sibling,o=Pn(o,{mode:"visible",children:u.children}),o.return=s,o.sibling=null,n!==null&&(x=s.deletions,x===null?(s.deletions=[n],s.flags|=16):x.push(n)),s.child=o,s.memoizedState=null,o)}function Yf(n,s){return s=Dc({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Dc(n,s){return n=Mi(22,n,null,s),n.lanes=0,n}function $f(n,s,o){return fs(s,n.child,null,o),n=Yf(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function T0(n,s,o){n.lanes|=s;var u=n.alternate;u!==null&&(u.lanes|=s),of(n.return,s,o)}function Wf(n,s,o,u,p,_){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:p,treeForkCount:_}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=u,x.tail=o,x.tailMode=p,x.treeForkCount=_)}function A0(n,s,o){var u=s.pendingProps,p=u.revealOrder,_=u.tail;u=u.children;var x=xt.current,D=(x&2)!==0;if(D?(x=x&1|2,s.flags|=128):x&=1,N(xt,x),Kt(n,s,u,o),u=Ve?ro:0,!D&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&T0(n,o,s);else if(n.tag===19)T0(n,o,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(p){case"forwards":for(o=s.child,p=null;o!==null;)n=o.alternate,n!==null&&yc(n)===null&&(p=o),o=o.sibling;o=p,o===null?(p=s.child,s.child=null):(p=o.sibling,o.sibling=null),Wf(s,!1,p,o,_,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=s.child,s.child=null;p!==null;){if(n=p.alternate,n!==null&&yc(n)===null){s.child=p;break}n=p.sibling,p.sibling=o,o=p,p=n}Wf(s,!0,o,null,_,u);break;case"together":Wf(s,!1,null,null,void 0,u);break;default:s.memoizedState=null}return s.child}function Fn(n,s,o){if(n!==null&&(s.dependencies=n.dependencies),Mr|=s.lanes,(o&s.childLanes)===0)if(n!==null){if(Qs(n,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,o=Pn(n,n.pendingProps),s.child=o,o.return=s;n.sibling!==null;)n=n.sibling,o=o.sibling=Pn(n,n.pendingProps),o.return=s;o.sibling=null}return s.child}function Xf(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&hc(n)))}function T2(n,s,o){switch(s.tag){case 3:he(s,s.stateNode.containerInfo),yr(s,kt,n.memoizedState.cache),ls();break;case 27:case 5:Ce(s);break;case 4:he(s,s.stateNode.containerInfo);break;case 10:yr(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,yf(s),null;break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(wr(s),s.flags|=128,null):(o&s.child.childLanes)!==0?M0(n,s,o):(wr(s),n=Fn(n,s,o),n!==null?n.sibling:null);wr(s);break;case 19:var p=(n.flags&128)!==0;if(u=(o&s.childLanes)!==0,u||(Qs(n,s,o,!1),u=(o&s.childLanes)!==0),p){if(u)return A0(n,s,o);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),N(xt,xt.current),u)break;return null;case 22:return s.lanes=0,b0(n,s,o,s.pendingProps);case 24:yr(s,kt,n.memoizedState.cache)}return Fn(n,s,o)}function N0(n,s,o){if(n!==null)if(n.memoizedProps!==s.pendingProps)Tt=!0;else{if(!Xf(n,o)&&(s.flags&128)===0)return Tt=!1,T2(n,s,o);Tt=(n.flags&131072)!==0}else Tt=!1,Ve&&(s.flags&1048576)!==0&&a_(s,ro,s.index);switch(s.lanes=0,s.tag){case 16:e:{var u=s.pendingProps;if(n=us(s.elementType),s.type=n,typeof n=="function")Qh(n)?(u=ps(n,u),s.tag=1,s=E0(null,s,n,u,o)):(s.tag=0,s=Uf(null,s,n,u,o));else{if(n!=null){var p=n.$$typeof;if(p===T){s.tag=11,s=v0(null,s,n,u,o);break e}else if(p===U){s.tag=14,s=y0(null,s,n,u,o);break e}}throw s=R(n)||n,Error(r(306,s,""))}}return s;case 0:return Uf(n,s,s.type,s.pendingProps,o);case 1:return u=s.type,p=ps(u,s.pendingProps),E0(n,s,u,p,o);case 3:e:{if(he(s,s.stateNode.containerInfo),n===null)throw Error(r(387));u=s.pendingProps;var _=s.memoizedState;p=_.element,pf(n,s),fo(s,u,null,o);var x=s.memoizedState;if(u=x.cache,yr(s,kt,u),u!==_.cache&&af(s,[kt],o,!0),ho(),u=x.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:x.cache},s.updateQueue.baseState=_,s.memoizedState=_,s.flags&256){s=k0(n,s,u,o);break e}else if(u!==p){p=ji(Error(r(424)),s),so(p),s=k0(n,s,u,o);break e}else{switch(n=s.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(ot=Yi(n.firstChild),Wt=s,Ve=!0,_r=null,Vi=!0,o=b_(s,null,u,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(ls(),u===p){s=Fn(n,s,o);break e}Kt(n,s,u,o)}s=s.child}return s;case 26:return Nc(n,s),n===null?(o=Uv(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ve||(o=s.type,n=s.pendingProps,u=Wc(oe.current).createElement(o),u[zt]=s,u[ti]=n,Gt(u,o,n),Et(u),s.stateNode=u):s.memoizedState=Uv(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Ce(s),n===null&&Ve&&(u=s.stateNode=Pv(s.type,s.pendingProps,oe.current),Wt=s,Vi=!0,p=ot,Rr(s.type)?(Md=p,ot=Yi(u.firstChild)):ot=p),Kt(n,s,s.pendingProps.children,o),Nc(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Ve&&((p=u=ot)&&(u=rE(u,s.type,s.pendingProps,Vi),u!==null?(s.stateNode=u,Wt=s,ot=Yi(u.firstChild),Vi=!1,p=!0):p=!1),p||vr(s)),Ce(s),p=s.type,_=s.pendingProps,x=n!==null?n.memoizedProps:null,u=_.children,xd(p,_)?u=null:x!==null&&xd(p,x)&&(s.flags|=32),s.memoizedState!==null&&(p=bf(n,s,y2,null,null,o),Bo._currentValue=p),Nc(n,s),Kt(n,s,u,o),s.child;case 6:return n===null&&Ve&&((n=o=ot)&&(o=sE(o,s.pendingProps,Vi),o!==null?(s.stateNode=o,Wt=s,ot=null,n=!0):n=!1),n||vr(s)),null;case 13:return M0(n,s,o);case 4:return he(s,s.stateNode.containerInfo),u=s.pendingProps,n===null?s.child=fs(s,null,u,o):Kt(n,s,u,o),s.child;case 11:return v0(n,s,s.type,s.pendingProps,o);case 7:return Kt(n,s,s.pendingProps,o),s.child;case 8:return Kt(n,s,s.pendingProps.children,o),s.child;case 12:return Kt(n,s,s.pendingProps.children,o),s.child;case 10:return u=s.pendingProps,yr(s,s.type,u.value),Kt(n,s,u.children,o),s.child;case 9:return p=s.type._context,u=s.pendingProps.children,as(s),p=Xt(p),u=u(p),s.flags|=1,Kt(n,s,u,o),s.child;case 14:return y0(n,s,s.type,s.pendingProps,o);case 15:return S0(n,s,s.type,s.pendingProps,o);case 19:return A0(n,s,o);case 31:return M2(n,s,o);case 22:return b0(n,s,o,s.pendingProps);case 24:return as(s),u=Xt(kt),n===null?(p=hf(),p===null&&(p=rt,_=cf(),p.pooledCache=_,_.refCount++,_!==null&&(p.pooledCacheLanes|=o),p=_),s.memoizedState={parent:u,cache:p},df(s),yr(s,kt,p)):((n.lanes&o)!==0&&(pf(n,s),fo(s,null,null,o),ho()),p=n.memoizedState,_=s.memoizedState,p.parent!==u?(p={parent:u,cache:u},s.memoizedState=p,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=p),yr(s,kt,u)):(u=_.cache,yr(s,kt,u),u!==p.cache&&af(s,[kt],o,!0))),Kt(n,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Yn(n){n.flags|=4}function Kf(n,s,o,u,p){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(p&335544128)===p)if(n.stateNode.complete)n.flags|=8192;else if(nv())n.flags|=8192;else throw hs=gc,ff}else n.flags&=-16777217}function D0(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!$v(s))if(nv())n.flags|=8192;else throw hs=gc,ff}function Rc(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?Pa():536870912,n.lanes|=s,ul|=s)}function yo(n,s){if(!Ve)switch(n.tailMode){case"hidden":s=n.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function at(n){var s=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(s)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=u,n.childLanes=o,s}function A2(n,s,o){var u=s.pendingProps;switch(nf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(s),null;case 1:return at(s),null;case 3:return o=s.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),Un(kt),pe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(Zs(s)?Yn(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,sf())),at(s),null;case 26:var p=s.type,_=s.memoizedState;return n===null?(Yn(s),_!==null?(at(s),D0(s,_)):(at(s),Kf(s,p,null,u,o))):_?_!==n.memoizedState?(Yn(s),at(s),D0(s,_)):(at(s),s.flags&=-16777217):(n=n.memoizedProps,n!==u&&Yn(s),at(s),Kf(s,p,n,u,o)),null;case 27:if(xe(s),o=oe.current,p=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==u&&Yn(s);else{if(!u){if(s.stateNode===null)throw Error(r(166));return at(s),null}n=ee.current,Zs(s)?u_(s):(n=Pv(p,u,o),s.stateNode=n,Yn(s))}return at(s),null;case 5:if(xe(s),p=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==u&&Yn(s);else{if(!u){if(s.stateNode===null)throw Error(r(166));return at(s),null}if(_=ee.current,Zs(s))u_(s);else{var x=Wc(oe.current);switch(_){case 1:_=x.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:_=x.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":_=x.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":_=x.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":_=x.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof u.is=="string"?x.createElement("select",{is:u.is}):x.createElement("select"),u.multiple?_.multiple=!0:u.size&&(_.size=u.size);break;default:_=typeof u.is=="string"?x.createElement(p,{is:u.is}):x.createElement(p)}}_[zt]=s,_[ti]=u;e:for(x=s.child;x!==null;){if(x.tag===5||x.tag===6)_.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===s)break e;for(;x.sibling===null;){if(x.return===null||x.return===s)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}s.stateNode=_;e:switch(Gt(_,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Yn(s)}}return at(s),Kf(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,o),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==u&&Yn(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(n=oe.current,Zs(s)){if(n=s.stateNode,o=s.memoizedProps,u=null,p=Wt,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}n[zt]=s,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||Mv(n.nodeValue,o)),n||vr(s,!0)}else n=Wc(n).createTextNode(u),n[zt]=s,s.stateNode=n}return at(s),null;case 31:if(o=s.memoizedState,n===null||n.memoizedState!==null){if(u=Zs(s),o!==null){if(n===null){if(!u)throw Error(r(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[zt]=s}else ls(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;at(s),n=!1}else o=sf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return s.flags&256?(Ai(s),s):(Ai(s),null);if((s.flags&128)!==0)throw Error(r(558))}return at(s),null;case 13:if(u=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=Zs(s),u!==null&&u.dehydrated!==null){if(n===null){if(!p)throw Error(r(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[zt]=s}else ls(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;at(s),p=!1}else p=sf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return s.flags&256?(Ai(s),s):(Ai(s),null)}return Ai(s),(s.flags&128)!==0?(s.lanes=o,s):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=s.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==p&&(u.flags|=2048)),o!==n&&o&&(s.child.flags|=8192),Rc(s,s.updateQueue),at(s),null);case 4:return pe(),n===null&&_d(s.stateNode.containerInfo),at(s),null;case 10:return Un(s.type),at(s),null;case 19:if($(xt),u=s.memoizedState,u===null)return at(s),null;if(p=(s.flags&128)!==0,_=u.rendering,_===null)if(p)yo(u,!1);else{if(_t!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(_=yc(n),_!==null){for(s.flags|=128,yo(u,!1),n=_.updateQueue,s.updateQueue=n,Rc(s,n),s.subtreeFlags=0,n=o,o=s.child;o!==null;)s_(o,n),o=o.sibling;return N(xt,xt.current&1|2),Ve&&In(s,u.treeForkCount),s.child}n=n.sibling}u.tail!==null&&Lt()>Hc&&(s.flags|=128,p=!0,yo(u,!1),s.lanes=4194304)}else{if(!p)if(n=yc(_),n!==null){if(s.flags|=128,p=!0,n=n.updateQueue,s.updateQueue=n,Rc(s,n),yo(u,!0),u.tail===null&&u.tailMode==="hidden"&&!_.alternate&&!Ve)return at(s),null}else 2*Lt()-u.renderingStartTime>Hc&&o!==536870912&&(s.flags|=128,p=!0,yo(u,!1),s.lanes=4194304);u.isBackwards?(_.sibling=s.child,s.child=_):(n=u.last,n!==null?n.sibling=_:s.child=_,u.last=_)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Lt(),n.sibling=null,o=xt.current,N(xt,p?o&1|2:o&1),Ve&&In(s,u.treeForkCount),n):(at(s),null);case 22:case 23:return Ai(s),vf(),u=s.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(o&536870912)!==0&&(s.flags&128)===0&&(at(s),s.subtreeFlags&6&&(s.flags|=8192)):at(s),o=s.updateQueue,o!==null&&Rc(s,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048),n!==null&&$(cs),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),Un(kt),at(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function N2(n,s){switch(nf(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Un(kt),pe(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return xe(s),null;case 31:if(s.memoizedState!==null){if(Ai(s),s.alternate===null)throw Error(r(340));ls()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(Ai(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ls()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return $(xt),null;case 4:return pe(),null;case 10:return Un(s.type),null;case 22:case 23:return Ai(s),vf(),n!==null&&$(cs),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return Un(kt),null;case 25:return null;default:return null}}function R0(n,s){switch(nf(s),s.tag){case 3:Un(kt),pe();break;case 26:case 27:case 5:xe(s);break;case 4:pe();break;case 31:s.memoizedState!==null&&Ai(s);break;case 13:Ai(s);break;case 19:$(xt);break;case 10:Un(s.type);break;case 22:case 23:Ai(s),vf(),n!==null&&$(cs);break;case 24:Un(kt)}}function So(n,s){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&n)===n){u=void 0;var _=o.create,x=o.inst;u=_(),x.destroy=u}o=o.next}while(o!==p)}}catch(D){Je(s,s.return,D)}}function Er(n,s,o){try{var u=s.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var _=p.next;u=_;do{if((u.tag&n)===n){var x=u.inst,D=x.destroy;if(D!==void 0){x.destroy=void 0,p=s;var W=o,J=D;try{J()}catch(se){Je(p,W,se)}}}u=u.next}while(u!==_)}}catch(se){Je(s,s.return,se)}}function B0(n){var s=n.updateQueue;if(s!==null){var o=n.stateNode;try{w_(s,o)}catch(u){Je(n,n.return,u)}}}function L0(n,s,o){o.props=ps(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){Je(n,s,u)}}function bo(n,s){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(p){Je(n,s,p)}}function gn(n,s){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(p){Je(n,s,p)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){Je(n,s,p)}else o.current=null}function z0(n){var s=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(p){Je(n,n.return,p)}}function Gf(n,s,o){try{var u=n.stateNode;Q2(u,n.type,o,s),u[ti]=s}catch(p){Je(n,n.return,p)}}function O0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Rr(n.type)||n.tag===4}function Zf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||O0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Rr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Qf(n,s,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(n),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=On));else if(u!==4&&(u===27&&Rr(n.type)&&(o=n.stateNode,s=null),n=n.child,n!==null))for(Qf(n,s,o),n=n.sibling;n!==null;)Qf(n,s,o),n=n.sibling}function Bc(n,s,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,s?o.insertBefore(n,s):o.appendChild(n);else if(u!==4&&(u===27&&Rr(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Bc(n,s,o),n=n.sibling;n!==null;)Bc(n,s,o),n=n.sibling}function H0(n){var s=n.stateNode,o=n.memoizedProps;try{for(var u=n.type,p=s.attributes;p.length;)s.removeAttributeNode(p[0]);Gt(s,u,o),s[zt]=n,s[ti]=o}catch(_){Je(n,n.return,_)}}var $n=!1,At=!1,Jf=!1,P0=typeof WeakSet=="function"?WeakSet:Set,jt=null;function D2(n,s){if(n=n.containerInfo,Sd=eu,n=Gm(n),Yh(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{o.nodeType,_.nodeType}catch{o=null;break e}var x=0,D=-1,W=-1,J=0,se=0,ae=n,te=null;t:for(;;){for(var ie;ae!==o||p!==0&&ae.nodeType!==3||(D=x+p),ae!==_||u!==0&&ae.nodeType!==3||(W=x+u),ae.nodeType===3&&(x+=ae.nodeValue.length),(ie=ae.firstChild)!==null;)te=ae,ae=ie;for(;;){if(ae===n)break t;if(te===o&&++J===p&&(D=x),te===_&&++se===u&&(W=x),(ie=ae.nextSibling)!==null)break;ae=te,te=ae.parentNode}ae=ie}o=D===-1||W===-1?null:{start:D,end:W}}else o=null}o=o||{start:0,end:0}}else o=null;for(bd={focusedElem:n,selectionRange:o},eu=!1,jt=s;jt!==null;)if(s=jt,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,jt=n;else for(;jt!==null;){switch(s=jt,_=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)p=n[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&_!==null){n=void 0,o=s,p=_.memoizedProps,_=_.memoizedState,u=o.stateNode;try{var ye=ps(o.type,p);n=u.getSnapshotBeforeUpdate(ye,_),u.__reactInternalSnapshotBeforeUpdate=n}catch(Me){Je(o,o.return,Me)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,o=n.nodeType,o===9)Cd(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Cd(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=s.sibling,n!==null){n.return=s.return,jt=n;break}jt=s.return}}function I0(n,s,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:Xn(n,o),u&4&&So(5,o);break;case 1:if(Xn(n,o),u&4)if(n=o.stateNode,s===null)try{n.componentDidMount()}catch(x){Je(o,o.return,x)}else{var p=ps(o.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(p,s,n.__reactInternalSnapshotBeforeUpdate)}catch(x){Je(o,o.return,x)}}u&64&&B0(o),u&512&&bo(o,o.return);break;case 3:if(Xn(n,o),u&64&&(n=o.updateQueue,n!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{w_(n,s)}catch(x){Je(o,o.return,x)}}break;case 27:s===null&&u&4&&H0(o);case 26:case 5:Xn(n,o),s===null&&u&4&&z0(o),u&512&&bo(o,o.return);break;case 12:Xn(n,o);break;case 31:Xn(n,o),u&4&&q0(n,o);break;case 13:Xn(n,o),u&4&&V0(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=j2.bind(null,o),lE(n,o))));break;case 22:if(u=o.memoizedState!==null||$n,!u){s=s!==null&&s.memoizedState!==null||At,p=$n;var _=At;$n=u,(At=s)&&!_?Kn(n,o,(o.subtreeFlags&8772)!==0):Xn(n,o),$n=p,At=_}break;case 30:break;default:Xn(n,o)}}function j0(n){var s=n.alternate;s!==null&&(n.alternate=null,j0(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&$l(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var ut=null,pi=!1;function Wn(n,s,o){for(o=o.child;o!==null;)U0(n,s,o),o=o.sibling}function U0(n,s,o){if(bt&&typeof bt.onCommitFiberUnmount=="function")try{bt.onCommitFiberUnmount($t,o)}catch{}switch(o.tag){case 26:At||gn(o,s),Wn(n,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:At||gn(o,s);var u=ut,p=pi;Rr(o.type)&&(ut=o.stateNode,pi=!1),Wn(n,s,o),No(o.stateNode),ut=u,pi=p;break;case 5:At||gn(o,s);case 6:if(u=ut,p=pi,ut=null,Wn(n,s,o),ut=u,pi=p,ut!==null)if(pi)try{(ut.nodeType===9?ut.body:ut.nodeName==="HTML"?ut.ownerDocument.body:ut).removeChild(o.stateNode)}catch(_){Je(o,s,_)}else try{ut.removeChild(o.stateNode)}catch(_){Je(o,s,_)}break;case 18:ut!==null&&(pi?(n=ut,Bv(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),vl(n)):Bv(ut,o.stateNode));break;case 4:u=ut,p=pi,ut=o.stateNode.containerInfo,pi=!0,Wn(n,s,o),ut=u,pi=p;break;case 0:case 11:case 14:case 15:Er(2,o,s),At||Er(4,o,s),Wn(n,s,o);break;case 1:At||(gn(o,s),u=o.stateNode,typeof u.componentWillUnmount=="function"&&L0(o,s,u)),Wn(n,s,o);break;case 21:Wn(n,s,o);break;case 22:At=(u=At)||o.memoizedState!==null,Wn(n,s,o),At=u;break;default:Wn(n,s,o)}}function q0(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{vl(n)}catch(o){Je(s,s.return,o)}}}function V0(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{vl(n)}catch(o){Je(s,s.return,o)}}function R2(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new P0),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new P0),s;default:throw Error(r(435,n.tag))}}function Lc(n,s){var o=R2(n);s.forEach(function(u){if(!o.has(u)){o.add(u);var p=U2.bind(null,n,u);u.then(p,p)}})}function gi(n,s){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var p=o[u],_=n,x=s,D=x;e:for(;D!==null;){switch(D.tag){case 27:if(Rr(D.type)){ut=D.stateNode,pi=!1;break e}break;case 5:ut=D.stateNode,pi=!1;break e;case 3:case 4:ut=D.stateNode.containerInfo,pi=!0;break e}D=D.return}if(ut===null)throw Error(r(160));U0(_,x,p),ut=null,pi=!1,_=p.alternate,_!==null&&(_.return=null),p.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)F0(s,n),s=s.sibling}var nn=null;function F0(n,s){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:gi(s,n),mi(n),u&4&&(Er(3,n,n.return),So(3,n),Er(5,n,n.return));break;case 1:gi(s,n),mi(n),u&512&&(At||o===null||gn(o,o.return)),u&64&&$n&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var p=nn;if(gi(s,n),mi(n),u&512&&(At||o===null||gn(o,o.return)),u&4){var _=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":_=p.getElementsByTagName("title")[0],(!_||_[Qr]||_[zt]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=p.createElement(u),p.head.insertBefore(_,p.querySelector("head > title"))),Gt(_,u,o),_[zt]=n,Et(_),u=_;break e;case"link":var x=Fv("link","href",p).get(u+(o.href||""));if(x){for(var D=0;D<x.length;D++)if(_=x[D],_.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&_.getAttribute("rel")===(o.rel==null?null:o.rel)&&_.getAttribute("title")===(o.title==null?null:o.title)&&_.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){x.splice(D,1);break t}}_=p.createElement(u),Gt(_,u,o),p.head.appendChild(_);break;case"meta":if(x=Fv("meta","content",p).get(u+(o.content||""))){for(D=0;D<x.length;D++)if(_=x[D],_.getAttribute("content")===(o.content==null?null:""+o.content)&&_.getAttribute("name")===(o.name==null?null:o.name)&&_.getAttribute("property")===(o.property==null?null:o.property)&&_.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&_.getAttribute("charset")===(o.charSet==null?null:o.charSet)){x.splice(D,1);break t}}_=p.createElement(u),Gt(_,u,o),p.head.appendChild(_);break;default:throw Error(r(468,u))}_[zt]=n,Et(_),u=_}n.stateNode=u}else Yv(p,n.type,n.stateNode);else n.stateNode=Vv(p,u,n.memoizedProps);else _!==u?(_===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):_.count--,u===null?Yv(p,n.type,n.stateNode):Vv(p,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Gf(n,n.memoizedProps,o.memoizedProps)}break;case 27:gi(s,n),mi(n),u&512&&(At||o===null||gn(o,o.return)),o!==null&&u&4&&Gf(n,n.memoizedProps,o.memoizedProps);break;case 5:if(gi(s,n),mi(n),u&512&&(At||o===null||gn(o,o.return)),n.flags&32){p=n.stateNode;try{Us(p,"")}catch(ye){Je(n,n.return,ye)}}u&4&&n.stateNode!=null&&(p=n.memoizedProps,Gf(n,p,o!==null?o.memoizedProps:p)),u&1024&&(Jf=!0);break;case 6:if(gi(s,n),mi(n),u&4){if(n.stateNode===null)throw Error(r(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(ye){Je(n,n.return,ye)}}break;case 3:if(Gc=null,p=nn,nn=Xc(s.containerInfo),gi(s,n),nn=p,mi(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{vl(s.containerInfo)}catch(ye){Je(n,n.return,ye)}Jf&&(Jf=!1,Y0(n));break;case 4:u=nn,nn=Xc(n.stateNode.containerInfo),gi(s,n),mi(n),nn=u;break;case 12:gi(s,n),mi(n);break;case 31:gi(s,n),mi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Lc(n,u)));break;case 13:gi(s,n),mi(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Oc=Lt()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Lc(n,u)));break;case 22:p=n.memoizedState!==null;var W=o!==null&&o.memoizedState!==null,J=$n,se=At;if($n=J||p,At=se||W,gi(s,n),At=se,$n=J,mi(n),u&8192)e:for(s=n.stateNode,s._visibility=p?s._visibility&-2:s._visibility|1,p&&(o===null||W||$n||At||gs(n)),o=null,s=n;;){if(s.tag===5||s.tag===26){if(o===null){W=o=s;try{if(_=W.stateNode,p)x=_.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{D=W.stateNode;var ae=W.memoizedProps.style,te=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;D.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(ye){Je(W,W.return,ye)}}}else if(s.tag===6){if(o===null){W=s;try{W.stateNode.nodeValue=p?"":W.memoizedProps}catch(ye){Je(W,W.return,ye)}}}else if(s.tag===18){if(o===null){W=s;try{var ie=W.stateNode;p?Lv(ie,!0):Lv(W.stateNode,!1)}catch(ye){Je(W,W.return,ye)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,Lc(n,o))));break;case 19:gi(s,n),mi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Lc(n,u)));break;case 30:break;case 21:break;default:gi(s,n),mi(n)}}function mi(n){var s=n.flags;if(s&2){try{for(var o,u=n.return;u!==null;){if(O0(u)){o=u;break}u=u.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var p=o.stateNode,_=Zf(n);Bc(n,_,p);break;case 5:var x=o.stateNode;o.flags&32&&(Us(x,""),o.flags&=-33);var D=Zf(n);Bc(n,D,x);break;case 3:case 4:var W=o.stateNode.containerInfo,J=Zf(n);Qf(n,J,W);break;default:throw Error(r(161))}}catch(se){Je(n,n.return,se)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function Y0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;Y0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function Xn(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)I0(n,s.alternate,s),s=s.sibling}function gs(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:Er(4,s,s.return),gs(s);break;case 1:gn(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&L0(s,s.return,o),gs(s);break;case 27:No(s.stateNode);case 26:case 5:gn(s,s.return),gs(s);break;case 22:s.memoizedState===null&&gs(s);break;case 30:gs(s);break;default:gs(s)}n=n.sibling}}function Kn(n,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,p=n,_=s,x=_.flags;switch(_.tag){case 0:case 11:case 15:Kn(p,_,o),So(4,_);break;case 1:if(Kn(p,_,o),u=_,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(J){Je(u,u.return,J)}if(u=_,p=u.updateQueue,p!==null){var D=u.stateNode;try{var W=p.shared.hiddenCallbacks;if(W!==null)for(p.shared.hiddenCallbacks=null,p=0;p<W.length;p++)x_(W[p],D)}catch(J){Je(u,u.return,J)}}o&&x&64&&B0(_),bo(_,_.return);break;case 27:H0(_);case 26:case 5:Kn(p,_,o),o&&u===null&&x&4&&z0(_),bo(_,_.return);break;case 12:Kn(p,_,o);break;case 31:Kn(p,_,o),o&&x&4&&q0(p,_);break;case 13:Kn(p,_,o),o&&x&4&&V0(p,_);break;case 22:_.memoizedState===null&&Kn(p,_,o),bo(_,_.return);break;case 30:break;default:Kn(p,_,o)}s=s.sibling}}function ed(n,s){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&lo(o))}function td(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&lo(n))}function rn(n,s,o,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)$0(n,s,o,u),s=s.sibling}function $0(n,s,o,u){var p=s.flags;switch(s.tag){case 0:case 11:case 15:rn(n,s,o,u),p&2048&&So(9,s);break;case 1:rn(n,s,o,u);break;case 3:rn(n,s,o,u),p&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&lo(n)));break;case 12:if(p&2048){rn(n,s,o,u),n=s.stateNode;try{var _=s.memoizedProps,x=_.id,D=_.onPostCommit;typeof D=="function"&&D(x,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(W){Je(s,s.return,W)}}else rn(n,s,o,u);break;case 31:rn(n,s,o,u);break;case 13:rn(n,s,o,u);break;case 23:break;case 22:_=s.stateNode,x=s.alternate,s.memoizedState!==null?_._visibility&2?rn(n,s,o,u):xo(n,s):_._visibility&2?rn(n,s,o,u):(_._visibility|=2,ol(n,s,o,u,(s.subtreeFlags&10256)!==0||!1)),p&2048&&ed(x,s);break;case 24:rn(n,s,o,u),p&2048&&td(s.alternate,s);break;default:rn(n,s,o,u)}}function ol(n,s,o,u,p){for(p=p&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var _=n,x=s,D=o,W=u,J=x.flags;switch(x.tag){case 0:case 11:case 15:ol(_,x,D,W,p),So(8,x);break;case 23:break;case 22:var se=x.stateNode;x.memoizedState!==null?se._visibility&2?ol(_,x,D,W,p):xo(_,x):(se._visibility|=2,ol(_,x,D,W,p)),p&&J&2048&&ed(x.alternate,x);break;case 24:ol(_,x,D,W,p),p&&J&2048&&td(x.alternate,x);break;default:ol(_,x,D,W,p)}s=s.sibling}}function xo(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=n,u=s,p=u.flags;switch(u.tag){case 22:xo(o,u),p&2048&&ed(u.alternate,u);break;case 24:xo(o,u),p&2048&&td(u.alternate,u);break;default:xo(o,u)}s=s.sibling}}var wo=8192;function al(n,s,o){if(n.subtreeFlags&wo)for(n=n.child;n!==null;)W0(n,s,o),n=n.sibling}function W0(n,s,o){switch(n.tag){case 26:al(n,s,o),n.flags&wo&&n.memoizedState!==null&&vE(o,nn,n.memoizedState,n.memoizedProps);break;case 5:al(n,s,o);break;case 3:case 4:var u=nn;nn=Xc(n.stateNode.containerInfo),al(n,s,o),nn=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=wo,wo=16777216,al(n,s,o),wo=u):al(n,s,o));break;default:al(n,s,o)}}function X0(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function Co(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];jt=u,G0(u,n)}X0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)K0(n),n=n.sibling}function K0(n){switch(n.tag){case 0:case 11:case 15:Co(n),n.flags&2048&&Er(9,n,n.return);break;case 3:Co(n);break;case 12:Co(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,zc(n)):Co(n);break;default:Co(n)}}function zc(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];jt=u,G0(u,n)}X0(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:Er(8,s,s.return),zc(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,zc(s));break;default:zc(s)}n=n.sibling}}function G0(n,s){for(;jt!==null;){var o=jt;switch(o.tag){case 0:case 11:case 15:Er(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:lo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,jt=u;else e:for(o=n;jt!==null;){u=jt;var p=u.sibling,_=u.return;if(j0(u),u===o){jt=null;break e}if(p!==null){p.return=_,jt=p;break e}jt=_}}}var B2={getCacheForType:function(n){var s=Xt(kt),o=s.data.get(n);return o===void 0&&(o=n(),s.data.set(n,o)),o},cacheSignal:function(){return Xt(kt).controller.signal}},L2=typeof WeakMap=="function"?WeakMap:Map,Ke=0,rt=null,Ie=null,Ue=0,Qe=0,Ni=null,kr=!1,cl=!1,id=!1,Gn=0,_t=0,Mr=0,ms=0,nd=0,Di=0,ul=0,Eo=null,_i=null,rd=!1,Oc=0,Z0=0,Hc=1/0,Pc=null,Tr=null,Ot=0,Ar=null,hl=null,Zn=0,sd=0,ld=null,Q0=null,ko=0,od=null;function Ri(){return(Ke&2)!==0&&Ue!==0?Ue&-Ue:M.T!==null?dd():qa()}function J0(){if(Di===0)if((Ue&536870912)===0||Ve){var n=zs;zs<<=1,(zs&3932160)===0&&(zs=262144),Di=n}else Di=536870912;return n=Ti.current,n!==null&&(n.flags|=32),Di}function vi(n,s,o){(n===rt&&(Qe===2||Qe===9)||n.cancelPendingCommit!==null)&&(fl(n,0),Nr(n,Ue,Di,!1)),Zr(n,o),((Ke&2)===0||n!==rt)&&(n===rt&&((Ke&2)===0&&(ms|=o),_t===4&&Nr(n,Ue,Di,!1)),mn(n))}function ev(n,s,o){if((Ke&6)!==0)throw Error(r(327));var u=!o&&(s&127)===0&&(s&n.expiredLanes)===0||Gr(n,s),p=u?H2(n,s):cd(n,s,!0),_=u;do{if(p===0){cl&&!u&&Nr(n,s,0,!1);break}else{if(o=n.current.alternate,_&&!z2(o)){p=cd(n,s,!1),_=!1;continue}if(p===2){if(_=s,n.errorRecoveryDisabledLanes&_)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){s=x;e:{var D=n;p=Eo;var W=D.current.memoizedState.isDehydrated;if(W&&(fl(D,x).flags|=256),x=cd(D,x,!1),x!==2){if(id&&!W){D.errorRecoveryDisabledLanes|=_,ms|=_,p=4;break e}_=_i,_i=p,_!==null&&(_i===null?_i=_:_i.push.apply(_i,_))}p=x}if(_=!1,p!==2)continue}}if(p===1){fl(n,0),Nr(n,s,0,!0);break}e:{switch(u=n,_=p,_){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:Nr(u,s,Di,!kr);break e;case 2:_i=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(p=Oc+300-Lt(),10<p)){if(Nr(u,s,Di,!kr),Hs(u,0,!0)!==0)break e;Zn=s,u.timeoutHandle=Dv(tv.bind(null,u,o,_i,Pc,rd,s,Di,ms,ul,kr,_,"Throttled",-0,0),p);break e}tv(u,o,_i,Pc,rd,s,Di,ms,ul,kr,_,null,-0,0)}}break}while(!0);mn(n)}function tv(n,s,o,u,p,_,x,D,W,J,se,ae,te,ie){if(n.timeoutHandle=-1,ae=s.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},W0(s,_,ae);var ye=(_&62914560)===_?Oc-Lt():(_&4194048)===_?Z0-Lt():0;if(ye=yE(ae,ye),ye!==null){Zn=_,n.cancelPendingCommit=ye(cv.bind(null,n,s,_,o,u,p,x,D,W,se,ae,null,te,ie)),Nr(n,_,x,!J);return}}cv(n,s,_,o,u,p,x,D,W)}function z2(n){for(var s=n;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var p=o[u],_=p.getSnapshot;p=p.value;try{if(!ki(_(),p))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Nr(n,s,o,u){s&=~nd,s&=~ms,n.suspendedLanes|=s,n.pingedLanes&=~s,u&&(n.warmLanes|=s),u=n.expirationTimes;for(var p=s;0<p;){var _=31-Ze(p),x=1<<_;u[_]=-1,p&=~x}o!==0&&Ia(n,o,s)}function Ic(){return(Ke&6)===0?(Mo(0),!1):!0}function ad(){if(Ie!==null){if(Qe===0)var n=Ie.return;else n=Ie,jn=os=null,Cf(n),il=null,ao=0,n=Ie;for(;n!==null;)R0(n.alternate,n),n=n.return;Ie=null}}function fl(n,s){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,tE(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),Zn=0,ad(),rt=n,Ie=o=Pn(n.current,null),Ue=s,Qe=0,Ni=null,kr=!1,cl=Gr(n,s),id=!1,ul=Di=nd=ms=Mr=_t=0,_i=Eo=null,rd=!1,(s&8)!==0&&(s|=s&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=s;0<u;){var p=31-Ze(u),_=1<<p;s|=n[p],u&=~_}return Gn=s,lc(),o}function iv(n,s){Re=null,M.H=_o,s===tl||s===pc?(s=v_(),Qe=3):s===ff?(s=v_(),Qe=4):Qe=s===jf?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ni=s,Ie===null&&(_t=1,Tc(n,ji(s,n.current)))}function nv(){var n=Ti.current;return n===null?!0:(Ue&4194048)===Ue?Fi===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?n===Fi:!1}function rv(){var n=M.H;return M.H=_o,n===null?_o:n}function sv(){var n=M.A;return M.A=B2,n}function jc(){_t=4,kr||(Ue&4194048)!==Ue&&Ti.current!==null||(cl=!0),(Mr&134217727)===0&&(ms&134217727)===0||rt===null||Nr(rt,Ue,Di,!1)}function cd(n,s,o){var u=Ke;Ke|=2;var p=rv(),_=sv();(rt!==n||Ue!==s)&&(Pc=null,fl(n,s)),s=!1;var x=_t;e:do try{if(Qe!==0&&Ie!==null){var D=Ie,W=Ni;switch(Qe){case 8:ad(),x=6;break e;case 3:case 2:case 9:case 6:Ti.current===null&&(s=!0);var J=Qe;if(Qe=0,Ni=null,dl(n,D,W,J),o&&cl){x=0;break e}break;default:J=Qe,Qe=0,Ni=null,dl(n,D,W,J)}}O2(),x=_t;break}catch(se){iv(n,se)}while(!0);return s&&n.shellSuspendCounter++,jn=os=null,Ke=u,M.H=p,M.A=_,Ie===null&&(rt=null,Ue=0,lc()),x}function O2(){for(;Ie!==null;)lv(Ie)}function H2(n,s){var o=Ke;Ke|=2;var u=rv(),p=sv();rt!==n||Ue!==s?(Pc=null,Hc=Lt()+500,fl(n,s)):cl=Gr(n,s);e:do try{if(Qe!==0&&Ie!==null){s=Ie;var _=Ni;t:switch(Qe){case 1:Qe=0,Ni=null,dl(n,s,_,1);break;case 2:case 9:if(m_(_)){Qe=0,Ni=null,ov(s);break}s=function(){Qe!==2&&Qe!==9||rt!==n||(Qe=7),mn(n)},_.then(s,s);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:m_(_)?(Qe=0,Ni=null,ov(s)):(Qe=0,Ni=null,dl(n,s,_,7));break;case 5:var x=null;switch(Ie.tag){case 26:x=Ie.memoizedState;case 5:case 27:var D=Ie;if(x?$v(x):D.stateNode.complete){Qe=0,Ni=null;var W=D.sibling;if(W!==null)Ie=W;else{var J=D.return;J!==null?(Ie=J,Uc(J)):Ie=null}break t}}Qe=0,Ni=null,dl(n,s,_,5);break;case 6:Qe=0,Ni=null,dl(n,s,_,6);break;case 8:ad(),_t=6;break e;default:throw Error(r(462))}}P2();break}catch(se){iv(n,se)}while(!0);return jn=os=null,M.H=u,M.A=p,Ke=o,Ie!==null?0:(rt=null,Ue=0,lc(),_t)}function P2(){for(;Ie!==null&&!Nn();)lv(Ie)}function lv(n){var s=N0(n.alternate,n,Gn);n.memoizedProps=n.pendingProps,s===null?Uc(n):Ie=s}function ov(n){var s=n,o=s.alternate;switch(s.tag){case 15:case 0:s=C0(o,s,s.pendingProps,s.type,void 0,Ue);break;case 11:s=C0(o,s,s.pendingProps,s.type.render,s.ref,Ue);break;case 5:Cf(s);default:R0(o,s),s=Ie=s_(s,Gn),s=N0(o,s,Gn)}n.memoizedProps=n.pendingProps,s===null?Uc(n):Ie=s}function dl(n,s,o,u){jn=os=null,Cf(s),il=null,ao=0;var p=s.return;try{if(k2(n,p,s,o,Ue)){_t=1,Tc(n,ji(o,n.current)),Ie=null;return}}catch(_){if(p!==null)throw Ie=p,_;_t=1,Tc(n,ji(o,n.current)),Ie=null;return}s.flags&32768?(Ve||u===1?n=!0:cl||(Ue&536870912)!==0?n=!1:(kr=n=!0,(u===2||u===9||u===3||u===6)&&(u=Ti.current,u!==null&&u.tag===13&&(u.flags|=16384))),av(s,n)):Uc(s)}function Uc(n){var s=n;do{if((s.flags&32768)!==0){av(s,kr);return}n=s.return;var o=A2(s.alternate,s,Gn);if(o!==null){Ie=o;return}if(s=s.sibling,s!==null){Ie=s;return}Ie=s=n}while(s!==null);_t===0&&(_t=5)}function av(n,s){do{var o=N2(n.alternate,n);if(o!==null){o.flags&=32767,Ie=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(n=n.sibling,n!==null)){Ie=n;return}Ie=n=o}while(n!==null);_t=6,Ie=null}function cv(n,s,o,u,p,_,x,D,W){n.cancelPendingCommit=null;do qc();while(Ot!==0);if((Ke&6)!==0)throw Error(r(327));if(s!==null){if(s===n.current)throw Error(r(177));if(_=s.lanes|s.childLanes,_|=Gh,kh(n,o,_,x,D,W),n===rt&&(Ie=rt=null,Ue=0),hl=s,Ar=n,Zn=o,sd=_,ld=p,Q0=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,q2(ke,function(){return pv(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=M.T,M.T=null,p=P.p,P.p=2,x=Ke,Ke|=4;try{D2(n,s,o)}finally{Ke=x,P.p=p,M.T=u}}Ot=1,uv(),hv(),fv()}}function uv(){if(Ot===1){Ot=0;var n=Ar,s=hl,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=M.T,M.T=null;var u=P.p;P.p=2;var p=Ke;Ke|=4;try{F0(s,n);var _=bd,x=Gm(n.containerInfo),D=_.focusedElem,W=_.selectionRange;if(x!==D&&D&&D.ownerDocument&&Km(D.ownerDocument.documentElement,D)){if(W!==null&&Yh(D)){var J=W.start,se=W.end;if(se===void 0&&(se=J),"selectionStart"in D)D.selectionStart=J,D.selectionEnd=Math.min(se,D.value.length);else{var ae=D.ownerDocument||document,te=ae&&ae.defaultView||window;if(te.getSelection){var ie=te.getSelection(),ye=D.textContent.length,Me=Math.min(W.start,ye),it=W.end===void 0?Me:Math.min(W.end,ye);!ie.extend&&Me>it&&(x=it,it=Me,Me=x);var Z=Xm(D,Me),K=Xm(D,it);if(Z&&K&&(ie.rangeCount!==1||ie.anchorNode!==Z.node||ie.anchorOffset!==Z.offset||ie.focusNode!==K.node||ie.focusOffset!==K.offset)){var Q=ae.createRange();Q.setStart(Z.node,Z.offset),ie.removeAllRanges(),Me>it?(ie.addRange(Q),ie.extend(K.node,K.offset)):(Q.setEnd(K.node,K.offset),ie.addRange(Q))}}}}for(ae=[],ie=D;ie=ie.parentNode;)ie.nodeType===1&&ae.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;D<ae.length;D++){var le=ae[D];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}eu=!!Sd,bd=Sd=null}finally{Ke=p,P.p=u,M.T=o}}n.current=s,Ot=2}}function hv(){if(Ot===2){Ot=0;var n=Ar,s=hl,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=M.T,M.T=null;var u=P.p;P.p=2;var p=Ke;Ke|=4;try{I0(n,s.alternate,s)}finally{Ke=p,P.p=u,M.T=o}}Ot=3}}function fv(){if(Ot===4||Ot===3){Ot=0,Dn();var n=Ar,s=hl,o=Zn,u=Q0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Ot=5:(Ot=0,hl=Ar=null,dv(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(Tr=null),Yl(o),s=s.stateNode,bt&&typeof bt.onCommitFiberRoot=="function")try{bt.onCommitFiberRoot($t,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=M.T,p=P.p,P.p=2,M.T=null;try{for(var _=n.onRecoverableError,x=0;x<u.length;x++){var D=u[x];_(D.value,{componentStack:D.stack})}}finally{M.T=s,P.p=p}}(Zn&3)!==0&&qc(),mn(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===od?ko++:(ko=0,od=n):ko=0,Mo(0)}}function dv(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,lo(s)))}function qc(){return uv(),hv(),fv(),pv()}function pv(){if(Ot!==5)return!1;var n=Ar,s=sd;sd=0;var o=Yl(Zn),u=M.T,p=P.p;try{P.p=32>o?32:o,M.T=null,o=ld,ld=null;var _=Ar,x=Zn;if(Ot=0,hl=Ar=null,Zn=0,(Ke&6)!==0)throw Error(r(331));var D=Ke;if(Ke|=4,K0(_.current),$0(_,_.current,x,o),Ke=D,Mo(0,!1),bt&&typeof bt.onPostCommitFiberRoot=="function")try{bt.onPostCommitFiberRoot($t,_)}catch{}return!0}finally{P.p=p,M.T=u,dv(n,s)}}function gv(n,s,o){s=ji(o,s),s=If(n.stateNode,s,2),n=xr(n,s,2),n!==null&&(Zr(n,2),mn(n))}function Je(n,s,o){if(n.tag===3)gv(n,n,o);else for(;s!==null;){if(s.tag===3){gv(s,n,o);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Tr===null||!Tr.has(u))){n=ji(o,n),o=m0(2),u=xr(s,o,2),u!==null&&(_0(o,u,s,n),Zr(u,2),mn(u));break}}s=s.return}}function ud(n,s,o){var u=n.pingCache;if(u===null){u=n.pingCache=new L2;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(o)||(id=!0,p.add(o),n=I2.bind(null,n,s,o),s.then(n,n))}function I2(n,s,o){var u=n.pingCache;u!==null&&u.delete(s),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,rt===n&&(Ue&o)===o&&(_t===4||_t===3&&(Ue&62914560)===Ue&&300>Lt()-Oc?(Ke&2)===0&&fl(n,0):nd|=o,ul===Ue&&(ul=0)),mn(n)}function mv(n,s){s===0&&(s=Pa()),n=rs(n,s),n!==null&&(Zr(n,s),mn(n))}function j2(n){var s=n.memoizedState,o=0;s!==null&&(o=s.retryLane),mv(n,o)}function U2(n,s){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,p=n.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(s),mv(n,o)}function q2(n,s){return ui(n,s)}var Vc=null,pl=null,hd=!1,Fc=!1,fd=!1,Dr=0;function mn(n){n!==pl&&n.next===null&&(pl===null?Vc=pl=n:pl=pl.next=n),Fc=!0,hd||(hd=!0,F2())}function Mo(n,s){if(!fd&&Fc){fd=!0;do for(var o=!1,u=Vc;u!==null;){if(n!==0){var p=u.pendingLanes;if(p===0)var _=0;else{var x=u.suspendedLanes,D=u.pingedLanes;_=(1<<31-Ze(42|n)+1)-1,_&=p&~(x&~D),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(o=!0,Sv(u,_))}else _=Ue,_=Hs(u,u===rt?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(_&3)===0||Gr(u,_)||(o=!0,Sv(u,_));u=u.next}while(o);fd=!1}}function V2(){_v()}function _v(){Fc=hd=!1;var n=0;Dr!==0&&eE()&&(n=Dr);for(var s=Lt(),o=null,u=Vc;u!==null;){var p=u.next,_=vv(u,s);_===0?(u.next=null,o===null?Vc=p:o.next=p,p===null&&(pl=o)):(o=u,(n!==0||(_&3)!==0)&&(Fc=!0)),u=p}Ot!==0&&Ot!==5||Mo(n),Dr!==0&&(Dr=0)}function vv(n,s){for(var o=n.suspendedLanes,u=n.pingedLanes,p=n.expirationTimes,_=n.pendingLanes&-62914561;0<_;){var x=31-Ze(_),D=1<<x,W=p[x];W===-1?((D&o)===0||(D&u)!==0)&&(p[x]=Eh(D,s)):W<=s&&(n.expiredLanes|=D),_&=~D}if(s=rt,o=Ue,o=Hs(n,n===s?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===s&&(Qe===2||Qe===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&Qi(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||Gr(n,o)){if(s=o&-o,s===n.callbackPriority)return s;switch(u!==null&&Qi(u),Yl(o)){case 2:case 8:o=ge;break;case 32:o=ke;break;case 268435456:o=Fe;break;default:o=ke}return u=yv.bind(null,n),o=ui(o,u),n.callbackPriority=s,n.callbackNode=o,s}return u!==null&&u!==null&&Qi(u),n.callbackPriority=2,n.callbackNode=null,2}function yv(n,s){if(Ot!==0&&Ot!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(qc()&&n.callbackNode!==o)return null;var u=Ue;return u=Hs(n,n===rt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(ev(n,u,s),vv(n,Lt()),n.callbackNode!=null&&n.callbackNode===o?yv.bind(null,n):null)}function Sv(n,s){if(qc())return null;ev(n,s,!0)}function F2(){iE(function(){(Ke&6)!==0?ui(re,V2):_v()})}function dd(){if(Dr===0){var n=Js;n===0&&(n=Ls,Ls<<=1,(Ls&261888)===0&&(Ls=256)),Dr=n}return Dr}function bv(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Qa(""+n)}function xv(n,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,n.id&&o.setAttribute("form",n.id),s.parentNode.insertBefore(o,s),n=new FormData(n),o.parentNode.removeChild(o),n}function Y2(n,s,o,u,p){if(s==="submit"&&o&&o.stateNode===p){var _=bv((p[ti]||null).action),x=u.submitter;x&&(s=(s=x[ti]||null)?bv(s.formAction):x.getAttribute("formAction"),s!==null&&(_=s,x=null));var D=new ic("action","action",null,u,p);n.push({event:D,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Dr!==0){var W=x?xv(p,x):new FormData(p);Bf(o,{pending:!0,data:W,method:p.method,action:_},null,W)}}else typeof _=="function"&&(D.preventDefault(),W=x?xv(p,x):new FormData(p),Bf(o,{pending:!0,data:W,method:p.method,action:_},_,W))},currentTarget:p}]})}}for(var pd=0;pd<Kh.length;pd++){var gd=Kh[pd],$2=gd.toLowerCase(),W2=gd[0].toUpperCase()+gd.slice(1);tn($2,"on"+W2)}tn(Jm,"onAnimationEnd"),tn(e_,"onAnimationIteration"),tn(t_,"onAnimationStart"),tn("dblclick","onDoubleClick"),tn("focusin","onFocus"),tn("focusout","onBlur"),tn(c2,"onTransitionRun"),tn(u2,"onTransitionStart"),tn(h2,"onTransitionCancel"),tn(i_,"onTransitionEnd"),dr("onMouseEnter",["mouseout","mouseover"]),dr("onMouseLeave",["mouseout","mouseover"]),dr("onPointerEnter",["pointerout","pointerover"]),dr("onPointerLeave",["pointerout","pointerover"]),Ln("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ln("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ln("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ln("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var To="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(" "),X2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(To));function wv(n,s){s=(s&4)!==0;for(var o=0;o<n.length;o++){var u=n[o],p=u.event;u=u.listeners;e:{var _=void 0;if(s)for(var x=u.length-1;0<=x;x--){var D=u[x],W=D.instance,J=D.currentTarget;if(D=D.listener,W!==_&&p.isPropagationStopped())break e;_=D,p.currentTarget=J;try{_(p)}catch(se){sc(se)}p.currentTarget=null,_=W}else for(x=0;x<u.length;x++){if(D=u[x],W=D.instance,J=D.currentTarget,D=D.listener,W!==_&&p.isPropagationStopped())break e;_=D,p.currentTarget=J;try{_(p)}catch(se){sc(se)}p.currentTarget=null,_=W}}}}function je(n,s){var o=s[Ps];o===void 0&&(o=s[Ps]=new Set);var u=n+"__bubble";o.has(u)||(Cv(s,n,2,!1),o.add(u))}function md(n,s,o){var u=0;s&&(u|=4),Cv(o,n,u,s)}var Yc="_reactListening"+Math.random().toString(36).slice(2);function _d(n){if(!n[Yc]){n[Yc]=!0,$a.forEach(function(o){o!=="selectionchange"&&(X2.has(o)||md(o,!1,n),md(o,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Yc]||(s[Yc]=!0,md("selectionchange",!1,s))}}function Cv(n,s,o,u){switch(Jv(s)){case 2:var p=xE;break;case 8:p=wE;break;default:p=Rd}o=p.bind(null,s,o,n),p=void 0,!Oh||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?n.addEventListener(s,o,{capture:!0,passive:p}):n.addEventListener(s,o,!0):p!==void 0?n.addEventListener(s,o,{passive:p}):n.addEventListener(s,o,!1)}function vd(n,s,o,u,p){var _=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var x=u.tag;if(x===3||x===4){var D=u.stateNode.containerInfo;if(D===p)break;if(x===4)for(x=u.return;x!==null;){var W=x.tag;if((W===3||W===4)&&x.stateNode.containerInfo===p)return;x=x.return}for(;D!==null;){if(x=cr(D),x===null)return;if(W=x.tag,W===5||W===6||W===26||W===27){u=_=x;continue e}D=D.parentNode}}u=u.return}Am(function(){var J=_,se=Lh(o),ae=[];e:{var te=n_.get(n);if(te!==void 0){var ie=ic,ye=n;switch(n){case"keypress":if(ec(o)===0)break e;case"keydown":case"keyup":ie=UC;break;case"focusin":ye="focus",ie=jh;break;case"focusout":ye="blur",ie=jh;break;case"beforeblur":case"afterblur":ie=jh;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Rm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=AC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=FC;break;case Jm:case e_:case t_:ie=RC;break;case i_:ie=$C;break;case"scroll":case"scrollend":ie=MC;break;case"wheel":ie=XC;break;case"copy":case"cut":case"paste":ie=LC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=Lm;break;case"toggle":case"beforetoggle":ie=GC}var Me=(s&4)!==0,it=!Me&&(n==="scroll"||n==="scrollend"),Z=Me?te!==null?te+"Capture":null:te;Me=[];for(var K=J,Q;K!==null;){var le=K;if(Q=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||Q===null||Z===null||(le=Kl(K,Z),le!=null&&Me.push(Ao(K,le,Q))),it)break;K=K.return}0<Me.length&&(te=new ie(te,ye,null,o,se),ae.push({event:te,listeners:Me}))}}if((s&7)===0){e:{if(te=n==="mouseover"||n==="pointerover",ie=n==="mouseout"||n==="pointerout",te&&o!==Bh&&(ye=o.relatedTarget||o.fromElement)&&(cr(ye)||ye[Bn]))break e;if((ie||te)&&(te=se.window===se?se:(te=se.ownerDocument)?te.defaultView||te.parentWindow:window,ie?(ye=o.relatedTarget||o.toElement,ie=J,ye=ye?cr(ye):null,ye!==null&&(it=a(ye),Me=ye.tag,ye!==it||Me!==5&&Me!==27&&Me!==6)&&(ye=null)):(ie=null,ye=J),ie!==ye)){if(Me=Rm,le="onMouseLeave",Z="onMouseEnter",K="mouse",(n==="pointerout"||n==="pointerover")&&(Me=Lm,le="onPointerLeave",Z="onPointerEnter",K="pointer"),it=ie==null?te:hr(ie),Q=ye==null?te:hr(ye),te=new Me(le,K+"leave",ie,o,se),te.target=it,te.relatedTarget=Q,le=null,cr(se)===J&&(Me=new Me(Z,K+"enter",ye,o,se),Me.target=Q,Me.relatedTarget=it,le=Me),it=le,ie&&ye)t:{for(Me=K2,Z=ie,K=ye,Q=0,le=Z;le;le=Me(le))Q++;le=0;for(var Ee=K;Ee;Ee=Me(Ee))le++;for(;0<Q-le;)Z=Me(Z),Q--;for(;0<le-Q;)K=Me(K),le--;for(;Q--;){if(Z===K||K!==null&&Z===K.alternate){Me=Z;break t}Z=Me(Z),K=Me(K)}Me=null}else Me=null;ie!==null&&Ev(ae,te,ie,Me,!1),ye!==null&&it!==null&&Ev(ae,it,ye,Me,!0)}}e:{if(te=J?hr(J):window,ie=te.nodeName&&te.nodeName.toLowerCase(),ie==="select"||ie==="input"&&te.type==="file")var We=qm;else if(jm(te))if(Vm)We=l2;else{We=r2;var be=n2}else ie=te.nodeName,!ie||ie.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?J&&Rh(J.elementType)&&(We=qm):We=s2;if(We&&(We=We(n,J))){Um(ae,We,o,se);break e}be&&be(n,te,J),n==="focusout"&&J&&te.type==="number"&&J.memoizedProps.value!=null&&Xl(te,"number",te.value)}switch(be=J?hr(J):window,n){case"focusin":(jm(be)||be.contentEditable==="true")&&(Ys=be,$h=J,no=null);break;case"focusout":no=$h=Ys=null;break;case"mousedown":Wh=!0;break;case"contextmenu":case"mouseup":case"dragend":Wh=!1,Zm(ae,o,se);break;case"selectionchange":if(a2)break;case"keydown":case"keyup":Zm(ae,o,se)}var Be;if(qh)e:{switch(n){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Fs?Pm(n,o)&&(qe="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(qe="onCompositionStart");qe&&(zm&&o.locale!=="ko"&&(Fs||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Fs&&(Be=Nm()):(gr=se,Hh="value"in gr?gr.value:gr.textContent,Fs=!0)),be=$c(J,qe),0<be.length&&(qe=new Bm(qe,n,null,o,se),ae.push({event:qe,listeners:be}),Be?qe.data=Be:(Be=Im(o),Be!==null&&(qe.data=Be)))),(Be=QC?JC(n,o):e2(n,o))&&(qe=$c(J,"onBeforeInput"),0<qe.length&&(be=new Bm("onBeforeInput","beforeinput",null,o,se),ae.push({event:be,listeners:qe}),be.data=Be)),Y2(ae,n,J,o,se)}wv(ae,s)})}function Ao(n,s,o){return{instance:n,listener:s,currentTarget:o}}function $c(n,s){for(var o=s+"Capture",u=[];n!==null;){var p=n,_=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||_===null||(p=Kl(n,o),p!=null&&u.unshift(Ao(n,p,_)),p=Kl(n,s),p!=null&&u.push(Ao(n,p,_))),n.tag===3)return u;n=n.return}return[]}function K2(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Ev(n,s,o,u,p){for(var _=s._reactName,x=[];o!==null&&o!==u;){var D=o,W=D.alternate,J=D.stateNode;if(D=D.tag,W!==null&&W===u)break;D!==5&&D!==26&&D!==27||J===null||(W=J,p?(J=Kl(o,_),J!=null&&x.unshift(Ao(o,J,W))):p||(J=Kl(o,_),J!=null&&x.push(Ao(o,J,W)))),o=o.return}x.length!==0&&n.push({event:s,listeners:x})}var G2=/\r\n?/g,Z2=/\u0000|\uFFFD/g;function kv(n){return(typeof n=="string"?n:""+n).replace(G2,`
49
+ `).replace(Z2,"")}function Mv(n,s){return s=kv(s),kv(n)===s}function tt(n,s,o,u,p,_){switch(o){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||Us(n,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&Us(n,""+u);break;case"className":js(n,"class",u);break;case"tabIndex":js(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":js(n,o,u);break;case"style":Mm(n,u,_);break;case"data":if(s!=="object"){js(n,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Qa(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(o,"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 _=="function"&&(o==="formAction"?(s!=="input"&&tt(n,s,"name",p.name,p,null),tt(n,s,"formEncType",p.formEncType,p,null),tt(n,s,"formMethod",p.formMethod,p,null),tt(n,s,"formTarget",p.formTarget,p,null)):(tt(n,s,"encType",p.encType,p,null),tt(n,s,"method",p.method,p,null),tt(n,s,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Qa(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=On);break;case"onScroll":u!=null&&je("scroll",n);break;case"onScrollEnd":u!=null&&je("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=Qa(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):n.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":je("beforetoggle",n),je("toggle",n),Is(n,"popover",u);break;case"xlinkActuate":en(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":en(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":en(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":en(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":en(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":en(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":en(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":en(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":en(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Is(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=EC.get(o)||o,Is(n,o,u))}}function yd(n,s,o,u,p,_){switch(o){case"style":Mm(n,u,_);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"children":typeof u=="string"?Us(n,u):(typeof u=="number"||typeof u=="bigint")&&Us(n,""+u);break;case"onScroll":u!=null&&je("scroll",n);break;case"onScrollEnd":u!=null&&je("scrollend",n);break;case"onClick":u!=null&&(n.onclick=On);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wa.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),s=o.slice(2,p?o.length-7:void 0),_=n[ti]||null,_=_!=null?_[o]:null,typeof _=="function"&&n.removeEventListener(s,_,p),typeof u=="function")){typeof _!="function"&&_!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(s,u,p);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):Is(n,o,u)}}}function Gt(n,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":je("error",n),je("load",n);var u=!1,p=!1,_;for(_ in o)if(o.hasOwnProperty(_)){var x=o[_];if(x!=null)switch(_){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:tt(n,s,_,x,o,null)}}p&&tt(n,s,"srcSet",o.srcSet,o,null),u&&tt(n,s,"src",o.src,o,null);return;case"input":je("invalid",n);var D=_=x=p=null,W=null,J=null;for(u in o)if(o.hasOwnProperty(u)){var se=o[u];if(se!=null)switch(u){case"name":p=se;break;case"type":x=se;break;case"checked":W=se;break;case"defaultChecked":J=se;break;case"value":_=se;break;case"defaultValue":D=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,s));break;default:tt(n,s,u,se,o,null)}}Za(n,_,D,W,J,x,p,!1);return;case"select":je("invalid",n),u=x=_=null;for(p in o)if(o.hasOwnProperty(p)&&(D=o[p],D!=null))switch(p){case"value":_=D;break;case"defaultValue":x=D;break;case"multiple":u=D;default:tt(n,s,p,D,o,null)}s=_,o=x,n.multiple=!!u,s!=null?zn(n,!!u,s,!1):o!=null&&zn(n,!!u,o,!0);return;case"textarea":je("invalid",n),_=p=u=null;for(x in o)if(o.hasOwnProperty(x)&&(D=o[x],D!=null))switch(x){case"value":u=D;break;case"defaultValue":p=D;break;case"children":_=D;break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(91));break;default:tt(n,s,x,D,o,null)}Em(n,u,p,_);return;case"option":for(W in o)if(o.hasOwnProperty(W)&&(u=o[W],u!=null))switch(W){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:tt(n,s,W,u,o,null)}return;case"dialog":je("beforetoggle",n),je("toggle",n),je("cancel",n),je("close",n);break;case"iframe":case"object":je("load",n);break;case"video":case"audio":for(u=0;u<To.length;u++)je(To[u],n);break;case"image":je("error",n),je("load",n);break;case"details":je("toggle",n);break;case"embed":case"source":case"link":je("error",n),je("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in o)if(o.hasOwnProperty(J)&&(u=o[J],u!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:tt(n,s,J,u,o,null)}return;default:if(Rh(s)){for(se in o)o.hasOwnProperty(se)&&(u=o[se],u!==void 0&&yd(n,s,se,u,o,void 0));return}}for(D in o)o.hasOwnProperty(D)&&(u=o[D],u!=null&&tt(n,s,D,u,o,null))}function Q2(n,s,o,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,_=null,x=null,D=null,W=null,J=null,se=null;for(ie in o){var ae=o[ie];if(o.hasOwnProperty(ie)&&ae!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":W=ae;default:u.hasOwnProperty(ie)||tt(n,s,ie,null,u,ae)}}for(var te in u){var ie=u[te];if(ae=o[te],u.hasOwnProperty(te)&&(ie!=null||ae!=null))switch(te){case"type":_=ie;break;case"name":p=ie;break;case"checked":J=ie;break;case"defaultChecked":se=ie;break;case"value":x=ie;break;case"defaultValue":D=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,s));break;default:ie!==ae&&tt(n,s,te,ie,u,ae)}}es(n,x,D,W,J,se,_,p);return;case"select":ie=x=D=te=null;for(_ in o)if(W=o[_],o.hasOwnProperty(_)&&W!=null)switch(_){case"value":break;case"multiple":ie=W;default:u.hasOwnProperty(_)||tt(n,s,_,null,u,W)}for(p in u)if(_=u[p],W=o[p],u.hasOwnProperty(p)&&(_!=null||W!=null))switch(p){case"value":te=_;break;case"defaultValue":D=_;break;case"multiple":x=_;default:_!==W&&tt(n,s,p,_,u,W)}s=D,o=x,u=ie,te!=null?zn(n,!!o,te,!1):!!u!=!!o&&(s!=null?zn(n,!!o,s,!0):zn(n,!!o,o?[]:"",!1));return;case"textarea":ie=te=null;for(D in o)if(p=o[D],o.hasOwnProperty(D)&&p!=null&&!u.hasOwnProperty(D))switch(D){case"value":break;case"children":break;default:tt(n,s,D,null,u,p)}for(x in u)if(p=u[x],_=o[x],u.hasOwnProperty(x)&&(p!=null||_!=null))switch(x){case"value":te=p;break;case"defaultValue":ie=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(r(91));break;default:p!==_&&tt(n,s,x,p,u,_)}Cm(n,te,ie);return;case"option":for(var ye in o)if(te=o[ye],o.hasOwnProperty(ye)&&te!=null&&!u.hasOwnProperty(ye))switch(ye){case"selected":n.selected=!1;break;default:tt(n,s,ye,null,u,te)}for(W in u)if(te=u[W],ie=o[W],u.hasOwnProperty(W)&&te!==ie&&(te!=null||ie!=null))switch(W){case"selected":n.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:tt(n,s,W,te,u,ie)}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 Me in o)te=o[Me],o.hasOwnProperty(Me)&&te!=null&&!u.hasOwnProperty(Me)&&tt(n,s,Me,null,u,te);for(J in u)if(te=u[J],ie=o[J],u.hasOwnProperty(J)&&te!==ie&&(te!=null||ie!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,s));break;default:tt(n,s,J,te,u,ie)}return;default:if(Rh(s)){for(var it in o)te=o[it],o.hasOwnProperty(it)&&te!==void 0&&!u.hasOwnProperty(it)&&yd(n,s,it,void 0,u,te);for(se in u)te=u[se],ie=o[se],!u.hasOwnProperty(se)||te===ie||te===void 0&&ie===void 0||yd(n,s,se,te,u,ie);return}}for(var Z in o)te=o[Z],o.hasOwnProperty(Z)&&te!=null&&!u.hasOwnProperty(Z)&&tt(n,s,Z,null,u,te);for(ae in u)te=u[ae],ie=o[ae],!u.hasOwnProperty(ae)||te===ie||te==null&&ie==null||tt(n,s,ae,te,u,ie)}function Tv(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function J2(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var p=o[u],_=p.transferSize,x=p.initiatorType,D=p.duration;if(_&&D&&Tv(x)){for(x=0,D=p.responseEnd,u+=1;u<o.length;u++){var W=o[u],J=W.startTime;if(J>D)break;var se=W.transferSize,ae=W.initiatorType;se&&Tv(ae)&&(W=W.responseEnd,x+=se*(W<D?1:(D-J)/(W-J)))}if(--u,s+=8*(_+x)/(p.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Sd=null,bd=null;function Wc(n){return n.nodeType===9?n:n.ownerDocument}function Av(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Nv(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function xd(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var wd=null;function eE(){var n=window.event;return n&&n.type==="popstate"?n===wd?!1:(wd=n,!0):(wd=null,!1)}var Dv=typeof setTimeout=="function"?setTimeout:void 0,tE=typeof clearTimeout=="function"?clearTimeout:void 0,Rv=typeof Promise=="function"?Promise:void 0,iE=typeof queueMicrotask=="function"?queueMicrotask:typeof Rv<"u"?function(n){return Rv.resolve(null).then(n).catch(nE)}:Dv;function nE(n){setTimeout(function(){throw n})}function Rr(n){return n==="head"}function Bv(n,s){var o=s,u=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(p),vl(s);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")No(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,No(o);for(var _=o.firstChild;_;){var x=_.nextSibling,D=_.nodeName;_[Qr]||D==="SCRIPT"||D==="STYLE"||D==="LINK"&&_.rel.toLowerCase()==="stylesheet"||o.removeChild(_),_=x}}else o==="body"&&No(n.ownerDocument.body);o=p}while(o);vl(s)}function Lv(n,s){var o=n;n=0;do{var u=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function Cd(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Cd(o),$l(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function rE(n,s,o,u){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[Qr])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(_=n.getAttribute("rel"),_==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(_!==p.rel||n.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||n.getAttribute("title")!==(p.title==null?null:p.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(_=n.getAttribute("src"),(_!==(p.src==null?null:p.src)||n.getAttribute("type")!==(p.type==null?null:p.type)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&_&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var _=p.name==null?null:""+p.name;if(p.type==="hidden"&&n.getAttribute("name")===_)return n}else return n;if(n=Yi(n.nextSibling),n===null)break}return null}function sE(n,s,o){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Yi(n.nextSibling),n===null))return null;return n}function zv(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Yi(n.nextSibling),n===null))return null;return n}function Ed(n){return n.data==="$?"||n.data==="$~"}function kd(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function lE(n,s){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||o.readyState!=="loading")s();else{var u=function(){s(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function Yi(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var Md=null;function Ov(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(s===0)return Yi(n.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}n=n.nextSibling}return null}function Hv(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return n;s--}else o!=="/$"&&o!=="/&"||s++}n=n.previousSibling}return null}function Pv(n,s,o){switch(s=Wc(o),n){case"html":if(n=s.documentElement,!n)throw Error(r(452));return n;case"head":if(n=s.head,!n)throw Error(r(453));return n;case"body":if(n=s.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function No(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);$l(n)}var $i=new Map,Iv=new Set;function Xc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Qn=P.d;P.d={f:oE,r:aE,D:cE,C:uE,L:hE,m:fE,X:pE,S:dE,M:gE};function oE(){var n=Qn.f(),s=Ic();return n||s}function aE(n){var s=ur(n);s!==null&&s.tag===5&&s.type==="form"?i0(s):Qn.r(n)}var gl=typeof document>"u"?null:document;function jv(n,s,o){var u=gl;if(u&&typeof s=="string"&&s){var p=fi(s);p='link[rel="'+n+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),Iv.has(p)||(Iv.add(p),n={rel:n,crossOrigin:o,href:s},u.querySelector(p)===null&&(s=u.createElement("link"),Gt(s,"link",n),Et(s),u.head.appendChild(s)))}}function cE(n){Qn.D(n),jv("dns-prefetch",n,null)}function uE(n,s){Qn.C(n,s),jv("preconnect",n,s)}function hE(n,s,o){Qn.L(n,s,o);var u=gl;if(u&&n&&s){var p='link[rel="preload"][as="'+fi(s)+'"]';s==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+fi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+fi(o.imageSizes)+'"]')):p+='[href="'+fi(n)+'"]';var _=p;switch(s){case"style":_=ml(n);break;case"script":_=_l(n)}$i.has(_)||(n=g({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:n,as:s},o),$i.set(_,n),u.querySelector(p)!==null||s==="style"&&u.querySelector(Do(_))||s==="script"&&u.querySelector(Ro(_))||(s=u.createElement("link"),Gt(s,"link",n),Et(s),u.head.appendChild(s)))}}function fE(n,s){Qn.m(n,s);var o=gl;if(o&&n){var u=s&&typeof s.as=="string"?s.as:"script",p='link[rel="modulepreload"][as="'+fi(u)+'"][href="'+fi(n)+'"]',_=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=_l(n)}if(!$i.has(_)&&(n=g({rel:"modulepreload",href:n},s),$i.set(_,n),o.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Ro(_)))return}u=o.createElement("link"),Gt(u,"link",n),Et(u),o.head.appendChild(u)}}}function dE(n,s,o){Qn.S(n,s,o);var u=gl;if(u&&n){var p=fr(u).hoistableStyles,_=ml(n);s=s||"default";var x=p.get(_);if(!x){var D={loading:0,preload:null};if(x=u.querySelector(Do(_)))D.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":s},o),(o=$i.get(_))&&Td(n,o);var W=x=u.createElement("link");Et(W),Gt(W,"link",n),W._p=new Promise(function(J,se){W.onload=J,W.onerror=se}),W.addEventListener("load",function(){D.loading|=1}),W.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Kc(x,s,u)}x={type:"stylesheet",instance:x,count:1,state:D},p.set(_,x)}}}function pE(n,s){Qn.X(n,s);var o=gl;if(o&&n){var u=fr(o).hoistableScripts,p=_l(n),_=u.get(p);_||(_=o.querySelector(Ro(p)),_||(n=g({src:n,async:!0},s),(s=$i.get(p))&&Ad(n,s),_=o.createElement("script"),Et(_),Gt(_,"link",n),o.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function gE(n,s){Qn.M(n,s);var o=gl;if(o&&n){var u=fr(o).hoistableScripts,p=_l(n),_=u.get(p);_||(_=o.querySelector(Ro(p)),_||(n=g({src:n,async:!0,type:"module"},s),(s=$i.get(p))&&Ad(n,s),_=o.createElement("script"),Et(_),Gt(_,"link",n),o.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function Uv(n,s,o,u){var p=(p=oe.current)?Xc(p):null;if(!p)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=ml(o.href),o=fr(p).hoistableStyles,u=o.get(s),u||(u={type:"style",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=ml(o.href);var _=fr(p).hoistableStyles,x=_.get(n);if(x||(p=p.ownerDocument||p,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(n,x),(_=p.querySelector(Do(n)))&&!_._p&&(x.instance=_,x.state.loading=5),$i.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},$i.set(n,o),_||mE(p,n,o,x.state))),s&&u===null)throw Error(r(528,""));return x}if(s&&u!==null)throw Error(r(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=_l(o),o=fr(p).hoistableScripts,u=o.get(s),u||(u={type:"script",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function ml(n){return'href="'+fi(n)+'"'}function Do(n){return'link[rel="stylesheet"]['+n+"]"}function qv(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function mE(n,s,o,u){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=n.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),Gt(s,"link",o),Et(s),n.head.appendChild(s))}function _l(n){return'[src="'+fi(n)+'"]'}function Ro(n){return"script[async]"+n}function Vv(n,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var u=n.querySelector('style[data-href~="'+fi(o.href)+'"]');if(u)return s.instance=u,Et(u),u;var p=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Et(u),Gt(u,"style",p),Kc(u,o.precedence,n),s.instance=u;case"stylesheet":p=ml(o.href);var _=n.querySelector(Do(p));if(_)return s.state.loading|=4,s.instance=_,Et(_),_;u=qv(o),(p=$i.get(p))&&Td(u,p),_=(n.ownerDocument||n).createElement("link"),Et(_);var x=_;return x._p=new Promise(function(D,W){x.onload=D,x.onerror=W}),Gt(_,"link",u),s.state.loading|=4,Kc(_,o.precedence,n),s.instance=_;case"script":return _=_l(o.src),(p=n.querySelector(Ro(_)))?(s.instance=p,Et(p),p):(u=o,(p=$i.get(_))&&(u=g({},o),Ad(u,p)),n=n.ownerDocument||n,p=n.createElement("script"),Et(p),Gt(p,"link",u),n.head.appendChild(p),s.instance=p);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,Kc(u,o.precedence,n));return s.instance}function Kc(n,s,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,_=p,x=0;x<u.length;x++){var D=u[x];if(D.dataset.precedence===s)_=D;else if(_!==p)break}_?_.parentNode.insertBefore(n,_.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(n,s.firstChild))}function Td(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function Ad(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Gc=null;function Fv(n,s,o){if(Gc===null){var u=new Map,p=Gc=new Map;p.set(o,u)}else p=Gc,u=p.get(o),u||(u=new Map,p.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var _=o[p];if(!(_[Qr]||_[zt]||n==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var x=_.getAttribute(s)||"";x=n+x;var D=u.get(x);D?D.push(_):u.set(x,[_])}}return u}function Yv(n,s,o){n=n.ownerDocument||n,n.head.insertBefore(o,s==="title"?n.querySelector("head > title"):null)}function _E(n,s,o){if(o===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return n=s.disabled,typeof s.precedence=="string"&&n==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function $v(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function vE(n,s,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=ml(u.href),_=s.querySelector(Do(p));if(_){s=_._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Zc.bind(n),s.then(n,n)),o.state.loading|=4,o.instance=_,Et(_);return}_=s.ownerDocument||s,u=qv(u),(p=$i.get(p))&&Td(u,p),_=_.createElement("link"),Et(_);var x=_;x._p=new Promise(function(D,W){x.onload=D,x.onerror=W}),Gt(_,"link",u),o.instance=_}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=Zc.bind(n),s.addEventListener("load",o),s.addEventListener("error",o))}}var Nd=0;function yE(n,s){return n.stylesheets&&n.count===0&&Jc(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&Jc(n,n.stylesheets),n.unsuspend){var _=n.unsuspend;n.unsuspend=null,_()}},6e4+s);0<n.imgBytes&&Nd===0&&(Nd=62500*J2());var p=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Jc(n,n.stylesheets),n.unsuspend)){var _=n.unsuspend;n.unsuspend=null,_()}},(n.imgBytes>Nd?50:800)+s);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Zc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Jc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Qc=null;function Jc(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Qc=new Map,s.forEach(SE,n),Qc=null,Zc.call(n))}function SE(n,s){if(!(s.state.loading&4)){var o=Qc.get(n);if(o)var u=o.get(null);else{o=new Map,Qc.set(n,o);for(var p=n.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<p.length;_++){var x=p[_];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(o.set(x.dataset.precedence,x),u=x)}u&&o.set(null,u)}p=s.instance,x=p.getAttribute("data-precedence"),_=o.get(x)||u,_===u&&o.set(null,p),o.set(x,p),this.count++,u=Zc.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),_?_.parentNode.insertBefore(p,_.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(p,n.firstChild)),s.state.loading|=4}}var Bo={$$typeof:C,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function bE(n,s,o,u,p,_,x,D,W){this.tag=1,this.containerInfo=n,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=Vl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vl(0),this.hiddenUpdates=Vl(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=_,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=W,this.incompleteTransitions=new Map}function Wv(n,s,o,u,p,_,x,D,W,J,se,ae){return n=new bE(n,s,o,x,W,J,se,ae,D),s=1,_===!0&&(s|=24),_=Mi(3,null,null,s),n.current=_,_.stateNode=n,s=cf(),s.refCount++,n.pooledCache=s,s.refCount++,_.memoizedState={element:u,isDehydrated:o,cache:s},df(_),n}function Xv(n){return n?(n=Xs,n):Xs}function Kv(n,s,o,u,p,_){p=Xv(p),u.context===null?u.context=p:u.pendingContext=p,u=br(s),u.payload={element:o},_=_===void 0?null:_,_!==null&&(u.callback=_),o=xr(n,u,s),o!==null&&(vi(o,n,s),uo(o,n,s))}function Gv(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<s?o:s}}function Dd(n,s){Gv(n,s),(n=n.alternate)&&Gv(n,s)}function Zv(n){if(n.tag===13||n.tag===31){var s=rs(n,67108864);s!==null&&vi(s,n,67108864),Dd(n,67108864)}}function Qv(n){if(n.tag===13||n.tag===31){var s=Ri();s=Fl(s);var o=rs(n,s);o!==null&&vi(o,n,s),Dd(n,s)}}var eu=!0;function xE(n,s,o,u){var p=M.T;M.T=null;var _=P.p;try{P.p=2,Rd(n,s,o,u)}finally{P.p=_,M.T=p}}function wE(n,s,o,u){var p=M.T;M.T=null;var _=P.p;try{P.p=8,Rd(n,s,o,u)}finally{P.p=_,M.T=p}}function Rd(n,s,o,u){if(eu){var p=Bd(u);if(p===null)vd(n,s,u,tu,o),ey(n,u);else if(EE(p,n,s,o,u))u.stopPropagation();else if(ey(n,u),s&4&&-1<CE.indexOf(n)){for(;p!==null;){var _=ur(p);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var x=Rn(_.pendingLanes);if(x!==0){var D=_;for(D.pendingLanes|=2,D.entangledLanes|=2;x;){var W=1<<31-Ze(x);D.entanglements[1]|=W,x&=~W}mn(_),(Ke&6)===0&&(Hc=Lt()+500,Mo(0))}}break;case 31:case 13:D=rs(_,2),D!==null&&vi(D,_,2),Ic(),Dd(_,2)}if(_=Bd(u),_===null&&vd(n,s,u,tu,o),_===p)break;p=_}p!==null&&u.stopPropagation()}else vd(n,s,u,null,o)}}function Bd(n){return n=Lh(n),Ld(n)}var tu=null;function Ld(n){if(tu=null,n=cr(n),n!==null){var s=a(n);if(s===null)n=null;else{var o=s.tag;if(o===13){if(n=c(s),n!==null)return n;n=null}else if(o===31){if(n=h(s),n!==null)return n;n=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return tu=n,null}function Jv(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ar()){case re:return 2;case ge:return 8;case ke:case Oe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var zd=!1,Br=null,Lr=null,zr=null,Lo=new Map,zo=new Map,Or=[],CE="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 ey(n,s){switch(n){case"focusin":case"focusout":Br=null;break;case"dragenter":case"dragleave":Lr=null;break;case"mouseover":case"mouseout":zr=null;break;case"pointerover":case"pointerout":Lo.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":zo.delete(s.pointerId)}}function Oo(n,s,o,u,p,_){return n===null||n.nativeEvent!==_?(n={blockedOn:s,domEventName:o,eventSystemFlags:u,nativeEvent:_,targetContainers:[p]},s!==null&&(s=ur(s),s!==null&&Zv(s)),n):(n.eventSystemFlags|=u,s=n.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),n)}function EE(n,s,o,u,p){switch(s){case"focusin":return Br=Oo(Br,n,s,o,u,p),!0;case"dragenter":return Lr=Oo(Lr,n,s,o,u,p),!0;case"mouseover":return zr=Oo(zr,n,s,o,u,p),!0;case"pointerover":var _=p.pointerId;return Lo.set(_,Oo(Lo.get(_)||null,n,s,o,u,p)),!0;case"gotpointercapture":return _=p.pointerId,zo.set(_,Oo(zo.get(_)||null,n,s,o,u,p)),!0}return!1}function ty(n){var s=cr(n.target);if(s!==null){var o=a(s);if(o!==null){if(s=o.tag,s===13){if(s=c(o),s!==null){n.blockedOn=s,Va(n.priority,function(){Qv(o)});return}}else if(s===31){if(s=h(o),s!==null){n.blockedOn=s,Va(n.priority,function(){Qv(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function iu(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var o=Bd(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);Bh=u,o.target.dispatchEvent(u),Bh=null}else return s=ur(o),s!==null&&Zv(s),n.blockedOn=o,!1;s.shift()}return!0}function iy(n,s,o){iu(n)&&o.delete(s)}function kE(){zd=!1,Br!==null&&iu(Br)&&(Br=null),Lr!==null&&iu(Lr)&&(Lr=null),zr!==null&&iu(zr)&&(zr=null),Lo.forEach(iy),zo.forEach(iy)}function nu(n,s){n.blockedOn===s&&(n.blockedOn=null,zd||(zd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,kE)))}var ru=null;function ny(n){ru!==n&&(ru=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ru===n&&(ru=null);for(var s=0;s<n.length;s+=3){var o=n[s],u=n[s+1],p=n[s+2];if(typeof u!="function"){if(Ld(u||o)===null)continue;break}var _=ur(o);_!==null&&(n.splice(s,3),s-=3,Bf(_,{pending:!0,data:p,method:o.method,action:u},u,p))}}))}function vl(n){function s(W){return nu(W,n)}Br!==null&&nu(Br,n),Lr!==null&&nu(Lr,n),zr!==null&&nu(zr,n),Lo.forEach(s),zo.forEach(s);for(var o=0;o<Or.length;o++){var u=Or[o];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Or.length&&(o=Or[0],o.blockedOn===null);)ty(o),o.blockedOn===null&&Or.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var p=o[u],_=o[u+1],x=p[ti]||null;if(typeof _=="function")x||ny(o);else if(x){var D=null;if(_&&_.hasAttribute("formAction")){if(p=_,x=_[ti]||null)D=x.formAction;else if(Ld(p)!==null)continue}else D=x.action;typeof D=="function"?o[u+1]=D:(o.splice(u,3),u-=3),ny(o)}}}function ry(){function n(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(x){return p=x})},focusReset:"manual",scroll:"manual"})}function s(){p!==null&&(p(),p=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),p!==null&&(p(),p=null)}}}function Od(n){this._internalRoot=n}su.prototype.render=Od.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));var o=s.current,u=Ri();Kv(o,u,n,s,null,null)},su.prototype.unmount=Od.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;Kv(n.current,2,null,n,null,null),Ic(),s[Bn]=null}};function su(n){this._internalRoot=n}su.prototype.unstable_scheduleHydration=function(n){if(n){var s=qa();n={blockedOn:null,target:n,priority:s};for(var o=0;o<Or.length&&s!==0&&s<Or[o].priority;o++);Or.splice(o,0,n),o===0&&ty(n)}};var sy=t.version;if(sy!=="19.2.4")throw Error(r(527,sy,"19.2.4"));P.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=f(s),n=n!==null?m(n):null,n=n===null?null:n.stateNode,n};var ME={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lu.isDisabled&&lu.supportsFiber)try{$t=lu.inject(ME),bt=lu}catch{}}return Po.createRoot=function(n,s){if(!l(n))throw Error(r(299));var o=!1,u="",p=f0,_=d0,x=p0;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(_=s.onCaughtError),s.onRecoverableError!==void 0&&(x=s.onRecoverableError)),s=Wv(n,1,!1,null,null,o,u,null,p,_,x,ry),n[Bn]=s.current,_d(n),new Od(s)},Po.hydrateRoot=function(n,s,o){if(!l(n))throw Error(r(299));var u=!1,p="",_=f0,x=d0,D=p0,W=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(_=o.onUncaughtError),o.onCaughtError!==void 0&&(x=o.onCaughtError),o.onRecoverableError!==void 0&&(D=o.onRecoverableError),o.formState!==void 0&&(W=o.formState)),s=Wv(n,1,!0,s,o??null,u,p,W,_,x,D,ry),s.context=Xv(null),o=s.current,u=Ri(),u=Fl(u),p=br(u),p.callback=null,xr(o,p,u),o=u,s.current.lanes=o,Zr(s,o),mn(s),n[Bn]=s.current,_d(n),new su(s)},Po.version="19.2.4",Po}var gy;function HE(){if(gy)return Id.exports;gy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Id.exports=OE(),Id.exports}var PE=HE();function Bt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let i=0,r;i<e.length;i++)(r=Bt(e[i]))!==""&&(t+=(t&&" ")+r);else for(let i in e)e[i]&&(t+=(t&&" ")+i);return t}var IE={value:()=>{}};function rh(){for(var e=0,t=arguments.length,i={},r;e<t;++e){if(!(r=arguments[e]+"")||r in i||/[\s.]/.test(r))throw new Error("illegal type: "+r);i[r]=[]}return new Eu(i)}function Eu(e){this._=e}function jE(e,t){return e.trim().split(/^|\s+/).map(function(i){var r="",l=i.indexOf(".");if(l>=0&&(r=i.slice(l+1),i=i.slice(0,l)),i&&!t.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}Eu.prototype=rh.prototype={constructor:Eu,on:function(e,t){var i=this._,r=jE(e+"",i),l,a=-1,c=r.length;if(arguments.length<2){for(;++a<c;)if((l=(e=r[a]).type)&&(l=UE(i[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<c;)if(l=(e=r[a]).type)i[l]=my(i[l],e.name,t);else if(t==null)for(l in i)i[l]=my(i[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var i in t)e[i]=t[i].slice();return new Eu(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var i=new Array(l),r=0,l,a;r<l;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],r=0,l=a.length;r<l;++r)a[r].value.apply(t,i)},apply:function(e,t,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],l=0,a=r.length;l<a;++l)r[l].value.apply(t,i)}};function UE(e,t){for(var i=0,r=e.length,l;i<r;++i)if((l=e[i]).name===t)return l.value}function my(e,t,i){for(var r=0,l=e.length;r<l;++r)if(e[r].name===t){e[r]=IE,e=e.slice(0,r).concat(e.slice(r+1));break}return i!=null&&e.push({name:t,value:i}),e}var Tp="http://www.w3.org/1999/xhtml";const _y={svg:"http://www.w3.org/2000/svg",xhtml:Tp,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sh(e){var t=e+="",i=t.indexOf(":");return i>=0&&(t=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),_y.hasOwnProperty(t)?{space:_y[t],local:e}:e}function qE(e){return function(){var t=this.ownerDocument,i=this.namespaceURI;return i===Tp&&t.documentElement.namespaceURI===Tp?t.createElement(e):t.createElementNS(i,e)}}function VE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fb(e){var t=sh(e);return(t.local?VE:qE)(t)}function FE(){}function zg(e){return e==null?FE:function(){return this.querySelector(e)}}function YE(e){typeof e!="function"&&(e=zg(e));for(var t=this._groups,i=t.length,r=new Array(i),l=0;l<i;++l)for(var a=t[l],c=a.length,h=r[l]=new Array(c),d,f,m=0;m<c;++m)(d=a[m])&&(f=e.call(d,d.__data__,m,a))&&("__data__"in d&&(f.__data__=d.__data__),h[m]=f);return new Pi(r,this._parents)}function $E(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function WE(){return[]}function db(e){return e==null?WE:function(){return this.querySelectorAll(e)}}function XE(e){return function(){return $E(e.apply(this,arguments))}}function KE(e){typeof e=="function"?e=XE(e):e=db(e);for(var t=this._groups,i=t.length,r=[],l=[],a=0;a<i;++a)for(var c=t[a],h=c.length,d,f=0;f<h;++f)(d=c[f])&&(r.push(e.call(d,d.__data__,f,c)),l.push(d));return new Pi(r,l)}function pb(e){return function(){return this.matches(e)}}function gb(e){return function(t){return t.matches(e)}}var GE=Array.prototype.find;function ZE(e){return function(){return GE.call(this.children,e)}}function QE(){return this.firstElementChild}function JE(e){return this.select(e==null?QE:ZE(typeof e=="function"?e:gb(e)))}var ek=Array.prototype.filter;function tk(){return Array.from(this.children)}function ik(e){return function(){return ek.call(this.children,e)}}function nk(e){return this.selectAll(e==null?tk:ik(typeof e=="function"?e:gb(e)))}function rk(e){typeof e!="function"&&(e=pb(e));for(var t=this._groups,i=t.length,r=new Array(i),l=0;l<i;++l)for(var a=t[l],c=a.length,h=r[l]=[],d,f=0;f<c;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&h.push(d);return new Pi(r,this._parents)}function mb(e){return new Array(e.length)}function sk(){return new Pi(this._enter||this._groups.map(mb),this._parents)}function Pu(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Pu.prototype={constructor:Pu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function lk(e){return function(){return e}}function ok(e,t,i,r,l,a){for(var c=0,h,d=t.length,f=a.length;c<f;++c)(h=t[c])?(h.__data__=a[c],r[c]=h):i[c]=new Pu(e,a[c]);for(;c<d;++c)(h=t[c])&&(l[c]=h)}function ak(e,t,i,r,l,a,c){var h,d,f=new Map,m=t.length,g=a.length,v=new Array(m),y;for(h=0;h<m;++h)(d=t[h])&&(v[h]=y=c.call(d,d.__data__,h,t)+"",f.has(y)?l[h]=d:f.set(y,d));for(h=0;h<g;++h)y=c.call(e,a[h],h,a)+"",(d=f.get(y))?(r[h]=d,d.__data__=a[h],f.delete(y)):i[h]=new Pu(e,a[h]);for(h=0;h<m;++h)(d=t[h])&&f.get(v[h])===d&&(l[h]=d)}function ck(e){return e.__data__}function uk(e,t){if(!arguments.length)return Array.from(this,ck);var i=t?ak:ok,r=this._parents,l=this._groups;typeof e!="function"&&(e=lk(e));for(var a=l.length,c=new Array(a),h=new Array(a),d=new Array(a),f=0;f<a;++f){var m=r[f],g=l[f],v=g.length,y=hk(e.call(m,m&&m.__data__,f,r)),S=y.length,b=h[f]=new Array(S),E=c[f]=new Array(S),w=d[f]=new Array(v);i(m,g,b,E,w,y,t);for(var z=0,C=0,T,I;z<S;++z)if(T=b[z]){for(z>=C&&(C=z+1);!(I=E[C])&&++C<S;);T._next=I||null}}return c=new Pi(c,r),c._enter=h,c._exit=d,c}function hk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fk(){return new Pi(this._exit||this._groups.map(mb),this._parents)}function dk(e,t,i){var r=this.enter(),l=this,a=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),i==null?a.remove():i(a),r&&l?r.merge(l).order():l}function pk(e){for(var t=e.selection?e.selection():e,i=this._groups,r=t._groups,l=i.length,a=r.length,c=Math.min(l,a),h=new Array(l),d=0;d<c;++d)for(var f=i[d],m=r[d],g=f.length,v=h[d]=new Array(g),y,S=0;S<g;++S)(y=f[S]||m[S])&&(v[S]=y);for(;d<l;++d)h[d]=i[d];return new Pi(h,this._parents)}function gk(){for(var e=this._groups,t=-1,i=e.length;++t<i;)for(var r=e[t],l=r.length-1,a=r[l],c;--l>=0;)(c=r[l])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function mk(e){e||(e=_k);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var i=this._groups,r=i.length,l=new Array(r),a=0;a<r;++a){for(var c=i[a],h=c.length,d=l[a]=new Array(h),f,m=0;m<h;++m)(f=c[m])&&(d[m]=f);d.sort(t)}return new Pi(l,this._parents).order()}function _k(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function vk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yk(){return Array.from(this)}function Sk(){for(var e=this._groups,t=0,i=e.length;t<i;++t)for(var r=e[t],l=0,a=r.length;l<a;++l){var c=r[l];if(c)return c}return null}function bk(){let e=0;for(const t of this)++e;return e}function xk(){return!this.node()}function wk(e){for(var t=this._groups,i=0,r=t.length;i<r;++i)for(var l=t[i],a=0,c=l.length,h;a<c;++a)(h=l[a])&&e.call(h,h.__data__,a,l);return this}function Ck(e){return function(){this.removeAttribute(e)}}function Ek(e){return function(){this.removeAttributeNS(e.space,e.local)}}function kk(e,t){return function(){this.setAttribute(e,t)}}function Mk(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Tk(e,t){return function(){var i=t.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function Ak(e,t){return function(){var i=t.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function Nk(e,t){var i=sh(e);if(arguments.length<2){var r=this.node();return i.local?r.getAttributeNS(i.space,i.local):r.getAttribute(i)}return this.each((t==null?i.local?Ek:Ck:typeof t=="function"?i.local?Ak:Tk:i.local?Mk:kk)(i,t))}function _b(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Dk(e){return function(){this.style.removeProperty(e)}}function Rk(e,t,i){return function(){this.style.setProperty(e,t,i)}}function Bk(e,t,i){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,i)}}function Lk(e,t,i){return arguments.length>1?this.each((t==null?Dk:typeof t=="function"?Bk:Rk)(e,t,i??"")):Dl(this.node(),e)}function Dl(e,t){return e.style.getPropertyValue(t)||_b(e).getComputedStyle(e,null).getPropertyValue(t)}function zk(e){return function(){delete this[e]}}function Ok(e,t){return function(){this[e]=t}}function Hk(e,t){return function(){var i=t.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function Pk(e,t){return arguments.length>1?this.each((t==null?zk:typeof t=="function"?Hk:Ok)(e,t)):this.node()[e]}function vb(e){return e.trim().split(/^|\s+/)}function Og(e){return e.classList||new yb(e)}function yb(e){this._node=e,this._names=vb(e.getAttribute("class")||"")}yb.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Sb(e,t){for(var i=Og(e),r=-1,l=t.length;++r<l;)i.add(t[r])}function bb(e,t){for(var i=Og(e),r=-1,l=t.length;++r<l;)i.remove(t[r])}function Ik(e){return function(){Sb(this,e)}}function jk(e){return function(){bb(this,e)}}function Uk(e,t){return function(){(t.apply(this,arguments)?Sb:bb)(this,e)}}function qk(e,t){var i=vb(e+"");if(arguments.length<2){for(var r=Og(this.node()),l=-1,a=i.length;++l<a;)if(!r.contains(i[l]))return!1;return!0}return this.each((typeof t=="function"?Uk:t?Ik:jk)(i,t))}function Vk(){this.textContent=""}function Fk(e){return function(){this.textContent=e}}function Yk(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function $k(e){return arguments.length?this.each(e==null?Vk:(typeof e=="function"?Yk:Fk)(e)):this.node().textContent}function Wk(){this.innerHTML=""}function Xk(e){return function(){this.innerHTML=e}}function Kk(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gk(e){return arguments.length?this.each(e==null?Wk:(typeof e=="function"?Kk:Xk)(e)):this.node().innerHTML}function Zk(){this.nextSibling&&this.parentNode.appendChild(this)}function Qk(){return this.each(Zk)}function Jk(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function eM(){return this.each(Jk)}function tM(e){var t=typeof e=="function"?e:fb(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function iM(){return null}function nM(e,t){var i=typeof e=="function"?e:fb(e),r=t==null?iM:typeof t=="function"?t:zg(t);return this.select(function(){return this.insertBefore(i.apply(this,arguments),r.apply(this,arguments)||null)})}function rM(){var e=this.parentNode;e&&e.removeChild(this)}function sM(){return this.each(rM)}function lM(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function oM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function aM(e){return this.select(e?oM:lM)}function cM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function uM(e){return function(t){e.call(this,t,this.__data__)}}function hM(e){return e.trim().split(/^|\s+/).map(function(t){var i="",r=t.indexOf(".");return r>=0&&(i=t.slice(r+1),t=t.slice(0,r)),{type:t,name:i}})}function fM(e){return function(){var t=this.__on;if(t){for(var i=0,r=-1,l=t.length,a;i<l;++i)a=t[i],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function dM(e,t,i){return function(){var r=this.__on,l,a=uM(t);if(r){for(var c=0,h=r.length;c<h;++c)if((l=r[c]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=i),l.value=t;return}}this.addEventListener(e.type,a,i),l={type:e.type,name:e.name,value:t,listener:a,options:i},r?r.push(l):this.__on=[l]}}function pM(e,t,i){var r=hM(e+""),l,a=r.length,c;if(arguments.length<2){var h=this.node().__on;if(h){for(var d=0,f=h.length,m;d<f;++d)for(l=0,m=h[d];l<a;++l)if((c=r[l]).type===m.type&&c.name===m.name)return m.value}return}for(h=t?dM:fM,l=0;l<a;++l)this.each(h(r[l],t,i));return this}function xb(e,t,i){var r=_b(e),l=r.CustomEvent;typeof l=="function"?l=new l(t,i):(l=r.document.createEvent("Event"),i?(l.initEvent(t,i.bubbles,i.cancelable),l.detail=i.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function gM(e,t){return function(){return xb(this,e,t)}}function mM(e,t){return function(){return xb(this,e,t.apply(this,arguments))}}function _M(e,t){return this.each((typeof t=="function"?mM:gM)(e,t))}function*vM(){for(var e=this._groups,t=0,i=e.length;t<i;++t)for(var r=e[t],l=0,a=r.length,c;l<a;++l)(c=r[l])&&(yield c)}var wb=[null];function Pi(e,t){this._groups=e,this._parents=t}function ka(){return new Pi([[document.documentElement]],wb)}function yM(){return this}Pi.prototype=ka.prototype={constructor:Pi,select:YE,selectAll:KE,selectChild:JE,selectChildren:nk,filter:rk,data:uk,enter:sk,exit:fk,join:dk,merge:pk,selection:yM,order:gk,sort:mk,call:vk,nodes:yk,node:Sk,size:bk,empty:xk,each:wk,attr:Nk,style:Lk,property:Pk,classed:qk,text:$k,html:Gk,raise:Qk,lower:eM,append:tM,insert:nM,remove:sM,clone:aM,datum:cM,on:pM,dispatch:_M,[Symbol.iterator]:vM};function Oi(e){return typeof e=="string"?new Pi([[document.querySelector(e)]],[document.documentElement]):new Pi([[e]],wb)}function SM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ln(e,t){if(e=SM(e),t===void 0&&(t=e.currentTarget),t){var i=t.ownerSVGElement||t;if(i.createSVGPoint){var r=i.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const bM={passive:!1},ua={capture:!0,passive:!1};function Vd(e){e.stopImmediatePropagation()}function Ml(e){e.preventDefault(),e.stopImmediatePropagation()}function Cb(e){var t=e.document.documentElement,i=Oi(e).on("dragstart.drag",Ml,ua);"onselectstart"in t?i.on("selectstart.drag",Ml,ua):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Eb(e,t){var i=e.document.documentElement,r=Oi(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ml,ua),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in i?r.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const ou=e=>()=>e;function Ap(e,{sourceEvent:t,subject:i,target:r,identifier:l,active:a,x:c,y:h,dx:d,dy:f,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:l,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:m}})}Ap.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xM(e){return!e.ctrlKey&&!e.button}function wM(){return this.parentNode}function CM(e,t){return t??{x:e.x,y:e.y}}function EM(){return navigator.maxTouchPoints||"ontouchstart"in this}function kb(){var e=xM,t=wM,i=CM,r=EM,l={},a=rh("start","drag","end"),c=0,h,d,f,m,g=0;function v(T){T.on("mousedown.drag",y).filter(r).on("touchstart.drag",E).on("touchmove.drag",w,bM).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(T,I){if(!(m||!e.call(this,T,I))){var B=C(this,t.call(this,T,I),T,I,"mouse");B&&(Oi(T.view).on("mousemove.drag",S,ua).on("mouseup.drag",b,ua),Cb(T.view),Vd(T),f=!1,h=T.clientX,d=T.clientY,B("start",T))}}function S(T){if(Ml(T),!f){var I=T.clientX-h,B=T.clientY-d;f=I*I+B*B>g}l.mouse("drag",T)}function b(T){Oi(T.view).on("mousemove.drag mouseup.drag",null),Eb(T.view,f),Ml(T),l.mouse("end",T)}function E(T,I){if(e.call(this,T,I)){var B=T.changedTouches,U=t.call(this,T,I),X=B.length,G,ne;for(G=0;G<X;++G)(ne=C(this,U,T,I,B[G].identifier,B[G]))&&(Vd(T),ne("start",T,B[G]))}}function w(T){var I=T.changedTouches,B=I.length,U,X;for(U=0;U<B;++U)(X=l[I[U].identifier])&&(Ml(T),X("drag",T,I[U]))}function z(T){var I=T.changedTouches,B=I.length,U,X;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),U=0;U<B;++U)(X=l[I[U].identifier])&&(Vd(T),X("end",T,I[U]))}function C(T,I,B,U,X,G){var ne=a.copy(),V=ln(G||B,I),j,F,R;if((R=i.call(T,new Ap("beforestart",{sourceEvent:B,target:v,identifier:X,active:c,x:V[0],y:V[1],dx:0,dy:0,dispatch:ne}),U))!=null)return j=R.x-V[0]||0,F=R.y-V[1]||0,function O(M,P,H){var Y=V,A;switch(M){case"start":l[X]=O,A=c++;break;case"end":delete l[X],--c;case"drag":V=ln(H||P,I),A=c;break}ne.call(M,T,new Ap(M,{sourceEvent:P,subject:R,target:v,identifier:X,active:A,x:V[0]+j,y:V[1]+F,dx:V[0]-Y[0],dy:V[1]-Y[1],dispatch:ne}),U)}}return v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:ou(!!T),v):e},v.container=function(T){return arguments.length?(t=typeof T=="function"?T:ou(T),v):t},v.subject=function(T){return arguments.length?(i=typeof T=="function"?T:ou(T),v):i},v.touchable=function(T){return arguments.length?(r=typeof T=="function"?T:ou(!!T),v):r},v.on=function(){var T=a.on.apply(a,arguments);return T===a?v:T},v.clickDistance=function(T){return arguments.length?(g=(T=+T)*T,v):Math.sqrt(g)},v}function Hg(e,t,i){e.prototype=t.prototype=i,i.constructor=e}function Mb(e,t){var i=Object.create(e.prototype);for(var r in t)i[r]=t[r];return i}function Ma(){}var ha=.7,Iu=1/ha,Tl="\\s*([+-]?\\d+)\\s*",fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kM=/^#([0-9a-f]{3,8})$/,MM=new RegExp(`^rgb\\(${Tl},${Tl},${Tl}\\)$`),TM=new RegExp(`^rgb\\(${Cn},${Cn},${Cn}\\)$`),AM=new RegExp(`^rgba\\(${Tl},${Tl},${Tl},${fa}\\)$`),NM=new RegExp(`^rgba\\(${Cn},${Cn},${Cn},${fa}\\)$`),DM=new RegExp(`^hsl\\(${fa},${Cn},${Cn}\\)$`),RM=new RegExp(`^hsla\\(${fa},${Cn},${Cn},${fa}\\)$`),vy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Hg(Ma,ks,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yy,formatHex:yy,formatHex8:BM,formatHsl:LM,formatRgb:Sy,toString:Sy});function yy(){return this.rgb().formatHex()}function BM(){return this.rgb().formatHex8()}function LM(){return Tb(this).formatHsl()}function Sy(){return this.rgb().formatRgb()}function ks(e){var t,i;return e=(e+"").trim().toLowerCase(),(t=kM.exec(e))?(i=t[1].length,t=parseInt(t[1],16),i===6?by(t):i===3?new bi(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):i===8?au(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):i===4?au(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=MM.exec(e))?new bi(t[1],t[2],t[3],1):(t=TM.exec(e))?new bi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=AM.exec(e))?au(t[1],t[2],t[3],t[4]):(t=NM.exec(e))?au(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=DM.exec(e))?Cy(t[1],t[2]/100,t[3]/100,1):(t=RM.exec(e))?Cy(t[1],t[2]/100,t[3]/100,t[4]):vy.hasOwnProperty(e)?by(vy[e]):e==="transparent"?new bi(NaN,NaN,NaN,0):null}function by(e){return new bi(e>>16&255,e>>8&255,e&255,1)}function au(e,t,i,r){return r<=0&&(e=t=i=NaN),new bi(e,t,i,r)}function zM(e){return e instanceof Ma||(e=ks(e)),e?(e=e.rgb(),new bi(e.r,e.g,e.b,e.opacity)):new bi}function Np(e,t,i,r){return arguments.length===1?zM(e):new bi(e,t,i,r??1)}function bi(e,t,i,r){this.r=+e,this.g=+t,this.b=+i,this.opacity=+r}Hg(bi,Np,Mb(Ma,{brighter(e){return e=e==null?Iu:Math.pow(Iu,e),new bi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new bi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new bi(ws(this.r),ws(this.g),ws(this.b),ju(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xy,formatHex:xy,formatHex8:OM,formatRgb:wy,toString:wy}));function xy(){return`#${bs(this.r)}${bs(this.g)}${bs(this.b)}`}function OM(){return`#${bs(this.r)}${bs(this.g)}${bs(this.b)}${bs((isNaN(this.opacity)?1:this.opacity)*255)}`}function wy(){const e=ju(this.opacity);return`${e===1?"rgb(":"rgba("}${ws(this.r)}, ${ws(this.g)}, ${ws(this.b)}${e===1?")":`, ${e})`}`}function ju(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ws(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bs(e){return e=ws(e),(e<16?"0":"")+e.toString(16)}function Cy(e,t,i,r){return r<=0?e=t=i=NaN:i<=0||i>=1?e=t=NaN:t<=0&&(e=NaN),new on(e,t,i,r)}function Tb(e){if(e instanceof on)return new on(e.h,e.s,e.l,e.opacity);if(e instanceof Ma||(e=ks(e)),!e)return new on;if(e instanceof on)return e;e=e.rgb();var t=e.r/255,i=e.g/255,r=e.b/255,l=Math.min(t,i,r),a=Math.max(t,i,r),c=NaN,h=a-l,d=(a+l)/2;return h?(t===a?c=(i-r)/h+(i<r)*6:i===a?c=(r-t)/h+2:c=(t-i)/h+4,h/=d<.5?a+l:2-a-l,c*=60):h=d>0&&d<1?0:c,new on(c,h,d,e.opacity)}function HM(e,t,i,r){return arguments.length===1?Tb(e):new on(e,t,i,r??1)}function on(e,t,i,r){this.h=+e,this.s=+t,this.l=+i,this.opacity=+r}Hg(on,HM,Mb(Ma,{brighter(e){return e=e==null?Iu:Math.pow(Iu,e),new on(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new on(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*t,l=2*i-r;return new bi(Fd(e>=240?e-240:e+120,l,r),Fd(e,l,r),Fd(e<120?e+240:e-120,l,r),this.opacity)},clamp(){return new on(Ey(this.h),cu(this.s),cu(this.l),ju(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ju(this.opacity);return`${e===1?"hsl(":"hsla("}${Ey(this.h)}, ${cu(this.s)*100}%, ${cu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ey(e){return e=(e||0)%360,e<0?e+360:e}function cu(e){return Math.max(0,Math.min(1,e||0))}function Fd(e,t,i){return(e<60?t+(i-t)*e/60:e<180?i:e<240?t+(i-t)*(240-e)/60:t)*255}const Pg=e=>()=>e;function PM(e,t){return function(i){return e+i*t}}function IM(e,t,i){return e=Math.pow(e,i),t=Math.pow(t,i)-e,i=1/i,function(r){return Math.pow(e+r*t,i)}}function jM(e){return(e=+e)==1?Ab:function(t,i){return i-t?IM(t,i,e):Pg(isNaN(t)?i:t)}}function Ab(e,t){var i=t-e;return i?PM(e,i):Pg(isNaN(e)?t:e)}const Uu=(function e(t){var i=jM(t);function r(l,a){var c=i((l=Np(l)).r,(a=Np(a)).r),h=i(l.g,a.g),d=i(l.b,a.b),f=Ab(l.opacity,a.opacity);return function(m){return l.r=c(m),l.g=h(m),l.b=d(m),l.opacity=f(m),l+""}}return r.gamma=e,r})(1);function UM(e,t){t||(t=[]);var i=e?Math.min(t.length,e.length):0,r=t.slice(),l;return function(a){for(l=0;l<i;++l)r[l]=e[l]*(1-a)+t[l]*a;return r}}function qM(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function VM(e,t){var i=t?t.length:0,r=e?Math.min(i,e.length):0,l=new Array(r),a=new Array(i),c;for(c=0;c<r;++c)l[c]=ra(e[c],t[c]);for(;c<i;++c)a[c]=t[c];return function(h){for(c=0;c<r;++c)a[c]=l[c](h);return a}}function FM(e,t){var i=new Date;return e=+e,t=+t,function(r){return i.setTime(e*(1-r)+t*r),i}}function bn(e,t){return e=+e,t=+t,function(i){return e*(1-i)+t*i}}function YM(e,t){var i={},r={},l;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(l in t)l in e?i[l]=ra(e[l],t[l]):r[l]=t[l];return function(a){for(l in i)r[l]=i[l](a);return r}}var Dp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yd=new RegExp(Dp.source,"g");function $M(e){return function(){return e}}function WM(e){return function(t){return e(t)+""}}function Nb(e,t){var i=Dp.lastIndex=Yd.lastIndex=0,r,l,a,c=-1,h=[],d=[];for(e=e+"",t=t+"";(r=Dp.exec(e))&&(l=Yd.exec(t));)(a=l.index)>i&&(a=t.slice(i,a),h[c]?h[c]+=a:h[++c]=a),(r=r[0])===(l=l[0])?h[c]?h[c]+=l:h[++c]=l:(h[++c]=null,d.push({i:c,x:bn(r,l)})),i=Yd.lastIndex;return i<t.length&&(a=t.slice(i),h[c]?h[c]+=a:h[++c]=a),h.length<2?d[0]?WM(d[0].x):$M(t):(t=d.length,function(f){for(var m=0,g;m<t;++m)h[(g=d[m]).i]=g.x(f);return h.join("")})}function ra(e,t){var i=typeof t,r;return t==null||i==="boolean"?Pg(t):(i==="number"?bn:i==="string"?(r=ks(t))?(t=r,Uu):Nb:t instanceof ks?Uu:t instanceof Date?FM:qM(t)?UM:Array.isArray(t)?VM:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?YM:bn)(e,t)}var ky=180/Math.PI,Rp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Db(e,t,i,r,l,a){var c,h,d;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(d=e*i+t*r)&&(i-=e*d,r-=t*d),(h=Math.sqrt(i*i+r*r))&&(i/=h,r/=h,d/=h),e*r<t*i&&(e=-e,t=-t,d=-d,c=-c),{translateX:l,translateY:a,rotate:Math.atan2(t,e)*ky,skewX:Math.atan(d)*ky,scaleX:c,scaleY:h}}var uu;function XM(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rp:Db(t.a,t.b,t.c,t.d,t.e,t.f)}function KM(e){return e==null||(uu||(uu=document.createElementNS("http://www.w3.org/2000/svg","g")),uu.setAttribute("transform",e),!(e=uu.transform.baseVal.consolidate()))?Rp:(e=e.matrix,Db(e.a,e.b,e.c,e.d,e.e,e.f))}function Rb(e,t,i,r){function l(f){return f.length?f.pop()+" ":""}function a(f,m,g,v,y,S){if(f!==g||m!==v){var b=y.push("translate(",null,t,null,i);S.push({i:b-4,x:bn(f,g)},{i:b-2,x:bn(m,v)})}else(g||v)&&y.push("translate("+g+t+v+i)}function c(f,m,g,v){f!==m?(f-m>180?m+=360:m-f>180&&(f+=360),v.push({i:g.push(l(g)+"rotate(",null,r)-2,x:bn(f,m)})):m&&g.push(l(g)+"rotate("+m+r)}function h(f,m,g,v){f!==m?v.push({i:g.push(l(g)+"skewX(",null,r)-2,x:bn(f,m)}):m&&g.push(l(g)+"skewX("+m+r)}function d(f,m,g,v,y,S){if(f!==g||m!==v){var b=y.push(l(y)+"scale(",null,",",null,")");S.push({i:b-4,x:bn(f,g)},{i:b-2,x:bn(m,v)})}else(g!==1||v!==1)&&y.push(l(y)+"scale("+g+","+v+")")}return function(f,m){var g=[],v=[];return f=e(f),m=e(m),a(f.translateX,f.translateY,m.translateX,m.translateY,g,v),c(f.rotate,m.rotate,g,v),h(f.skewX,m.skewX,g,v),d(f.scaleX,f.scaleY,m.scaleX,m.scaleY,g,v),f=m=null,function(y){for(var S=-1,b=v.length,E;++S<b;)g[(E=v[S]).i]=E.x(y);return g.join("")}}}var GM=Rb(XM,"px, ","px)","deg)"),ZM=Rb(KM,", ",")",")"),QM=1e-12;function My(e){return((e=Math.exp(e))+1/e)/2}function JM(e){return((e=Math.exp(e))-1/e)/2}function e5(e){return((e=Math.exp(2*e))-1)/(e+1)}const ku=(function e(t,i,r){function l(a,c){var h=a[0],d=a[1],f=a[2],m=c[0],g=c[1],v=c[2],y=m-h,S=g-d,b=y*y+S*S,E,w;if(b<QM)w=Math.log(v/f)/t,E=function(U){return[h+U*y,d+U*S,f*Math.exp(t*U*w)]};else{var z=Math.sqrt(b),C=(v*v-f*f+r*b)/(2*f*i*z),T=(v*v-f*f-r*b)/(2*v*i*z),I=Math.log(Math.sqrt(C*C+1)-C),B=Math.log(Math.sqrt(T*T+1)-T);w=(B-I)/t,E=function(U){var X=U*w,G=My(I),ne=f/(i*z)*(G*e5(t*X+I)-JM(I));return[h+ne*y,d+ne*S,f*G/My(t*X+I)]}}return E.duration=w*1e3*t/Math.SQRT2,E}return l.rho=function(a){var c=Math.max(.001,+a),h=c*c,d=h*h;return e(c,h,d)},l})(Math.SQRT2,2,4);var Rl=0,Zo=0,Io=0,Bb=1e3,qu,Qo,Vu=0,Ms=0,lh=0,da=typeof performance=="object"&&performance.now?performance:Date,Lb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ig(){return Ms||(Lb(t5),Ms=da.now()+lh)}function t5(){Ms=0}function Fu(){this._call=this._time=this._next=null}Fu.prototype=zb.prototype={constructor:Fu,restart:function(e,t,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?Ig():+i)+(t==null?0:+t),!this._next&&Qo!==this&&(Qo?Qo._next=this:qu=this,Qo=this),this._call=e,this._time=i,Bp()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bp())}};function zb(e,t,i){var r=new Fu;return r.restart(e,t,i),r}function i5(){Ig(),++Rl;for(var e=qu,t;e;)(t=Ms-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rl}function Ty(){Ms=(Vu=da.now())+lh,Rl=Zo=0;try{i5()}finally{Rl=0,r5(),Ms=0}}function n5(){var e=da.now(),t=e-Vu;t>Bb&&(lh-=t,Vu=e)}function r5(){for(var e,t=qu,i,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(i=t._next,t._next=null,t=e?e._next=i:qu=i);Qo=e,Bp(r)}function Bp(e){if(!Rl){Zo&&(Zo=clearTimeout(Zo));var t=e-Ms;t>24?(e<1/0&&(Zo=setTimeout(Ty,e-da.now()-lh)),Io&&(Io=clearInterval(Io))):(Io||(Vu=da.now(),Io=setInterval(n5,Bb)),Rl=1,Lb(Ty))}}function Ay(e,t,i){var r=new Fu;return t=t==null?0:+t,r.restart(l=>{r.stop(),e(l+t)},t,i),r}var s5=rh("start","end","cancel","interrupt"),l5=[],Ob=0,Ny=1,Lp=2,Mu=3,Dy=4,zp=5,Tu=6;function oh(e,t,i,r,l,a){var c=e.__transition;if(!c)e.__transition={};else if(i in c)return;o5(e,i,{name:t,index:r,group:l,on:s5,tween:l5,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Ob})}function jg(e,t){var i=un(e,t);if(i.state>Ob)throw new Error("too late; already scheduled");return i}function An(e,t){var i=un(e,t);if(i.state>Mu)throw new Error("too late; already running");return i}function un(e,t){var i=e.__transition;if(!i||!(i=i[t]))throw new Error("transition not found");return i}function o5(e,t,i){var r=e.__transition,l;r[t]=i,i.timer=zb(a,0,i.time);function a(f){i.state=Ny,i.timer.restart(c,i.delay,i.time),i.delay<=f&&c(f-i.delay)}function c(f){var m,g,v,y;if(i.state!==Ny)return d();for(m in r)if(y=r[m],y.name===i.name){if(y.state===Mu)return Ay(c);y.state===Dy?(y.state=Tu,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[m]):+m<t&&(y.state=Tu,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[m])}if(Ay(function(){i.state===Mu&&(i.state=Dy,i.timer.restart(h,i.delay,i.time),h(f))}),i.state=Lp,i.on.call("start",e,e.__data__,i.index,i.group),i.state===Lp){for(i.state=Mu,l=new Array(v=i.tween.length),m=0,g=-1;m<v;++m)(y=i.tween[m].value.call(e,e.__data__,i.index,i.group))&&(l[++g]=y);l.length=g+1}}function h(f){for(var m=f<i.duration?i.ease.call(null,f/i.duration):(i.timer.restart(d),i.state=zp,1),g=-1,v=l.length;++g<v;)l[g].call(e,m);i.state===zp&&(i.on.call("end",e,e.__data__,i.index,i.group),d())}function d(){i.state=Tu,i.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Au(e,t){var i=e.__transition,r,l,a=!0,c;if(i){t=t==null?null:t+"";for(c in i){if((r=i[c]).name!==t){a=!1;continue}l=r.state>Lp&&r.state<zp,r.state=Tu,r.timer.stop(),r.on.call(l?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete i[c]}a&&delete e.__transition}}function a5(e){return this.each(function(){Au(this,e)})}function c5(e,t){var i,r;return function(){var l=An(this,e),a=l.tween;if(a!==i){r=i=a;for(var c=0,h=r.length;c<h;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}l.tween=r}}function u5(e,t,i){var r,l;if(typeof i!="function")throw new Error;return function(){var a=An(this,e),c=a.tween;if(c!==r){l=(r=c).slice();for(var h={name:t,value:i},d=0,f=l.length;d<f;++d)if(l[d].name===t){l[d]=h;break}d===f&&l.push(h)}a.tween=l}}function h5(e,t){var i=this._id;if(e+="",arguments.length<2){for(var r=un(this.node(),i).tween,l=0,a=r.length,c;l<a;++l)if((c=r[l]).name===e)return c.value;return null}return this.each((t==null?c5:u5)(i,e,t))}function Ug(e,t,i){var r=e._id;return e.each(function(){var l=An(this,r);(l.value||(l.value={}))[t]=i.apply(this,arguments)}),function(l){return un(l,r).value[t]}}function Hb(e,t){var i;return(typeof t=="number"?bn:t instanceof ks?Uu:(i=ks(t))?(t=i,Uu):Nb)(e,t)}function f5(e){return function(){this.removeAttribute(e)}}function d5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function p5(e,t,i){var r,l=i+"",a;return function(){var c=this.getAttribute(e);return c===l?null:c===r?a:a=t(r=c,i)}}function g5(e,t,i){var r,l=i+"",a;return function(){var c=this.getAttributeNS(e.space,e.local);return c===l?null:c===r?a:a=t(r=c,i)}}function m5(e,t,i){var r,l,a;return function(){var c,h=i(this),d;return h==null?void this.removeAttribute(e):(c=this.getAttribute(e),d=h+"",c===d?null:c===r&&d===l?a:(l=d,a=t(r=c,h)))}}function _5(e,t,i){var r,l,a;return function(){var c,h=i(this),d;return h==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),d=h+"",c===d?null:c===r&&d===l?a:(l=d,a=t(r=c,h)))}}function v5(e,t){var i=sh(e),r=i==="transform"?ZM:Hb;return this.attrTween(e,typeof t=="function"?(i.local?_5:m5)(i,r,Ug(this,"attr."+e,t)):t==null?(i.local?d5:f5)(i):(i.local?g5:p5)(i,r,t))}function y5(e,t){return function(i){this.setAttribute(e,t.call(this,i))}}function S5(e,t){return function(i){this.setAttributeNS(e.space,e.local,t.call(this,i))}}function b5(e,t){var i,r;function l(){var a=t.apply(this,arguments);return a!==r&&(i=(r=a)&&S5(e,a)),i}return l._value=t,l}function x5(e,t){var i,r;function l(){var a=t.apply(this,arguments);return a!==r&&(i=(r=a)&&y5(e,a)),i}return l._value=t,l}function w5(e,t){var i="attr."+e;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;var r=sh(e);return this.tween(i,(r.local?b5:x5)(r,t))}function C5(e,t){return function(){jg(this,e).delay=+t.apply(this,arguments)}}function E5(e,t){return t=+t,function(){jg(this,e).delay=t}}function k5(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?C5:E5)(t,e)):un(this.node(),t).delay}function M5(e,t){return function(){An(this,e).duration=+t.apply(this,arguments)}}function T5(e,t){return t=+t,function(){An(this,e).duration=t}}function A5(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?M5:T5)(t,e)):un(this.node(),t).duration}function N5(e,t){if(typeof t!="function")throw new Error;return function(){An(this,e).ease=t}}function D5(e){var t=this._id;return arguments.length?this.each(N5(t,e)):un(this.node(),t).ease}function R5(e,t){return function(){var i=t.apply(this,arguments);if(typeof i!="function")throw new Error;An(this,e).ease=i}}function B5(e){if(typeof e!="function")throw new Error;return this.each(R5(this._id,e))}function L5(e){typeof e!="function"&&(e=pb(e));for(var t=this._groups,i=t.length,r=new Array(i),l=0;l<i;++l)for(var a=t[l],c=a.length,h=r[l]=[],d,f=0;f<c;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&h.push(d);return new rr(r,this._parents,this._name,this._id)}function z5(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,i=e._groups,r=t.length,l=i.length,a=Math.min(r,l),c=new Array(r),h=0;h<a;++h)for(var d=t[h],f=i[h],m=d.length,g=c[h]=new Array(m),v,y=0;y<m;++y)(v=d[y]||f[y])&&(g[y]=v);for(;h<r;++h)c[h]=t[h];return new rr(c,this._parents,this._name,this._id)}function O5(e){return(e+"").trim().split(/^|\s+/).every(function(t){var i=t.indexOf(".");return i>=0&&(t=t.slice(0,i)),!t||t==="start"})}function H5(e,t,i){var r,l,a=O5(t)?jg:An;return function(){var c=a(this,e),h=c.on;h!==r&&(l=(r=h).copy()).on(t,i),c.on=l}}function P5(e,t){var i=this._id;return arguments.length<2?un(this.node(),i).on.on(e):this.each(H5(i,e,t))}function I5(e){return function(){var t=this.parentNode;for(var i in this.__transition)if(+i!==e)return;t&&t.removeChild(this)}}function j5(){return this.on("end.remove",I5(this._id))}function U5(e){var t=this._name,i=this._id;typeof e!="function"&&(e=zg(e));for(var r=this._groups,l=r.length,a=new Array(l),c=0;c<l;++c)for(var h=r[c],d=h.length,f=a[c]=new Array(d),m,g,v=0;v<d;++v)(m=h[v])&&(g=e.call(m,m.__data__,v,h))&&("__data__"in m&&(g.__data__=m.__data__),f[v]=g,oh(f[v],t,i,v,f,un(m,i)));return new rr(a,this._parents,t,i)}function q5(e){var t=this._name,i=this._id;typeof e!="function"&&(e=db(e));for(var r=this._groups,l=r.length,a=[],c=[],h=0;h<l;++h)for(var d=r[h],f=d.length,m,g=0;g<f;++g)if(m=d[g]){for(var v=e.call(m,m.__data__,g,d),y,S=un(m,i),b=0,E=v.length;b<E;++b)(y=v[b])&&oh(y,t,i,b,v,S);a.push(v),c.push(m)}return new rr(a,c,t,i)}var V5=ka.prototype.constructor;function F5(){return new V5(this._groups,this._parents)}function Y5(e,t){var i,r,l;return function(){var a=Dl(this,e),c=(this.style.removeProperty(e),Dl(this,e));return a===c?null:a===i&&c===r?l:l=t(i=a,r=c)}}function Pb(e){return function(){this.style.removeProperty(e)}}function $5(e,t,i){var r,l=i+"",a;return function(){var c=Dl(this,e);return c===l?null:c===r?a:a=t(r=c,i)}}function W5(e,t,i){var r,l,a;return function(){var c=Dl(this,e),h=i(this),d=h+"";return h==null&&(d=h=(this.style.removeProperty(e),Dl(this,e))),c===d?null:c===r&&d===l?a:(l=d,a=t(r=c,h))}}function X5(e,t){var i,r,l,a="style."+t,c="end."+a,h;return function(){var d=An(this,e),f=d.on,m=d.value[a]==null?h||(h=Pb(t)):void 0;(f!==i||l!==m)&&(r=(i=f).copy()).on(c,l=m),d.on=r}}function K5(e,t,i){var r=(e+="")=="transform"?GM:Hb;return t==null?this.styleTween(e,Y5(e,r)).on("end.style."+e,Pb(e)):typeof t=="function"?this.styleTween(e,W5(e,r,Ug(this,"style."+e,t))).each(X5(this._id,e)):this.styleTween(e,$5(e,r,t),i).on("end.style."+e,null)}function G5(e,t,i){return function(r){this.style.setProperty(e,t.call(this,r),i)}}function Z5(e,t,i){var r,l;function a(){var c=t.apply(this,arguments);return c!==l&&(r=(l=c)&&G5(e,c,i)),r}return a._value=t,a}function Q5(e,t,i){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Z5(e,t,i??""))}function J5(e){return function(){this.textContent=e}}function eT(e){return function(){var t=e(this);this.textContent=t??""}}function tT(e){return this.tween("text",typeof e=="function"?eT(Ug(this,"text",e)):J5(e==null?"":e+""))}function iT(e){return function(t){this.textContent=e.call(this,t)}}function nT(e){var t,i;function r(){var l=e.apply(this,arguments);return l!==i&&(t=(i=l)&&iT(l)),t}return r._value=e,r}function rT(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,nT(e))}function sT(){for(var e=this._name,t=this._id,i=Ib(),r=this._groups,l=r.length,a=0;a<l;++a)for(var c=r[a],h=c.length,d,f=0;f<h;++f)if(d=c[f]){var m=un(d,t);oh(d,e,i,f,c,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new rr(r,this._parents,e,i)}function lT(){var e,t,i=this,r=i._id,l=i.size();return new Promise(function(a,c){var h={value:c},d={value:function(){--l===0&&a()}};i.each(function(){var f=An(this,r),m=f.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(h),t._.interrupt.push(h),t._.end.push(d)),f.on=t}),l===0&&a()})}var oT=0;function rr(e,t,i,r){this._groups=e,this._parents=t,this._name=i,this._id=r}function Ib(){return++oT}var Jn=ka.prototype;rr.prototype={constructor:rr,select:U5,selectAll:q5,selectChild:Jn.selectChild,selectChildren:Jn.selectChildren,filter:L5,merge:z5,selection:F5,transition:sT,call:Jn.call,nodes:Jn.nodes,node:Jn.node,size:Jn.size,empty:Jn.empty,each:Jn.each,on:P5,attr:v5,attrTween:w5,style:K5,styleTween:Q5,text:tT,textTween:rT,remove:j5,tween:h5,delay:k5,duration:A5,ease:D5,easeVarying:B5,end:lT,[Symbol.iterator]:Jn[Symbol.iterator]};function aT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cT={time:null,delay:0,duration:250,ease:aT};function uT(e,t){for(var i;!(i=e.__transition)||!(i=i[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return i}function hT(e){var t,i;e instanceof rr?(t=e._id,e=e._name):(t=Ib(),(i=cT).time=Ig(),e=e==null?null:e+"");for(var r=this._groups,l=r.length,a=0;a<l;++a)for(var c=r[a],h=c.length,d,f=0;f<h;++f)(d=c[f])&&oh(d,e,t,f,c,i||uT(d,t));return new rr(r,this._parents,e,t)}ka.prototype.interrupt=a5;ka.prototype.transition=hT;const hu=e=>()=>e;function fT(e,{sourceEvent:t,target:i,transform:r,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:l}})}function tr(e,t,i){this.k=e,this.x=t,this.y=i}tr.prototype={constructor:tr,scale:function(e){return e===1?this:new tr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new tr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ah=new tr(1,0,0);jb.prototype=tr.prototype;function jb(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ah;return e.__zoom}function $d(e){e.stopImmediatePropagation()}function jo(e){e.preventDefault(),e.stopImmediatePropagation()}function dT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pT(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ry(){return this.__zoom||ah}function gT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mT(){return navigator.maxTouchPoints||"ontouchstart"in this}function _T(e,t,i){var r=e.invertX(t[0][0])-i[0][0],l=e.invertX(t[1][0])-i[1][0],a=e.invertY(t[0][1])-i[0][1],c=e.invertY(t[1][1])-i[1][1];return e.translate(l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function Ub(){var e=dT,t=pT,i=_T,r=gT,l=mT,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],h=250,d=ku,f=rh("start","zoom","end"),m,g,v,y=500,S=150,b=0,E=10;function w(R){R.property("__zoom",Ry).on("wheel.zoom",X,{passive:!1}).on("mousedown.zoom",G).on("dblclick.zoom",ne).filter(l).on("touchstart.zoom",V).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(R,O,M,P){var H=R.selection?R.selection():R;H.property("__zoom",Ry),R!==H?I(R,O,M,P):H.interrupt().each(function(){B(this,arguments).event(P).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},w.scaleBy=function(R,O,M,P){w.scaleTo(R,function(){var H=this.__zoom.k,Y=typeof O=="function"?O.apply(this,arguments):O;return H*Y},M,P)},w.scaleTo=function(R,O,M,P){w.transform(R,function(){var H=t.apply(this,arguments),Y=this.__zoom,A=M==null?T(H):typeof M=="function"?M.apply(this,arguments):M,L=Y.invert(A),$=typeof O=="function"?O.apply(this,arguments):O;return i(C(z(Y,$),A,L),H,c)},M,P)},w.translateBy=function(R,O,M,P){w.transform(R,function(){return i(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),c)},null,P)},w.translateTo=function(R,O,M,P,H){w.transform(R,function(){var Y=t.apply(this,arguments),A=this.__zoom,L=P==null?T(Y):typeof P=="function"?P.apply(this,arguments):P;return i(ah.translate(L[0],L[1]).scale(A.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof M=="function"?-M.apply(this,arguments):-M),Y,c)},P,H)};function z(R,O){return O=Math.max(a[0],Math.min(a[1],O)),O===R.k?R:new tr(O,R.x,R.y)}function C(R,O,M){var P=O[0]-M[0]*R.k,H=O[1]-M[1]*R.k;return P===R.x&&H===R.y?R:new tr(R.k,P,H)}function T(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function I(R,O,M,P){R.on("start.zoom",function(){B(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event(P).end()}).tween("zoom",function(){var H=this,Y=arguments,A=B(H,Y).event(P),L=t.apply(H,Y),$=M==null?T(L):typeof M=="function"?M.apply(H,Y):M,N=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),ee=H.__zoom,ce=typeof O=="function"?O.apply(H,Y):O,oe=d(ee.invert($).concat(N/ee.k),ce.invert($).concat(N/ce.k));return function(fe){if(fe===1)fe=ce;else{var he=oe(fe),pe=N/he[2];fe=new tr(pe,$[0]-he[0]*pe,$[1]-he[1]*pe)}A.zoom(null,fe)}})}function B(R,O,M){return!M&&R.__zooming||new U(R,O)}function U(R,O){this.that=R,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,O),this.taps=0}U.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,O){return this.mouse&&R!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var O=Oi(this.that).datum();f.call(R,this.that,new fT(R,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:f}),O)}};function X(R,...O){if(!e.apply(this,arguments))return;var M=B(this,O).event(R),P=this.__zoom,H=Math.max(a[0],Math.min(a[1],P.k*Math.pow(2,r.apply(this,arguments)))),Y=ln(R);if(M.wheel)(M.mouse[0][0]!==Y[0]||M.mouse[0][1]!==Y[1])&&(M.mouse[1]=P.invert(M.mouse[0]=Y)),clearTimeout(M.wheel);else{if(P.k===H)return;M.mouse=[Y,P.invert(Y)],Au(this),M.start()}jo(R),M.wheel=setTimeout(A,S),M.zoom("mouse",i(C(z(P,H),M.mouse[0],M.mouse[1]),M.extent,c));function A(){M.wheel=null,M.end()}}function G(R,...O){if(v||!e.apply(this,arguments))return;var M=R.currentTarget,P=B(this,O,!0).event(R),H=Oi(R.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",N,!0),Y=ln(R,M),A=R.clientX,L=R.clientY;Cb(R.view),$d(R),P.mouse=[Y,this.__zoom.invert(Y)],Au(this),P.start();function $(ee){if(jo(ee),!P.moved){var ce=ee.clientX-A,oe=ee.clientY-L;P.moved=ce*ce+oe*oe>b}P.event(ee).zoom("mouse",i(C(P.that.__zoom,P.mouse[0]=ln(ee,M),P.mouse[1]),P.extent,c))}function N(ee){H.on("mousemove.zoom mouseup.zoom",null),Eb(ee.view,P.moved),jo(ee),P.event(ee).end()}}function ne(R,...O){if(e.apply(this,arguments)){var M=this.__zoom,P=ln(R.changedTouches?R.changedTouches[0]:R,this),H=M.invert(P),Y=M.k*(R.shiftKey?.5:2),A=i(C(z(M,Y),P,H),t.apply(this,O),c);jo(R),h>0?Oi(this).transition().duration(h).call(I,A,P,R):Oi(this).call(w.transform,A,P,R)}}function V(R,...O){if(e.apply(this,arguments)){var M=R.touches,P=M.length,H=B(this,O,R.changedTouches.length===P).event(R),Y,A,L,$;for($d(R),A=0;A<P;++A)L=M[A],$=ln(L,this),$=[$,this.__zoom.invert($),L.identifier],H.touch0?!H.touch1&&H.touch0[2]!==$[2]&&(H.touch1=$,H.taps=0):(H.touch0=$,Y=!0,H.taps=1+!!m);m&&(m=clearTimeout(m)),Y&&(H.taps<2&&(g=$[0],m=setTimeout(function(){m=null},y)),Au(this),H.start())}}function j(R,...O){if(this.__zooming){var M=B(this,O).event(R),P=R.changedTouches,H=P.length,Y,A,L,$;for(jo(R),Y=0;Y<H;++Y)A=P[Y],L=ln(A,this),M.touch0&&M.touch0[2]===A.identifier?M.touch0[0]=L:M.touch1&&M.touch1[2]===A.identifier&&(M.touch1[0]=L);if(A=M.that.__zoom,M.touch1){var N=M.touch0[0],ee=M.touch0[1],ce=M.touch1[0],oe=M.touch1[1],fe=(fe=ce[0]-N[0])*fe+(fe=ce[1]-N[1])*fe,he=(he=oe[0]-ee[0])*he+(he=oe[1]-ee[1])*he;A=z(A,Math.sqrt(fe/he)),L=[(N[0]+ce[0])/2,(N[1]+ce[1])/2],$=[(ee[0]+oe[0])/2,(ee[1]+oe[1])/2]}else if(M.touch0)L=M.touch0[0],$=M.touch0[1];else return;M.zoom("touch",i(C(A,L,$),M.extent,c))}}function F(R,...O){if(this.__zooming){var M=B(this,O).event(R),P=R.changedTouches,H=P.length,Y,A;for($d(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},y),Y=0;Y<H;++Y)A=P[Y],M.touch0&&M.touch0[2]===A.identifier?delete M.touch0:M.touch1&&M.touch1[2]===A.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(A=ln(A,this),Math.hypot(g[0]-A[0],g[1]-A[1])<E)){var L=Oi(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return w.wheelDelta=function(R){return arguments.length?(r=typeof R=="function"?R:hu(+R),w):r},w.filter=function(R){return arguments.length?(e=typeof R=="function"?R:hu(!!R),w):e},w.touchable=function(R){return arguments.length?(l=typeof R=="function"?R:hu(!!R),w):l},w.extent=function(R){return arguments.length?(t=typeof R=="function"?R:hu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),w):t},w.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],w):[a[0],a[1]]},w.translateExtent=function(R){return arguments.length?(c[0][0]=+R[0][0],c[1][0]=+R[1][0],c[0][1]=+R[0][1],c[1][1]=+R[1][1],w):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},w.constrain=function(R){return arguments.length?(i=R,w):i},w.duration=function(R){return arguments.length?(h=+R,w):h},w.interpolate=function(R){return arguments.length?(d=R,w):d},w.on=function(){var R=f.on.apply(f,arguments);return R===f?w:R},w.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,w):Math.sqrt(b)},w.tapDistance=function(R){return arguments.length?(E=+R,w):E},w}const kn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:i,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pa=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qb=["Enter"," ","Escape"],Vb={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:i})=>`Moved selected node ${e}. New position, x: ${t}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Bl;(function(e){e.Strict="strict",e.Loose="loose"})(Bl||(Bl={}));var Cs;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Cs||(Cs={}));var ga;(function(e){e.Partial="partial",e.Full="full"})(ga||(ga={}));const Fb={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Yr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Yr||(Yr={}));var ma;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ma||(ma={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const By={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function Yb(e){return e===null?null:e?"valid":"invalid"}const $b=e=>"id"in e&&"source"in e&&"target"in e,vT=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qg=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ta=(e,t=[0,0])=>{const{width:i,height:r}=sr(e),l=e.origin??t,a=i*l[0],c=r*l[1];return{x:e.position.x-a,y:e.position.y-c}},yT=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((r,l)=>{const a=typeof l=="string";let c=!t.nodeLookup&&!a?l:void 0;t.nodeLookup&&(c=a?t.nodeLookup.get(l):qg(l)?l:t.nodeLookup.get(l.id));const h=c?Yu(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ch(r,h)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return uh(i)},Aa=(e,t={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(l=>{(t.filter===void 0||t.filter(l))&&(i=ch(i,Yu(l)),r=!0)}),r?uh(i):{x:0,y:0,width:0,height:0}},Vg=(e,t,[i,r,l]=[0,0,1],a=!1,c=!1)=>{const h={...Da(t,[i,r,l]),width:t.width/l,height:t.height/l},d=[];for(const f of e.values()){const{measured:m,selectable:g=!0,hidden:v=!1}=f;if(c&&!g||v)continue;const y=m.width??f.width??f.initialWidth??null,S=m.height??f.height??f.initialHeight??null,b=_a(h,zl(f)),E=(y??0)*(S??0),w=a&&b>0;(!f.internals.handleBounds||w||b>=E||f.dragging)&&d.push(f)}return d},ST=(e,t)=>{const i=new Set;return e.forEach(r=>{i.add(r.id)}),t.filter(r=>i.has(r.source)||i.has(r.target))};function bT(e,t){const i=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(l=>l.id)):null;return e.forEach(l=>{l.measured.width&&l.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!l.hidden)&&(!r||r.has(l.id))&&i.set(l.id,l)}),i}async function xT({nodes:e,width:t,height:i,panZoom:r,minZoom:l,maxZoom:a},c){if(e.size===0)return Promise.resolve(!0);const h=bT(e,c),d=Aa(h),f=Fg(d,t,i,(c==null?void 0:c.minZoom)??l,(c==null?void 0:c.maxZoom)??a,(c==null?void 0:c.padding)??.1);return await r.setViewport(f,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),Promise.resolve(!0)}function Wb({nodeId:e,nextPosition:t,nodeLookup:i,nodeOrigin:r=[0,0],nodeExtent:l,onError:a}){const c=i.get(e),h=c.parentId?i.get(c.parentId):void 0,{x:d,y:f}=h?h.internals.positionAbsolute:{x:0,y:0},m=c.origin??r;let g=c.extent||l;if(c.extent==="parent"&&!c.expandParent)if(!h)a==null||a("005",kn.error005());else{const y=h.measured.width,S=h.measured.height;y&&S&&(g=[[d,f],[d+y,f+S]])}else h&&Ol(c.extent)&&(g=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);const v=Ol(g)?Ts(t,g,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(a==null||a("015",kn.error015())),{position:{x:v.x-d+(c.measured.width??0)*m[0],y:v.y-f+(c.measured.height??0)*m[1]},positionAbsolute:v}}async function wT({nodesToRemove:e=[],edgesToRemove:t=[],nodes:i,edges:r,onBeforeDelete:l}){const a=new Set(e.map(v=>v.id)),c=[];for(const v of i){if(v.deletable===!1)continue;const y=a.has(v.id),S=!y&&v.parentId&&c.find(b=>b.id===v.parentId);(y||S)&&c.push(v)}const h=new Set(t.map(v=>v.id)),d=r.filter(v=>v.deletable!==!1),m=ST(c,d);for(const v of d)h.has(v.id)&&!m.find(S=>S.id===v.id)&&m.push(v);if(!l)return{edges:m,nodes:c};const g=await l({nodes:c,edges:m});return typeof g=="boolean"?g?{edges:m,nodes:c}:{edges:[],nodes:[]}:g}const Ll=(e,t=0,i=1)=>Math.min(Math.max(e,t),i),Ts=(e={x:0,y:0},t,i)=>({x:Ll(e.x,t[0][0],t[1][0]-((i==null?void 0:i.width)??0)),y:Ll(e.y,t[0][1],t[1][1]-((i==null?void 0:i.height)??0))});function Xb(e,t,i){const{width:r,height:l}=sr(i),{x:a,y:c}=i.internals.positionAbsolute;return Ts(e,[[a,c],[a+r,c+l]],t)}const Ly=(e,t,i)=>e<t?Ll(Math.abs(e-t),1,t)/t:e>i?-Ll(Math.abs(e-i),1,t)/t:0,Kb=(e,t,i=15,r=40)=>{const l=Ly(e.x,r,t.width-r)*i,a=Ly(e.y,r,t.height-r)*i;return[l,a]},ch=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Op=({x:e,y:t,width:i,height:r})=>({x:e,y:t,x2:e+i,y2:t+r}),uh=({x:e,y:t,x2:i,y2:r})=>({x:e,y:t,width:i-e,height:r-t}),zl=(e,t=[0,0])=>{var l,a;const{x:i,y:r}=qg(e)?e.internals.positionAbsolute:Ta(e,t);return{x:i,y:r,width:((l=e.measured)==null?void 0:l.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Yu=(e,t=[0,0])=>{var l,a;const{x:i,y:r}=qg(e)?e.internals.positionAbsolute:Ta(e,t);return{x:i,y:r,x2:i+(((l=e.measured)==null?void 0:l.width)??e.width??e.initialWidth??0),y2:r+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},Gb=(e,t)=>uh(ch(Op(e),Op(t))),_a=(e,t)=>{const i=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(i*r)},zy=e=>an(e.width)&&an(e.height)&&an(e.x)&&an(e.y),an=e=>!isNaN(e)&&isFinite(e),CT=(e,t)=>{},Na=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Da=({x:e,y:t},[i,r,l],a=!1,c=[1,1])=>{const h={x:(e-i)/l,y:(t-r)/l};return a?Na(h,c):h},$u=({x:e,y:t},[i,r,l])=>({x:e*l+i,y:t*l+r});function yl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(t*i*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ET(e,t,i){if(typeof e=="string"||typeof e=="number"){const r=yl(e,i),l=yl(e,t);return{top:r,right:l,bottom:r,left:l,x:l*2,y:r*2}}if(typeof e=="object"){const r=yl(e.top??e.y??0,i),l=yl(e.bottom??e.y??0,i),a=yl(e.left??e.x??0,t),c=yl(e.right??e.x??0,t);return{top:r,right:c,bottom:l,left:a,x:a+c,y:r+l}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kT(e,t,i,r,l,a){const{x:c,y:h}=$u(e,[t,i,r]),{x:d,y:f}=$u({x:e.x+e.width,y:e.y+e.height},[t,i,r]),m=l-d,g=a-f;return{left:Math.floor(c),top:Math.floor(h),right:Math.floor(m),bottom:Math.floor(g)}}const Fg=(e,t,i,r,l,a)=>{const c=ET(a,t,i),h=(t-c.x)/e.width,d=(i-c.y)/e.height,f=Math.min(h,d),m=Ll(f,r,l),g=e.x+e.width/2,v=e.y+e.height/2,y=t/2-g*m,S=i/2-v*m,b=kT(e,y,S,m,t,i),E={left:Math.min(b.left-c.left,0),top:Math.min(b.top-c.top,0),right:Math.min(b.right-c.right,0),bottom:Math.min(b.bottom-c.bottom,0)};return{x:y-E.left+E.right,y:S-E.top+E.bottom,zoom:m}},va=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ol(e){return e!=null&&e!=="parent"}function sr(e){var t,i;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function Zb(e){var t,i;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function Qb(e,t={width:0,height:0},i,r,l){const a={...e},c=r.get(i);if(c){const h=c.origin||l;a.x+=c.internals.positionAbsolute.x-(t.width??0)*h[0],a.y+=c.internals.positionAbsolute.y-(t.height??0)*h[1]}return a}function Oy(e,t){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}function MT(){let e,t;return{promise:new Promise((r,l)=>{e=r,t=l}),resolve:e,reject:t}}function TT(e){return{...Vb,...e||{}}}function sa(e,{snapGrid:t=[0,0],snapToGrid:i=!1,transform:r,containerBounds:l}){const{x:a,y:c}=cn(e),h=Da({x:a-((l==null?void 0:l.left)??0),y:c-((l==null?void 0:l.top)??0)},r),{x:d,y:f}=i?Na(h,t):h;return{xSnapped:d,ySnapped:f,...h}}const Yg=e=>({width:e.offsetWidth,height:e.offsetHeight}),Jb=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},AT=["INPUT","SELECT","TEXTAREA"];function ex(e){var r,l;const t=((l=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:l[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:AT.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const tx=e=>"clientX"in e,cn=(e,t)=>{var a,c;const i=tx(e),r=i?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,l=i?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}},Hy=(e,t,i,r,l)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:l,position:c.getAttribute("data-handlepos"),x:(h.left-i.left)/r,y:(h.top-i.top)/r,...Yg(c)}})};function ix({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:l,sourceControlY:a,targetControlX:c,targetControlY:h}){const d=e*.125+l*.375+c*.375+i*.125,f=t*.125+a*.375+h*.375+r*.125,m=Math.abs(d-e),g=Math.abs(f-t);return[d,f,m,g]}function fu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Py({pos:e,x1:t,y1:i,x2:r,y2:l,c:a}){switch(e){case we.Left:return[t-fu(t-r,a),i];case we.Right:return[t+fu(r-t,a),i];case we.Top:return[t,i-fu(i-l,a)];case we.Bottom:return[t,i+fu(l-i,a)]}}function $g({sourceX:e,sourceY:t,sourcePosition:i=we.Bottom,targetX:r,targetY:l,targetPosition:a=we.Top,curvature:c=.25}){const[h,d]=Py({pos:i,x1:e,y1:t,x2:r,y2:l,c}),[f,m]=Py({pos:a,x1:r,y1:l,x2:e,y2:t,c}),[g,v,y,S]=ix({sourceX:e,sourceY:t,targetX:r,targetY:l,sourceControlX:h,sourceControlY:d,targetControlX:f,targetControlY:m});return[`M${e},${t} C${h},${d} ${f},${m} ${r},${l}`,g,v,y,S]}function nx({sourceX:e,sourceY:t,targetX:i,targetY:r}){const l=Math.abs(i-e)/2,a=i<e?i+l:i-l,c=Math.abs(r-t)/2,h=r<t?r+c:r-c;return[a,h,l,c]}function NT({sourceNode:e,targetNode:t,selected:i=!1,zIndex:r=0,elevateOnSelect:l=!1,zIndexMode:a="basic"}){if(a==="manual")return r;const c=l&&i?r+1e3:r,h=Math.max(e.parentId||l&&e.selected?e.internals.z:0,t.parentId||l&&t.selected?t.internals.z:0);return c+h}function DT({sourceNode:e,targetNode:t,width:i,height:r,transform:l}){const a=ch(Yu(e),Yu(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const c={x:-l[0]/l[2],y:-l[1]/l[2],width:i/l[2],height:r/l[2]};return _a(c,uh(a))>0}const RT=({source:e,sourceHandle:t,target:i,targetHandle:r})=>`xy-edge__${e}${t||""}-${i}${r||""}`,BT=(e,t)=>t.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),LT=(e,t,i={})=>{if(!e.source||!e.target)return t;const r=i.getEdgeId||RT;let l;return $b(e)?l={...e}:l={...e,id:r(e)},BT(l,t)?t:(l.sourceHandle===null&&delete l.sourceHandle,l.targetHandle===null&&delete l.targetHandle,t.concat(l))};function rx({sourceX:e,sourceY:t,targetX:i,targetY:r}){const[l,a,c,h]=nx({sourceX:e,sourceY:t,targetX:i,targetY:r});return[`M ${e},${t}L ${i},${r}`,l,a,c,h]}const Iy={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},zT=({source:e,sourcePosition:t=we.Bottom,target:i})=>t===we.Left||t===we.Right?e.x<i.x?{x:1,y:0}:{x:-1,y:0}:e.y<i.y?{x:0,y:1}:{x:0,y:-1},jy=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function OT({source:e,sourcePosition:t=we.Bottom,target:i,targetPosition:r=we.Top,center:l,offset:a,stepPosition:c}){const h=Iy[t],d=Iy[r],f={x:e.x+h.x*a,y:e.y+h.y*a},m={x:i.x+d.x*a,y:i.y+d.y*a},g=zT({source:f,sourcePosition:t,target:m}),v=g.x!==0?"x":"y",y=g[v];let S=[],b,E;const w={x:0,y:0},z={x:0,y:0},[,,C,T]=nx({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(h[v]*d[v]===-1){v==="x"?(b=l.x??f.x+(m.x-f.x)*c,E=l.y??(f.y+m.y)/2):(b=l.x??(f.x+m.x)/2,E=l.y??f.y+(m.y-f.y)*c);const B=[{x:b,y:f.y},{x:b,y:m.y}],U=[{x:f.x,y:E},{x:m.x,y:E}];h[v]===y?S=v==="x"?B:U:S=v==="x"?U:B}else{const B=[{x:f.x,y:m.y}],U=[{x:m.x,y:f.y}];if(v==="x"?S=h.x===y?U:B:S=h.y===y?B:U,t===r){const j=Math.abs(e[v]-i[v]);if(j<=a){const F=Math.min(a-1,a-j);h[v]===y?w[v]=(f[v]>e[v]?-1:1)*F:z[v]=(m[v]>i[v]?-1:1)*F}}if(t!==r){const j=v==="x"?"y":"x",F=h[v]===d[j],R=f[j]>m[j],O=f[j]<m[j];(h[v]===1&&(!F&&R||F&&O)||h[v]!==1&&(!F&&O||F&&R))&&(S=v==="x"?B:U)}const X={x:f.x+w.x,y:f.y+w.y},G={x:m.x+z.x,y:m.y+z.y},ne=Math.max(Math.abs(X.x-S[0].x),Math.abs(G.x-S[0].x)),V=Math.max(Math.abs(X.y-S[0].y),Math.abs(G.y-S[0].y));ne>=V?(b=(X.x+G.x)/2,E=S[0].y):(b=S[0].x,E=(X.y+G.y)/2)}return[[e,{x:f.x+w.x,y:f.y+w.y},...S,{x:m.x+z.x,y:m.y+z.y},i],b,E,C,T]}function HT(e,t,i,r){const l=Math.min(jy(e,t)/2,jy(t,i)/2,r),{x:a,y:c}=t;if(e.x===a&&a===i.x||e.y===c&&c===i.y)return`L${a} ${c}`;if(e.y===c){const f=e.x<i.x?-1:1,m=e.y<i.y?1:-1;return`L ${a+l*f},${c}Q ${a},${c} ${a},${c+l*m}`}const h=e.x<i.x?1:-1,d=e.y<i.y?-1:1;return`L ${a},${c+l*d}Q ${a},${c} ${a+l*h},${c}`}function Hp({sourceX:e,sourceY:t,sourcePosition:i=we.Bottom,targetX:r,targetY:l,targetPosition:a=we.Top,borderRadius:c=5,centerX:h,centerY:d,offset:f=20,stepPosition:m=.5}){const[g,v,y,S,b]=OT({source:{x:e,y:t},sourcePosition:i,target:{x:r,y:l},targetPosition:a,center:{x:h,y:d},offset:f,stepPosition:m});return[g.reduce((w,z,C)=>{let T="";return C>0&&C<g.length-1?T=HT(g[C-1],z,g[C+1],c):T=`${C===0?"M":"L"}${z.x} ${z.y}`,w+=T,w},""),v,y,S,b]}function Uy(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function PT(e){var g;const{sourceNode:t,targetNode:i}=e;if(!Uy(t)||!Uy(i))return null;const r=t.internals.handleBounds||qy(t.handles),l=i.internals.handleBounds||qy(i.handles),a=Vy((r==null?void 0:r.source)??[],e.sourceHandle),c=Vy(e.connectionMode===Bl.Strict?(l==null?void 0:l.target)??[]:((l==null?void 0:l.target)??[]).concat((l==null?void 0:l.source)??[]),e.targetHandle);if(!a||!c)return(g=e.onError)==null||g.call(e,"008",kn.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const h=(a==null?void 0:a.position)||we.Bottom,d=(c==null?void 0:c.position)||we.Top,f=As(t,a,h),m=As(i,c,d);return{sourceX:f.x,sourceY:f.y,targetX:m.x,targetY:m.y,sourcePosition:h,targetPosition:d}}function qy(e){if(!e)return null;const t=[],i=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&i.push(r);return{source:t,target:i}}function As(e,t,i=we.Left,r=!1){const l=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,a=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:c,height:h}=t??sr(e);if(r)return{x:l+c/2,y:a+h/2};switch((t==null?void 0:t.position)??i){case we.Top:return{x:l+c/2,y:a};case we.Right:return{x:l+c,y:a+h/2};case we.Bottom:return{x:l+c/2,y:a+h};case we.Left:return{x:l,y:a+h/2}}}function Vy(e,t){return e&&(t?e.find(i=>i.id===t):e[0])||null}function Pp(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function IT(e,{id:t,defaultColor:i,defaultMarkerStart:r,defaultMarkerEnd:l}){const a=new Set;return e.reduce((c,h)=>([h.markerStart||r,h.markerEnd||l].forEach(d=>{if(d&&typeof d=="object"){const f=Pp(d,t);a.has(f)||(c.push({id:f,color:d.color||i,...d}),a.add(f))}}),c),[]).sort((c,h)=>c.id.localeCompare(h.id))}const sx=1e3,jT=10,Wg={nodeOrigin:[0,0],nodeExtent:pa,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},UT={...Wg,checkEquality:!0};function Xg(e,t){const i={...e};for(const r in t)t[r]!==void 0&&(i[r]=t[r]);return i}function qT(e,t,i){const r=Xg(Wg,i);for(const l of e.values())if(l.parentId)Gg(l,e,t,r);else{const a=Ta(l,r.nodeOrigin),c=Ol(l.extent)?l.extent:r.nodeExtent,h=Ts(a,c,sr(l));l.internals.positionAbsolute=h}}function VT(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const i=[],r=[];for(const l of e.handles){const a={id:l.id,width:l.width??1,height:l.height??1,nodeId:e.id,x:l.x,y:l.y,position:l.position,type:l.type};l.type==="source"?i.push(a):l.type==="target"&&r.push(a)}return{source:i,target:r}}function Kg(e){return e==="manual"}function Ip(e,t,i,r={}){var f,m;const l=Xg(UT,r),a={i:0},c=new Map(t),h=l!=null&&l.elevateNodesOnSelect&&!Kg(l.zIndexMode)?sx:0;let d=e.length>0;t.clear(),i.clear();for(const g of e){let v=c.get(g.id);if(l.checkEquality&&g===(v==null?void 0:v.internals.userNode))t.set(g.id,v);else{const y=Ta(g,l.nodeOrigin),S=Ol(g.extent)?g.extent:l.nodeExtent,b=Ts(y,S,sr(g));v={...l.defaults,...g,measured:{width:(f=g.measured)==null?void 0:f.width,height:(m=g.measured)==null?void 0:m.height},internals:{positionAbsolute:b,handleBounds:VT(g,v),z:lx(g,h,l.zIndexMode),userNode:g}},t.set(g.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(d=!1),g.parentId&&Gg(v,t,i,r,a)}return d}function FT(e,t){if(!e.parentId)return;const i=t.get(e.parentId);i?i.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Gg(e,t,i,r,l){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:h,zIndexMode:d}=Xg(Wg,r),f=e.parentId,m=t.get(f);if(!m){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}FT(e,i),l&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++l.i,m.internals.z=m.internals.z+l.i*jT),l&&m.internals.rootParentIndex!==void 0&&(l.i=m.internals.rootParentIndex);const g=a&&!Kg(d)?sx:0,{x:v,y,z:S}=YT(e,m,c,h,g,d),{positionAbsolute:b}=e.internals,E=v!==b.x||y!==b.y;(E||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:v,y}:b,z:S}})}function lx(e,t,i){const r=an(e.zIndex)?e.zIndex:0;return Kg(i)?r:r+(e.selected?t:0)}function YT(e,t,i,r,l,a){const{x:c,y:h}=t.internals.positionAbsolute,d=sr(e),f=Ta(e,i),m=Ol(e.extent)?Ts(f,e.extent,d):f;let g=Ts({x:c+m.x,y:h+m.y},r,d);e.extent==="parent"&&(g=Xb(g,d,t));const v=lx(e,l,a),y=t.internals.z??0;return{x:g.x,y:g.y,z:y>=v?y+1:v}}function Zg(e,t,i,r=[0,0]){var c;const l=[],a=new Map;for(const h of e){const d=t.get(h.parentId);if(!d)continue;const f=((c=a.get(h.parentId))==null?void 0:c.expandedRect)??zl(d),m=Gb(f,h.rect);a.set(h.parentId,{expandedRect:m,parent:d})}return a.size>0&&a.forEach(({expandedRect:h,parent:d},f)=>{var C;const m=d.internals.positionAbsolute,g=sr(d),v=d.origin??r,y=h.x<m.x?Math.round(Math.abs(m.x-h.x)):0,S=h.y<m.y?Math.round(Math.abs(m.y-h.y)):0,b=Math.max(g.width,Math.round(h.width)),E=Math.max(g.height,Math.round(h.height)),w=(b-g.width)*v[0],z=(E-g.height)*v[1];(y>0||S>0||w||z)&&(l.push({id:f,type:"position",position:{x:d.position.x-y+w,y:d.position.y-S+z}}),(C=i.get(f))==null||C.forEach(T=>{e.some(I=>I.id===T.id)||l.push({id:T.id,type:"position",position:{x:T.position.x+y,y:T.position.y+S}})})),(g.width<h.width||g.height<h.height||y||S)&&l.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:b+(y?v[0]*y-w:0),height:E+(S?v[1]*S-z:0)}})}),l}function $T(e,t,i,r,l,a,c){const h=r==null?void 0:r.querySelector(".xyflow__viewport");let d=!1;if(!h)return{changes:[],updatedInternals:d};const f=[],m=window.getComputedStyle(h),{m22:g}=new window.DOMMatrixReadOnly(m.transform),v=[];for(const y of e.values()){const S=t.get(y.id);if(!S)continue;if(S.hidden){t.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),d=!0;continue}const b=Yg(y.nodeElement),E=S.measured.width!==b.width||S.measured.height!==b.height;if(!!(b.width&&b.height&&(E||!S.internals.handleBounds||y.force))){const z=y.nodeElement.getBoundingClientRect(),C=Ol(S.extent)?S.extent:a;let{positionAbsolute:T}=S.internals;S.parentId&&S.extent==="parent"?T=Xb(T,b,t.get(S.parentId)):C&&(T=Ts(T,C,b));const I={...S,measured:b,internals:{...S.internals,positionAbsolute:T,handleBounds:{source:Hy("source",y.nodeElement,z,g,S.id),target:Hy("target",y.nodeElement,z,g,S.id)}}};t.set(S.id,I),S.parentId&&Gg(I,t,i,{nodeOrigin:l,zIndexMode:c}),d=!0,E&&(f.push({id:S.id,type:"dimensions",dimensions:b}),S.expandParent&&S.parentId&&v.push({id:S.id,parentId:S.parentId,rect:zl(I,l)}))}}if(v.length>0){const y=Zg(v,t,i,l);f.push(...y)}return{changes:f,updatedInternals:d}}async function WT({delta:e,panZoom:t,transform:i,translateExtent:r,width:l,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const c=await t.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[l,a]],r),h=!!c&&(c.x!==i[0]||c.y!==i[1]||c.k!==i[2]);return Promise.resolve(h)}function Fy(e,t,i,r,l,a){let c=l;const h=r.get(c)||new Map;r.set(c,h.set(i,t)),c=`${l}-${e}`;const d=r.get(c)||new Map;if(r.set(c,d.set(i,t)),a){c=`${l}-${e}-${a}`;const f=r.get(c)||new Map;r.set(c,f.set(i,t))}}function ox(e,t,i){e.clear(),t.clear();for(const r of i){const{source:l,target:a,sourceHandle:c=null,targetHandle:h=null}=r,d={edgeId:r.id,source:l,target:a,sourceHandle:c,targetHandle:h},f=`${l}-${c}--${a}-${h}`,m=`${a}-${h}--${l}-${c}`;Fy("source",d,m,e,l,c),Fy("target",d,f,e,a,h),t.set(r.id,r)}}function ax(e,t){if(!e.parentId)return!1;const i=t.get(e.parentId);return i?i.selected?!0:ax(i,t):!1}function Yy(e,t,i){var l;let r=e;do{if((l=r==null?void 0:r.matches)!=null&&l.call(r,t))return!0;if(r===i)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function XT(e,t,i,r){const l=new Map;for(const[a,c]of e)if((c.selected||c.id===r)&&(!c.parentId||!ax(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const h=e.get(a);h&&l.set(a,{id:a,position:h.position||{x:0,y:0},distance:{x:i.x-h.internals.positionAbsolute.x,y:i.y-h.internals.positionAbsolute.y},extent:h.extent,parentId:h.parentId,origin:h.origin,expandParent:h.expandParent,internals:{positionAbsolute:h.internals.positionAbsolute||{x:0,y:0}},measured:{width:h.measured.width??0,height:h.measured.height??0}})}return l}function Wd({nodeId:e,dragItems:t,nodeLookup:i,dragging:r=!0}){var c,h,d;const l=[];for(const[f,m]of t){const g=(c=i.get(f))==null?void 0:c.internals.userNode;g&&l.push({...g,position:m.position,dragging:r})}if(!e)return[l[0],l];const a=(h=i.get(e))==null?void 0:h.internals.userNode;return[a?{...a,position:((d=t.get(e))==null?void 0:d.position)||a.position,dragging:r}:l[0],l]}function KT({dragItems:e,snapGrid:t,x:i,y:r}){const l=e.values().next().value;if(!l)return null;const a={x:i-l.distance.x,y:r-l.distance.y},c=Na(a,t);return{x:c.x-a.x,y:c.y-a.y}}function GT({onNodeMouseDown:e,getStoreItems:t,onDragStart:i,onDrag:r,onDragStop:l}){let a={x:null,y:null},c=0,h=new Map,d=!1,f={x:0,y:0},m=null,g=!1,v=null,y=!1,S=!1,b=null;function E({noDragClassName:z,handleSelector:C,domNode:T,isSelectable:I,nodeId:B,nodeClickDistance:U=0}){v=Oi(T);function X({x:j,y:F}){const{nodeLookup:R,nodeExtent:O,snapGrid:M,snapToGrid:P,nodeOrigin:H,onNodeDrag:Y,onSelectionDrag:A,onError:L,updateNodePositions:$}=t();a={x:j,y:F};let N=!1;const ee=h.size>1,ce=ee&&O?Op(Aa(h)):null,oe=ee&&P?KT({dragItems:h,snapGrid:M,x:j,y:F}):null;for(const[fe,he]of h){if(!R.has(fe))continue;let pe={x:j-he.distance.x,y:F-he.distance.y};P&&(pe=oe?{x:Math.round(pe.x+oe.x),y:Math.round(pe.y+oe.y)}:Na(pe,M));let Ce=null;if(ee&&O&&!he.extent&&ce){const{positionAbsolute:me}=he.internals,Ne=me.x-ce.x+O[0][0],$e=me.x+he.measured.width-ce.x2+O[1][0],ze=me.y-ce.y+O[0][1],St=me.y+he.measured.height-ce.y2+O[1][1];Ce=[[Ne,ze],[$e,St]]}const{position:xe,positionAbsolute:Se}=Wb({nodeId:fe,nextPosition:pe,nodeLookup:R,nodeExtent:Ce||O,nodeOrigin:H,onError:L});N=N||he.position.x!==xe.x||he.position.y!==xe.y,he.position=xe,he.internals.positionAbsolute=Se}if(S=S||N,!!N&&($(h,!0),b&&(r||Y||!B&&A))){const[fe,he]=Wd({nodeId:B,dragItems:h,nodeLookup:R});r==null||r(b,h,fe,he),Y==null||Y(b,fe,he),B||A==null||A(b,he)}}async function G(){if(!m)return;const{transform:j,panBy:F,autoPanSpeed:R,autoPanOnNodeDrag:O}=t();if(!O){d=!1,cancelAnimationFrame(c);return}const[M,P]=Kb(f,m,R);(M!==0||P!==0)&&(a.x=(a.x??0)-M/j[2],a.y=(a.y??0)-P/j[2],await F({x:M,y:P})&&X(a)),c=requestAnimationFrame(G)}function ne(j){var ee;const{nodeLookup:F,multiSelectionActive:R,nodesDraggable:O,transform:M,snapGrid:P,snapToGrid:H,selectNodesOnDrag:Y,onNodeDragStart:A,onSelectionDragStart:L,unselectNodesAndEdges:$}=t();g=!0,(!Y||!I)&&!R&&B&&((ee=F.get(B))!=null&&ee.selected||$()),I&&Y&&B&&(e==null||e(B));const N=sa(j.sourceEvent,{transform:M,snapGrid:P,snapToGrid:H,containerBounds:m});if(a=N,h=XT(F,O,N,B),h.size>0&&(i||A||!B&&L)){const[ce,oe]=Wd({nodeId:B,dragItems:h,nodeLookup:F});i==null||i(j.sourceEvent,h,ce,oe),A==null||A(j.sourceEvent,ce,oe),B||L==null||L(j.sourceEvent,oe)}}const V=kb().clickDistance(U).on("start",j=>{const{domNode:F,nodeDragThreshold:R,transform:O,snapGrid:M,snapToGrid:P}=t();m=(F==null?void 0:F.getBoundingClientRect())||null,y=!1,S=!1,b=j.sourceEvent,R===0&&ne(j),a=sa(j.sourceEvent,{transform:O,snapGrid:M,snapToGrid:P,containerBounds:m}),f=cn(j.sourceEvent,m)}).on("drag",j=>{const{autoPanOnNodeDrag:F,transform:R,snapGrid:O,snapToGrid:M,nodeDragThreshold:P,nodeLookup:H}=t(),Y=sa(j.sourceEvent,{transform:R,snapGrid:O,snapToGrid:M,containerBounds:m});if(b=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||B&&!H.has(B))&&(y=!0),!y){if(!d&&F&&g&&(d=!0,G()),!g){const A=cn(j.sourceEvent,m),L=A.x-f.x,$=A.y-f.y;Math.sqrt(L*L+$*$)>P&&ne(j)}(a.x!==Y.xSnapped||a.y!==Y.ySnapped)&&h&&g&&(f=cn(j.sourceEvent,m),X(Y))}}).on("end",j=>{if(!(!g||y)&&(d=!1,g=!1,cancelAnimationFrame(c),h.size>0)){const{nodeLookup:F,updateNodePositions:R,onNodeDragStop:O,onSelectionDragStop:M}=t();if(S&&(R(h,!1),S=!1),l||O||!B&&M){const[P,H]=Wd({nodeId:B,dragItems:h,nodeLookup:F,dragging:!1});l==null||l(j.sourceEvent,h,P,H),O==null||O(j.sourceEvent,P,H),B||M==null||M(j.sourceEvent,H)}}}).filter(j=>{const F=j.target;return!j.button&&(!z||!Yy(F,`.${z}`,T))&&(!C||Yy(F,C,T))});v.call(V)}function w(){v==null||v.on(".drag",null)}return{update:E,destroy:w}}function ZT(e,t,i){const r=[],l={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const a of t.values())_a(l,zl(a))>0&&r.push(a);return r}const QT=250;function JT(e,t,i,r){var h,d;let l=[],a=1/0;const c=ZT(e,i,t+QT);for(const f of c){const m=[...((h=f.internals.handleBounds)==null?void 0:h.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const g of m){if(r.nodeId===g.nodeId&&r.type===g.type&&r.id===g.id)continue;const{x:v,y}=As(f,g,g.position,!0),S=Math.sqrt(Math.pow(v-e.x,2)+Math.pow(y-e.y,2));S>t||(S<a?(l=[{...g,x:v,y}],a=S):S===a&&l.push({...g,x:v,y}))}}if(!l.length)return null;if(l.length>1){const f=r.type==="source"?"target":"source";return l.find(m=>m.type===f)??l[0]}return l[0]}function cx(e,t,i,r,l,a=!1){var f,m,g;const c=r.get(e);if(!c)return null;const h=l==="strict"?(f=c.internals.handleBounds)==null?void 0:f[t]:[...((m=c.internals.handleBounds)==null?void 0:m.source)??[],...((g=c.internals.handleBounds)==null?void 0:g.target)??[]],d=(i?h==null?void 0:h.find(v=>v.id===i):h==null?void 0:h[0])??null;return d&&a?{...d,...As(c,d,d.position,!0)}:d}function ux(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function e3(e,t){let i=null;return t?i=!0:e&&!t&&(i=!1),i}const hx=()=>!0;function t3(e,{connectionMode:t,connectionRadius:i,handleId:r,nodeId:l,edgeUpdaterType:a,isTarget:c,domNode:h,nodeLookup:d,lib:f,autoPanOnConnect:m,flowId:g,panBy:v,cancelConnection:y,onConnectStart:S,onConnect:b,onConnectEnd:E,isValidConnection:w=hx,onReconnectEnd:z,updateConnection:C,getTransform:T,getFromHandle:I,autoPanSpeed:B,dragThreshold:U=1,handleDomNode:X}){const G=Jb(e.target);let ne=0,V;const{x:j,y:F}=cn(e),R=ux(a,X),O=h==null?void 0:h.getBoundingClientRect();let M=!1;if(!O||!R)return;const P=cx(l,R,r,d,t);if(!P)return;let H=cn(e,O),Y=!1,A=null,L=!1,$=null;function N(){if(!m||!O)return;const[xe,Se]=Kb(H,O,B);v({x:xe,y:Se}),ne=requestAnimationFrame(N)}const ee={...P,nodeId:l,type:R,position:P.position},ce=d.get(l);let fe={inProgress:!0,isValid:null,from:As(ce,ee,we.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:ce,to:H,toHandle:null,toPosition:By[ee.position],toNode:null,pointer:H};function he(){M=!0,C(fe),S==null||S(e,{nodeId:l,handleId:r,handleType:R})}U===0&&he();function pe(xe){if(!M){const{x:St,y:Ci}=cn(xe),Jt=St-j,ui=Ci-F;if(!(Jt*Jt+ui*ui>U*U))return;he()}if(!I()||!ee){Ce(xe);return}const Se=T();H=cn(xe,O),V=JT(Da(H,Se,!1,[1,1]),i,d,ee),Y||(N(),Y=!0);const me=fx(xe,{handle:V,connectionMode:t,fromNodeId:l,fromHandleId:r,fromType:c?"target":"source",isValidConnection:w,doc:G,lib:f,flowId:g,nodeLookup:d});$=me.handleDomNode,A=me.connection,L=e3(!!V,me.isValid);const Ne=d.get(l),$e=Ne?As(Ne,ee,we.Left,!0):fe.from,ze={...fe,from:$e,isValid:L,to:me.toHandle&&L?$u({x:me.toHandle.x,y:me.toHandle.y},Se):H,toHandle:me.toHandle,toPosition:L&&me.toHandle?me.toHandle.position:By[ee.position],toNode:me.toHandle?d.get(me.toHandle.nodeId):null,pointer:H};C(ze),fe=ze}function Ce(xe){if(!("touches"in xe&&xe.touches.length>0)){if(M){(V||$)&&A&&L&&(b==null||b(A));const{inProgress:Se,...me}=fe,Ne={...me,toPosition:fe.toHandle?fe.toPosition:null};E==null||E(xe,Ne),a&&(z==null||z(xe,Ne))}y(),cancelAnimationFrame(ne),Y=!1,L=!1,A=null,$=null,G.removeEventListener("mousemove",pe),G.removeEventListener("mouseup",Ce),G.removeEventListener("touchmove",pe),G.removeEventListener("touchend",Ce)}}G.addEventListener("mousemove",pe),G.addEventListener("mouseup",Ce),G.addEventListener("touchmove",pe),G.addEventListener("touchend",Ce)}function fx(e,{handle:t,connectionMode:i,fromNodeId:r,fromHandleId:l,fromType:a,doc:c,lib:h,flowId:d,isValidConnection:f=hx,nodeLookup:m}){const g=a==="target",v=t?c.querySelector(`.${h}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:S}=cn(e),b=c.elementFromPoint(y,S),E=b!=null&&b.classList.contains(`${h}-flow__handle`)?b:v,w={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const z=ux(void 0,E),C=E.getAttribute("data-nodeid"),T=E.getAttribute("data-handleid"),I=E.classList.contains("connectable"),B=E.classList.contains("connectableend");if(!C||!z)return w;const U={source:g?C:r,sourceHandle:g?T:l,target:g?r:C,targetHandle:g?l:T};w.connection=U;const G=I&&B&&(i===Bl.Strict?g&&z==="source"||!g&&z==="target":C!==r||T!==l);w.isValid=G&&f(U),w.toHandle=cx(C,z,T,m,i,!0)}return w}const jp={onPointerDown:t3,isValid:fx};function i3({domNode:e,panZoom:t,getTransform:i,getViewScale:r}){const l=Oi(e);function a({translateExtent:h,width:d,height:f,zoomStep:m=1,pannable:g=!0,zoomable:v=!0,inversePan:y=!1}){const S=C=>{if(C.sourceEvent.type!=="wheel"||!t)return;const T=i(),I=C.sourceEvent.ctrlKey&&va()?10:1,B=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*m,U=T[2]*Math.pow(2,B*I);t.scaleTo(U)};let b=[0,0];const E=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(b=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},w=C=>{const T=i();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!t)return;const I=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],B=[I[0]-b[0],I[1]-b[1]];b=I;const U=r()*Math.max(T[2],Math.log(T[2]))*(y?-1:1),X={x:T[0]-B[0]*U,y:T[1]-B[1]*U},G=[[0,0],[d,f]];t.setViewportConstrained({x:X.x,y:X.y,zoom:T[2]},G,h)},z=Ub().on("start",E).on("zoom",g?w:null).on("zoom.wheel",v?S:null);l.call(z,{})}function c(){l.on("zoom",null)}return{update:a,destroy:c,pointer:ln}}const hh=e=>({x:e.x,y:e.y,zoom:e.k}),Xd=({x:e,y:t,zoom:i})=>ah.translate(e,t).scale(i),Cl=(e,t)=>e.target.closest(`.${t}`),dx=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),n3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Kd=(e,t=0,i=n3,r=()=>{})=>{const l=typeof t=="number"&&t>0;return l||r(),l?e.transition().duration(t).ease(i).on("end",r):e},px=e=>{const t=e.ctrlKey&&va()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function r3({zoomPanValues:e,noWheelClassName:t,d3Selection:i,d3Zoom:r,panOnScrollMode:l,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:h,onPanZoom:d,onPanZoomEnd:f}){return m=>{if(Cl(m,t))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const g=i.property("__zoom").k||1;if(m.ctrlKey&&c){const E=ln(m),w=px(m),z=g*Math.pow(2,w);r.scaleTo(i,z,E,m);return}const v=m.deltaMode===1?20:1;let y=l===Cs.Vertical?0:m.deltaX*v,S=l===Cs.Horizontal?0:m.deltaY*v;!va()&&m.shiftKey&&l!==Cs.Vertical&&(y=m.deltaY*v,S=0),r.translateBy(i,-(y/g)*a,-(S/g)*a,{internal:!0});const b=hh(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(m,b),e.panScrollTimeout=setTimeout(()=>{f==null||f(m,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,h==null||h(m,b))}}function s3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:i}){return function(r,l){const a=r.type==="wheel",c=!t&&a&&!r.ctrlKey,h=Cl(r,e);if(r.ctrlKey&&a&&h&&r.preventDefault(),c||h)return null;r.preventDefault(),i.call(this,r,l)}}function l3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:i}){return r=>{var a,c,h;if((a=r.sourceEvent)!=null&&a.internal)return;const l=hh(r.transform);e.mouseButton=((c=r.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=l,((h=r.sourceEvent)==null?void 0:h.type)==="mousedown"&&t(!0),i&&(i==null||i(r.sourceEvent,l))}}function o3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:i,onTransformChange:r,onPanZoom:l}){return a=>{var c,h;e.usedRightMouseButton=!!(i&&dx(t,e.mouseButton??0)),(c=a.sourceEvent)!=null&&c.sync||r([a.transform.x,a.transform.y,a.transform.k]),l&&!((h=a.sourceEvent)!=null&&h.internal)&&(l==null||l(a.sourceEvent,hh(a.transform)))}}function a3({zoomPanValues:e,panOnDrag:t,panOnScroll:i,onDraggingChange:r,onPanZoomEnd:l,onPaneContextMenu:a}){return c=>{var h;if(!((h=c.sourceEvent)!=null&&h.internal)&&(e.isZoomingOrPanning=!1,a&&dx(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),e.usedRightMouseButton=!1,r(!1),l)){const d=hh(c.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{l==null||l(c.sourceEvent,d)},i?150:0)}}}function c3({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:i,panOnDrag:r,panOnScroll:l,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:h,noPanClassName:d,lib:f,connectionInProgress:m}){return g=>{var E;const v=e||t,y=i&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Cl(g,`${f}-flow__node`)||Cl(g,`${f}-flow__edge`)))return!0;if(!r&&!v&&!l&&!a&&!i||c||m&&!S||Cl(g,h)&&S||Cl(g,d)&&(!S||l&&S&&!e)||!i&&g.ctrlKey&&S)return!1;if(!i&&g.type==="touchstart"&&((E=g.touches)==null?void 0:E.length)>1)return g.preventDefault(),!1;if(!v&&!l&&!y&&S||!r&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(r)&&!r.includes(g.button)&&g.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S)&&b}}function u3({domNode:e,minZoom:t,maxZoom:i,translateExtent:r,viewport:l,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:h,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),g=Ub().scaleExtent([t,i]).translateExtent(r),v=Oi(e).call(g);z({x:l.x,y:l.y,zoom:Ll(l.zoom,t,i)},[[0,0],[m.width,m.height]],r);const y=v.on("wheel.zoom"),S=v.on("dblclick.zoom");g.wheelDelta(px);function b(V,j){return v?new Promise(F=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?ra:ku).transform(Kd(v,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>F(!0)),V)}):Promise.resolve(!1)}function E({noWheelClassName:V,noPanClassName:j,onPaneContextMenu:F,userSelectionActive:R,panOnScroll:O,panOnDrag:M,panOnScrollMode:P,panOnScrollSpeed:H,preventScrolling:Y,zoomOnPinch:A,zoomOnScroll:L,zoomOnDoubleClick:$,zoomActivationKeyPressed:N,lib:ee,onTransformChange:ce,connectionInProgress:oe,paneClickDistance:fe,selectionOnDrag:he}){R&&!f.isZoomingOrPanning&&w();const pe=O&&!N&&!R;g.clickDistance(he?1/0:!an(fe)||fe<0?0:fe);const Ce=pe?r3({zoomPanValues:f,noWheelClassName:V,d3Selection:v,d3Zoom:g,panOnScrollMode:P,panOnScrollSpeed:H,zoomOnPinch:A,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:h}):s3({noWheelClassName:V,preventScrolling:Y,d3ZoomHandler:y});if(v.on("wheel.zoom",Ce,{passive:!1}),!R){const Se=l3({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:c});g.on("start",Se);const me=o3({zoomPanValues:f,panOnDrag:M,onPaneContextMenu:!!F,onPanZoom:a,onTransformChange:ce});g.on("zoom",me);const Ne=a3({zoomPanValues:f,panOnDrag:M,panOnScroll:O,onPaneContextMenu:F,onPanZoomEnd:h,onDraggingChange:d});g.on("end",Ne)}const xe=c3({zoomActivationKeyPressed:N,panOnDrag:M,zoomOnScroll:L,panOnScroll:O,zoomOnDoubleClick:$,zoomOnPinch:A,userSelectionActive:R,noPanClassName:j,noWheelClassName:V,lib:ee,connectionInProgress:oe});g.filter(xe),$?v.on("dblclick.zoom",S):v.on("dblclick.zoom",null)}function w(){g.on("zoom",null)}async function z(V,j,F){const R=Xd(V),O=g==null?void 0:g.constrain()(R,j,F);return O&&await b(O),new Promise(M=>M(O))}async function C(V,j){const F=Xd(V);return await b(F,j),new Promise(R=>R(F))}function T(V){if(v){const j=Xd(V),F=v.property("__zoom");(F.k!==V.zoom||F.x!==V.x||F.y!==V.y)&&(g==null||g.transform(v,j,null,{sync:!0}))}}function I(){const V=v?jb(v.node()):{x:0,y:0,k:1};return{x:V.x,y:V.y,zoom:V.k}}function B(V,j){return v?new Promise(F=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?ra:ku).scaleTo(Kd(v,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>F(!0)),V)}):Promise.resolve(!1)}function U(V,j){return v?new Promise(F=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?ra:ku).scaleBy(Kd(v,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>F(!0)),V)}):Promise.resolve(!1)}function X(V){g==null||g.scaleExtent(V)}function G(V){g==null||g.translateExtent(V)}function ne(V){const j=!an(V)||V<0?0:V;g==null||g.clickDistance(j)}return{update:E,destroy:w,setViewport:C,setViewportConstrained:z,getViewport:I,scaleTo:B,scaleBy:U,setScaleExtent:X,setTranslateExtent:G,syncViewport:T,setClickDistance:ne}}var Hl;(function(e){e.Line="line",e.Handle="handle"})(Hl||(Hl={}));function h3({width:e,prevWidth:t,height:i,prevHeight:r,affectsX:l,affectsY:a}){const c=e-t,h=i-r,d=[c>0?1:c<0?-1:0,h>0?1:h<0?-1:0];return c&&l&&(d[0]=d[0]*-1),h&&a&&(d[1]=d[1]*-1),d}function $y(e){const t=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),r=e.includes("left"),l=e.includes("top");return{isHorizontal:t,isVertical:i,affectsX:r,affectsY:l}}function Pr(e,t){return Math.max(0,t-e)}function Ir(e,t){return Math.max(0,e-t)}function du(e,t,i){return Math.max(0,t-e,e-i)}function Wy(e,t){return e?!t:t}function f3(e,t,i,r,l,a,c,h){let{affectsX:d,affectsY:f}=t;const{isHorizontal:m,isVertical:g}=t,v=m&&g,{xSnapped:y,ySnapped:S}=i,{minWidth:b,maxWidth:E,minHeight:w,maxHeight:z}=r,{x:C,y:T,width:I,height:B,aspectRatio:U}=e;let X=Math.floor(m?y-e.pointerX:0),G=Math.floor(g?S-e.pointerY:0);const ne=I+(d?-X:X),V=B+(f?-G:G),j=-a[0]*I,F=-a[1]*B;let R=du(ne,b,E),O=du(V,w,z);if(c){let H=0,Y=0;d&&X<0?H=Pr(C+X+j,c[0][0]):!d&&X>0&&(H=Ir(C+ne+j,c[1][0])),f&&G<0?Y=Pr(T+G+F,c[0][1]):!f&&G>0&&(Y=Ir(T+V+F,c[1][1])),R=Math.max(R,H),O=Math.max(O,Y)}if(h){let H=0,Y=0;d&&X>0?H=Ir(C+X,h[0][0]):!d&&X<0&&(H=Pr(C+ne,h[1][0])),f&&G>0?Y=Ir(T+G,h[0][1]):!f&&G<0&&(Y=Pr(T+V,h[1][1])),R=Math.max(R,H),O=Math.max(O,Y)}if(l){if(m){const H=du(ne/U,w,z)*U;if(R=Math.max(R,H),c){let Y=0;!d&&!f||d&&!f&&v?Y=Ir(T+F+ne/U,c[1][1])*U:Y=Pr(T+F+(d?X:-X)/U,c[0][1])*U,R=Math.max(R,Y)}if(h){let Y=0;!d&&!f||d&&!f&&v?Y=Pr(T+ne/U,h[1][1])*U:Y=Ir(T+(d?X:-X)/U,h[0][1])*U,R=Math.max(R,Y)}}if(g){const H=du(V*U,b,E)/U;if(O=Math.max(O,H),c){let Y=0;!d&&!f||f&&!d&&v?Y=Ir(C+V*U+j,c[1][0])/U:Y=Pr(C+(f?G:-G)*U+j,c[0][0])/U,O=Math.max(O,Y)}if(h){let Y=0;!d&&!f||f&&!d&&v?Y=Pr(C+V*U,h[1][0])/U:Y=Ir(C+(f?G:-G)*U,h[0][0])/U,O=Math.max(O,Y)}}}G=G+(G<0?O:-O),X=X+(X<0?R:-R),l&&(v?ne>V*U?G=(Wy(d,f)?-X:X)/U:X=(Wy(d,f)?-G:G)*U:m?(G=X/U,f=d):(X=G*U,d=f));const M=d?C+X:C,P=f?T+G:T;return{width:I+(d?-X:X),height:B+(f?-G:G),x:a[0]*X*(d?-1:1)+M,y:a[1]*G*(f?-1:1)+P}}const gx={width:0,height:0,x:0,y:0},d3={...gx,pointerX:0,pointerY:0,aspectRatio:1};function p3(e){return[[0,0],[e.measured.width,e.measured.height]]}function g3(e,t,i){const r=t.position.x+e.position.x,l=t.position.y+e.position.y,a=e.measured.width??0,c=e.measured.height??0,h=i[0]*a,d=i[1]*c;return[[r-h,l-d],[r+a-h,l+c-d]]}function m3({domNode:e,nodeId:t,getStoreItems:i,onChange:r,onEnd:l}){const a=Oi(e);let c={controlDirection:$y("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function h({controlPosition:f,boundaries:m,keepAspectRatio:g,resizeDirection:v,onResizeStart:y,onResize:S,onResizeEnd:b,shouldResize:E}){let w={...gx},z={...d3};c={boundaries:m,resizeDirection:v,keepAspectRatio:g,controlDirection:$y(f)};let C,T=null,I=[],B,U,X,G=!1;const ne=kb().on("start",V=>{const{nodeLookup:j,transform:F,snapGrid:R,snapToGrid:O,nodeOrigin:M,paneDomNode:P}=i();if(C=j.get(t),!C)return;T=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:H,ySnapped:Y}=sa(V.sourceEvent,{transform:F,snapGrid:R,snapToGrid:O,containerBounds:T});w={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},z={...w,pointerX:H,pointerY:Y,aspectRatio:w.width/w.height},B=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(B=j.get(C.parentId),U=B&&C.extent==="parent"?p3(B):void 0),I=[],X=void 0;for(const[A,L]of j)if(L.parentId===t&&(I.push({id:A,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const $=g3(L,C,L.origin??M);X?X=[[Math.min($[0][0],X[0][0]),Math.min($[0][1],X[0][1])],[Math.max($[1][0],X[1][0]),Math.max($[1][1],X[1][1])]]:X=$}y==null||y(V,{...w})}).on("drag",V=>{const{transform:j,snapGrid:F,snapToGrid:R,nodeOrigin:O}=i(),M=sa(V.sourceEvent,{transform:j,snapGrid:F,snapToGrid:R,containerBounds:T}),P=[];if(!C)return;const{x:H,y:Y,width:A,height:L}=w,$={},N=C.origin??O,{width:ee,height:ce,x:oe,y:fe}=f3(z,c.controlDirection,M,c.boundaries,c.keepAspectRatio,N,U,X),he=ee!==A,pe=ce!==L,Ce=oe!==H&&he,xe=fe!==Y&&pe;if(!Ce&&!xe&&!he&&!pe)return;if((Ce||xe||N[0]===1||N[1]===1)&&($.x=Ce?oe:w.x,$.y=xe?fe:w.y,w.x=$.x,w.y=$.y,I.length>0)){const $e=oe-H,ze=fe-Y;for(const St of I)St.position={x:St.position.x-$e+N[0]*(ee-A),y:St.position.y-ze+N[1]*(ce-L)},P.push(St)}if((he||pe)&&($.width=he&&(!c.resizeDirection||c.resizeDirection==="horizontal")?ee:w.width,$.height=pe&&(!c.resizeDirection||c.resizeDirection==="vertical")?ce:w.height,w.width=$.width,w.height=$.height),B&&C.expandParent){const $e=N[0]*($.width??0);$.x&&$.x<$e&&(w.x=$e,z.x=z.x-($.x-$e));const ze=N[1]*($.height??0);$.y&&$.y<ze&&(w.y=ze,z.y=z.y-($.y-ze))}const Se=h3({width:w.width,prevWidth:A,height:w.height,prevHeight:L,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),me={...w,direction:Se};(E==null?void 0:E(V,me))!==!1&&(G=!0,S==null||S(V,me),r($,P))}).on("end",V=>{G&&(b==null||b(V,{...w}),l==null||l({...w}),G=!1)});a.call(ne)}function d(){a.on(".drag",null)}return{update:h,destroy:d}}var Gd={exports:{}},Zd={},Qd={exports:{}},Jd={};/**
50
+ * @license React
51
+ * use-sync-external-store-shim.production.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */var Xy;function _3(){if(Xy)return Jd;Xy=1;var e=Ea();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var i=typeof Object.is=="function"?Object.is:t,r=e.useState,l=e.useEffect,a=e.useLayoutEffect,c=e.useDebugValue;function h(g,v){var y=v(),S=r({inst:{value:y,getSnapshot:v}}),b=S[0].inst,E=S[1];return a(function(){b.value=y,b.getSnapshot=v,d(b)&&E({inst:b})},[g,y,v]),l(function(){return d(b)&&E({inst:b}),g(function(){d(b)&&E({inst:b})})},[g]),c(y),y}function d(g){var v=g.getSnapshot;g=g.value;try{var y=v();return!i(g,y)}catch{return!0}}function f(g,v){return v()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:h;return Jd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Jd}var Ky;function v3(){return Ky||(Ky=1,Qd.exports=_3()),Qd.exports}/**
58
+ * @license React
59
+ * use-sync-external-store-shim/with-selector.production.js
60
+ *
61
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */var Gy;function y3(){if(Gy)return Zd;Gy=1;var e=Ea(),t=v3();function i(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:i,l=t.useSyncExternalStore,a=e.useRef,c=e.useEffect,h=e.useMemo,d=e.useDebugValue;return Zd.useSyncExternalStoreWithSelector=function(f,m,g,v,y){var S=a(null);if(S.current===null){var b={hasValue:!1,value:null};S.current=b}else b=S.current;S=h(function(){function w(B){if(!z){if(z=!0,C=B,B=v(B),y!==void 0&&b.hasValue){var U=b.value;if(y(U,B))return T=U}return T=B}if(U=T,r(C,B))return U;var X=v(B);return y!==void 0&&y(U,X)?(C=B,U):(C=B,T=X)}var z=!1,C,T,I=g===void 0?null:g;return[function(){return w(m())},I===null?void 0:function(){return w(I())}]},[m,g,v,y]);var E=l(f,S[0],S[1]);return c(function(){b.hasValue=!0,b.value=E},[E]),d(E),E},Zd}var Zy;function S3(){return Zy||(Zy=1,Gd.exports=y3()),Gd.exports}var b3=S3();const x3=nh(b3),w3={},Qy=e=>{let t;const i=new Set,r=(m,g)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),i.forEach(S=>S(t,y))}},l=()=>t,d={setState:r,getState:l,getInitialState:()=>f,subscribe:m=>(i.add(m),()=>i.delete(m)),destroy:()=>{(w3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},f=t=e(r,l,d);return d},C3=e=>e?Qy(e):Qy,{useDebugValue:E3}=RE,{useSyncExternalStoreWithSelector:k3}=x3,M3=e=>e;function mx(e,t=M3,i){const r=k3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,i);return E3(r),r}const Jy=(e,t)=>{const i=C3(e),r=(l,a=t)=>mx(i,l,a);return Object.assign(r,i),r},T3=(e,t)=>e?Jy(e,t):Jy;function ht(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,l]of e)if(!Object.is(l,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(t).length)return!1;for(const r of i)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}hb();const fh=q.createContext(null),A3=fh.Provider,_x=kn.error001();function Ye(e,t){const i=q.useContext(fh);if(i===null)throw new Error(_x);return mx(i,e,t)}function dt(){const e=q.useContext(fh);if(e===null)throw new Error(_x);return q.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const eS={display:"none"},N3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},vx="react-flow__node-desc",yx="react-flow__edge-desc",D3="react-flow__aria-live",R3=e=>e.ariaLiveMessage,B3=e=>e.ariaLabelConfig;function L3({rfId:e}){const t=Ye(R3);return k.jsx("div",{id:`${D3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:N3,children:t})}function z3({rfId:e,disableKeyboardA11y:t}){const i=Ye(B3);return k.jsxs(k.Fragment,{children:[k.jsx("div",{id:`${vx}-${e}`,style:eS,children:t?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),k.jsx("div",{id:`${yx}-${e}`,style:eS,children:i["edge.a11yDescription.default"]}),!t&&k.jsx(L3,{rfId:e})]})}const dh=q.forwardRef(({position:e="top-left",children:t,className:i,style:r,...l},a)=>{const c=`${e}`.split("-");return k.jsx("div",{className:Bt(["react-flow__panel",i,...c]),style:r,ref:a,...l,children:t})});dh.displayName="Panel";function O3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:k.jsx(dh,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:k.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const H3=e=>{const t=[],i=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&i.push(r);return{selectedNodes:t,selectedEdges:i}},pu=e=>e.id;function P3(e,t){return ht(e.selectedNodes.map(pu),t.selectedNodes.map(pu))&&ht(e.selectedEdges.map(pu),t.selectedEdges.map(pu))}function I3({onSelectionChange:e}){const t=dt(),{selectedNodes:i,selectedEdges:r}=Ye(H3,P3);return q.useEffect(()=>{const l={nodes:i,edges:r};e==null||e(l),t.getState().onSelectionChangeHandlers.forEach(a=>a(l))},[i,r,e]),null}const j3=e=>!!e.onSelectionChangeHandlers;function U3({onSelectionChange:e}){const t=Ye(j3);return e||t?k.jsx(I3,{onSelectionChange:e}):null}const Sx=[0,0],q3={x:0,y:0,zoom:1},V3=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],tS=[...V3,"rfId"],F3=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),iS={translateExtent:pa,nodeOrigin:Sx,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Y3(e){const{setNodes:t,setEdges:i,setMinZoom:r,setMaxZoom:l,setTranslateExtent:a,setNodeExtent:c,reset:h,setDefaultNodesAndEdges:d}=Ye(F3,ht),f=dt();q.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=iS,h()}),[]);const m=q.useRef(iS);return q.useEffect(()=>{for(const g of tS){const v=e[g],y=m.current[g];v!==y&&(typeof e[g]>"u"||(g==="nodes"?t(v):g==="edges"?i(v):g==="minZoom"?r(v):g==="maxZoom"?l(v):g==="translateExtent"?a(v):g==="nodeExtent"?c(v):g==="ariaLabelConfig"?f.setState({ariaLabelConfig:TT(v)}):g==="fitView"?f.setState({fitViewQueued:v}):g==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[g]:v})))}m.current=e},tS.map(g=>e[g])),null}function nS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function $3(e){var r;const[t,i]=q.useState(e==="system"?null:e);return q.useEffect(()=>{if(e!=="system"){i(e);return}const l=nS(),a=()=>i(l!=null&&l.matches?"dark":"light");return a(),l==null||l.addEventListener("change",a),()=>{l==null||l.removeEventListener("change",a)}},[e]),t!==null?t:(r=nS())!=null&&r.matches?"dark":"light"}const rS=typeof document<"u"?document:null;function ya(e=null,t={target:rS,actInsideInputWithModifier:!0}){const[i,r]=q.useState(!1),l=q.useRef(!1),a=q.useRef(new Set([])),[c,h]=q.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
66
+ `).replace(`
67
+
68
+ `,`
69
+ +`).split(`
70
+ `)),m=f.reduce((g,v)=>g.concat(...v),[]);return[f,m]}return[[],[]]},[e]);return q.useEffect(()=>{const d=(t==null?void 0:t.target)??rS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const m=y=>{var E,w;if(l.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!l.current||l.current&&!f)&&ex(y))return!1;const b=lS(y.code,h);if(a.current.add(y[b]),sS(c,a.current,!1)){const z=((w=(E=y.composedPath)==null?void 0:E.call(y))==null?void 0:w[0])||y.target,C=(z==null?void 0:z.nodeName)==="BUTTON"||(z==null?void 0:z.nodeName)==="A";t.preventDefault!==!1&&(l.current||!C)&&y.preventDefault(),r(!0)}},g=y=>{const S=lS(y.code,h);sS(c,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(y[S]),y.key==="Meta"&&a.current.clear(),l.current=!1},v=()=>{a.current.clear(),r(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",g),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",g),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[e,r]),i}function sS(e,t,i){return e.filter(r=>i||r.length===t.size).some(r=>r.every(l=>t.has(l)))}function lS(e,t){return t.includes(e)?"code":"key"}const W3=()=>{const e=dt();return q.useMemo(()=>({zoomIn:t=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,i)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,i)=>{const{transform:[r,l,a],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??r,y:t.y??l,zoom:t.zoom??a},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,i,r]=e.getState().transform;return{x:t,y:i,zoom:r}},setCenter:async(t,i,r)=>e.getState().setCenter(t,i,r),fitBounds:async(t,i)=>{const{width:r,height:l,minZoom:a,maxZoom:c,panZoom:h}=e.getState(),d=Fg(t,r,l,a,c,(i==null?void 0:i.padding)??.1);return h?(await h.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,i={})=>{const{transform:r,snapGrid:l,snapToGrid:a,domNode:c}=e.getState();if(!c)return t;const{x:h,y:d}=c.getBoundingClientRect(),f={x:t.x-h,y:t.y-d},m=i.snapGrid??l,g=i.snapToGrid??a;return Da(f,r,g,m)},flowToScreenPosition:t=>{const{transform:i,domNode:r}=e.getState();if(!r)return t;const{x:l,y:a}=r.getBoundingClientRect(),c=$u(t,i);return{x:c.x+l,y:c.y+a}}}),[])};function bx(e,t){const i=[],r=new Map,l=[];for(const a of e)if(a.type==="add"){l.push(a);continue}else if(a.type==="remove"||a.type==="replace")r.set(a.id,[a]);else{const c=r.get(a.id);c?c.push(a):r.set(a.id,[a])}for(const a of t){const c=r.get(a.id);if(!c){i.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){i.push({...c[0].item});continue}const h={...a};for(const d of c)X3(d,h);i.push(h)}return l.length&&l.forEach(a=>{a.index!==void 0?i.splice(a.index,0,{...a.item}):i.push({...a.item})}),i}function X3(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function xx(e,t){return bx(e,t)}function wx(e,t){return bx(e,t)}function vs(e,t){return{id:e,type:"select",selected:t}}function El(e,t=new Set,i=!1){const r=[];for(const[l,a]of e){const c=t.has(l);!(a.selected===void 0&&!c)&&a.selected!==c&&(i&&(a.selected=c),r.push(vs(a.id,c)))}return r}function oS({items:e=[],lookup:t}){var l;const i=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,c]of e.entries()){const h=t.get(c.id),d=((l=h==null?void 0:h.internals)==null?void 0:l.userNode)??h;d!==void 0&&d!==c&&i.push({id:c.id,item:c,type:"replace"}),d===void 0&&i.push({item:c,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&i.push({id:a,type:"remove"});return i}function aS(e){return{id:e.id,type:"remove"}}const cS=e=>vT(e),K3=e=>$b(e);function Cx(e){return q.forwardRef(e)}const G3=typeof window<"u"?q.useLayoutEffect:q.useEffect;function uS(e){const[t,i]=q.useState(BigInt(0)),[r]=q.useState(()=>Z3(()=>i(l=>l+BigInt(1))));return G3(()=>{const l=r.get();l.length&&(e(l),r.reset())},[t]),r}function Z3(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:i=>{t.push(i),e()}}}const Ex=q.createContext(null);function Q3({children:e}){const t=dt(),i=q.useCallback(h=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:m,onNodesChange:g,nodeLookup:v,fitViewQueued:y,onNodesChangeMiddlewareMap:S}=t.getState();let b=d;for(const w of h)b=typeof w=="function"?w(b):w;let E=oS({items:b,lookup:v});for(const w of S.values())E=w(E);m&&f(b),E.length>0?g==null||g(E):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:z,setNodes:C}=t.getState();w&&C(z)})},[]),r=uS(i),l=q.useCallback(h=>{const{edges:d=[],setEdges:f,hasDefaultEdges:m,onEdgesChange:g,edgeLookup:v}=t.getState();let y=d;for(const S of h)y=typeof S=="function"?S(y):S;m?f(y):g&&g(oS({items:y,lookup:v}))},[]),a=uS(l),c=q.useMemo(()=>({nodeQueue:r,edgeQueue:a}),[]);return k.jsx(Ex.Provider,{value:c,children:e})}function J3(){const e=q.useContext(Ex);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const eA=e=>!!e.panZoom;function ph(){const e=W3(),t=dt(),i=J3(),r=Ye(eA),l=q.useMemo(()=>{const a=g=>t.getState().nodeLookup.get(g),c=g=>{i.nodeQueue.push(g)},h=g=>{i.edgeQueue.push(g)},d=g=>{var w,z;const{nodeLookup:v,nodeOrigin:y}=t.getState(),S=cS(g)?g:v.get(g.id),b=S.parentId?Qb(S.position,S.measured,S.parentId,v,y):S.position,E={...S,position:b,width:((w=S.measured)==null?void 0:w.width)??S.width,height:((z=S.measured)==null?void 0:z.height)??S.height};return zl(E)},f=(g,v,y={replace:!1})=>{c(S=>S.map(b=>{if(b.id===g){const E=typeof v=="function"?v(b):v;return y.replace&&cS(E)?E:{...b,...E}}return b}))},m=(g,v,y={replace:!1})=>{h(S=>S.map(b=>{if(b.id===g){const E=typeof v=="function"?v(b):v;return y.replace&&K3(E)?E:{...b,...E}}return b}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>{var v;return(v=a(g))==null?void 0:v.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:c,setEdges:h,addNodes:g=>{const v=Array.isArray(g)?g:[g];i.nodeQueue.push(y=>[...y,...v])},addEdges:g=>{const v=Array.isArray(g)?g:[g];i.edgeQueue.push(y=>[...y,...v])},toObject:()=>{const{nodes:g=[],edges:v=[],transform:y}=t.getState(),[S,b,E]=y;return{nodes:g.map(w=>({...w})),edges:v.map(w=>({...w})),viewport:{x:S,y:b,zoom:E}}},deleteElements:async({nodes:g=[],edges:v=[]})=>{const{nodes:y,edges:S,onNodesDelete:b,onEdgesDelete:E,triggerNodeChanges:w,triggerEdgeChanges:z,onDelete:C,onBeforeDelete:T}=t.getState(),{nodes:I,edges:B}=await wT({nodesToRemove:g,edgesToRemove:v,nodes:y,edges:S,onBeforeDelete:T}),U=B.length>0,X=I.length>0;if(U){const G=B.map(aS);E==null||E(B),z(G)}if(X){const G=I.map(aS);b==null||b(I),w(G)}return(X||U)&&(C==null||C({nodes:I,edges:B})),{deletedNodes:I,deletedEdges:B}},getIntersectingNodes:(g,v=!0,y)=>{const S=zy(g),b=S?g:d(g),E=y!==void 0;return b?(y||t.getState().nodes).filter(w=>{const z=t.getState().nodeLookup.get(w.id);if(z&&!S&&(w.id===g.id||!z.internals.positionAbsolute))return!1;const C=zl(E?w:z),T=_a(C,b);return v&&T>0||T>=C.width*C.height||T>=b.width*b.height}):[]},isNodeIntersecting:(g,v,y=!0)=>{const b=zy(g)?g:d(g);if(!b)return!1;const E=_a(b,v);return y&&E>0||E>=v.width*v.height||E>=b.width*b.height},updateNode:f,updateNodeData:(g,v,y={replace:!1})=>{f(g,S=>{const b=typeof v=="function"?v(S):v;return y.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},y)},updateEdge:m,updateEdgeData:(g,v,y={replace:!1})=>{m(g,S=>{const b=typeof v=="function"?v(S):v;return y.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},y)},getNodesBounds:g=>{const{nodeLookup:v,nodeOrigin:y}=t.getState();return yT(g,{nodeLookup:v,nodeOrigin:y})},getHandleConnections:({type:g,id:v,nodeId:y})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${y}-${g}${v?`-${v}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:v,nodeId:y})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${y}${g?v?`-${g}-${v}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const v=t.getState().fitViewResolver??MT();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:v}),i.nodeQueue.push(y=>[...y]),v.promise}}},[]);return q.useMemo(()=>({...l,...e,viewportInitialized:r}),[r])}const hS=e=>e.selected,tA=typeof window<"u"?window:void 0;function iA({deleteKeyCode:e,multiSelectionKeyCode:t}){const i=dt(),{deleteElements:r}=ph(),l=ya(e,{actInsideInputWithModifier:!1}),a=ya(t,{target:tA});q.useEffect(()=>{if(l){const{edges:c,nodes:h}=i.getState();r({nodes:h.filter(hS),edges:c.filter(hS)}),i.setState({nodesSelectionActive:!1})}},[l]),q.useEffect(()=>{i.setState({multiSelectionActive:a})},[a])}function nA(e){const t=dt();q.useEffect(()=>{const i=()=>{var l,a,c,h;if(!e.current||!(((a=(l=e.current).checkVisibility)==null?void 0:a.call(l))??!0))return!1;const r=Yg(e.current);(r.height===0||r.width===0)&&((h=(c=t.getState()).onError)==null||h.call(c,"004",kn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){i(),window.addEventListener("resize",i);const r=new ResizeObserver(()=>i());return r.observe(e.current),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}}},[])}const gh={position:"absolute",width:"100%",height:"100%",top:0,left:0},rA=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function sA({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:i=!0,panOnScroll:r=!1,panOnScrollSpeed:l=.5,panOnScrollMode:a=Cs.Free,zoomOnDoubleClick:c=!0,panOnDrag:h=!0,defaultViewport:d,translateExtent:f,minZoom:m,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:y=!0,children:S,noWheelClassName:b,noPanClassName:E,onViewportChange:w,isControlledViewport:z,paneClickDistance:C,selectionOnDrag:T}){const I=dt(),B=q.useRef(null),{userSelectionActive:U,lib:X,connectionInProgress:G}=Ye(rA,ht),ne=ya(v),V=q.useRef();nA(B);const j=q.useCallback(F=>{w==null||w({x:F[0],y:F[1],zoom:F[2]}),z||I.setState({transform:F})},[w,z]);return q.useEffect(()=>{if(B.current){V.current=u3({domNode:B.current,minZoom:m,maxZoom:g,translateExtent:f,viewport:d,onDraggingChange:M=>I.setState({paneDragging:M}),onPanZoomStart:(M,P)=>{const{onViewportChangeStart:H,onMoveStart:Y}=I.getState();Y==null||Y(M,P),H==null||H(P)},onPanZoom:(M,P)=>{const{onViewportChange:H,onMove:Y}=I.getState();Y==null||Y(M,P),H==null||H(P)},onPanZoomEnd:(M,P)=>{const{onViewportChangeEnd:H,onMoveEnd:Y}=I.getState();Y==null||Y(M,P),H==null||H(P)}});const{x:F,y:R,zoom:O}=V.current.getViewport();return I.setState({panZoom:V.current,transform:[F,R,O],domNode:B.current.closest(".react-flow")}),()=>{var M;(M=V.current)==null||M.destroy()}}},[]),q.useEffect(()=>{var F;(F=V.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:i,panOnScroll:r,panOnScrollSpeed:l,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:h,zoomActivationKeyPressed:ne,preventScrolling:y,noPanClassName:E,userSelectionActive:U,noWheelClassName:b,lib:X,onTransformChange:j,connectionInProgress:G,selectionOnDrag:T,paneClickDistance:C})},[e,t,i,r,l,a,c,h,ne,y,E,U,b,X,j,G,T,C]),k.jsx("div",{className:"react-flow__renderer",ref:B,style:gh,children:S})}const lA=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function oA(){const{userSelectionActive:e,userSelectionRect:t}=Ye(lA,ht);return e&&t?k.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const ep=(e,t)=>i=>{i.target===t.current&&(e==null||e(i))},aA=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function cA({isSelecting:e,selectionKeyPressed:t,selectionMode:i=ga.Full,panOnDrag:r,paneClickDistance:l,selectionOnDrag:a,onSelectionStart:c,onSelectionEnd:h,onPaneClick:d,onPaneContextMenu:f,onPaneScroll:m,onPaneMouseEnter:g,onPaneMouseMove:v,onPaneMouseLeave:y,children:S}){const b=dt(),{userSelectionActive:E,elementsSelectable:w,dragging:z,connectionInProgress:C}=Ye(aA,ht),T=w&&(e||E),I=q.useRef(null),B=q.useRef(),U=q.useRef(new Set),X=q.useRef(new Set),G=q.useRef(!1),ne=H=>{if(G.current||C){G.current=!1;return}d==null||d(H),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},V=H=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){H.preventDefault();return}f==null||f(H)},j=m?H=>m(H):void 0,F=H=>{G.current&&(H.stopPropagation(),G.current=!1)},R=H=>{var ce,oe;const{domNode:Y}=b.getState();if(B.current=Y==null?void 0:Y.getBoundingClientRect(),!B.current)return;const A=H.target===I.current;if(!A&&!!H.target.closest(".nokey")||!e||!(a&&A||t)||H.button!==0||!H.isPrimary)return;(oe=(ce=H.target)==null?void 0:ce.setPointerCapture)==null||oe.call(ce,H.pointerId),G.current=!1;const{x:N,y:ee}=cn(H.nativeEvent,B.current);b.setState({userSelectionRect:{width:0,height:0,startX:N,startY:ee,x:N,y:ee}}),A||(H.stopPropagation(),H.preventDefault())},O=H=>{const{userSelectionRect:Y,transform:A,nodeLookup:L,edgeLookup:$,connectionLookup:N,triggerNodeChanges:ee,triggerEdgeChanges:ce,defaultEdgeOptions:oe,resetSelectedElements:fe}=b.getState();if(!B.current||!Y)return;const{x:he,y:pe}=cn(H.nativeEvent,B.current),{startX:Ce,startY:xe}=Y;if(!G.current){const ze=t?0:l;if(Math.hypot(he-Ce,pe-xe)<=ze)return;fe(),c==null||c(H)}G.current=!0;const Se={startX:Ce,startY:xe,x:he<Ce?he:Ce,y:pe<xe?pe:xe,width:Math.abs(he-Ce),height:Math.abs(pe-xe)},me=U.current,Ne=X.current;U.current=new Set(Vg(L,Se,A,i===ga.Partial,!0).map(ze=>ze.id)),X.current=new Set;const $e=(oe==null?void 0:oe.selectable)??!0;for(const ze of U.current){const St=N.get(ze);if(St)for(const{edgeId:Ci}of St.values()){const Jt=$.get(Ci);Jt&&(Jt.selectable??$e)&&X.current.add(Ci)}}if(!Oy(me,U.current)){const ze=El(L,U.current,!0);ee(ze)}if(!Oy(Ne,X.current)){const ze=El($,X.current);ce(ze)}b.setState({userSelectionRect:Se,userSelectionActive:!0,nodesSelectionActive:!1})},M=H=>{var Y,A;H.button===0&&((A=(Y=H.target)==null?void 0:Y.releasePointerCapture)==null||A.call(Y,H.pointerId),!E&&H.target===I.current&&b.getState().userSelectionRect&&(ne==null||ne(H)),b.setState({userSelectionActive:!1,userSelectionRect:null}),G.current&&(h==null||h(H),b.setState({nodesSelectionActive:U.current.size>0})))},P=r===!0||Array.isArray(r)&&r.includes(0);return k.jsxs("div",{className:Bt(["react-flow__pane",{draggable:P,dragging:z,selection:e}]),onClick:T?void 0:ep(ne,I),onContextMenu:ep(V,I),onWheel:ep(j,I),onPointerEnter:T?void 0:g,onPointerMove:T?O:v,onPointerUp:T?M:void 0,onPointerDownCapture:T?R:void 0,onClickCapture:T?F:void 0,onPointerLeave:y,ref:I,style:gh,children:[S,k.jsx(oA,{})]})}function Up({id:e,store:t,unselect:i=!1,nodeRef:r}){const{addSelectedNodes:l,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:h,onError:d}=t.getState(),f=h.get(e);if(!f){d==null||d("012",kn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(i||f.selected&&c)&&(a({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var m;return(m=r==null?void 0:r.current)==null?void 0:m.blur()})):l([e])}function kx({nodeRef:e,disabled:t=!1,noDragClassName:i,handleSelector:r,nodeId:l,isSelectable:a,nodeClickDistance:c}){const h=dt(),[d,f]=q.useState(!1),m=q.useRef();return q.useEffect(()=>{m.current=GT({getStoreItems:()=>h.getState(),onNodeMouseDown:g=>{Up({id:g,store:h,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),q.useEffect(()=>{var g,v;if(t)(g=m.current)==null||g.destroy();else if(e.current)return(v=m.current)==null||v.update({noDragClassName:i,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:l,nodeClickDistance:c}),()=>{var y;(y=m.current)==null||y.destroy()}},[i,r,t,a,e,l]),d}const uA=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Mx(){const e=dt();return q.useCallback(i=>{const{nodeExtent:r,snapToGrid:l,snapGrid:a,nodesDraggable:c,onError:h,updateNodePositions:d,nodeLookup:f,nodeOrigin:m}=e.getState(),g=new Map,v=uA(c),y=l?a[0]:5,S=l?a[1]:5,b=i.direction.x*y*i.factor,E=i.direction.y*S*i.factor;for(const[,w]of f){if(!v(w))continue;let z={x:w.internals.positionAbsolute.x+b,y:w.internals.positionAbsolute.y+E};l&&(z=Na(z,a));const{position:C,positionAbsolute:T}=Wb({nodeId:w.id,nextPosition:z,nodeLookup:f,nodeExtent:r,nodeOrigin:m,onError:h});w.position=C,w.internals.positionAbsolute=T,g.set(w.id,w)}d(g)},[])}const Qg=q.createContext(null),hA=Qg.Provider;Qg.Consumer;const Tx=()=>q.useContext(Qg),fA=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),dA=(e,t,i)=>r=>{const{connectionClickStartHandle:l,connectionMode:a,connection:c}=r,{fromHandle:h,toHandle:d,isValid:f}=c,m=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.type)===i;return{connectingFrom:(h==null?void 0:h.nodeId)===e&&(h==null?void 0:h.id)===t&&(h==null?void 0:h.type)===i,connectingTo:m,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===i,isPossibleEndHandle:a===Bl.Strict?(h==null?void 0:h.type)!==i:e!==(h==null?void 0:h.nodeId)||t!==(h==null?void 0:h.id),connectionInProcess:!!h,clickConnectionInProcess:!!l,valid:m&&f}};function pA({type:e="source",position:t=we.Top,isValidConnection:i,isConnectable:r=!0,isConnectableStart:l=!0,isConnectableEnd:a=!0,id:c,onConnect:h,children:d,className:f,onMouseDown:m,onTouchStart:g,...v},y){var O,M;const S=c||null,b=e==="target",E=dt(),w=Tx(),{connectOnClick:z,noPanClassName:C,rfId:T}=Ye(fA,ht),{connectingFrom:I,connectingTo:B,clickConnecting:U,isPossibleEndHandle:X,connectionInProcess:G,clickConnectionInProcess:ne,valid:V}=Ye(dA(w,S,e),ht);w||(M=(O=E.getState()).onError)==null||M.call(O,"010",kn.error010());const j=P=>{const{defaultEdgeOptions:H,onConnect:Y,hasDefaultEdges:A}=E.getState(),L={...H,...P};if(A){const{edges:$,setEdges:N}=E.getState();N(LT(L,$))}Y==null||Y(L),h==null||h(L)},F=P=>{if(!w)return;const H=tx(P.nativeEvent);if(l&&(H&&P.button===0||!H)){const Y=E.getState();jp.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:Y.autoPanOnConnect,connectionMode:Y.connectionMode,connectionRadius:Y.connectionRadius,domNode:Y.domNode,nodeLookup:Y.nodeLookup,lib:Y.lib,isTarget:b,handleId:S,nodeId:w,flowId:Y.rfId,panBy:Y.panBy,cancelConnection:Y.cancelConnection,onConnectStart:Y.onConnectStart,onConnectEnd:Y.onConnectEnd,updateConnection:Y.updateConnection,onConnect:j,isValidConnection:i||Y.isValidConnection,getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:Y.autoPanSpeed,dragThreshold:Y.connectionDragThreshold})}H?m==null||m(P):g==null||g(P)},R=P=>{const{onClickConnectStart:H,onClickConnectEnd:Y,connectionClickStartHandle:A,connectionMode:L,isValidConnection:$,lib:N,rfId:ee,nodeLookup:ce,connection:oe}=E.getState();if(!w||!A&&!l)return;if(!A){H==null||H(P.nativeEvent,{nodeId:w,handleId:S,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:w,type:e,id:S}});return}const fe=Jb(P.target),he=i||$,{connection:pe,isValid:Ce}=jp.isValid(P.nativeEvent,{handle:{nodeId:w,id:S,type:e},connectionMode:L,fromNodeId:A.nodeId,fromHandleId:A.id||null,fromType:A.type,isValidConnection:he,flowId:ee,doc:fe,lib:N,nodeLookup:ce});Ce&&pe&&j(pe);const xe=structuredClone(oe);delete xe.inProgress,xe.toPosition=xe.toHandle?xe.toHandle.position:null,Y==null||Y(P,xe),E.setState({connectionClickStartHandle:null})};return k.jsx("div",{"data-handleid":S,"data-nodeid":w,"data-handlepos":t,"data-id":`${T}-${w}-${S}-${e}`,className:Bt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",C,f,{source:!b,target:b,connectable:r,connectablestart:l,connectableend:a,clickconnecting:U,connectingfrom:I,connectingto:B,valid:V,connectionindicator:r&&(!G||X)&&(G||ne?a:l)}]),onMouseDown:F,onTouchStart:F,onClick:z?R:void 0,ref:y,...v,children:d})}const Xr=q.memo(Cx(pA));function gA({data:e,isConnectable:t,sourcePosition:i=we.Bottom}){return k.jsxs(k.Fragment,{children:[e==null?void 0:e.label,k.jsx(Xr,{type:"source",position:i,isConnectable:t})]})}function mA({data:e,isConnectable:t,targetPosition:i=we.Top,sourcePosition:r=we.Bottom}){return k.jsxs(k.Fragment,{children:[k.jsx(Xr,{type:"target",position:i,isConnectable:t}),e==null?void 0:e.label,k.jsx(Xr,{type:"source",position:r,isConnectable:t})]})}function _A(){return null}function vA({data:e,isConnectable:t,targetPosition:i=we.Top}){return k.jsxs(k.Fragment,{children:[k.jsx(Xr,{type:"target",position:i,isConnectable:t}),e==null?void 0:e.label]})}const Wu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},fS={input:gA,default:mA,output:vA,group:_A};function yA(e){var t,i,r,l;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((l=e.style)==null?void 0:l.height)}}const SA=e=>{const{width:t,height:i,x:r,y:l}=Aa(e.nodeLookup,{filter:a=>!!a.selected});return{width:an(t)?t:null,height:an(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${l}px)`}};function bA({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:i}){const r=dt(),{width:l,height:a,transformString:c,userSelectionActive:h}=Ye(SA,ht),d=Mx(),f=q.useRef(null);if(q.useEffect(()=>{var v;i||(v=f.current)==null||v.focus({preventScroll:!0})},[i]),kx({nodeRef:f}),h||!l||!a)return null;const m=e?v=>{const y=r.getState().nodes.filter(S=>S.selected);e(v,y)}:void 0,g=v=>{Object.prototype.hasOwnProperty.call(Wu,v.key)&&(v.preventDefault(),d({direction:Wu[v.key],factor:v.shiftKey?4:1}))};return k.jsx("div",{className:Bt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:k.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:i?void 0:-1,onKeyDown:i?void 0:g,style:{width:l,height:a}})})}const dS=typeof window<"u"?window:void 0,xA=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ax({children:e,onPaneClick:t,onPaneMouseEnter:i,onPaneMouseMove:r,onPaneMouseLeave:l,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:h,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:m,selectionMode:g,onSelectionStart:v,onSelectionEnd:y,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:E,elementsSelectable:w,zoomOnScroll:z,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:I,panOnScrollMode:B,zoomOnDoubleClick:U,panOnDrag:X,defaultViewport:G,translateExtent:ne,minZoom:V,maxZoom:j,preventScrolling:F,onSelectionContextMenu:R,noWheelClassName:O,noPanClassName:M,disableKeyboardA11y:P,onViewportChange:H,isControlledViewport:Y}){const{nodesSelectionActive:A,userSelectionActive:L}=Ye(xA,ht),$=ya(f,{target:dS}),N=ya(b,{target:dS}),ee=N||X,ce=N||T,oe=m&&ee!==!0,fe=$||L||oe;return iA({deleteKeyCode:d,multiSelectionKeyCode:S}),k.jsx(sA,{onPaneContextMenu:a,elementsSelectable:w,zoomOnScroll:z,zoomOnPinch:C,panOnScroll:ce,panOnScrollSpeed:I,panOnScrollMode:B,zoomOnDoubleClick:U,panOnDrag:!$&&ee,defaultViewport:G,translateExtent:ne,minZoom:V,maxZoom:j,zoomActivationKeyCode:E,preventScrolling:F,noWheelClassName:O,noPanClassName:M,onViewportChange:H,isControlledViewport:Y,paneClickDistance:h,selectionOnDrag:oe,children:k.jsxs(cA,{onSelectionStart:v,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:i,onPaneMouseMove:r,onPaneMouseLeave:l,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:ee,isSelecting:!!fe,selectionMode:g,selectionKeyPressed:$,paneClickDistance:h,selectionOnDrag:oe,children:[e,A&&k.jsx(bA,{onSelectionContextMenu:R,noPanClassName:M,disableKeyboardA11y:P})]})})}Ax.displayName="FlowRenderer";const wA=q.memo(Ax),CA=e=>t=>e?Vg(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(i=>i.id):Array.from(t.nodeLookup.keys());function EA(e){return Ye(q.useCallback(CA(e),[e]),ht)}const kA=e=>e.updateNodeInternals;function MA(){const e=Ye(kA),[t]=q.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const r=new Map;i.forEach(l=>{const a=l.target.getAttribute("data-id");r.set(a,{id:a,nodeElement:l.target,force:!0})}),e(r)}));return q.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function TA({node:e,nodeType:t,hasDimensions:i,resizeObserver:r}){const l=dt(),a=q.useRef(null),c=q.useRef(null),h=q.useRef(e.sourcePosition),d=q.useRef(e.targetPosition),f=q.useRef(t),m=i&&!!e.internals.handleBounds;return q.useEffect(()=>{a.current&&!e.hidden&&(!m||c.current!==a.current)&&(c.current&&(r==null||r.unobserve(c.current)),r==null||r.observe(a.current),c.current=a.current)},[m,e.hidden]),q.useEffect(()=>()=>{c.current&&(r==null||r.unobserve(c.current),c.current=null)},[]),q.useEffect(()=>{if(a.current){const g=f.current!==t,v=h.current!==e.sourcePosition,y=d.current!==e.targetPosition;(g||v||y)&&(f.current=t,h.current=e.sourcePosition,d.current=e.targetPosition,l.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function AA({id:e,onClick:t,onMouseEnter:i,onMouseMove:r,onMouseLeave:l,onContextMenu:a,onDoubleClick:c,nodesDraggable:h,elementsSelectable:d,nodesConnectable:f,nodesFocusable:m,resizeObserver:g,noDragClassName:v,noPanClassName:y,disableKeyboardA11y:S,rfId:b,nodeTypes:E,nodeClickDistance:w,onError:z}){const{node:C,internals:T,isParent:I}=Ye(he=>{const pe=he.nodeLookup.get(e),Ce=he.parentLookup.has(e);return{node:pe,internals:pe.internals,isParent:Ce}},ht);let B=C.type||"default",U=(E==null?void 0:E[B])||fS[B];U===void 0&&(z==null||z("003",kn.error003(B)),B="default",U=(E==null?void 0:E.default)||fS.default);const X=!!(C.draggable||h&&typeof C.draggable>"u"),G=!!(C.selectable||d&&typeof C.selectable>"u"),ne=!!(C.connectable||f&&typeof C.connectable>"u"),V=!!(C.focusable||m&&typeof C.focusable>"u"),j=dt(),F=Zb(C),R=TA({node:C,nodeType:B,hasDimensions:F,resizeObserver:g}),O=kx({nodeRef:R,disabled:C.hidden||!X,noDragClassName:v,handleSelector:C.dragHandle,nodeId:e,isSelectable:G,nodeClickDistance:w}),M=Mx();if(C.hidden)return null;const P=sr(C),H=yA(C),Y=G||X||t||i||r||l,A=i?he=>i(he,{...T.userNode}):void 0,L=r?he=>r(he,{...T.userNode}):void 0,$=l?he=>l(he,{...T.userNode}):void 0,N=a?he=>a(he,{...T.userNode}):void 0,ee=c?he=>c(he,{...T.userNode}):void 0,ce=he=>{const{selectNodesOnDrag:pe,nodeDragThreshold:Ce}=j.getState();G&&(!pe||!X||Ce>0)&&Up({id:e,store:j,nodeRef:R}),t&&t(he,{...T.userNode})},oe=he=>{if(!(ex(he.nativeEvent)||S)){if(qb.includes(he.key)&&G){const pe=he.key==="Escape";Up({id:e,store:j,unselect:pe,nodeRef:R})}else if(X&&C.selected&&Object.prototype.hasOwnProperty.call(Wu,he.key)){he.preventDefault();const{ariaLabelConfig:pe}=j.getState();j.setState({ariaLiveMessage:pe["node.a11yDescription.ariaLiveMessage"]({direction:he.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),M({direction:Wu[he.key],factor:he.shiftKey?4:1})}}},fe=()=>{var Ne;if(S||!((Ne=R.current)!=null&&Ne.matches(":focus-visible")))return;const{transform:he,width:pe,height:Ce,autoPanOnNodeFocus:xe,setCenter:Se}=j.getState();if(!xe)return;Vg(new Map([[e,C]]),{x:0,y:0,width:pe,height:Ce},he,!0).length>0||Se(C.position.x+P.width/2,C.position.y+P.height/2,{zoom:he[2]})};return k.jsx("div",{className:Bt(["react-flow__node",`react-flow__node-${B}`,{[y]:X},C.className,{selected:C.selected,selectable:G,parent:I,draggable:X,dragging:O}]),ref:R,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:Y?"all":"none",visibility:F?"visible":"hidden",...C.style,...H},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:A,onMouseMove:L,onMouseLeave:$,onContextMenu:N,onClick:ce,onDoubleClick:ee,onKeyDown:V?oe:void 0,tabIndex:V?0:void 0,onFocus:V?fe:void 0,role:C.ariaRole??(V?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${vx}-${b}`,"aria-label":C.ariaLabel,...C.domAttributes,children:k.jsx(hA,{value:e,children:k.jsx(U,{id:e,data:C.data,type:B,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:C.selected??!1,selectable:G,draggable:X,deletable:C.deletable??!0,isConnectable:ne,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:O,dragHandle:C.dragHandle,zIndex:T.z,parentId:C.parentId,...P})})})}var NA=q.memo(AA);const DA=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Nx(e){const{nodesDraggable:t,nodesConnectable:i,nodesFocusable:r,elementsSelectable:l,onError:a}=Ye(DA,ht),c=EA(e.onlyRenderVisibleElements),h=MA();return k.jsx("div",{className:"react-flow__nodes",style:gh,children:c.map(d=>k.jsx(NA,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:h,nodesDraggable:t,nodesConnectable:i,nodesFocusable:r,elementsSelectable:l,nodeClickDistance:e.nodeClickDistance,onError:a},d))})}Nx.displayName="NodeRenderer";const RA=q.memo(Nx);function BA(e){return Ye(q.useCallback(i=>{if(!e)return i.edges.map(l=>l.id);const r=[];if(i.width&&i.height)for(const l of i.edges){const a=i.nodeLookup.get(l.source),c=i.nodeLookup.get(l.target);a&&c&&DT({sourceNode:a,targetNode:c,width:i.width,height:i.height,transform:i.transform})&&r.push(l.id)}return r},[e]),ht)}const LA=({color:e="none",strokeWidth:t=1})=>{const i={strokeWidth:t,...e&&{stroke:e}};return k.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},zA=({color:e="none",strokeWidth:t=1})=>{const i={strokeWidth:t,...e&&{stroke:e,fill:e}};return k.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},pS={[ma.Arrow]:LA,[ma.ArrowClosed]:zA};function OA(e){const t=dt();return q.useMemo(()=>{var l,a;return Object.prototype.hasOwnProperty.call(pS,e)?pS[e]:((a=(l=t.getState()).onError)==null||a.call(l,"009",kn.error009(e)),null)},[e])}const HA=({id:e,type:t,color:i,width:r=12.5,height:l=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:h="auto-start-reverse"})=>{const d=OA(t);return d?k.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${l}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:h,refX:"0",refY:"0",children:k.jsx(d,{color:i,strokeWidth:c})}):null},Dx=({defaultColor:e,rfId:t})=>{const i=Ye(a=>a.edges),r=Ye(a=>a.defaultEdgeOptions),l=q.useMemo(()=>IT(i,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[i,r,t,e]);return l.length?k.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:k.jsx("defs",{children:l.map(a=>k.jsx(HA,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};Dx.displayName="MarkerDefinitions";var PA=q.memo(Dx);function Rx({x:e,y:t,label:i,labelStyle:r,labelShowBg:l=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:h=2,children:d,className:f,...m}){const[g,v]=q.useState({x:1,y:0,width:0,height:0}),y=Bt(["react-flow__edge-textwrapper",f]),S=q.useRef(null);return q.useEffect(()=>{if(S.current){const b=S.current.getBBox();v({x:b.x,y:b.y,width:b.width,height:b.height})}},[i]),i?k.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...m,children:[l&&k.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:h,ry:h}),k.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:r,children:i}),d]}):null}Rx.displayName="EdgeText";const IA=q.memo(Rx);function mh({path:e,labelX:t,labelY:i,label:r,labelStyle:l,labelShowBg:a,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:d,interactionWidth:f=20,...m}){return k.jsxs(k.Fragment,{children:[k.jsx("path",{...m,d:e,fill:"none",className:Bt(["react-flow__edge-path",m.className])}),f?k.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&an(t)&&an(i)?k.jsx(IA,{x:t,y:i,label:r,labelStyle:l,labelShowBg:a,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:d}):null]})}function gS({pos:e,x1:t,y1:i,x2:r,y2:l}){return e===we.Left||e===we.Right?[.5*(t+r),i]:[t,.5*(i+l)]}function Bx({sourceX:e,sourceY:t,sourcePosition:i=we.Bottom,targetX:r,targetY:l,targetPosition:a=we.Top}){const[c,h]=gS({pos:i,x1:e,y1:t,x2:r,y2:l}),[d,f]=gS({pos:a,x1:r,y1:l,x2:e,y2:t}),[m,g,v,y]=ix({sourceX:e,sourceY:t,targetX:r,targetY:l,sourceControlX:c,sourceControlY:h,targetControlX:d,targetControlY:f});return[`M${e},${t} C${c},${h} ${d},${f} ${r},${l}`,m,g,v,y]}function Lx(e){return q.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,sourcePosition:c,targetPosition:h,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,interactionWidth:w})=>{const[z,C,T]=Bx({sourceX:i,sourceY:r,sourcePosition:c,targetX:l,targetY:a,targetPosition:h}),I=e.isInternal?void 0:t;return k.jsx(mh,{id:I,path:z,labelX:C,labelY:T,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,interactionWidth:w})})}const jA=Lx({isInternal:!1}),zx=Lx({isInternal:!0});jA.displayName="SimpleBezierEdge";zx.displayName="SimpleBezierEdgeInternal";function Ox(e){return q.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,sourcePosition:y=we.Bottom,targetPosition:S=we.Top,markerEnd:b,markerStart:E,pathOptions:w,interactionWidth:z})=>{const[C,T,I]=Hp({sourceX:i,sourceY:r,sourcePosition:y,targetX:l,targetY:a,targetPosition:S,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset,stepPosition:w==null?void 0:w.stepPosition}),B=e.isInternal?void 0:t;return k.jsx(mh,{id:B,path:C,labelX:T,labelY:I,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:E,interactionWidth:z})})}const Hx=Ox({isInternal:!1}),Px=Ox({isInternal:!0});Hx.displayName="SmoothStepEdge";Px.displayName="SmoothStepEdgeInternal";function Ix(e){return q.memo(({id:t,...i})=>{var l;const r=e.isInternal?void 0:t;return k.jsx(Hx,{...i,id:r,pathOptions:q.useMemo(()=>{var a;return{borderRadius:0,offset:(a=i.pathOptions)==null?void 0:a.offset}},[(l=i.pathOptions)==null?void 0:l.offset])})})}const UA=Ix({isInternal:!1}),jx=Ix({isInternal:!0});UA.displayName="StepEdge";jx.displayName="StepEdgeInternal";function Ux(e){return q.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,markerEnd:y,markerStart:S,interactionWidth:b})=>{const[E,w,z]=rx({sourceX:i,sourceY:r,targetX:l,targetY:a}),C=e.isInternal?void 0:t;return k.jsx(mh,{id:C,path:E,labelX:w,labelY:z,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,markerEnd:y,markerStart:S,interactionWidth:b})})}const qA=Ux({isInternal:!1}),qx=Ux({isInternal:!0});qA.displayName="StraightEdge";qx.displayName="StraightEdgeInternal";function Vx(e){return q.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,sourcePosition:c=we.Bottom,targetPosition:h=we.Top,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,pathOptions:w,interactionWidth:z})=>{const[C,T,I]=$g({sourceX:i,sourceY:r,sourcePosition:c,targetX:l,targetY:a,targetPosition:h,curvature:w==null?void 0:w.curvature}),B=e.isInternal?void 0:t;return k.jsx(mh,{id:B,path:C,labelX:T,labelY:I,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,interactionWidth:z})})}const VA=Vx({isInternal:!1}),Fx=Vx({isInternal:!0});VA.displayName="BezierEdge";Fx.displayName="BezierEdgeInternal";const mS={default:Fx,straight:qx,step:jx,smoothstep:Px,simplebezier:zx},_S={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},FA=(e,t,i)=>i===we.Left?e-t:i===we.Right?e+t:e,YA=(e,t,i)=>i===we.Top?e-t:i===we.Bottom?e+t:e,vS="react-flow__edgeupdater";function yS({position:e,centerX:t,centerY:i,radius:r=10,onMouseDown:l,onMouseEnter:a,onMouseOut:c,type:h}){return k.jsx("circle",{onMouseDown:l,onMouseEnter:a,onMouseOut:c,className:Bt([vS,`${vS}-${h}`]),cx:FA(t,r,e),cy:YA(i,r,e),r,stroke:"transparent",fill:"transparent"})}function $A({isReconnectable:e,reconnectRadius:t,edge:i,sourceX:r,sourceY:l,targetX:a,targetY:c,sourcePosition:h,targetPosition:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:g,setReconnecting:v,setUpdateHover:y}){const S=dt(),b=(T,I)=>{if(T.button!==0)return;const{autoPanOnConnect:B,domNode:U,isValidConnection:X,connectionMode:G,connectionRadius:ne,lib:V,onConnectStart:j,onConnectEnd:F,cancelConnection:R,nodeLookup:O,rfId:M,panBy:P,updateConnection:H}=S.getState(),Y=I.type==="target",A=(N,ee)=>{v(!1),g==null||g(N,i,I.type,ee)},L=N=>f==null?void 0:f(i,N),$=(N,ee)=>{v(!0),m==null||m(T,i,I.type),j==null||j(N,ee)};jp.onPointerDown(T.nativeEvent,{autoPanOnConnect:B,connectionMode:G,connectionRadius:ne,domNode:U,handleId:I.id,nodeId:I.nodeId,nodeLookup:O,isTarget:Y,edgeUpdaterType:I.type,lib:V,flowId:M,cancelConnection:R,panBy:P,isValidConnection:X,onConnect:L,onConnectStart:$,onConnectEnd:F,onReconnectEnd:A,updateConnection:H,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},E=T=>b(T,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),w=T=>b(T,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),z=()=>y(!0),C=()=>y(!1);return k.jsxs(k.Fragment,{children:[(e===!0||e==="source")&&k.jsx(yS,{position:h,centerX:r,centerY:l,radius:t,onMouseDown:E,onMouseEnter:z,onMouseOut:C,type:"source"}),(e===!0||e==="target")&&k.jsx(yS,{position:d,centerX:a,centerY:c,radius:t,onMouseDown:w,onMouseEnter:z,onMouseOut:C,type:"target"})]})}function WA({id:e,edgesFocusable:t,edgesReconnectable:i,elementsSelectable:r,onClick:l,onDoubleClick:a,onContextMenu:c,onMouseEnter:h,onMouseMove:d,onMouseLeave:f,reconnectRadius:m,onReconnect:g,onReconnectStart:v,onReconnectEnd:y,rfId:S,edgeTypes:b,noPanClassName:E,onError:w,disableKeyboardA11y:z}){let C=Ye(Se=>Se.edgeLookup.get(e));const T=Ye(Se=>Se.defaultEdgeOptions);C=T?{...T,...C}:C;let I=C.type||"default",B=(b==null?void 0:b[I])||mS[I];B===void 0&&(w==null||w("011",kn.error011(I)),I="default",B=(b==null?void 0:b.default)||mS.default);const U=!!(C.focusable||t&&typeof C.focusable>"u"),X=typeof g<"u"&&(C.reconnectable||i&&typeof C.reconnectable>"u"),G=!!(C.selectable||r&&typeof C.selectable>"u"),ne=q.useRef(null),[V,j]=q.useState(!1),[F,R]=q.useState(!1),O=dt(),{zIndex:M,sourceX:P,sourceY:H,targetX:Y,targetY:A,sourcePosition:L,targetPosition:$}=Ye(q.useCallback(Se=>{const me=Se.nodeLookup.get(C.source),Ne=Se.nodeLookup.get(C.target);if(!me||!Ne)return{zIndex:C.zIndex,..._S};const $e=PT({id:e,sourceNode:me,targetNode:Ne,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:Se.connectionMode,onError:w});return{zIndex:NT({selected:C.selected,zIndex:C.zIndex,sourceNode:me,targetNode:Ne,elevateOnSelect:Se.elevateEdgesOnSelect,zIndexMode:Se.zIndexMode}),...$e||_S}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),ht),N=q.useMemo(()=>C.markerStart?`url('#${Pp(C.markerStart,S)}')`:void 0,[C.markerStart,S]),ee=q.useMemo(()=>C.markerEnd?`url('#${Pp(C.markerEnd,S)}')`:void 0,[C.markerEnd,S]);if(C.hidden||P===null||H===null||Y===null||A===null)return null;const ce=Se=>{var ze;const{addSelectedEdges:me,unselectNodesAndEdges:Ne,multiSelectionActive:$e}=O.getState();G&&(O.setState({nodesSelectionActive:!1}),C.selected&&$e?(Ne({nodes:[],edges:[C]}),(ze=ne.current)==null||ze.blur()):me([e])),l&&l(Se,C)},oe=a?Se=>{a(Se,{...C})}:void 0,fe=c?Se=>{c(Se,{...C})}:void 0,he=h?Se=>{h(Se,{...C})}:void 0,pe=d?Se=>{d(Se,{...C})}:void 0,Ce=f?Se=>{f(Se,{...C})}:void 0,xe=Se=>{var me;if(!z&&qb.includes(Se.key)&&G){const{unselectNodesAndEdges:Ne,addSelectedEdges:$e}=O.getState();Se.key==="Escape"?((me=ne.current)==null||me.blur(),Ne({edges:[C]})):$e([e])}};return k.jsx("svg",{style:{zIndex:M},children:k.jsxs("g",{className:Bt(["react-flow__edge",`react-flow__edge-${I}`,C.className,E,{selected:C.selected,animated:C.animated,inactive:!G&&!l,updating:V,selectable:G}]),onClick:ce,onDoubleClick:oe,onContextMenu:fe,onMouseEnter:he,onMouseMove:pe,onMouseLeave:Ce,onKeyDown:U?xe:void 0,tabIndex:U?0:void 0,role:C.ariaRole??(U?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":U?`${yx}-${S}`:void 0,ref:ne,...C.domAttributes,children:[!F&&k.jsx(B,{id:e,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:G,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:P,sourceY:H,targetX:Y,targetY:A,sourcePosition:L,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:N,markerEnd:ee,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),X&&k.jsx($A,{edge:C,isReconnectable:X,reconnectRadius:m,onReconnect:g,onReconnectStart:v,onReconnectEnd:y,sourceX:P,sourceY:H,targetX:Y,targetY:A,sourcePosition:L,targetPosition:$,setUpdateHover:j,setReconnecting:R})]})})}var XA=q.memo(WA);const KA=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Yx({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:i,edgeTypes:r,noPanClassName:l,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:h,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:m,reconnectRadius:g,onEdgeDoubleClick:v,onReconnectStart:y,onReconnectEnd:S,disableKeyboardA11y:b}){const{edgesFocusable:E,edgesReconnectable:w,elementsSelectable:z,onError:C}=Ye(KA,ht),T=BA(t);return k.jsxs("div",{className:"react-flow__edges",children:[k.jsx(PA,{defaultColor:e,rfId:i}),T.map(I=>k.jsx(XA,{id:I,edgesFocusable:E,edgesReconnectable:w,elementsSelectable:z,noPanClassName:l,onReconnect:a,onContextMenu:c,onMouseEnter:h,onMouseMove:d,onMouseLeave:f,onClick:m,reconnectRadius:g,onDoubleClick:v,onReconnectStart:y,onReconnectEnd:S,rfId:i,onError:C,edgeTypes:r,disableKeyboardA11y:b},I))]})}Yx.displayName="EdgeRenderer";const GA=q.memo(Yx),ZA=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function QA({children:e}){const t=Ye(ZA);return k.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function JA(e){const t=ph(),i=q.useRef(!1);q.useEffect(()=>{!i.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),i.current=!0)},[e,t.viewportInitialized])}const eN=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function tN(e){const t=Ye(eN),i=dt();return q.useEffect(()=>{e&&(t==null||t(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function iN(e){return e.connection.inProgress?{...e.connection,to:Da(e.connection.to,e.transform)}:{...e.connection}}function nN(e){return iN}function rN(e){const t=nN();return Ye(t,ht)}const sN=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lN({containerStyle:e,style:t,type:i,component:r}){const{nodesConnectable:l,width:a,height:c,isValid:h,inProgress:d}=Ye(sN,ht);return!(a&&l&&d)?null:k.jsx("svg",{style:e,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:k.jsx("g",{className:Bt(["react-flow__connection",Yb(h)]),children:k.jsx($x,{style:t,type:i,CustomComponent:r,isValid:h})})})}const $x=({style:e,type:t=Yr.Bezier,CustomComponent:i,isValid:r})=>{const{inProgress:l,from:a,fromNode:c,fromHandle:h,fromPosition:d,to:f,toNode:m,toHandle:g,toPosition:v,pointer:y}=rN();if(!l)return;if(i)return k.jsx(i,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:h,fromX:a.x,fromY:a.y,toX:f.x,toY:f.y,fromPosition:d,toPosition:v,connectionStatus:Yb(r),toNode:m,toHandle:g,pointer:y});let S="";const b={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:v};switch(t){case Yr.Bezier:[S]=$g(b);break;case Yr.SimpleBezier:[S]=Bx(b);break;case Yr.Step:[S]=Hp({...b,borderRadius:0});break;case Yr.SmoothStep:[S]=Hp(b);break;default:[S]=rx(b)}return k.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};$x.displayName="ConnectionLine";const oN={};function SS(e=oN){q.useRef(e),dt(),q.useEffect(()=>{},[e])}function aN(){dt(),q.useRef(!1),q.useEffect(()=>{},[])}function Wx({nodeTypes:e,edgeTypes:t,onInit:i,onNodeClick:r,onEdgeClick:l,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:y,connectionLineType:S,connectionLineStyle:b,connectionLineComponent:E,connectionLineContainerStyle:w,selectionKeyCode:z,selectionOnDrag:C,selectionMode:T,multiSelectionKeyCode:I,panActivationKeyCode:B,zoomActivationKeyCode:U,deleteKeyCode:X,onlyRenderVisibleElements:G,elementsSelectable:ne,defaultViewport:V,translateExtent:j,minZoom:F,maxZoom:R,preventScrolling:O,defaultMarkerColor:M,zoomOnScroll:P,zoomOnPinch:H,panOnScroll:Y,panOnScrollSpeed:A,panOnScrollMode:L,zoomOnDoubleClick:$,panOnDrag:N,onPaneClick:ee,onPaneMouseEnter:ce,onPaneMouseMove:oe,onPaneMouseLeave:fe,onPaneScroll:he,onPaneContextMenu:pe,paneClickDistance:Ce,nodeClickDistance:xe,onEdgeContextMenu:Se,onEdgeMouseEnter:me,onEdgeMouseMove:Ne,onEdgeMouseLeave:$e,reconnectRadius:ze,onReconnect:St,onReconnectStart:Ci,onReconnectEnd:Jt,noDragClassName:ui,noWheelClassName:Qi,noPanClassName:Nn,disableKeyboardA11y:Dn,nodeExtent:Lt,rfId:ar,viewport:re,onViewportChange:ge}){return SS(e),SS(t),aN(),JA(i),tN(re),k.jsx(wA,{onPaneClick:ee,onPaneMouseEnter:ce,onPaneMouseMove:oe,onPaneMouseLeave:fe,onPaneContextMenu:pe,onPaneScroll:he,paneClickDistance:Ce,deleteKeyCode:X,selectionKeyCode:z,selectionOnDrag:C,selectionMode:T,onSelectionStart:v,onSelectionEnd:y,multiSelectionKeyCode:I,panActivationKeyCode:B,zoomActivationKeyCode:U,elementsSelectable:ne,zoomOnScroll:P,zoomOnPinch:H,zoomOnDoubleClick:$,panOnScroll:Y,panOnScrollSpeed:A,panOnScrollMode:L,panOnDrag:N,defaultViewport:V,translateExtent:j,minZoom:F,maxZoom:R,onSelectionContextMenu:g,preventScrolling:O,noDragClassName:ui,noWheelClassName:Qi,noPanClassName:Nn,disableKeyboardA11y:Dn,onViewportChange:ge,isControlledViewport:!!re,children:k.jsxs(QA,{children:[k.jsx(GA,{edgeTypes:t,onEdgeClick:l,onEdgeDoubleClick:c,onReconnect:St,onReconnectStart:Ci,onReconnectEnd:Jt,onlyRenderVisibleElements:G,onEdgeContextMenu:Se,onEdgeMouseEnter:me,onEdgeMouseMove:Ne,onEdgeMouseLeave:$e,reconnectRadius:ze,defaultMarkerColor:M,noPanClassName:Nn,disableKeyboardA11y:Dn,rfId:ar}),k.jsx(lN,{style:b,type:S,component:E,containerStyle:w}),k.jsx("div",{className:"react-flow__edgelabel-renderer"}),k.jsx(RA,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,nodeClickDistance:xe,onlyRenderVisibleElements:G,noPanClassName:Nn,noDragClassName:ui,disableKeyboardA11y:Dn,nodeExtent:Lt,rfId:ar}),k.jsx("div",{className:"react-flow__viewport-portal"})]})})}Wx.displayName="GraphView";const cN=q.memo(Wx),bS=({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,width:l,height:a,fitView:c,fitViewOptions:h,minZoom:d=.5,maxZoom:f=2,nodeOrigin:m,nodeExtent:g,zIndexMode:v="basic"}={})=>{const y=new Map,S=new Map,b=new Map,E=new Map,w=r??t??[],z=i??e??[],C=m??[0,0],T=g??pa;ox(b,E,w);const I=Ip(z,y,S,{nodeOrigin:C,nodeExtent:T,zIndexMode:v});let B=[0,0,1];if(c&&l&&a){const U=Aa(y,{filter:V=>!!((V.width||V.initialWidth)&&(V.height||V.initialHeight))}),{x:X,y:G,zoom:ne}=Fg(U,l,a,d,f,(h==null?void 0:h.padding)??.1);B=[X,G,ne]}return{rfId:"1",width:l??0,height:a??0,transform:B,nodes:z,nodesInitialized:I,nodeLookup:y,parentLookup:S,edges:w,edgeLookup:E,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:pa,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Bl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:c??!1,fitViewOptions:h,fitViewResolver:null,connection:{...Fb},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:CT,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Vb,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},uN=({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,width:l,height:a,fitView:c,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:m,nodeExtent:g,zIndexMode:v})=>T3((y,S)=>{async function b(){const{nodeLookup:E,panZoom:w,fitViewOptions:z,fitViewResolver:C,width:T,height:I,minZoom:B,maxZoom:U}=S();w&&(await xT({nodes:E,width:T,height:I,panZoom:w,minZoom:B,maxZoom:U},z),C==null||C.resolve(!0),y({fitViewResolver:null}))}return{...bS({nodes:e,edges:t,width:l,height:a,fitView:c,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:m,nodeExtent:g,defaultNodes:i,defaultEdges:r,zIndexMode:v}),setNodes:E=>{const{nodeLookup:w,parentLookup:z,nodeOrigin:C,elevateNodesOnSelect:T,fitViewQueued:I,zIndexMode:B}=S(),U=Ip(E,w,z,{nodeOrigin:C,nodeExtent:g,elevateNodesOnSelect:T,checkEquality:!0,zIndexMode:B});I&&U?(b(),y({nodes:E,nodesInitialized:U,fitViewQueued:!1,fitViewOptions:void 0})):y({nodes:E,nodesInitialized:U})},setEdges:E=>{const{connectionLookup:w,edgeLookup:z}=S();ox(w,z,E),y({edges:E})},setDefaultNodesAndEdges:(E,w)=>{if(E){const{setNodes:z}=S();z(E),y({hasDefaultNodes:!0})}if(w){const{setEdges:z}=S();z(w),y({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:w,nodeLookup:z,parentLookup:C,domNode:T,nodeOrigin:I,nodeExtent:B,debug:U,fitViewQueued:X,zIndexMode:G}=S(),{changes:ne,updatedInternals:V}=$T(E,z,C,T,I,B,G);V&&(qT(z,C,{nodeOrigin:I,nodeExtent:B,zIndexMode:G}),X?(b(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(ne==null?void 0:ne.length)>0&&(U&&console.log("React Flow: trigger node changes",ne),w==null||w(ne)))},updateNodePositions:(E,w=!1)=>{const z=[];let C=[];const{nodeLookup:T,triggerNodeChanges:I,connection:B,updateConnection:U,onNodesChangeMiddlewareMap:X}=S();for(const[G,ne]of E){const V=T.get(G),j=!!(V!=null&&V.expandParent&&(V!=null&&V.parentId)&&(ne!=null&&ne.position)),F={id:G,type:"position",position:j?{x:Math.max(0,ne.position.x),y:Math.max(0,ne.position.y)}:ne.position,dragging:w};if(V&&B.inProgress&&B.fromNode.id===V.id){const R=As(V,B.fromHandle,we.Left,!0);U({...B,from:R})}j&&V.parentId&&z.push({id:G,parentId:V.parentId,rect:{...ne.internals.positionAbsolute,width:ne.measured.width??0,height:ne.measured.height??0}}),C.push(F)}if(z.length>0){const{parentLookup:G,nodeOrigin:ne}=S(),V=Zg(z,T,G,ne);C.push(...V)}for(const G of X.values())C=G(C);I(C)},triggerNodeChanges:E=>{const{onNodesChange:w,setNodes:z,nodes:C,hasDefaultNodes:T,debug:I}=S();if(E!=null&&E.length){if(T){const B=xx(E,C);z(B)}I&&console.log("React Flow: trigger node changes",E),w==null||w(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:w,setEdges:z,edges:C,hasDefaultEdges:T,debug:I}=S();if(E!=null&&E.length){if(T){const B=wx(E,C);z(B)}I&&console.log("React Flow: trigger edge changes",E),w==null||w(E)}},addSelectedNodes:E=>{const{multiSelectionActive:w,edgeLookup:z,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:I}=S();if(w){const B=E.map(U=>vs(U,!0));T(B);return}T(El(C,new Set([...E]),!0)),I(El(z))},addSelectedEdges:E=>{const{multiSelectionActive:w,edgeLookup:z,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:I}=S();if(w){const B=E.map(U=>vs(U,!0));I(B);return}I(El(z,new Set([...E]))),T(El(C,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:w}={})=>{const{edges:z,nodes:C,nodeLookup:T,triggerNodeChanges:I,triggerEdgeChanges:B}=S(),U=E||C,X=w||z,G=U.map(V=>{const j=T.get(V.id);return j&&(j.selected=!1),vs(V.id,!1)}),ne=X.map(V=>vs(V.id,!1));I(G),B(ne)},setMinZoom:E=>{const{panZoom:w,maxZoom:z}=S();w==null||w.setScaleExtent([E,z]),y({minZoom:E})},setMaxZoom:E=>{const{panZoom:w,minZoom:z}=S();w==null||w.setScaleExtent([z,E]),y({maxZoom:E})},setTranslateExtent:E=>{var w;(w=S().panZoom)==null||w.setTranslateExtent(E),y({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:w,triggerNodeChanges:z,triggerEdgeChanges:C,elementsSelectable:T}=S();if(!T)return;const I=w.reduce((U,X)=>X.selected?[...U,vs(X.id,!1)]:U,[]),B=E.reduce((U,X)=>X.selected?[...U,vs(X.id,!1)]:U,[]);z(I),C(B)},setNodeExtent:E=>{const{nodes:w,nodeLookup:z,parentLookup:C,nodeOrigin:T,elevateNodesOnSelect:I,nodeExtent:B,zIndexMode:U}=S();E[0][0]===B[0][0]&&E[0][1]===B[0][1]&&E[1][0]===B[1][0]&&E[1][1]===B[1][1]||(Ip(w,z,C,{nodeOrigin:T,nodeExtent:E,elevateNodesOnSelect:I,checkEquality:!1,zIndexMode:U}),y({nodeExtent:E}))},panBy:E=>{const{transform:w,width:z,height:C,panZoom:T,translateExtent:I}=S();return WT({delta:E,panZoom:T,transform:w,translateExtent:I,width:z,height:C})},setCenter:async(E,w,z)=>{const{width:C,height:T,maxZoom:I,panZoom:B}=S();if(!B)return Promise.resolve(!1);const U=typeof(z==null?void 0:z.zoom)<"u"?z.zoom:I;return await B.setViewport({x:C/2-E*U,y:T/2-w*U,zoom:U},{duration:z==null?void 0:z.duration,ease:z==null?void 0:z.ease,interpolate:z==null?void 0:z.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...Fb}})},updateConnection:E=>{y({connection:E})},reset:()=>y({...bS()})}},Object.is);function Xx({initialNodes:e,initialEdges:t,defaultNodes:i,defaultEdges:r,initialWidth:l,initialHeight:a,initialMinZoom:c,initialMaxZoom:h,initialFitViewOptions:d,fitView:f,nodeOrigin:m,nodeExtent:g,zIndexMode:v,children:y}){const[S]=q.useState(()=>uN({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,width:l,height:a,fitView:f,minZoom:c,maxZoom:h,fitViewOptions:d,nodeOrigin:m,nodeExtent:g,zIndexMode:v}));return k.jsx(A3,{value:S,children:k.jsx(Q3,{children:y})})}function hN({children:e,nodes:t,edges:i,defaultNodes:r,defaultEdges:l,width:a,height:c,fitView:h,fitViewOptions:d,minZoom:f,maxZoom:m,nodeOrigin:g,nodeExtent:v,zIndexMode:y}){return q.useContext(fh)?k.jsx(k.Fragment,{children:e}):k.jsx(Xx,{initialNodes:t,initialEdges:i,defaultNodes:r,defaultEdges:l,initialWidth:a,initialHeight:c,fitView:h,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:m,nodeOrigin:g,nodeExtent:v,zIndexMode:y,children:e})}const fN={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function dN({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,className:l,nodeTypes:a,edgeTypes:c,onNodeClick:h,onEdgeClick:d,onInit:f,onMove:m,onMoveStart:g,onMoveEnd:v,onConnect:y,onConnectStart:S,onConnectEnd:b,onClickConnectStart:E,onClickConnectEnd:w,onNodeMouseEnter:z,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:B,onNodeDragStart:U,onNodeDrag:X,onNodeDragStop:G,onNodesDelete:ne,onEdgesDelete:V,onDelete:j,onSelectionChange:F,onSelectionDragStart:R,onSelectionDrag:O,onSelectionDragStop:M,onSelectionContextMenu:P,onSelectionStart:H,onSelectionEnd:Y,onBeforeDelete:A,connectionMode:L,connectionLineType:$=Yr.Bezier,connectionLineStyle:N,connectionLineComponent:ee,connectionLineContainerStyle:ce,deleteKeyCode:oe="Backspace",selectionKeyCode:fe="Shift",selectionOnDrag:he=!1,selectionMode:pe=ga.Full,panActivationKeyCode:Ce="Space",multiSelectionKeyCode:xe=va()?"Meta":"Control",zoomActivationKeyCode:Se=va()?"Meta":"Control",snapToGrid:me,snapGrid:Ne,onlyRenderVisibleElements:$e=!1,selectNodesOnDrag:ze,nodesDraggable:St,autoPanOnNodeFocus:Ci,nodesConnectable:Jt,nodesFocusable:ui,nodeOrigin:Qi=Sx,edgesFocusable:Nn,edgesReconnectable:Dn,elementsSelectable:Lt=!0,defaultViewport:ar=q3,minZoom:re=.5,maxZoom:ge=2,translateExtent:ke=pa,preventScrolling:Oe=!0,nodeExtent:Fe,defaultMarkerColor:si="#b1b1b7",zoomOnScroll:Ji=!0,zoomOnPinch:$t=!0,panOnScroll:bt=!1,panOnScrollSpeed:ei=.5,panOnScrollMode:Ze=Cs.Free,zoomOnDoubleClick:hn=!0,panOnDrag:Ei=!0,onPaneClick:Ch,onPaneMouseEnter:Ls,onPaneMouseMove:zs,onPaneMouseLeave:Os,onPaneScroll:Rn,onPaneContextMenu:Hs,paneClickDistance:Gr=1,nodeClickDistance:Eh=0,children:Pa,onReconnect:Vl,onReconnectStart:Zr,onReconnectEnd:kh,onEdgeContextMenu:Ia,onEdgeDoubleClick:ja,onEdgeMouseEnter:Ua,onEdgeMouseMove:Fl,onEdgeMouseLeave:Yl,reconnectRadius:qa=10,onNodesChange:Va,onEdgesChange:fn,noDragClassName:zt="nodrag",noWheelClassName:ti="nowheel",noPanClassName:Bn="nopan",fitView:Ps,fitViewOptions:Fa,connectOnClick:Mh,attributionPosition:Ya,proOptions:Qr,defaultEdgeOptions:$l,elevateNodesOnSelect:cr=!0,elevateEdgesOnSelect:ur=!1,disableKeyboardA11y:hr=!1,autoPanOnConnect:fr,autoPanOnNodeDrag:Et,autoPanSpeed:$a,connectionRadius:Wa,isValidConnection:Ln,onError:dr,style:Th,id:Wl,nodeDragThreshold:Xa,connectionDragThreshold:Ah,viewport:Is,onViewportChange:js,width:en,height:hi,colorMode:Ka="light",debug:Nh,onScroll:pr,ariaLabelConfig:Ga,zIndexMode:Jr="basic",...Dh},fi){const es=Wl||"1",Za=$3(Ka),Xl=q.useCallback(zn=>{zn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),pr==null||pr(zn)},[pr]);return k.jsx("div",{"data-testid":"rf__wrapper",...Dh,onScroll:Xl,style:{...Th,...fN},ref:fi,className:Bt(["react-flow",l,Za]),id:Wl,role:"application",children:k.jsxs(hN,{nodes:e,edges:t,width:en,height:hi,fitView:Ps,fitViewOptions:Fa,minZoom:re,maxZoom:ge,nodeOrigin:Qi,nodeExtent:Fe,zIndexMode:Jr,children:[k.jsx(cN,{onInit:f,onNodeClick:h,onEdgeClick:d,onNodeMouseEnter:z,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:I,onNodeDoubleClick:B,nodeTypes:a,edgeTypes:c,connectionLineType:$,connectionLineStyle:N,connectionLineComponent:ee,connectionLineContainerStyle:ce,selectionKeyCode:fe,selectionOnDrag:he,selectionMode:pe,deleteKeyCode:oe,multiSelectionKeyCode:xe,panActivationKeyCode:Ce,zoomActivationKeyCode:Se,onlyRenderVisibleElements:$e,defaultViewport:ar,translateExtent:ke,minZoom:re,maxZoom:ge,preventScrolling:Oe,zoomOnScroll:Ji,zoomOnPinch:$t,zoomOnDoubleClick:hn,panOnScroll:bt,panOnScrollSpeed:ei,panOnScrollMode:Ze,panOnDrag:Ei,onPaneClick:Ch,onPaneMouseEnter:Ls,onPaneMouseMove:zs,onPaneMouseLeave:Os,onPaneScroll:Rn,onPaneContextMenu:Hs,paneClickDistance:Gr,nodeClickDistance:Eh,onSelectionContextMenu:P,onSelectionStart:H,onSelectionEnd:Y,onReconnect:Vl,onReconnectStart:Zr,onReconnectEnd:kh,onEdgeContextMenu:Ia,onEdgeDoubleClick:ja,onEdgeMouseEnter:Ua,onEdgeMouseMove:Fl,onEdgeMouseLeave:Yl,reconnectRadius:qa,defaultMarkerColor:si,noDragClassName:zt,noWheelClassName:ti,noPanClassName:Bn,rfId:es,disableKeyboardA11y:hr,nodeExtent:Fe,viewport:Is,onViewportChange:js}),k.jsx(Y3,{nodes:e,edges:t,defaultNodes:i,defaultEdges:r,onConnect:y,onConnectStart:S,onConnectEnd:b,onClickConnectStart:E,onClickConnectEnd:w,nodesDraggable:St,autoPanOnNodeFocus:Ci,nodesConnectable:Jt,nodesFocusable:ui,edgesFocusable:Nn,edgesReconnectable:Dn,elementsSelectable:Lt,elevateNodesOnSelect:cr,elevateEdgesOnSelect:ur,minZoom:re,maxZoom:ge,nodeExtent:Fe,onNodesChange:Va,onEdgesChange:fn,snapToGrid:me,snapGrid:Ne,connectionMode:L,translateExtent:ke,connectOnClick:Mh,defaultEdgeOptions:$l,fitView:Ps,fitViewOptions:Fa,onNodesDelete:ne,onEdgesDelete:V,onDelete:j,onNodeDragStart:U,onNodeDrag:X,onNodeDragStop:G,onSelectionDrag:O,onSelectionDragStart:R,onSelectionDragStop:M,onMove:m,onMoveStart:g,onMoveEnd:v,noPanClassName:Bn,nodeOrigin:Qi,rfId:es,autoPanOnConnect:fr,autoPanOnNodeDrag:Et,autoPanSpeed:$a,onError:dr,connectionRadius:Wa,isValidConnection:Ln,selectNodesOnDrag:ze,nodeDragThreshold:Xa,connectionDragThreshold:Ah,onBeforeDelete:A,debug:Nh,ariaLabelConfig:Ga,zIndexMode:Jr}),k.jsx(U3,{onSelectionChange:F}),Pa,k.jsx(O3,{proOptions:Qr,position:Ya}),k.jsx(z3,{rfId:es,disableKeyboardA11y:hr})]})})}var pN=Cx(dN);function gN(e){const[t,i]=q.useState(e),r=q.useCallback(l=>i(a=>xx(l,a)),[]);return[t,i,r]}function mN(e){const[t,i]=q.useState(e),r=q.useCallback(l=>i(a=>wx(l,a)),[]);return[t,i,r]}function _N({dimensions:e,lineWidth:t,variant:i,className:r}){return k.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Bt(["react-flow__background-pattern",i,r])})}function vN({radius:e,className:t}){return k.jsx("circle",{cx:e,cy:e,r:e,className:Bt(["react-flow__background-pattern","dots",t])})}var nr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(nr||(nr={}));const yN={[nr.Dots]:1,[nr.Lines]:1,[nr.Cross]:6},SN=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Kx({id:e,variant:t=nr.Dots,gap:i=20,size:r,lineWidth:l=1,offset:a=0,color:c,bgColor:h,style:d,className:f,patternClassName:m}){const g=q.useRef(null),{transform:v,patternId:y}=Ye(SN,ht),S=r||yN[t],b=t===nr.Dots,E=t===nr.Cross,w=Array.isArray(i)?i:[i,i],z=[w[0]*v[2]||1,w[1]*v[2]||1],C=S*v[2],T=Array.isArray(a)?a:[a,a],I=E?[C,C]:z,B=[T[0]*v[2]||1+I[0]/2,T[1]*v[2]||1+I[1]/2],U=`${y}${e||""}`;return k.jsxs("svg",{className:Bt(["react-flow__background",f]),style:{...d,...gh,"--xy-background-color-props":h,"--xy-background-pattern-color-props":c},ref:g,"data-testid":"rf__background",children:[k.jsx("pattern",{id:U,x:v[0]%z[0],y:v[1]%z[1],width:z[0],height:z[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${B[0]},-${B[1]})`,children:b?k.jsx(vN,{radius:C/2,className:m}):k.jsx(_N,{dimensions:I,lineWidth:l,variant:t,className:m})}),k.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${U})`})]})}Kx.displayName="Background";const bN=q.memo(Kx);function xN(){return k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:k.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function wN(){return k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:k.jsx("path",{d:"M0 0h32v4.2H0z"})})}function CN(){return k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:k.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function EN(){return k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:k.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function kN(){return k.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:k.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function gu({children:e,className:t,...i}){return k.jsx("button",{type:"button",className:Bt(["react-flow__controls-button",t]),...i,children:e})}const MN=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Gx({style:e,showZoom:t=!0,showFitView:i=!0,showInteractive:r=!0,fitViewOptions:l,onZoomIn:a,onZoomOut:c,onFitView:h,onInteractiveChange:d,className:f,children:m,position:g="bottom-left",orientation:v="vertical","aria-label":y}){const S=dt(),{isInteractive:b,minZoomReached:E,maxZoomReached:w,ariaLabelConfig:z}=Ye(MN,ht),{zoomIn:C,zoomOut:T,fitView:I}=ph(),B=()=>{C(),a==null||a()},U=()=>{T(),c==null||c()},X=()=>{I(l),h==null||h()},G=()=>{S.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)},ne=v==="horizontal"?"horizontal":"vertical";return k.jsxs(dh,{className:Bt(["react-flow__controls",ne,f]),position:g,style:e,"data-testid":"rf__controls","aria-label":y??z["controls.ariaLabel"],children:[t&&k.jsxs(k.Fragment,{children:[k.jsx(gu,{onClick:B,className:"react-flow__controls-zoomin",title:z["controls.zoomIn.ariaLabel"],"aria-label":z["controls.zoomIn.ariaLabel"],disabled:w,children:k.jsx(xN,{})}),k.jsx(gu,{onClick:U,className:"react-flow__controls-zoomout",title:z["controls.zoomOut.ariaLabel"],"aria-label":z["controls.zoomOut.ariaLabel"],disabled:E,children:k.jsx(wN,{})})]}),i&&k.jsx(gu,{className:"react-flow__controls-fitview",onClick:X,title:z["controls.fitView.ariaLabel"],"aria-label":z["controls.fitView.ariaLabel"],children:k.jsx(CN,{})}),r&&k.jsx(gu,{className:"react-flow__controls-interactive",onClick:G,title:z["controls.interactive.ariaLabel"],"aria-label":z["controls.interactive.ariaLabel"],children:b?k.jsx(kN,{}):k.jsx(EN,{})}),m]})}Gx.displayName="Controls";const TN=q.memo(Gx);function AN({id:e,x:t,y:i,width:r,height:l,style:a,color:c,strokeColor:h,strokeWidth:d,className:f,borderRadius:m,shapeRendering:g,selected:v,onClick:y}){const{background:S,backgroundColor:b}=a||{},E=c||S||b;return k.jsx("rect",{className:Bt(["react-flow__minimap-node",{selected:v},f]),x:t,y:i,rx:m,ry:m,width:r,height:l,style:{fill:E,stroke:h,strokeWidth:d},shapeRendering:g,onClick:y?w=>y(w,e):void 0})}const NN=q.memo(AN),DN=e=>e.nodes.map(t=>t.id),tp=e=>e instanceof Function?e:()=>e;function RN({nodeStrokeColor:e,nodeColor:t,nodeClassName:i="",nodeBorderRadius:r=5,nodeStrokeWidth:l,nodeComponent:a=NN,onClick:c}){const h=Ye(DN,ht),d=tp(t),f=tp(e),m=tp(i),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return k.jsx(k.Fragment,{children:h.map(v=>k.jsx(LN,{id:v,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:m,nodeBorderRadius:r,nodeStrokeWidth:l,NodeComponent:a,onClick:c,shapeRendering:g},v))})}function BN({id:e,nodeColorFunc:t,nodeStrokeColorFunc:i,nodeClassNameFunc:r,nodeBorderRadius:l,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:h,onClick:d}){const{node:f,x:m,y:g,width:v,height:y}=Ye(S=>{const{internals:b}=S.nodeLookup.get(e),E=b.userNode,{x:w,y:z}=b.positionAbsolute,{width:C,height:T}=sr(E);return{node:E,x:w,y:z,width:C,height:T}},ht);return!f||f.hidden||!Zb(f)?null:k.jsx(h,{x:m,y:g,width:v,height:y,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:l,strokeColor:i(f),strokeWidth:a,shapeRendering:c,onClick:d,id:f.id})}const LN=q.memo(BN);var zN=q.memo(RN);const ON=200,HN=150,PN=e=>!e.hidden,IN=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Gb(Aa(e.nodeLookup,{filter:PN}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},jN="react-flow__minimap-desc";function Zx({style:e,className:t,nodeStrokeColor:i,nodeColor:r,nodeClassName:l="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:h,bgColor:d,maskColor:f,maskStrokeColor:m,maskStrokeWidth:g,position:v="bottom-right",onClick:y,onNodeClick:S,pannable:b=!1,zoomable:E=!1,ariaLabel:w,inversePan:z,zoomStep:C=1,offsetScale:T=5}){const I=dt(),B=q.useRef(null),{boundingRect:U,viewBB:X,rfId:G,panZoom:ne,translateExtent:V,flowWidth:j,flowHeight:F,ariaLabelConfig:R}=Ye(IN,ht),O=(e==null?void 0:e.width)??ON,M=(e==null?void 0:e.height)??HN,P=U.width/O,H=U.height/M,Y=Math.max(P,H),A=Y*O,L=Y*M,$=T*Y,N=U.x-(A-U.width)/2-$,ee=U.y-(L-U.height)/2-$,ce=A+$*2,oe=L+$*2,fe=`${jN}-${G}`,he=q.useRef(0),pe=q.useRef();he.current=Y,q.useEffect(()=>{if(B.current&&ne)return pe.current=i3({domNode:B.current,panZoom:ne,getTransform:()=>I.getState().transform,getViewScale:()=>he.current}),()=>{var me;(me=pe.current)==null||me.destroy()}},[ne]),q.useEffect(()=>{var me;(me=pe.current)==null||me.update({translateExtent:V,width:j,height:F,inversePan:z,pannable:b,zoomStep:C,zoomable:E})},[b,E,z,C,V,j,F]);const Ce=y?me=>{var ze;const[Ne,$e]=((ze=pe.current)==null?void 0:ze.pointer(me))||[0,0];y(me,{x:Ne,y:$e})}:void 0,xe=S?q.useCallback((me,Ne)=>{const $e=I.getState().nodeLookup.get(Ne).internals.userNode;S(me,$e)},[]):void 0,Se=w??R["minimap.ariaLabel"];return k.jsx(dh,{position:v,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*Y:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:Bt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:k.jsxs("svg",{width:O,height:M,viewBox:`${N} ${ee} ${ce} ${oe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":fe,ref:B,onClick:Ce,children:[Se&&k.jsx("title",{id:fe,children:Se}),k.jsx(zN,{onClick:xe,nodeColor:r,nodeStrokeColor:i,nodeBorderRadius:a,nodeClassName:l,nodeStrokeWidth:c,nodeComponent:h}),k.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-$},${ee-$}h${ce+$*2}v${oe+$*2}h${-ce-$*2}z
71
+ M${X.x},${X.y}h${X.width}v${X.height}h${-X.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Zx.displayName="MiniMap";const UN=q.memo(Zx),qN=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,VN={[Hl.Line]:"right",[Hl.Handle]:"bottom-right"};function FN({nodeId:e,position:t,variant:i=Hl.Handle,className:r,style:l=void 0,children:a,color:c,minWidth:h=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:v,autoScale:y=!0,shouldResize:S,onResizeStart:b,onResize:E,onResizeEnd:w}){const z=Tx(),C=typeof e=="string"?e:z,T=dt(),I=q.useRef(null),B=i===Hl.Handle,U=Ye(q.useCallback(qN(B&&y),[B,y]),ht),X=q.useRef(null),G=t??VN[i];q.useEffect(()=>{if(!(!I.current||!C))return X.current||(X.current=m3({domNode:I.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:V,transform:j,snapGrid:F,snapToGrid:R,nodeOrigin:O,domNode:M}=T.getState();return{nodeLookup:V,transform:j,snapGrid:F,snapToGrid:R,nodeOrigin:O,paneDomNode:M}},onChange:(V,j)=>{const{triggerNodeChanges:F,nodeLookup:R,parentLookup:O,nodeOrigin:M}=T.getState(),P=[],H={x:V.x,y:V.y},Y=R.get(C);if(Y&&Y.expandParent&&Y.parentId){const A=Y.origin??M,L=V.width??Y.measured.width??0,$=V.height??Y.measured.height??0,N={id:Y.id,parentId:Y.parentId,rect:{width:L,height:$,...Qb({x:V.x??Y.position.x,y:V.y??Y.position.y},{width:L,height:$},Y.parentId,R,A)}},ee=Zg([N],R,O,M);P.push(...ee),H.x=V.x?Math.max(A[0]*L,V.x):void 0,H.y=V.y?Math.max(A[1]*$,V.y):void 0}if(H.x!==void 0&&H.y!==void 0){const A={id:C,type:"position",position:{...H}};P.push(A)}if(V.width!==void 0&&V.height!==void 0){const L={id:C,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:V.width,height:V.height}};P.push(L)}for(const A of j){const L={...A,type:"position"};P.push(L)}F(P)},onEnd:({width:V,height:j})=>{const F={id:C,type:"dimensions",resizing:!1,dimensions:{width:V,height:j}};T.getState().triggerNodeChanges([F])}})),X.current.update({controlPosition:G,boundaries:{minWidth:h,minHeight:d,maxWidth:f,maxHeight:m},keepAspectRatio:g,resizeDirection:v,onResizeStart:b,onResize:E,onResizeEnd:w,shouldResize:S}),()=>{var V;(V=X.current)==null||V.destroy()}},[G,h,d,f,m,g,b,E,w,S]);const ne=G.split("-");return k.jsx("div",{className:Bt(["react-flow__resize-control","nodrag",...ne,i,r]),ref:I,style:{...l,scale:U,...c&&{[B?"backgroundColor":"borderColor"]:c}},children:a})}q.memo(FN);const YN=1e3,$N=1e4;function WN(){const[e,t]=q.useState({workflows:[],parseErrors:[]}),[i,r]=q.useState(!1),l=q.useRef(0),a=q.useRef(null),c=q.useRef(new EventTarget),h=q.useCallback(f=>{const m=a.current;m&&m.readyState===WebSocket.OPEN&&m.send(JSON.stringify(f))},[]),d=q.useCallback(()=>{const f=window.location.protocol==="https:"?"wss:":"ws:",m=new WebSocket(`${f}//${window.location.host}`);a.current=m,m.onopen=()=>{r(!0),l.current=0},m.onclose=()=>{r(!1),a.current=null;const g=Math.min(YN*2**l.current,$N);l.current++,setTimeout(d,g)},m.onerror=()=>{m.close()},m.onmessage=g=>{try{const v=JSON.parse(g.data);switch(v.type){case"full-sync":t(v.data);break;case"workflow-updated":t(y=>{const S=y.workflows.filter(E=>E.filePath!==v.data.filePath||E.workflowName!==v.data.workflowName);S.push(v.data);const b=y.parseErrors.filter(E=>E.filePath!==v.data.filePath);return{workflows:S,parseErrors:b}});break;case"workflow-removed":t(y=>({workflows:y.workflows.filter(S=>S.filePath!==v.data.filePath),parseErrors:y.parseErrors.filter(S=>S.filePath!==v.data.filePath)}));break;case"parse-error":t(y=>{const S=y.workflows.filter(E=>E.filePath!==v.data.filePath),b=y.parseErrors.filter(E=>E.filePath!==v.data.filePath);return b.push(v.data),{workflows:S,parseErrors:b}});break;case"pty-data":c.current.dispatchEvent(new CustomEvent("data",{detail:v.data}));break;case"pty-exit":c.current.dispatchEvent(new CustomEvent("exit",{detail:v.data.code}));break;case"pty-spawned":c.current.dispatchEvent(new CustomEvent("spawned",{detail:v.data.pid}));break}}catch{}}},[]);return q.useEffect(()=>(d(),()=>{var f;(f=a.current)==null||f.close()}),[d]),{state:e,connected:i,sendMessage:h,ptyEvents:c.current}}function XN(){const[e,t]=q.useState([]),[i,r]=q.useState(!0),[l,a]=q.useState(0),c=q.useCallback(async()=>{try{const m=await fetch("/api/connections");m.ok&&t(await m.json())}catch{}finally{r(!1)}},[]);q.useEffect(()=>{c()},[c]);const h=q.useCallback(async m=>{await fetch("/api/connections",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),await c(),a(g=>g+1)},[c]),d=q.useCallback(async(m,g,v)=>{await fetch("/api/connections",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow_name:m,node_name:g,integration_id:v})}),await c(),a(y=>y+1)},[c]),f=q.useCallback((m,g,v)=>e.find(y=>y.workflow_name===m&&y.node_name===g&&y.integration_id===v)??e.find(y=>y.workflow_name==="*"&&y.node_name==="*"&&y.integration_id===v)??null,[e]);return{connections:e,loading:i,upsert:h,remove:d,getForNode:f,refetch:c,mutationVersion:l}}function KN(){const[e,t]=q.useState([]),[i,r]=q.useState(!0);return q.useEffect(()=>{(async()=>{try{const l=await fetch("/api/nango/integrations");l.ok&&t(await l.json())}catch{}finally{r(!1)}})()},[]),{integrations:e,loading:i}}function GN(e,t=0){const[i,r]=q.useState([]),[l,a]=q.useState(!1),c=q.useCallback(async()=>{if(!e)return[];a(!0);try{const h=await fetch(`/api/nango/connections/${encodeURIComponent(e)}`);if(h.ok){const d=await h.json();return r(d),d}}catch{}finally{a(!1)}return[]},[e]);return q.useEffect(()=>{c()},[c,t]),{nangoConnections:i,loading:l,refetch:c}}const ZN=5e3;function QN(e){const[t,i]=q.useState([]),[r,l]=q.useState(!0),[a,c]=q.useState(!0),[h,d]=q.useState(null),[f,m]=q.useState(null),[g,v]=q.useState(!1),y=q.useRef(void 0),S=q.useCallback(async()=>{try{const E=new URLSearchParams;e&&E.set("workflow",e),E.set("limit","50");const w=await fetch(`/api/runs?${E}`);w.ok?(i(await w.json()),c(!0)):c(!1)}catch{c(!1)}finally{l(!1)}},[e]);q.useEffect(()=>(l(!0),S(),y.current=setInterval(S,ZN),()=>clearInterval(y.current)),[S]);const b=q.useCallback(async E=>{if(d(E),!E){m(null);return}v(!0);try{const w=await fetch(`/api/runs/${E}/trace`);w.ok&&m(await w.json())}catch{}finally{v(!1)}},[]);return{runs:t,loading:r,available:a,selectedRunId:h,trace:f,traceLoading:g,selectRun:b,refresh:S}}/**
72
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
73
+ * @license MIT
74
+ *
75
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
76
+ * @license MIT
77
+ *
78
+ * Originally forked from (with the author's permission):
79
+ * Fabrice Bellard's javascript vt100 for jslinux:
80
+ * http://bellard.org/jslinux/
81
+ * Copyright (c) 2011 Fabrice Bellard
82
+ */var Qx=Object.defineProperty,JN=Object.getOwnPropertyDescriptor,eD=(e,t)=>{for(var i in t)Qx(e,i,{get:t[i],enumerable:!0})},yt=(e,t,i,r)=>{for(var l=r>1?void 0:r?JN(t,i):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(l=(r?c(t,i,l):c(l))||l);return r&&l&&Qx(t,i,l),l},ve=(e,t)=>(i,r)=>t(i,r,e),xS="Terminal input",qp={get:()=>xS,set:e=>xS=e},wS="Too much output to announce, navigate to rows manually to read",Vp={get:()=>wS,set:e=>wS=e};function tD(e){return e.replace(/\r?\n/g,"\r")}function iD(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function nD(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function rD(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");Jx(l,t,i,r)}}function Jx(e,t,i,r){e=tD(e),e=iD(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function ew(e,t,i){let r=i.getBoundingClientRect(),l=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function CS(e,t,i,r,l){ew(e,t,i),l&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Fr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _h(e,t=0,i=e.length){let r="";for(let l=t;l<i;++l){let a=e[l];a>65535?(a-=65536,r+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):r+=String.fromCharCode(a)}return r}var sD=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,l=0;if(this._interim){let a=e.charCodeAt(l++);56320<=a&&a<=57343?t[r++]=(this._interim-55296)*1024+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0}for(let a=l;a<i;++a){let c=e.charCodeAt(a);if(55296<=c&&c<=56319){if(++a>=i)return this._interim=c,r;let h=e.charCodeAt(a);56320<=h&&h<=57343?t[r++]=(c-55296)*1024+h-56320+65536:(t[r++]=c,t[r++]=h);continue}c!==65279&&(t[r++]=c)}return r}},lD=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r=0,l,a,c,h,d=0,f=0;if(this.interim[0]){let v=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let S=0,b;for(;(b=this.interim[++S]&63)&&S<4;)y<<=6,y|=b;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,w=E-S;for(;f<w;){if(f>=i)return 0;if(b=e[f++],(b&192)!==128){f--,v=!0;break}else this.interim[S++]=b,y<<=6,y|=b&63}v||(E===2?y<128?f--:t[r++]=y:E===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let m=i-4,g=f;for(;g<i;){for(;g<m&&!((l=e[g])&128)&&!((a=e[g+1])&128)&&!((c=e[g+2])&128)&&!((h=e[g+3])&128);)t[r++]=l,t[r++]=a,t[r++]=c,t[r++]=h,g+=4;if(l=e[g++],l<128)t[r++]=l;else if((l&224)===192){if(g>=i)return this.interim[0]=l,r;if(a=e[g++],(a&192)!==128){g--;continue}if(d=(l&31)<<6|a&63,d<128){g--;continue}t[r++]=d}else if((l&240)===224){if(g>=i)return this.interim[0]=l,r;if(a=e[g++],(a&192)!==128){g--;continue}if(g>=i)return this.interim[0]=l,this.interim[1]=a,r;if(c=e[g++],(c&192)!==128){g--;continue}if(d=(l&15)<<12|(a&63)<<6|c&63,d<2048||d>=55296&&d<=57343||d===65279)continue;t[r++]=d}else if((l&248)===240){if(g>=i)return this.interim[0]=l,r;if(a=e[g++],(a&192)!==128){g--;continue}if(g>=i)return this.interim[0]=l,this.interim[1]=a,r;if(c=e[g++],(c&192)!==128){g--;continue}if(g>=i)return this.interim[0]=l,this.interim[1]=a,this.interim[2]=c,r;if(h=e[g++],(h&192)!==128){g--;continue}if(d=(l&7)<<18|(a&63)<<12|(c&63)<<6|h&63,d<65536||d>1114111)continue;t[r++]=d}}return r}},tw="",$r=" ",Ra=class iw{constructor(){this.fg=0,this.bg=0,this.extended=new Xu}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new iw;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Xu=class nw{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new nw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Zi=class rw extends Ra{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Xu,this.combinedData=""}static fromCharData(t){let i=new rw;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Fr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(r-55296)*1024+l-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ES="di$target",Fp="di$dependencies",ip=new Map;function oD(e){return e[Fp]||[]}function Yt(e){if(ip.has(e))return ip.get(e);let t=function(i,r,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");aD(t,i,l)};return t._id=e,ip.set(e,t),t}function aD(e,t,i){t[ES]===t?t[Fp].push({id:e,index:i}):(t[Fp]=[{id:e,index:i}],t[ES]=t)}var ai=Yt("BufferService"),sw=Yt("CoreMouseService"),Rs=Yt("CoreService"),cD=Yt("CharsetService"),Jg=Yt("InstantiationService"),lw=Yt("LogService"),ci=Yt("OptionsService"),ow=Yt("OscLinkService"),uD=Yt("UnicodeService"),Ba=Yt("DecorationService"),Yp=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var m;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let r=[],l=this._optionsService.rawOptions.linkHandler,a=new Zi,c=i.getTrimmedLength(),h=-1,d=-1,f=!1;for(let g=0;g<c;g++)if(!(d===-1&&!i.hasContent(g))){if(i.loadCell(g,a),a.hasExtendedAttrs()&&a.extended.urlId)if(d===-1){d=g,h=a.extended.urlId;continue}else f=a.extended.urlId!==h;else d!==-1&&(f=!0);if(f||d!==-1&&g===c-1){let v=(m=this._oscLinkService.getLinkData(h))==null?void 0:m.uri;if(v){let y={start:{x:d+1,y:e},end:{x:g+(!f&&g===c-1?1:0),y:e}},S=!1;if(!(l!=null&&l.allowNonHttpProtocols))try{let b=new URL(v);["http:","https:"].includes(b.protocol)||(S=!0)}catch{S=!0}S||r.push({text:v,range:y,activate:(b,E)=>l?l.activate(b,E,y):hD(b,E),hover:(b,E)=>{var w;return(w=l==null?void 0:l.hover)==null?void 0:w.call(l,b,E,y)},leave:(b,E)=>{var w;return(w=l==null?void 0:l.leave)==null?void 0:w.call(l,b,E,y)}})}f=!1,a.hasExtendedAttrs()&&a.extended.urlId?(d=g,h=a.extended.urlId):(d=-1,h=-1)}}t(r)}};Yp=yt([ve(0,ai),ve(1,ci),ve(2,ow)],Yp);function hD(e,t){if(confirm(`Do you want to navigate to ${t}?
83
+
84
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var vh=Yt("CharSizeService"),lr=Yt("CoreBrowserService"),em=Yt("MouseService"),or=Yt("RenderService"),fD=Yt("SelectionService"),aw=Yt("CharacterJoinerService"),Il=Yt("ThemeService"),cw=Yt("LinkProviderService"),dD=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?kS.isErrorNoTelemetry(e)?new kS(e.message+`
85
+
86
+ `+e.stack):new Error(e.message+`
87
+
88
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},pD=new dD;function Nu(e){gD(e)||pD.onUnexpectedError(e)}var $p="Canceled";function gD(e){return e instanceof mD?!0:e instanceof Error&&e.name===$p&&e.message===$p}var mD=class extends Error{constructor(){super($p),this.name=this.message}};function _D(e){return new Error(`Illegal argument: ${e}`)}var kS=class Wp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Wp)return t;let i=new Wp;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Xp=class uw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,uw.prototype)}};function Bi(e,t=0){return e[e.length-(1+t)]}var vD;(e=>{function t(a){return a<0}e.isLessThan=t;function i(a){return a<=0}e.isLessThanOrEqual=i;function r(a){return a>0}e.isGreaterThan=r;function l(a){return a===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(vD||(vD={}));function yD(e,t){let i=this,r=!1,l;return function(){return r||(r=!0,t||(l=e.apply(i,arguments))),l}}var hw;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*l(T){yield T}e.single=l;function a(T){return t(T)?T:l(T)}e.wrap=a;function c(T){return T||i}e.from=c;function*h(T){for(let I=T.length-1;I>=0;I--)yield T[I]}e.reverse=h;function d(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=d;function f(T){return T[Symbol.iterator]().next().value}e.first=f;function m(T,I){let B=0;for(let U of T)if(I(U,B++))return!0;return!1}e.some=m;function g(T,I){for(let B of T)if(I(B))return B}e.find=g;function*v(T,I){for(let B of T)I(B)&&(yield B)}e.filter=v;function*y(T,I){let B=0;for(let U of T)yield I(U,B++)}e.map=y;function*S(T,I){let B=0;for(let U of T)yield*I(U,B++)}e.flatMap=S;function*b(...T){for(let I of T)yield*I}e.concat=b;function E(T,I,B){let U=B;for(let X of T)U=I(U,X);return U}e.reduce=E;function*w(T,I,B=T.length){for(I<0&&(I+=T.length),B<0?B+=T.length:B>T.length&&(B=T.length);I<B;I++)yield T[I]}e.slice=w;function z(T,I=Number.POSITIVE_INFINITY){let B=[];if(I===0)return[B,T];let U=T[Symbol.iterator]();for(let X=0;X<I;X++){let G=U.next();if(G.done)return[B,e.empty()];B.push(G.value)}return[B,{[Symbol.iterator](){return U}}]}e.consume=z;async function C(T){let I=[];for await(let B of T)I.push(B);return Promise.resolve(I)}e.asyncToArray=C})(hw||(hw={}));function Ns(e){if(hw.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function SD(...e){return ft(()=>Ns(e))}function ft(e){return{dispose:yD(()=>{e()})}}var fw=class dw{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ns(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?dw.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};fw.DISABLE_DISPOSED_WARNING=!1;var Wr=fw,Pe=class{constructor(){this._store=new Wr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Pe.None=Object.freeze({dispose(){}});var Pl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},ir=typeof window=="object"?window:globalThis,Kp=class Gp{constructor(t){this.element=t,this.next=Gp.Undefined,this.prev=Gp.Undefined}};Kp.Undefined=new Kp(void 0);var pt=Kp,MS=class{constructor(){this._first=pt.Undefined,this._last=pt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===pt.Undefined}clear(){let e=this._first;for(;e!==pt.Undefined;){let t=e.next;e.prev=pt.Undefined,e.next=pt.Undefined,e=t}this._first=pt.Undefined,this._last=pt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new pt(e);if(this._first===pt.Undefined)this._first=i,this._last=i;else if(t){let l=this._last;this._last=i,i.prev=l,l.next=i}else{let l=this._first;this._first=i,i.next=l,l.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==pt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==pt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==pt.Undefined&&e.next!==pt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===pt.Undefined&&e.next===pt.Undefined?(this._first=pt.Undefined,this._last=pt.Undefined):e.next===pt.Undefined?(this._last=this._last.prev,this._last.next=pt.Undefined):e.prev===pt.Undefined&&(this._first=this._first.next,this._first.prev=pt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==pt.Undefined;)yield e.element,e=e.next}},bD=globalThis.performance&&typeof globalThis.performance.now=="function",xD=class pw{static create(t){return new pw(t)}constructor(t){this._now=bD&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Qt;(e=>{e.None=()=>Pe.None;function t(j,F){return g(j,()=>{},0,void 0,!0,void 0,F)}e.defer=t;function i(j){return(F,R=null,O)=>{let M=!1,P;return P=j(H=>{if(!M)return P?P.dispose():M=!0,F.call(R,H)},null,O),M&&P.dispose(),P}}e.once=i;function r(j,F,R){return f((O,M=null,P)=>j(H=>O.call(M,F(H)),null,P),R)}e.map=r;function l(j,F,R){return f((O,M=null,P)=>j(H=>{F(H),O.call(M,H)},null,P),R)}e.forEach=l;function a(j,F,R){return f((O,M=null,P)=>j(H=>F(H)&&O.call(M,H),null,P),R)}e.filter=a;function c(j){return j}e.signal=c;function h(...j){return(F,R=null,O)=>{let M=SD(...j.map(P=>P(H=>F.call(R,H))));return m(M,O)}}e.any=h;function d(j,F,R,O){let M=R;return r(j,P=>(M=F(M,P),M),O)}e.reduce=d;function f(j,F){let R,O={onWillAddFirstListener(){R=j(M.fire,M)},onDidRemoveLastListener(){R==null||R.dispose()}},M=new _e(O);return F==null||F.add(M),M.event}function m(j,F){return F instanceof Array?F.push(j):F&&F.add(j),j}function g(j,F,R=100,O=!1,M=!1,P,H){let Y,A,L,$=0,N,ee={leakWarningThreshold:P,onWillAddFirstListener(){Y=j(oe=>{$++,A=F(A,oe),O&&!L&&(ce.fire(A),A=void 0),N=()=>{let fe=A;A=void 0,L=void 0,(!O||$>1)&&ce.fire(fe),$=0},typeof R=="number"?(clearTimeout(L),L=setTimeout(N,R)):L===void 0&&(L=0,queueMicrotask(N))})},onWillRemoveListener(){M&&$>0&&(N==null||N())},onDidRemoveLastListener(){N=void 0,Y.dispose()}},ce=new _e(ee);return H==null||H.add(ce),ce.event}e.debounce=g;function v(j,F=0,R){return e.debounce(j,(O,M)=>O?(O.push(M),O):[M],F,void 0,!0,void 0,R)}e.accumulate=v;function y(j,F=(O,M)=>O===M,R){let O=!0,M;return a(j,P=>{let H=O||!F(P,M);return O=!1,M=P,H},R)}e.latch=y;function S(j,F,R){return[e.filter(j,F,R),e.filter(j,O=>!F(O),R)]}e.split=S;function b(j,F=!1,R=[],O){let M=R.slice(),P=j(A=>{M?M.push(A):Y.fire(A)});O&&O.add(P);let H=()=>{M==null||M.forEach(A=>Y.fire(A)),M=null},Y=new _e({onWillAddFirstListener(){P||(P=j(A=>Y.fire(A)),O&&O.add(P))},onDidAddFirstListener(){M&&(F?setTimeout(H):H())},onDidRemoveLastListener(){P&&P.dispose(),P=null}});return O&&O.add(Y),Y.event}e.buffer=b;function E(j,F){return(R,O,M)=>{let P=F(new z);return j(function(H){let Y=P.evaluate(H);Y!==w&&R.call(O,Y)},void 0,M)}}e.chain=E;let w=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(F){return this.steps.push(F),this}forEach(F){return this.steps.push(R=>(F(R),R)),this}filter(F){return this.steps.push(R=>F(R)?R:w),this}reduce(F,R){let O=R;return this.steps.push(M=>(O=F(O,M),O)),this}latch(F=(R,O)=>R===O){let R=!0,O;return this.steps.push(M=>{let P=R||!F(M,O);return R=!1,O=M,P?M:w}),this}evaluate(F){for(let R of this.steps)if(F=R(F),F===w)break;return F}}function C(j,F,R=O=>O){let O=(...Y)=>H.fire(R(...Y)),M=()=>j.on(F,O),P=()=>j.removeListener(F,O),H=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:P});return H.event}e.fromNodeEventEmitter=C;function T(j,F,R=O=>O){let O=(...Y)=>H.fire(R(...Y)),M=()=>j.addEventListener(F,O),P=()=>j.removeEventListener(F,O),H=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:P});return H.event}e.fromDOMEventEmitter=T;function I(j){return new Promise(F=>i(j)(F))}e.toPromise=I;function B(j){let F=new _e;return j.then(R=>{F.fire(R)},()=>{F.fire(void 0)}).finally(()=>{F.dispose()}),F.event}e.fromPromise=B;function U(j,F){return j(R=>F.fire(R))}e.forward=U;function X(j,F,R){return F(R),j(O=>F(O))}e.runAndSubscribe=X;class G{constructor(F,R){this._observable=F,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{F.addObserver(this)},onDidRemoveLastListener:()=>{F.removeObserver(this)}};this.emitter=new _e(O),R&&R.add(this.emitter)}beginUpdate(F){this._counter++}handlePossibleChange(F){}handleChange(F,R){this._hasChanged=!0}endUpdate(F){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ne(j,F){return new G(j,F).emitter.event}e.fromObservable=ne;function V(j){return(F,R,O)=>{let M=0,P=!1,H={beginUpdate(){M++},endUpdate(){M--,M===0&&(j.reportChanges(),P&&(P=!1,F.call(R)))},handlePossibleChange(){},handleChange(){P=!0}};j.addObserver(H),j.reportChanges();let Y={dispose(){j.removeObserver(H)}};return O instanceof Wr?O.add(Y):Array.isArray(O)&&O.push(Y),Y}}e.fromObservableLight=V})(Qt||(Qt={}));var Zp=class Qp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Qp._idPool++}`,Qp.all.add(this)}start(t){this._stopWatch=new xD,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Zp.all=new Set,Zp._idPool=0;var wD=Zp,CD=-1,gw=class mw{constructor(t,i,r=(mw._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[a,c]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${c}):`;console.warn(h),console.warn(a);let d=new MD(h,a);this._errorHandler(d)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,l]of this._stacks)(!t||i<l)&&(t=[r,l],i=l);return t}};gw._idPool=1;var ED=gw,kD=class _w{constructor(t){this.value=t}static create(){let t=new Error;return new _w(t.stack??"")}print(){console.warn(this.value.split(`
89
+ `).slice(2).join(`
90
+ `))}},MD=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},TD=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},AD=0,np=class{constructor(e){this.value=e,this.id=AD++}},ND=2,DD,_e=class{constructor(t){var i,r,l,a;this._size=0,this._options=t,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new ED((t==null?void 0:t.onListenerError)??Nu,((r=this._options)==null?void 0:r.leakWarningThreshold)??CD):void 0,this._perfMon=(l=this._options)!=null&&l._profName?new wD(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var t,i,r,l;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(l=this._leakageMon)==null||l.dispose())}get event(){return this._event??(this._event=(t,i,r)=>{var h,d,f,m,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let v=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(v);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new TD(`${v}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((h=this._options)==null?void 0:h.onListenerError)||Nu)(S),Pe.None}if(this._disposed)return Pe.None;i&&(t=t.bind(i));let l=new np(t),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(l.stack=kD.create(),a=this._leakageMon.check(l.stack,this._size+1)),this._listeners?this._listeners instanceof np?(this._deliveryQueue??(this._deliveryQueue=new RD),this._listeners=[this._listeners,l]):this._listeners.push(l):((f=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||f.call(d,this),this._listeners=l,(g=(m=this._options)==null?void 0:m.onDidAddFirstListener)==null||g.call(m,this)),this._size++;let c=ft(()=>{a==null||a(),this._removeListener(l)});return r instanceof Wr?r.add(c):Array.isArray(r)&&r.push(c),c}),this._event}_removeListener(t){var a,c,h,d;if((c=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||c.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h,this),this._size=0;return}let i=this._listeners,r=i.indexOf(t);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[r]=void 0;let l=this._deliveryQueue.current===this;if(this._size*ND<=i.length){let f=0;for(let m=0;m<i.length;m++)i[m]?i[f++]=i[m]:l&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=f}}_deliver(t,i){var l;if(!t)return;let r=((l=this._options)==null?void 0:l.onListenerError)||Nu;if(!r){t.value(i);return}try{t.value(i)}catch(a){r(a)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){var i,r,l,a;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(l=this._perfMon)==null||l.start(this._size),this._listeners)if(this._listeners instanceof np)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},RD=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Jp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Jp.INSTANCE=new Jp;var tm=Jp;function BD(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}tm.INSTANCE.onDidChangeZoomLevel;function LD(e){return tm.INSTANCE.getZoomFactor(e)}tm.INSTANCE.onDidChangeFullscreen;var jl=typeof navigator=="object"?navigator.userAgent:"",eg=jl.indexOf("Firefox")>=0,zD=jl.indexOf("AppleWebKit")>=0,im=jl.indexOf("Chrome")>=0,OD=!im&&jl.indexOf("Safari")>=0;jl.indexOf("Electron/")>=0;jl.indexOf("Android")>=0;var rp=!1;if(typeof ir.matchMedia=="function"){let e=ir.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ir.matchMedia("(display-mode: fullscreen)");rp=e.matches,BD(ir,e,({matches:i})=>{rp&&t.matches||(rp=i)})}var kl="en",tg=!1,ig=!1,Du=!1,vw=!1,mu,Ru=kl,TS=kl,HD,sn,Es=globalThis,Zt,ab;typeof Es.vscode<"u"&&typeof Es.vscode.process<"u"?Zt=Es.vscode.process:typeof process<"u"&&typeof((ab=process==null?void 0:process.versions)==null?void 0:ab.node)=="string"&&(Zt=process);var cb,PD=typeof((cb=Zt==null?void 0:Zt.versions)==null?void 0:cb.electron)=="string",ID=PD&&(Zt==null?void 0:Zt.type)==="renderer",ub;if(typeof Zt=="object"){tg=Zt.platform==="win32",ig=Zt.platform==="darwin",Du=Zt.platform==="linux",Du&&Zt.env.SNAP&&Zt.env.SNAP_REVISION,Zt.env.CI||Zt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,mu=kl,Ru=kl;let e=Zt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);mu=t.userLocale,TS=t.osLocale,Ru=t.resolvedLanguage||kl,HD=(ub=t.languagePack)==null?void 0:ub.translationsConfigFile}catch{}vw=!0}else typeof navigator=="object"&&!ID?(sn=navigator.userAgent,tg=sn.indexOf("Windows")>=0,ig=sn.indexOf("Macintosh")>=0,(sn.indexOf("Macintosh")>=0||sn.indexOf("iPad")>=0||sn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Du=sn.indexOf("Linux")>=0,(sn==null?void 0:sn.indexOf("Mobi"))>=0,Ru=globalThis._VSCODE_NLS_LANGUAGE||kl,mu=navigator.language.toLowerCase(),TS=mu):console.error("Unable to resolve platform.");var yw=tg,En=ig,jD=Du,AS=vw,Mn=sn,jr=Ru,UD;(e=>{function t(){return jr}e.value=t;function i(){return jr.length===2?jr==="en":jr.length>=3?jr[0]==="e"&&jr[1]==="n"&&jr[2]==="-":!1}e.isDefaultVariant=i;function r(){return jr==="en"}e.isDefault=r})(UD||(UD={}));var qD=typeof Es.postMessage=="function"&&!Es.importScripts;(()=>{if(qD){let e=[];Es.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,l=e.length;r<l;r++){let a=e[r];if(a.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),a.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Es.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var VD=!!(Mn&&Mn.indexOf("Chrome")>=0);Mn&&Mn.indexOf("Firefox")>=0;!VD&&Mn&&Mn.indexOf("Safari")>=0;Mn&&Mn.indexOf("Edg/")>=0;Mn&&Mn.indexOf("Android")>=0;var Sl=typeof navigator=="object"?navigator:{};AS||document.queryCommandSupported&&document.queryCommandSupported("copy")||Sl&&Sl.clipboard&&Sl.clipboard.writeText,AS||Sl&&Sl.clipboard&&Sl.clipboard.readText;var nm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},sp=new nm,NS=new nm,DS=new nm,FD=new Array(230),Sw;(e=>{function t(h){return sp.keyCodeToStr(h)}e.toString=t;function i(h){return sp.strToKeyCode(h)}e.fromString=i;function r(h){return NS.keyCodeToStr(h)}e.toUserSettingsUS=r;function l(h){return DS.keyCodeToStr(h)}e.toUserSettingsGeneral=l;function a(h){return NS.strToKeyCode(h)||DS.strToKeyCode(h)}e.fromUserSettings=a;function c(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return sp.keyCodeToStr(h)}e.toElectronAccelerator=c})(Sw||(Sw={}));var YD=class bw{constructor(t,i,r,l,a){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=l,this.keyCode=a}equals(t){return t instanceof bw&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${i}${r}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new $D([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},$D=class{constructor(e){if(e.length===0)throw _D("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function WD(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Sw.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(eg)switch(t){case 59:return 85;case 60:if(jD)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(En)return 57;break}else if(zD&&(En&&t===93||!En&&t===92))return 57;return FD[t]||0}var XD=En?256:2048,KD=512,GD=1024,ZD=En?2048:256,RS=class{constructor(e){var i;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=WD(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=XD),this.altKey&&(t|=KD),this.shiftKey&&(t|=GD),this.metaKey&&(t|=ZD),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new YD(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},BS=new WeakMap;function QD(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var JD=class{static getSameOriginWindowChain(e){let t=BS.get(e);if(!t){t=[],BS.set(e,t);let i=e,r;do r=QD(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,l=this.getSameOriginWindowChain(e);for(let a of l){let c=a.window.deref();if(i+=(c==null?void 0:c.scrollY)??0,r+=(c==null?void 0:c.scrollX)??0,c===t||!a.iframeElement)break;let h=a.iframeElement.getBoundingClientRect();i+=h.top,r+=h.left}return{top:i,left:r}}},_u=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=JD.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},LS=class{constructor(e,t=0,i=0){var l;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(im){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,c=e,h=((l=e.view)==null?void 0:l.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*h):this.deltaY=a.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?eg&&!En?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")OD&&yw?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*h):this.deltaX=a.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let d=e;d.deltaMode===d.DOM_DELTA_LINE?eg&&!En?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},xw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),eR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof tR?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Qt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xw})})(eR||(eR={}));var tR=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?xw:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},rm=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Xp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Xp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},iR=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Xp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=ft(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},nR;(e=>{async function t(r){let l,a=await Promise.all(r.map(c=>c.then(h=>h,h=>{l||(l=h)})));if(typeof l<"u")throw l;return a}e.settled=t;function i(r){return new Promise(async(l,a)=>{try{await r(l,a)}catch(c){a(c)}})}e.withAsyncBody=i})(nR||(nR={}));var zS=class Xi{static fromArray(t){return new Xi(i=>{i.emitMany(t)})}static fromPromise(t){return new Xi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Xi(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new Xi(async i=>{await Promise.all(t.map(async r=>{for await(let l of r)i.emitOne(l)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new _e,queueMicrotask(async()=>{let r={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(r)),this.resolve()}catch(l){this.reject(l)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Qt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new Xi(async r=>{for await(let l of t)r.emitOne(i(l))})}map(t){return Xi.map(this,t)}static filter(t,i){return new Xi(async r=>{for await(let l of t)i(l)&&r.emitOne(l)})}filter(t){return Xi.filter(this,t)}static coalesce(t){return Xi.filter(t,i=>!!i)}coalesce(){return Xi.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return Xi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};zS.EMPTY=zS.fromArray([]);var{getWindow:wn,getWindowId:rR,onDidRegisterWindow:sR}=(function(){let e=new Map,t={window:ir,disposables:new Wr};e.set(ir.vscodeWindowId,t);let i=new _e,r=new _e,l=new _e;function a(c,h){return(typeof c=="number"?e.get(c):void 0)??(h?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:r.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Pe.None;let h=new Wr,d={window:c,disposables:h.add(new Wr)};return e.set(c.vscodeWindowId,d),h.add(ft(()=>{e.delete(c.vscodeWindowId),r.fire(c)})),h.add(Te(c,Ut.BEFORE_UNLOAD,()=>{l.fire(c)})),i.fire(d),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:a,getWindow(c){var f;let h=c;if((f=h==null?void 0:h.ownerDocument)!=null&&f.defaultView)return h.ownerDocument.defaultView.window;let d=c;return d!=null&&d.view?d.view.window:ir},getDocument(c){return wn(c).document}}})(),lR=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Te(e,t,i,r){return new lR(e,t,i,r)}var OS=function(e,t,i,r){return Te(e,t,i,r)},sm,oR=class extends iR{constructor(e){super(),this.defaultTarget=e&&wn(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},HS=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Nu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,l=a=>{i.set(a,!1);let c=e.get(a)??[];for(t.set(a,c),e.set(a,[]),r.set(a,!0);c.length>0;)c.sort(HS.sort),c.shift().execute();r.set(a,!1)};sm=(a,c,h=0)=>{let d=rR(a),f=new HS(c,h),m=e.get(d);return m||(m=[],e.set(d,m)),m.push(f),i.get(d)||(i.set(d,!0),a.requestAnimationFrame(()=>l(d))),f}})();function aR(e){let t=e.getBoundingClientRect(),i=wn(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Ut={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},cR=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=yi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=yi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=yi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=yi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=yi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=yi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=yi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=yi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=yi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=yi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=yi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=yi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=yi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=yi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function yi(e){return typeof e=="number"?`${e}px`:e}function la(e){return new cR(e)}var ww=class{constructor(){this._hooks=new Wr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=l;let a=e;try{e.setPointerCapture(t),this._hooks.add(ft(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=wn(e)}this._hooks.add(Te(a,Ut.POINTER_MOVE,c=>{if(c.buttons!==i){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Te(a,Ut.POINTER_UP,c=>this.stopMonitoring(!0)))}};function uR(e,t,i){let r=null,l=null;if(typeof i.value=="function"?(r="value",l=i.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",l=i.get),!l)throw new Error("not supported");let a=`$memoize$${t}`;i[r]=function(...c){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,c)}),this[a]}}var yn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(yn||(yn={}));var Jo=class ni extends Pe{constructor(){super(),this.dispatched=!1,this.targets=new MS,this.ignoreTargets=new MS,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Qt.runAndSubscribe(sR,({window:t,disposables:i})=>{i.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:ir,disposables:this._store}))}static addTarget(t){if(!ni.isTouchDevice())return Pe.None;ni.INSTANCE||(ni.INSTANCE=new ni);let i=ni.INSTANCE.targets.push(t);return ft(i)}static ignoreTarget(t){if(!ni.isTouchDevice())return Pe.None;ni.INSTANCE||(ni.INSTANCE=new ni);let i=ni.INSTANCE.ignoreTargets.push(t);return ft(i)}static isTouchDevice(){return"ontouchstart"in ir||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,l=t.targetTouches.length;r<l;r++){let a=t.targetTouches.item(r);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:i,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[i],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let c=this.newGestureEvent(yn.Start,a.target);c.pageX=a.pageX,c.pageY=a.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),l=Object.keys(this.activeTouches).length;for(let a=0,c=i.changedTouches.length;a<c;a++){let h=i.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],f=Date.now()-d.initialTimeStamp;if(f<ni.HOLD_DELAY&&Math.abs(d.initialPageX-Bi(d.rollingPageX))<30&&Math.abs(d.initialPageY-Bi(d.rollingPageY))<30){let m=this.newGestureEvent(yn.Tap,d.initialTarget);m.pageX=Bi(d.rollingPageX),m.pageY=Bi(d.rollingPageY),this.dispatchEvent(m)}else if(f>=ni.HOLD_DELAY&&Math.abs(d.initialPageX-Bi(d.rollingPageX))<30&&Math.abs(d.initialPageY-Bi(d.rollingPageY))<30){let m=this.newGestureEvent(yn.Contextmenu,d.initialTarget);m.pageX=Bi(d.rollingPageX),m.pageY=Bi(d.rollingPageY),this.dispatchEvent(m)}else if(l===1){let m=Bi(d.rollingPageX),g=Bi(d.rollingPageY),v=Bi(d.rollingTimestamps)-d.rollingTimestamps[0],y=m-d.rollingPageX[0],S=g-d.rollingPageY[0],b=[...this.targets].filter(E=>d.initialTarget instanceof Node&&E.contains(d.initialTarget));this.inertia(t,b,r,Math.abs(y)/v,y>0?1:-1,m,Math.abs(S)/v,S>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(yn.End,d.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===yn.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ni.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===yn.Change||t.type===yn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let l=0,a=t.initialTarget;for(;a&&a!==r;)l++,a=a.parentElement;i.push([l,r])}i.sort((r,l)=>r[0]-l[0]);for(let[r,l]of i)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,l,a,c,h,d,f){this.handle=sm(t,()=>{let m=Date.now(),g=m-r,v=0,y=0,S=!0;l+=ni.SCROLL_FRICTION*g,h+=ni.SCROLL_FRICTION*g,l>0&&(S=!1,v=a*l*g),h>0&&(S=!1,y=d*h*g);let b=this.newGestureEvent(yn.Change);b.translationX=v,b.translationY=y,i.forEach(E=>E.dispatchEvent(b)),S||this.inertia(t,i,m,l,a,c+v,h,d,f+y)})}onTouchMove(t){let i=Date.now();for(let r=0,l=t.changedTouches.length;r<l;r++){let a=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],h=this.newGestureEvent(yn.Change,c.initialTarget);h.translationX=a.pageX-Bi(c.rollingPageX),h.translationY=a.pageY-Bi(c.rollingPageY),h.pageX=a.pageX,h.pageY=a.pageY,this.dispatchEvent(h),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(a.pageX),c.rollingPageY.push(a.pageY),c.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Jo.SCROLL_FRICTION=-.005,Jo.HOLD_DELAY=700,Jo.CLEAR_TAP_COUNT_TIME=400,yt([uR],Jo,"isTouchDevice",1);var hR=Jo,lm=class extends Pe{onclick(e,t){this._register(Te(e,Ut.CLICK,i=>t(new _u(wn(e),i))))}onmousedown(e,t){this._register(Te(e,Ut.MOUSE_DOWN,i=>t(new _u(wn(e),i))))}onmouseover(e,t){this._register(Te(e,Ut.MOUSE_OVER,i=>t(new _u(wn(e),i))))}onmouseleave(e,t){this._register(Te(e,Ut.MOUSE_LEAVE,i=>t(new _u(wn(e),i))))}onkeydown(e,t){this._register(Te(e,Ut.KEY_DOWN,i=>t(new RS(i))))}onkeyup(e,t){this._register(Te(e,Ut.KEY_UP,i=>t(new RS(i))))}oninput(e,t){this._register(Te(e,Ut.INPUT,t))}onblur(e,t){this._register(Te(e,Ut.BLUR,t))}onfocus(e,t){this._register(Te(e,Ut.FOCUS,t))}onchange(e,t){this._register(Te(e,Ut.CHANGE,t))}ignoreGesture(e){return hR.ignoreTarget(e)}},PS=11,fR=class extends lm{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=PS+"px",this.domNode.style.height=PS+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ww),this._register(OS(this.bgDomNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(OS(this.domNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new oR),this._pointerdownScheduleRepeatTimer=this._register(new rm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,wn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},dR=class ng{constructor(t,i,r,l,a,c,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,l=l|0,a=a|0,c=c|0,h=h|0),this.rawScrollLeft=l,this.rawScrollTop=h,i<0&&(i=0),l+i>r&&(l=r-i),l<0&&(l=0),a<0&&(a=0),h+a>c&&(h=c-a),h<0&&(h=0),this.width=i,this.scrollWidth=r,this.scrollLeft=l,this.height=a,this.scrollHeight=c,this.scrollTop=h}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new ng(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new ng(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let r=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,d=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:l,scrollLeftChanged:a,heightChanged:c,scrollHeightChanged:h,scrollTopChanged:d}}},pR=class extends Pe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new dR(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new jS(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=jS.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},IS=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function lp(e,t){let i=t-e;return function(r){return e+i*_R(r)}}function gR(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var jS=class rg{constructor(t,i,r,l){this.from=t,this.to=i,this.duration=l,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,r){if(Math.abs(t-i)>2.5*r){let l,a;return t<i?(l=t+.75*r,a=i-.75*r):(l=t-.75*r,a=i+.75*r),gR(lp(t,l),lp(a,i),.33)}return lp(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),l=this.scrollTop(i);return new IS(r,l,!1)}return new IS(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return rg.start(t,i,r)}static start(t,i,r){r=r+10;let l=Date.now()-10;return new rg(t,i,l,r)}};function mR(e){return Math.pow(e,3)}function _R(e){return 1-mR(1-e)}var vR=class extends Pe{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new rm)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},yR=140,Cw=class extends lm{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new vR(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ww),this._shouldRender=!0,this.domNode=la(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,Ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new fR(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=la(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,Ut.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);i<=l&&l<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let l=aR(this.domNode.domNode);t=e.pageX-l.left,i=e.pageY-l.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let a=this._sliderOrthogonalPointerPosition(l),c=Math.abs(a-i);if(yw&&c>yR){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Ew=class sg{constructor(t,i,r,l,a,c){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=a,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new sg(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,r,l,a){let c=Math.max(0,r-t),h=Math.max(0,c-2*i),d=l>0&&l>r;if(!d)return{computedAvailableSize:Math.round(c),computedIsNeeded:d,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(r*h/l))),m=(h-f)/(l-r),g=a*m;return{computedAvailableSize:Math.round(c),computedIsNeeded:d,computedSliderSize:Math.round(f),computedSliderRatio:m,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=sg._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},SR=class extends Cw{constructor(e,t,i){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Ew(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,l.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},bR=class extends Cw{constructor(e,t,i){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Ew(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,l.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},xR=500,US=50,wR=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},lg=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,r=1,l=this._rear;do{let a=l===this._front?t:Math.pow(2,-r);if(t-=a,i+=this._memory[l].score*a,l===this._front)break;l=(this._capacity+l-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(im){let i=wn(t.browserEvent),r=LD(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let l=null,a=new wR(t,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(l=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=a),a.score=this._computeScore(a,l)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let l=Math.abs(t.deltaX),a=Math.abs(t.deltaY),c=Math.abs(i.deltaX),h=Math.abs(i.deltaY),d=Math.max(Math.min(l,c),1),f=Math.max(Math.min(a,h),1),m=Math.max(l,c),g=Math.max(a,h);m%d===0&&g%f===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};lg.INSTANCE=new lg;var CR=lg,ER=class extends lm{constructor(e,t,i){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=MR(t),this._scrollable=i,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let r={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new bR(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new SR(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=la(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=la(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=la(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new rm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ns(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,En&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new LS(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ns(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new LS(i))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var l;if((l=e.browserEvent)!=null&&l.defaultPrevented)return;let t=CR.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+a===0?c=a=0:Math.abs(a)>=Math.abs(c)?c=0:a=0),this._options.flipAxes&&([a,c]=[c,a]);let h=!En&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),f={};if(a){let m=US*a,g=d.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(f,g)}if(c){let m=US*c,g=d.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(f,g)}f=this._scrollable.validateScrollPosition(f),(d.scrollLeft!==f.scrollLeft||d.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,r=i?" left":"",l=t?" top":"",a=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${l}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),xR)}},kR=class extends ER{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function MR(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,En&&(t.className+=" mac"),t}var og=class extends Pe{constructor(e,t,i,r,l,a,c,h){super(),this._bufferService=i,this._optionsService=c,this._renderService=h,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let d=this._register(new pR({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>sm(r.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new kR(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Qt.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ft(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ft(()=>this._styleElement.remove())),this._register(Qt.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
91
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};og=yt([ve(2,ai),ve(3,lr),ve(4,sw),ve(5,Il),ve(6,ci),ve(7,or)],og);var ag=class extends Pe{constructor(e,t,i,r,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=l,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(a=>this._removeDecoration(a))),this._register(ft(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};ag=yt([ve(1,ai),ve(2,lr),ve(3,Ba),ve(4,or)],ag);var TR=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},_n={full:0,left:0,center:0,right:0},Ur={full:0,left:0,center:0,right:0},Uo={full:0,left:0,center:0,right:0},Ku=class extends Pe{constructor(e,t,i,r,l,a,c,h){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=l,this._optionsService=a,this._themeService=c,this._coreBrowserService=h,this._colorZoneStore=new TR,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(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(ft(()=>{var m;return(m=this._canvas)==null?void 0:m.remove()}));let d=this._canvas.getContext("2d");if(d)this._ctx=d;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ur.full=this._canvas.width,Ur.left=e,Ur.center=t,Ur.right=e,this._refreshDrawHeightConstants(),Uo.full=1,Uo.left=1,Uo.center=1+Ur.left,Uo.right=1+Ur.left+Ur.center}_refreshDrawHeightConstants(){_n.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);_n.left=t,_n.center=t,_n.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Uo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_n[e.position||"full"]/2),Ur[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_n[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ku=yt([ve(2,ai),ve(3,Ba),ve(4,or),ve(5,ci),ve(6,Il),ve(7,lr)],Ku);var ue;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
92
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ue||(ue={}));var Bu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Bu||(Bu={}));var kw;(e=>e.ST=`${ue.ESC}\\`)(kw||(kw={}));var cg=class{constructor(e,t,i,r,l,a){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=l,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ue.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};cg=yt([ve(2,ai),ve(3,ci),ve(4,Rs),ve(5,or)],cg);var qt=0,Vt=0,Ft=0,vt=0,qS={css:"#00000000",rgba:0},Rt;(e=>{function t(l,a,c,h){return h!==void 0?`#${_s(l)}${_s(a)}${_s(c)}${_s(h)}`:`#${_s(l)}${_s(a)}${_s(c)}`}e.toCss=t;function i(l,a,c,h=255){return(l<<24|a<<16|c<<8|h)>>>0}e.toRgba=i;function r(l,a,c,h){return{css:e.toCss(l,a,c,h),rgba:e.toRgba(l,a,c,h)}}e.toColor=r})(Rt||(Rt={}));var ct;(e=>{function t(d,f){if(vt=(f.rgba&255)/255,vt===1)return{css:f.css,rgba:f.rgba};let m=f.rgba>>24&255,g=f.rgba>>16&255,v=f.rgba>>8&255,y=d.rgba>>24&255,S=d.rgba>>16&255,b=d.rgba>>8&255;qt=y+Math.round((m-y)*vt),Vt=S+Math.round((g-S)*vt),Ft=b+Math.round((v-b)*vt);let E=Rt.toCss(qt,Vt,Ft),w=Rt.toRgba(qt,Vt,Ft);return{css:E,rgba:w}}e.blend=t;function i(d){return(d.rgba&255)===255}e.isOpaque=i;function r(d,f,m){let g=Lu.ensureContrastRatio(d.rgba,f.rgba,m);if(g)return Rt.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=r;function l(d){let f=(d.rgba|255)>>>0;return[qt,Vt,Ft]=Lu.toChannels(f),{css:Rt.toCss(qt,Vt,Ft),rgba:f}}e.opaque=l;function a(d,f){return vt=Math.round(f*255),[qt,Vt,Ft]=Lu.toChannels(d.rgba),{css:Rt.toCss(qt,Vt,Ft,vt),rgba:Rt.toRgba(qt,Vt,Ft,vt)}}e.opacity=a;function c(d,f){return vt=d.rgba&255,a(d,vt*f/255)}e.multiplyOpacity=c;function h(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=h})(ct||(ct={}));var gt;(e=>{let t,i;try{let l=document.createElement("canvas");l.width=1,l.height=1;let a=l.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return qt=parseInt(l.slice(1,2).repeat(2),16),Vt=parseInt(l.slice(2,3).repeat(2),16),Ft=parseInt(l.slice(3,4).repeat(2),16),Rt.toColor(qt,Vt,Ft);case 5:return qt=parseInt(l.slice(1,2).repeat(2),16),Vt=parseInt(l.slice(2,3).repeat(2),16),Ft=parseInt(l.slice(3,4).repeat(2),16),vt=parseInt(l.slice(4,5).repeat(2),16),Rt.toColor(qt,Vt,Ft,vt);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let a=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return qt=parseInt(a[1]),Vt=parseInt(a[2]),Ft=parseInt(a[3]),vt=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Rt.toColor(qt,Vt,Ft,vt);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[qt,Vt,Ft,vt]=t.getImageData(0,0,1,1).data,vt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Rt.toRgba(qt,Vt,Ft,vt),css:l}}e.toColor=r})(gt||(gt={}));var oi;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,l,a){let c=r/255,h=l/255,d=a/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return f*.2126+m*.7152+g*.0722}e.relativeLuminance2=i})(oi||(oi={}));var Lu;(e=>{function t(c,h){if(vt=(h&255)/255,vt===1)return h;let d=h>>24&255,f=h>>16&255,m=h>>8&255,g=c>>24&255,v=c>>16&255,y=c>>8&255;return qt=g+Math.round((d-g)*vt),Vt=v+Math.round((f-v)*vt),Ft=y+Math.round((m-y)*vt),Rt.toRgba(qt,Vt,Ft)}e.blend=t;function i(c,h,d){let f=oi.relativeLuminance(c>>8),m=oi.relativeLuminance(h>>8);if(er(f,m)<d){if(m<f){let y=r(c,h,d),S=er(f,oi.relativeLuminance(y>>8));if(S<d){let b=l(c,h,d),E=er(f,oi.relativeLuminance(b>>8));return S>E?y:b}return y}let g=l(c,h,d),v=er(f,oi.relativeLuminance(g>>8));if(v<d){let y=r(c,h,d),S=er(f,oi.relativeLuminance(y>>8));return v>S?g:y}return g}}e.ensureContrastRatio=i;function r(c,h,d){let f=c>>24&255,m=c>>16&255,g=c>>8&255,v=h>>24&255,y=h>>16&255,S=h>>8&255,b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));for(;b<d&&(v>0||y>0||S>0);)v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),S-=Math.max(0,Math.ceil(S*.1)),b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));return(v<<24|y<<16|S<<8|255)>>>0}e.reduceLuminance=r;function l(c,h,d){let f=c>>24&255,m=c>>16&255,g=c>>8&255,v=h>>24&255,y=h>>16&255,S=h>>8&255,b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));for(;b<d&&(v<255||y<255||S<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));return(v<<24|y<<16|S<<8|255)>>>0}e.increaseLuminance=l;function a(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=a})(Lu||(Lu={}));function _s(e){let t=e.toString(16);return t.length<2?"0"+t:t}function er(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var AR=class extends Ra{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Gu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Zi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],r=t.translateToString(!0),l=0,a=0,c=0,h=t.getFg(0),d=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==d){if(f-l>1){let m=this._getJoinedRanges(r,c,a,t,l);for(let g=0;g<m.length;g++)i.push(m[g])}l=f,c=a,h=this._workCell.fg,d=this._workCell.bg}a+=this._workCell.getChars().length||$r.length}if(this._bufferService.cols-l>1){let f=this._getJoinedRanges(r,c,a,t,l);for(let m=0;m<f.length;m++)i.push(f[m])}return i}_getJoinedRanges(e,t,i,r,l){let a=e.substring(t,i),c=[];try{c=this._characterJoiners[0].handler(a)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let d=this._characterJoiners[h].handler(a);for(let f=0;f<d.length;f++)Gu._mergeRanges(c,d[f])}catch(d){console.error(d)}return this._stringRangesToCellRanges(c,r,l),c}_stringRangesToCellRanges(e,t,i){let r=0,l=!1,a=0,c=e[r];if(c){for(let h=i;h<this._bufferService.cols;h++){let d=t.getWidth(h),f=t.getString(h).length||$r.length;if(d!==0){if(!l&&c[0]<=a&&(c[0]=h,l=!0),c[1]<=a){if(c[1]=h,c=e[++r],!c)break;c[0]<=a?(c[0]=h,l=!0):l=!1}a+=f}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let l=e[r];if(i){if(t[1]<=l[0])return e[r-1][1]=t[1],e;if(t[1]<=l[1])return e[r-1][1]=Math.max(t[1],l[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=l[0])return e.splice(r,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Gu=yt([ve(0,ai)],Gu);function NR(e){return 57508<=e&&e<=57558}function DR(e){return 9472<=e&&e<=9631}function RR(e){return NR(e)||DR(e)}function BR(){return{css:{canvas:vu(),cell:vu()},device:{canvas:vu(),cell:vu(),char:{width:0,height:0,left:0,top:0}}}}function vu(){return{width:0,height:0}}var ug=class{constructor(e,t,i,r,l,a,c){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=l,this._decorationService=a,this._themeService=c,this._workCell=new Zi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,l,a,c,h,d,f,m){let g=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,S=e.getNoBgTrimmedLength();i&&S<a+1&&(S=a+1);let b,E=0,w="",z=0,C=0,T=0,I=0,B=!1,U=0,X=!1,G=0,ne=0,V=[],j=f!==-1&&m!==-1;for(let F=0;F<S;F++){e.loadCell(F,this._workCell);let R=this._workCell.getWidth();if(R===0)continue;let O=!1,M=F>=ne,P=F,H=this._workCell;if(v.length>0&&F===v[0][0]&&M){let me=v.shift(),Ne=this._isCellInSelection(me[0],t);for(z=me[0]+1;z<me[1];z++)M&&(M=Ne===this._isCellInSelection(z,t));M&&(M=!i||a<me[0]||a>=me[1]),M?(O=!0,H=new AR(this._workCell,e.translateToString(!0,me[0],me[1]),me[1]-me[0]),P=me[1]-1,R=H.getWidth()):ne=me[1]}let Y=this._isCellInSelection(F,t),A=i&&F===a,L=j&&F>=f&&F<=m,$=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,me=>{$=!0});let N=H.getChars()||$r;if(N===" "&&(H.isUnderline()||H.isOverline())&&(N=" "),G=R*h-d.get(N,H.isBold(),H.isItalic()),!b)b=this._document.createElement("span");else if(E&&(Y&&X||!Y&&!X&&H.bg===C)&&(Y&&X&&y.selectionForeground||H.fg===T)&&H.extended.ext===I&&L===B&&G===U&&!A&&!O&&!$&&M){H.isInvisible()?w+=$r:w+=N,E++;continue}else E&&(b.textContent=w),b=this._document.createElement("span"),E=0,w="";if(C=H.bg,T=H.fg,I=H.extended.ext,B=L,U=G,X=Y,O&&a>=F&&a<=P&&(a=F),!this._coreService.isCursorHidden&&A&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&V.push("xterm-cursor-blink"),V.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(H.isBold()&&V.push("xterm-bold"),H.isItalic()&&V.push("xterm-italic"),H.isDim()&&V.push("xterm-dim"),H.isInvisible()?w=$r:w=H.getChars()||$r,H.isUnderline()&&(V.push(`xterm-underline-${H.extended.underlineStyle}`),w===" "&&(w=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${Ra.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let me=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&me<8&&(me+=8),b.style.textDecorationColor=y.ansi[me].css}H.isOverline()&&(V.push("xterm-overline"),w===" "&&(w=" ")),H.isStrikethrough()&&V.push("xterm-strikethrough"),L&&(b.style.textDecoration="underline");let ee=H.getFgColor(),ce=H.getFgColorMode(),oe=H.getBgColor(),fe=H.getBgColorMode(),he=!!H.isInverse();if(he){let me=ee;ee=oe,oe=me;let Ne=ce;ce=fe,fe=Ne}let pe,Ce,xe=!1;this._decorationService.forEachDecorationAtCell(F,t,void 0,me=>{me.options.layer!=="top"&&xe||(me.backgroundColorRGB&&(fe=50331648,oe=me.backgroundColorRGB.rgba>>8&16777215,pe=me.backgroundColorRGB),me.foregroundColorRGB&&(ce=50331648,ee=me.foregroundColorRGB.rgba>>8&16777215,Ce=me.foregroundColorRGB),xe=me.options.layer==="top")}),!xe&&Y&&(pe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,oe=pe.rgba>>8&16777215,fe=50331648,xe=!0,y.selectionForeground&&(ce=50331648,ee=y.selectionForeground.rgba>>8&16777215,Ce=y.selectionForeground)),xe&&V.push("xterm-decoration-top");let Se;switch(fe){case 16777216:case 33554432:Se=y.ansi[oe],V.push(`xterm-bg-${oe}`);break;case 50331648:Se=Rt.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(b,`background-color:#${VS((oe>>>0).toString(16),"0",6)}`);break;case 0:default:he?(Se=y.foreground,V.push("xterm-bg-257")):Se=y.background}switch(pe||H.isDim()&&(pe=ct.multiplyOpacity(Se,.5)),ce){case 16777216:case 33554432:H.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(b,Se,y.ansi[ee],H,pe,void 0)||V.push(`xterm-fg-${ee}`);break;case 50331648:let me=Rt.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(b,Se,me,H,pe,Ce)||this._addStyle(b,`color:#${VS(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,Se,y.foreground,H,pe,Ce)||he&&V.push("xterm-fg-257")}V.length&&(b.className=V.join(" "),V.length=0),!A&&!O&&!$&&M?E++:b.textContent=w,G!==this.defaultSpacing&&(b.style.letterSpacing=`${G}px`),g.push(b),F=P}return b&&E&&(b.textContent=w),g}_applyMinimumContrast(e,t,i,r,l,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||RR(r.getCode()))return!1;let c=this._getContrastCache(r),h;if(!l&&!a&&(h=c.getColor(t.rgba,i.rgba)),h===void 0){let d=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=ct.ensureContrastRatio(l||t,a||i,d),c.setColor((l||t).rgba,(a||i).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};ug=yt([ve(1,aw),ve(2,ci),ve(3,lr),ve(4,Rs),ve(5,Ba),ve(6,Il)],ug);function VS(e,t,i){for(;e.length<i;)e=t+e;return e}var LR=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[i,r,l,a],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(l),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let c=this._measure(e,0);return c>0&&(this._flat[r]=c),c}let l=e;t&&(l+="B"),i&&(l+="I");let a=this._holey.get(l);if(a===void 0){let c=0;t&&(c|=1),i&&(c|=2),a=this._measure(e,c),a>0&&this._holey.set(l,a)}return a}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},zR=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let l=e.buffers.active.ydisp,a=t[1]-l,c=i[1]-l,h=Math.max(a,0),d=Math.min(c,e.rows-1);if(h>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=c,this.viewportCappedStartRow=h,this.viewportCappedEndRow=d,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function OR(){return new zR}var op="xterm-dom-renderer-owner-",Wi="xterm-rows",yu="xterm-fg-",FS="xterm-bg-",qo="xterm-focus",Su="xterm-selection",HR=1,hg=class extends Pe{constructor(e,t,i,r,l,a,c,h,d,f,m,g,v,y){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=l,this._helperContainer=a,this._linkifier2=c,this._charSizeService=d,this._optionsService=f,this._bufferService=m,this._coreService=g,this._coreBrowserService=v,this._themeService=y,this._terminalClass=HR++,this._rowElements=[],this._selectionRenderModel=OR(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Wi),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(Su),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=BR(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(ug,document),this._element.classList.add(op+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(ft(()=>{this._element.classList.remove(op+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new LR(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Wi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Wi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Wi} .xterm-dim { color: ${ct.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Wi}.${qo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Wi}.${qo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Wi}.${qo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Su} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Su} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Su} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,c]of e.ansi.entries())t+=`${this._terminalSelector} .${yu}${a} { color: ${c.css}; }${this._terminalSelector} .${yu}${a}.xterm-dim { color: ${ct.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${FS}${a} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${yu}257 { color: ${ct.opaque(e.background).css}; }${this._terminalSelector} .${yu}257.xterm-dim { color: ${ct.multiplyOpacity(ct.opaque(e.background),.5).css}; }${this._terminalSelector} .${FS}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(qo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(qo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(i){let d=e[0]>t[0];h.appendChild(this._createSelectionElement(a,d?t[0]:e[0],d?e[0]:t[0],c-a+1))}else{let d=r===a?e[0]:0,f=a===l?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(a,d,f));let m=c-a-1;if(h.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,m)),a!==c){let g=l===c?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(c,0,g))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,i,r=1){let l=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(i-t);return a+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-a),l.style.height=`${r*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${a}px`,l.style.width=`${c}px`,l}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,r=i.ybase+i.y,l=Math.min(i.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=t;d++){let f=d+i.ydisp,m=this._rowElements[d],g=i.lines.get(f);if(!m||!g)break;m.replaceChildren(...this._rowFactory.createRow(g,f,f===r,c,h,l,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${op}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,r,l,a){i<0&&(e=0),r<0&&(t=0);let c=this._bufferService.rows-1;i=Math.max(Math.min(i,c),0),r=Math.max(Math.min(r,c),0),l=Math.min(l,this._bufferService.cols);let h=this._bufferService.buffer,d=h.ybase+h.y,f=Math.min(h.x,l-1),m=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=i;y<=r;++y){let S=y+h.ydisp,b=this._rowElements[y],E=h.lines.get(S);if(!b||!E)break;b.replaceChildren(...this._rowFactory.createRow(E,S,S===d,g,v,f,m,this.dimensions.css.cell.width,this._widthCache,a?y===i?e:0:-1,a?(y===r?t:l)-1:-1))}}};hg=yt([ve(7,Jg),ve(8,vh),ve(9,ci),ve(10,ai),ve(11,Rs),ve(12,lr),ve(13,Il)],hg);var fg=class extends Pe{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new IR(this._optionsService))}catch{this._measureStrategy=this._register(new PR(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};fg=yt([ve(2,ci)],fg);var Mw=class extends Pe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},PR=class extends Mw{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},IR=class extends Mw{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},jR=class extends Pe{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new UR(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Qt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},UR=class extends Pe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Pl),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ft(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},qR=class extends Pe{constructor(){super(),this.linkProviders=[],this._register(ft(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function om(e,t,i){let r=i.getBoundingClientRect(),l=e.getComputedStyle(i),a=parseInt(l.getPropertyValue("padding-left")),c=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-r.left-a,t.clientY-r.top-c]}function VR(e,t,i,r,l,a,c,h,d){if(!a)return;let f=om(e,t,i);if(f)return f[0]=Math.ceil((f[0]+(d?c/2:0))/c),f[1]=Math.ceil(f[1]/h),f[0]=Math.min(Math.max(f[0],1),r+(d?1:0)),f[1]=Math.min(Math.max(f[1],1),l),f}var dg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,l){return VR(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let i=om(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};dg=yt([ve(0,or),ve(1,vh)],dg);var FR=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Tw={};eD(Tw,{getSafariVersion:()=>$R,isChromeOS:()=>Rw,isFirefox:()=>Aw,isIpad:()=>WR,isIphone:()=>XR,isLegacyEdge:()=>YR,isLinux:()=>am,isMac:()=>Zu,isNode:()=>yh,isSafari:()=>Nw,isWindows:()=>Dw});var yh=typeof process<"u"&&"title"in process,La=yh?"node":navigator.userAgent,za=yh?"node":navigator.platform,Aw=La.includes("Firefox"),YR=La.includes("Edge"),Nw=/^((?!chrome|android).)*safari/i.test(La);function $R(){if(!Nw)return 0;let e=La.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Zu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(za),WR=za==="iPad",XR=za==="iPhone",Dw=["Windows","Win16","Win32","WinCE"].includes(za),am=za.indexOf("Linux")>=0,Rw=/\bCrOS\b/.test(La),Bw=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),l=e.timeRemaining(),i*1.5>l){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=l}this.clear()}},KR=class extends Bw{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},GR=class extends Bw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Qu=!yh&&"requestIdleCallback"in window?GR:KR,ZR=class{constructor(){this._queue=new Qu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},pg=class extends Pe{constructor(e,t,i,r,l,a,c,h,d){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=l,this._coreBrowserService=h,this._renderer=this._register(new Pl),this._pausedResizeTask=new ZR,this._observerDisposable=this._register(new Pl),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 _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new FR((f,m)=>this._renderRows(f,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new QR(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ft(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ft(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};pg=yt([ve(2,ci),ve(3,vh),ve(4,Rs),ve(5,Ba),ve(6,ai),ve(7,lr),ve(8,Il)],pg);var QR=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function JR(e,t,i,r){let l=i.buffer.x,a=i.buffer.y;if(!i.buffer.hasScrollback)return i4(l,a,e,t,i,r)+Sh(a,t,i,r)+n4(l,a,e,t,i,r);let c;if(a===t)return c=l>e?"D":"C",ba(Math.abs(l-e),Sa(c,r));c=a>t?"D":"C";let h=Math.abs(a-t),d=t4(a>t?e:l,i)+(h-1)*i.cols+1+e4(a>t?l:e);return ba(d,Sa(c,r))}function e4(e,t){return e-1}function t4(e,t){return t.cols-e}function i4(e,t,i,r,l,a){return Sh(t,r,l,a).length===0?"":ba(zw(e,t,e,t-Ds(t,l),!1,l).length,Sa("D",a))}function Sh(e,t,i,r){let l=e-Ds(e,i),a=t-Ds(t,i),c=Math.abs(l-a)-r4(e,t,i);return ba(c,Sa(Lw(e,t),r))}function n4(e,t,i,r,l,a){let c;Sh(t,r,l,a).length>0?c=r-Ds(r,l):c=t;let h=r,d=s4(e,t,i,r,l,a);return ba(zw(e,c,i,h,d==="C",l).length,Sa(d,a))}function r4(e,t,i){var c;let r=0,l=e-Ds(e,i),a=t-Ds(t,i);for(let h=0;h<Math.abs(l-a);h++){let d=Lw(e,t)==="A"?-1:1;(c=i.buffer.lines.get(l+d*h))!=null&&c.isWrapped&&r++}return r}function Ds(e,t){let i=0,r=t.buffer.lines.get(e),l=r==null?void 0:r.isWrapped;for(;l&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),l=r==null?void 0:r.isWrapped;return i}function s4(e,t,i,r,l,a){let c;return Sh(i,r,l,a).length>0?c=r-Ds(r,l):c=t,e<i&&c<=r||e>=i&&c<r?"C":"D"}function Lw(e,t){return e>t?"A":"B"}function zw(e,t,i,r,l,a){let c=e,h=t,d="";for(;(c!==i||h!==r)&&h>=0&&h<a.buffer.lines.length;)c+=l?1:-1,l&&c>a.cols-1?(d+=a.buffer.translateBufferLineToString(h,!1,e,c),c=0,e=0,h++):!l&&c<0&&(d+=a.buffer.translateBufferLineToString(h,!1,0,e+1),c=a.cols-1,e=c,h--);return d+a.buffer.translateBufferLineToString(h,!1,e,c)}function Sa(e,t){let i=t?"O":"[";return ue.ESC+i+e}function ba(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var l4=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function YS(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var ap=50,o4=15,a4=50,c4=500,u4=" ",h4=new RegExp(u4,"g"),gg=class extends Pe{constructor(e,t,i,r,l,a,c,h,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=l,this._mouseService=a,this._optionsService=c,this._renderService=h,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Zi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new l4(this._bufferService),this._activeSelectionMode=0,this._register(ft(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let l=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let h=i.translateBufferLineToString(c,!0,l,a);r.push(h)}}else{let l=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],l));for(let a=e[1]+1;a<=t[1]-1;a++){let c=i.lines.get(a),h=i.translateBufferLineToString(a,!0);c!=null&&c.isWrapped?r[r.length-1]+=h:r.push(h)}if(e[1]!==t[1]){let a=i.lines.get(t[1]),c=i.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?r[r.length-1]+=c:r.push(c)}}return r.map(l=>l.replace(h4," ")).join(Dw?`\r
93
+ `:`
94
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),am&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var l,a;let i=(a=(l=this._linkifier.currentLink)==null?void 0:l.link)==null?void 0:a.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=YS(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=om(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-ap),ap),t/=ap,t/Math.abs(t)+Math.round(t*(o4-1)))}shouldForceSelection(e){return Zu?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),a4)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Zu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<c4&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=JR(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let l=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:l>1&&t!==r&&(i+=l-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,a=l.lines.get(e[1]);if(!a)return;let c=l.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(a,e[0]),d=h,f=e[0]-h,m=0,g=0,v=0,y=0;if(c.charAt(h)===" "){for(;h>0&&c.charAt(h-1)===" ";)h--;for(;d<c.length&&c.charAt(d+1)===" ";)d++}else{let E=e[0],w=e[0];a.getWidth(E)===0&&(m++,E--),a.getWidth(w)===2&&(g++,w++);let z=a.getString(w).length;for(z>1&&(y+=z-1,d+=z-1);E>0&&h>0&&!this._isCharWordSeparator(a.loadCell(E-1,this._workCell));){a.loadCell(E-1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,E--):C>1&&(v+=C-1,h-=C-1),h--,E--}for(;w<a.length&&d+1<c.length&&!this._isCharWordSeparator(a.loadCell(w+1,this._workCell));){a.loadCell(w+1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,w++):C>1&&(y+=C-1,d+=C-1),d++,w++}}d++;let S=h+f-m+v,b=Math.min(this._bufferService.cols,d-h+m+g-v-y);if(!(!t&&c.slice(h,d).trim()==="")){if(i&&S===0&&a.getCodePoint(0)!==32){let E=l.lines.get(e[1]-1);if(E&&a.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let w=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(w){let z=this._bufferService.cols-w.start;S-=z,b+=z}}}if(r&&S+b===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let E=l.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let w=this._getWordAt([0,e[1]+1],!1,!1,!0);w&&(b+=w.length)}}return{start:S,length:b}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=YS(i,this._bufferService.cols)}};gg=yt([ve(3,ai),ve(4,Rs),ve(5,em),ve(6,ci),ve(7,or),ve(8,lr)],gg);var $S=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},WS=class{constructor(){this._color=new $S,this._css=new $S}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ht=Object.freeze((()=>{let e=[gt.toColor("#2e3436"),gt.toColor("#cc0000"),gt.toColor("#4e9a06"),gt.toColor("#c4a000"),gt.toColor("#3465a4"),gt.toColor("#75507b"),gt.toColor("#06989a"),gt.toColor("#d3d7cf"),gt.toColor("#555753"),gt.toColor("#ef2929"),gt.toColor("#8ae234"),gt.toColor("#fce94f"),gt.toColor("#729fcf"),gt.toColor("#ad7fa8"),gt.toColor("#34e2e2"),gt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],l=t[i/6%6|0],a=t[i%6];e.push({css:Rt.toCss(r,l,a),rgba:Rt.toRgba(r,l,a)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Rt.toCss(r,r,r),rgba:Rt.toRgba(r,r,r)})}return e})()),ys=gt.toColor("#ffffff"),ea=gt.toColor("#000000"),XS=gt.toColor("#ffffff"),KS=ea,Vo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},f4=ys,mg=class extends Pe{constructor(e){super(),this._optionsService=e,this._contrastCache=new WS,this._halfContrastCache=new WS,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ys,background:ea,cursor:XS,cursorAccent:KS,selectionForeground:void 0,selectionBackgroundTransparent:Vo,selectionBackgroundOpaque:ct.blend(ea,Vo),selectionInactiveBackgroundTransparent:Vo,selectionInactiveBackgroundOpaque:ct.blend(ea,Vo),scrollbarSliderBackground:ct.opacity(ys,.2),scrollbarSliderHoverBackground:ct.opacity(ys,.4),scrollbarSliderActiveBackground:ct.opacity(ys,.5),overviewRulerBorder:ys,ansi:Ht.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=nt(e.foreground,ys),t.background=nt(e.background,ea),t.cursor=ct.blend(t.background,nt(e.cursor,XS)),t.cursorAccent=ct.blend(t.background,nt(e.cursorAccent,KS)),t.selectionBackgroundTransparent=nt(e.selectionBackground,Vo),t.selectionBackgroundOpaque=ct.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=nt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ct.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?nt(e.selectionForeground,qS):void 0,t.selectionForeground===qS&&(t.selectionForeground=void 0),ct.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ct.opacity(t.selectionBackgroundTransparent,.3)),ct.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ct.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=nt(e.scrollbarSliderBackground,ct.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=nt(e.scrollbarSliderHoverBackground,ct.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=nt(e.scrollbarSliderActiveBackground,ct.opacity(t.foreground,.5)),t.overviewRulerBorder=nt(e.overviewRulerBorder,f4),t.ansi=Ht.slice(),t.ansi[0]=nt(e.black,Ht[0]),t.ansi[1]=nt(e.red,Ht[1]),t.ansi[2]=nt(e.green,Ht[2]),t.ansi[3]=nt(e.yellow,Ht[3]),t.ansi[4]=nt(e.blue,Ht[4]),t.ansi[5]=nt(e.magenta,Ht[5]),t.ansi[6]=nt(e.cyan,Ht[6]),t.ansi[7]=nt(e.white,Ht[7]),t.ansi[8]=nt(e.brightBlack,Ht[8]),t.ansi[9]=nt(e.brightRed,Ht[9]),t.ansi[10]=nt(e.brightGreen,Ht[10]),t.ansi[11]=nt(e.brightYellow,Ht[11]),t.ansi[12]=nt(e.brightBlue,Ht[12]),t.ansi[13]=nt(e.brightMagenta,Ht[13]),t.ansi[14]=nt(e.brightCyan,Ht[14]),t.ansi[15]=nt(e.brightWhite,Ht[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=nt(e.extendedAnsi[r],Ht[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};mg=yt([ve(0,ci)],mg);function nt(e,t){if(e!==void 0)try{return gt.toColor(e)}catch{}return t}var d4=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},p4=class{constructor(){this._services=new d4,this._services.set(Jg,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=oD(e).sort((a,c)=>a.index-c.index),r=[];for(let a of i){let c=this._services.get(a.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);r.push(c)}let l=i.length>0?i[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},g4={trace:0,debug:1,info:2,warn:3,error:4,off:5},m4="xterm.js: ",_g=class extends Pe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=g4[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":m4)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};_g=yt([ve(0,ci)],_g);var GS=class extends Pe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let l=t-1;l>=0;l--)this.set(e+l+i,this.get(e+l));let r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},He=3,Dt=Object.freeze(new Ra),bu=0,cp=2,ta=class Ow{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*He);let l=i||Zi.fromCharData([0,tw,1,0]);for(let a=0;a<t;++a)this.setCell(a,l);this.length=t}get(t){let i=this._data[t*He+0],r=i&2097151;return[this._data[t*He+1],i&2097152?this._combined[t]:r?Fr(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*He+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*He+0]=t|2097152|i[2]<<22):this._data[t*He+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*He+0]>>22}hasWidth(t){return this._data[t*He+0]&12582912}getFg(t){return this._data[t*He+1]}getBg(t){return this._data[t*He+2]}hasContent(t){return this._data[t*He+0]&4194303}getCodePoint(t){let i=this._data[t*He+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*He+0]&2097152}getString(t){let i=this._data[t*He+0];return i&2097152?this._combined[t]:i&2097151?Fr(i&2097151):""}isProtected(t){return this._data[t*He+2]&536870912}loadCell(t,i){return bu=t*He,i.content=this._data[bu+0],i.fg=this._data[bu+1],i.bg=this._data[bu+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*He+0]=i.content,this._data[t*He+1]=i.fg,this._data[t*He+2]=i.bg}setCellFromCodepoint(t,i,r,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*He+0]=i|r<<22,this._data[t*He+1]=l.fg,this._data[t*He+2]=l.bg}addCodepointToCell(t,i,r){let l=this._data[t*He+0];l&2097152?this._combined[t]+=Fr(i):l&2097151?(this._combined[t]=Fr(l&2097151)+Fr(i),l&=-2097152,l|=2097152):l=i|1<<22,r&&(l&=-12582913,l|=r<<22),this._data[t*He+0]=l}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let l=new Zi;for(let a=this.length-t-i-1;a>=0;--a)this.setCell(t+i+a,this.loadCell(t+a,l));for(let a=0;a<i;++a)this.setCell(t+a,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let l=new Zi;for(let a=0;a<this.length-t-i;++a)this.setCell(t+a,this.loadCell(t+i+a,l));for(let a=this.length-i;a<this.length;++a)this.setCell(a,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*cp<this._data.buffer.byteLength;let r=t*He;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let l=new Uint32Array(r);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,i)}else{this._data=this._data.subarray(0,r);let l=Object.keys(this._combined);for(let c=0;c<l.length;c++){let h=parseInt(l[c],10);h>=t&&delete this._combined[h]}let a=Object.keys(this._extendedAttrs);for(let c=0;c<a.length;c++){let h=parseInt(a[c],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,r*4*cp<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*cp<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new Ow(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303)return t+(this._data[t*He+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303||this._data[t*He+2]&50331648)return t+(this._data[t*He+0]>>22);return 0}copyCellsFrom(t,i,r,l,a){let c=t._data;if(a)for(let d=l-1;d>=0;d--){for(let f=0;f<He;f++)this._data[(r+d)*He+f]=c[(i+d)*He+f];c[(i+d)*He+2]&268435456&&(this._extendedAttrs[r+d]=t._extendedAttrs[i+d])}else for(let d=0;d<l;d++){for(let f=0;f<He;f++)this._data[(r+d)*He+f]=c[(i+d)*He+f];c[(i+d)*He+2]&268435456&&(this._extendedAttrs[r+d]=t._extendedAttrs[i+d])}let h=Object.keys(t._combined);for(let d=0;d<h.length;d++){let f=parseInt(h[d],10);f>=i&&(this._combined[f-i+r]=t._combined[f])}}translateToString(t,i,r,l){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),l&&(l.length=0);let a="";for(;i<r;){let c=this._data[i*He+0],h=c&2097151,d=c&2097152?this._combined[i]:h?Fr(h):$r;if(a+=d,l)for(let f=0;f<d.length;++f)l.push(i);i+=c>>22||1}return l&&l.push(i),a}};function _4(e,t,i,r,l,a){let c=[];for(let h=0;h<e.length-1;h++){let d=h,f=e.get(++d);if(!f.isWrapped)continue;let m=[e.get(h)];for(;d<e.length&&f.isWrapped;)m.push(f),f=e.get(++d);if(!a&&r>=h&&r<d){h+=m.length-1;continue}let g=0,v=xa(m,g,t),y=1,S=0;for(;y<m.length;){let E=xa(m,y,t),w=E-S,z=i-v,C=Math.min(w,z);m[g].copyCellsFrom(m[y],S,v,C,!1),v+=C,v===i&&(g++,v=0),S+=C,S===E&&(y++,S=0),v===0&&g!==0&&m[g-1].getWidth(i-1)===2&&(m[g].copyCellsFrom(m[g-1],i-1,v++,1,!1),m[g-1].setCell(i-1,l))}m[g].replaceCells(v,i,l);let b=0;for(let E=m.length-1;E>0&&(E>g||m[E].getTrimmedLength()===0);E--)b++;b>0&&(c.push(h+m.length-b),c.push(b)),h+=m.length-1}return c}function v4(e,t){let i=[],r=0,l=t[r],a=0;for(let c=0;c<e.length;c++)if(l===c){let h=t[++r];e.onDeleteEmitter.fire({index:c-a,amount:h}),c+=h-1,a+=h,l=t[++r]}else i.push(c);return{layout:i,countRemoved:a}}function y4(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function S4(e,t,i){let r=[],l=e.map((d,f)=>xa(e,f,t)).reduce((d,f)=>d+f),a=0,c=0,h=0;for(;h<l;){if(l-h<i){r.push(l-h);break}a+=i;let d=xa(e,c,t);a>d&&(a-=d,c++);let f=e[c].getWidth(a-1)===2;f&&a--;let m=f?i-1:i;r.push(m),h+=m}return r}function xa(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,l=e[t+1].getWidth(0)===2;return r&&l?i-1:i}var Hw=class Pw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Pw._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ns(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Hw._nextId=1;var b4=Hw,It={},Ss=It.B;It[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:"≥","{":"π","|":"≠","}":"£","~":"·"};It.A={"#":"£"};It.B=void 0;It[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};It.C=It[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};It.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};It.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};It.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};It.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};It.E=It[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};It.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};It.H=It[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};It["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ZS=4294967295,QS=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Dt.clone(),this.savedCharset=Ss,this.markers=[],this._nullCell=Zi.fromCharData([0,tw,1,0]),this._whitespaceCell=Zi.fromCharData([0,$r,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Qu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new GS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Xu),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Xu),this._whitespaceCell}getBlankLine(e,t){return new ta(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>ZS?ZS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Dt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new GS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Dt),r=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)r+=+this.lines.get(c).resize(e,i);let a=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ta(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new ta(e,i)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(l<this.lines.maxLength){let c=this.lines.length-l;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let a=0;a<this.lines.length;a++)r+=+this.lines.get(a).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=_4(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Dt),i);if(r.length>0){let l=v4(this.lines,r);y4(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(Dt),l=i;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ta(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Dt),l=[],a=0;for(let c=this.lines.length-1;c>=0;c--){let h=this.lines.get(c);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let d=[h];for(;h.isWrapped&&c>0;)h=this.lines.get(--c),d.unshift(h);if(!i){let C=this.ybase+this.y;if(C>=c&&C<c+d.length)continue}let f=d[d.length-1].getTrimmedLength(),m=S4(d,this._cols,e),g=m.length-d.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+g):v=Math.max(0,this.lines.length-this.lines.maxLength+g);let y=[];for(let C=0;C<g;C++){let T=this.getBlankLine(Dt,!0);y.push(T)}y.length>0&&(l.push({start:c+d.length+a,newLines:y}),a+=y.length),d.push(...y);let S=m.length-1,b=m[S];b===0&&(S--,b=m[S]);let E=d.length-g-1,w=f;for(;E>=0;){let C=Math.min(w,b);if(d[S]===void 0)break;if(d[S].copyCellsFrom(d[E],w-C,b-C,C,!0),b-=C,b===0&&(S--,b=m[S]),w-=C,w===0){E--;let T=Math.max(E,0);w=xa(d,T,this._cols)}}for(let C=0;C<d.length;C++)m[C]<e&&d[C].setCell(m[C],r);let z=g-v;for(;z-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(l.length>0){let c=[],h=[];for(let b=0;b<this.lines.length;b++)h.push(this.lines.get(b));let d=this.lines.length,f=d-1,m=0,g=l[m];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let v=0;for(let b=Math.min(this.lines.maxLength-1,d+a-1);b>=0;b--)if(g&&g.start>f+v){for(let E=g.newLines.length-1;E>=0;E--)this.lines.set(b--,g.newLines[E]);b++,c.push({index:f+1,amount:g.newLines.length}),v+=g.newLines.length,g=l[++m]}else this.lines.set(b,h[f--]);let y=0;for(let b=c.length-1;b>=0;b--)c[b].index+=y,this.lines.onInsertEmitter.fire(c[b]),y+=c[b].amount;let S=Math.max(0,d+a-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,i=0,r){let l=this.lines.get(e);return l?l.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new b4(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},x4=class extends Pe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),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 QS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new QS(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Iw=2,jw=1,vg=class extends Pe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Iw),this.rows=Math.max(e.rawOptions.rows||0,jw),this.buffers=this._register(new x4(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let l=i.ybase+i.scrollTop,a=i.ybase+i.scrollBottom;if(i.scrollTop===0){let c=i.lines.isFull;a===i.lines.length-1?c?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(a+1,0,r.clone()),c?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let c=a-l+1;i.lines.shiftElements(l+1,c-1,-1),i.lines.set(a,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};vg=yt([ve(0,ci)],vg);var bl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Zu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},w4=["normal","bold","100","200","300","400","500","600","700","800","900"],C4=class extends Pe{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...bl};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ft(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in bl))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in bl))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=bl[e]),!E4(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=bl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=w4.includes(t)?t:bl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function E4(e){return e==="block"||e==="underline"||e==="bar"}function ia(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&ia(e[r],t-1);return i}var JS=Object.freeze({insertMode:!1}),e1=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),yg=class extends Pe{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ia(JS),this.decPrivateModes=ia(e1)}reset(){this.modes=ia(JS),this.decPrivateModes=ia(e1)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};yg=yt([ve(0,ai),ve(1,lw),ve(2,ci)],yg);var t1={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function up(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var hp=String.fromCharCode,i1={DEFAULT:e=>{let t=[up(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${hp(t[0])}${hp(t[1])}${hp(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${up(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${up(e,!0)};${e.x};${e.y}${t}`}},Sg=class extends Pe{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(t1))this.addProtocol(r,t1[r]);for(let r of Object.keys(i1))this.addEncoding(r,i1[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let r=t/i,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=r+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Sg=yt([ve(0,ai),ve(1,Rs),ve(2,ci)],Sg);var fp=[[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]],k4=[[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]],Pt;function M4(e,t){let i=0,r=t.length-1,l;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(l=i+r>>1,e>t[l][1])i=l+1;else if(e<t[l][0])r=l-1;else return!0;return!1}var T4=class{constructor(){if(this.version="6",!Pt){Pt=new Uint8Array(65536),Pt.fill(1),Pt[0]=0,Pt.fill(0,1,32),Pt.fill(0,127,160),Pt.fill(2,4352,4448),Pt[9001]=2,Pt[9002]=2,Pt.fill(2,11904,42192),Pt[12351]=1,Pt.fill(2,44032,55204),Pt.fill(2,63744,64256),Pt.fill(2,65040,65050),Pt.fill(2,65072,65136),Pt.fill(2,65280,65377),Pt.fill(2,65504,65511);for(let e=0;e<fp.length;++e)Pt.fill(0,fp[e][0],fp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Pt[e]:M4(e,k4)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let l=xs.extractWidth(t);l===0?r=!1:l>i&&(i=l)}return xs.createPropertyValue(0,i,r)}},xs=class zu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new T4;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,r=!1){return(t&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,r=0,l=t.length;for(let a=0;a<l;++a){let c=t.charCodeAt(a);if(55296<=c&&c<=56319){if(++a>=l)return i+this.wcwidth(c);let f=t.charCodeAt(a);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:i+=this.wcwidth(f)}let h=this.charProperties(c,r),d=zu.extractWidth(h);zu.extractShouldJoin(h)&&(d-=zu.extractWidth(r)),i+=d,r=h}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},A4=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function n1(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Fo=2147483647,N4=256,Uw=class bg{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>N4)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new bg;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let l=t[r];if(Array.isArray(l))for(let a=0;a<l.length;++a)i.addSubParam(l[a]);else i.addParam(l)}return i}clone(){let t=new bg(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let r=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;l-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,l))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Fo?Fo:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Fo?Fo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;l-r>0&&(t[i]=this._subParams.slice(r,l))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,l=r[i-1];r[i-1]=~l?Math.min(l*10+t,Fo):t}},Yo=[],D4=class{constructor(){this._state=0,this._active=Yo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Yo}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Yo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Yo,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",_h(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Yo,this._id=-1,this._state=0}}},Li=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=_h(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},$o=[],R4=class{constructor(){this._handlers=Object.create(null),this._active=$o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$o}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=$o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||$o,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",_h(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=$o,this._ident=0}},na=new Uw;na.addParam(0);var r1=class{constructor(e){this._handler=e,this._data="",this._params=na,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():na,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=_h(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(i=>(this._params=na,this._data="",this._hitLimit=!1,i));return this._params=na,this._data="",this._hitLimit=!1,t}},B4=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let l=0;l<e.length;l++)this.table[t<<8|e[l]]=i<<4|r}},Ki=160,L4=(function(){let e=new B4(4095),t=Array.apply(null,Array(256)).map((h,d)=>d),i=(h,d)=>t.slice(h,d),r=i(32,127),l=i(0,24);l.push(25),l.push.apply(l,i(28,32));let a=i(0,14),c;e.setDefault(1,0),e.addMany(r,0,2,0);for(c in a)e.addMany([24,26,153,154],c,3,0),e.addMany(i(128,144),c,3,0),e.addMany(i(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ki,0,2,0),e.add(Ki,8,5,8),e.add(Ki,6,0,6),e.add(Ki,11,0,11),e.add(Ki,13,13,13),e})(),z4=class extends Pe{constructor(e=L4){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Uw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ft(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new D4),this._dcsParser=this._register(new R4),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let l=0;l<e.intermediates.length;++l){let a=e.intermediates.charCodeAt(l);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,r,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=l}parse(e,t,i){let r=0,l=0,a=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&d>-1){for(;d>=0&&(c=h[d](this._params),c!==!0);d--)if(c instanceof Promise)return this._parseStack.handlerPos=d,c}this._parseStack.handlers=[];break;case 4:if(i===!1&&d>-1){for(;d>=0&&(c=h[d](),c!==!0);d--)if(c instanceof Promise)return this._parseStack.handlerPos=d,c}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(r!==24&&r!==26,i),c)return c;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],c=this._oscParser.end(r!==24&&r!==26,i),c)return c;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=a;h<t;++h){switch(r=e[h],l=this._transitions.table[this.currentState<<8|(r<160?r:Ki)],l>>4){case 2:for(let v=h+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let d=this._csiHandlers[this._collect<<8|r],f=d?d.length-1:-1;for(;f>=0&&(c=d[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._preserveStack(3,d,f,l,h),c;f<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h<t&&(r=e[h])>47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let m=this._escHandlers[this._collect<<8|r],g=m?m.length-1:-1;for(;g>=0&&(c=m[g](),c!==!0);g--)if(c instanceof Promise)return this._preserveStack(4,m,g,l,h),c;g<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let v=h+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<Ki){this._dcsParser.put(e,h,v),h=v-1;break}break;case 14:if(c=this._dcsParser.unhook(r!==24&&r!==26),c)return this._preserveStack(6,[],0,l,h),c;r===27&&(l|=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 v=h+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<Ki){this._oscParser.put(e,h,v),h=v-1;break}break;case 6:if(c=this._oscParser.end(r!==24&&r!==26),c)return this._preserveStack(5,[],0,l,h),c;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},O4=/^([\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})$/,H4=/^[\da-f]+$/;function s1(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=O4.exec(t);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),H4.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let l=0;l<3;++l){let a=parseInt(t.slice(i*l,i*l+i),16);r[l]=i===1?a<<4:i===2?a:i===3?a>>4:a>>8}return r}}function dp(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function P4(e,t=16){let[i,r,l]=e;return`rgb:${dp(i,t)}/${dp(r,t)}/${dp(l,t)}`}var I4={"(":0,")":1,"*":2,"+":3,"-":1,".":2},qr=131072,l1=10;function o1(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var a1=5e3,c1=0,j4=class extends Pe{constructor(e,t,i,r,l,a,c,h,d=new z4){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=l,this._oscLinkService=a,this._coreMouseService=c,this._unicodeService=h,this._parser=d,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new sD,this._utf8Decoder=new lD,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Dt.clone(),this._eraseAttrDataInternal=Dt.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),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 xg(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,m)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:m.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,m,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:m,data:g})}),this._parser.setDcsHandlerFallback((f,m,g)=>{m==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:m,payload:g})}),this._parser.setPrintHandler((f,m,g)=>this.print(f,m,g)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Bu.IND,()=>this.index()),this._parser.setExecuteHandler(Bu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Bu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Li(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Li(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Li(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Li(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Li(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Li(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Li(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Li(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Li(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Li(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Li(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Li(f=>this.restoreCursorColor(f))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let f in It)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new r1((f,m)=>this.requestStatusString(f,m)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),a1))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${a1} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,l=this._activeBuffer.y,a=0,c=this._parseStack.paused;if(c){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>qr&&(a=this._parseStack.position+qr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<qr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,qr))),c||this._dirtyRowTracker.clearRange(),e.length>qr)for(let f=a;f<e.length;f+=qr){let m=f+qr<e.length?f+qr:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(f,m),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,m),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,g))return this._preserveStack(r,l,g,f),this._logSlowResolvingAsync(i),i}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,f))return this._preserveStack(r,l,f,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),d=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);d<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(d,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,i){let r,l,a=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,d=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,m=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let v=this._parser.precedingJoinState;for(let y=t;y<i;++y){if(r=e[y],r<127&&a){let w=a[String.fromCharCode(r)];w&&(r=w.charCodeAt(0))}let S=this._unicodeService.charProperties(r,v);l=xs.extractWidth(S);let b=xs.extractShouldJoin(S),E=b?xs.extractWidth(v):0;if(v=S,c&&this._onA11yChar.fire(Fr(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-E>h){if(d){let w=g,z=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&g instanceof ta&&g.copyCellsFrom(w,z,0,E,!1);z<h;)w.setCellFromCodepoint(z++,0,1,m)}else if(this._activeBuffer.x=h-1,l===2)continue}if(b&&this._activeBuffer.x){let w=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-w,r,l);for(let z=l-E;--z>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(f&&(g.insertCells(this._activeBuffer.x,l-E,this._activeBuffer.getNullCell(m)),g.getWidth(h-1)===2&&g.setCellFromCodepoint(h-1,0,1,m)),g.setCellFromCodepoint(this._activeBuffer.x++,r,l,m),l>0)for(;--l;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=v,this._activeBuffer.x<h&&i-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,m),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>o1(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new r1(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Li(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,r=!1,l=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),l),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(l-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Dt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,r=xs.extractWidth(t),l=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),c=new Uint32Array(a.length*i),h=0;for(let f=0;f<a.length;){let m=a.codePointAt(f)||0;c[h++]=m,f+=m>65535?2:1}let d=h;for(let f=1;f<i;++f)c.copyWithin(d,0,h),d+=h;return this.print(c,0,d),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Ss),this._charsetService.setgCharset(1,Ss),this._charsetService.setgCharset(2,Ss),this._charsetService.setgCharset(3,Ss);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:a}=this._coreMouseService,c=this._coreService,{buffers:h,cols:d}=this._bufferService,{active:f,alt:m}=h,g=this._optionsService.rawOptions,v=(b,E)=>(c.triggerDataEvent(`${ue.ESC}[${t?"":"?"}${b};${E}$y`),!0),y=b=>b?1:2,S=e.params[0];return t?S===2?v(S,4):S===4?v(S,y(c.modes.insertMode)):S===12?v(S,3):S===20?v(S,y(g.convertEol)):v(S,0):S===1?v(S,y(r.applicationCursorKeys)):S===3?v(S,g.windowOptions.setWinLines?d===80?2:d===132?1:0:0):S===6?v(S,y(r.origin)):S===7?v(S,y(r.wraparound)):S===8?v(S,3):S===9?v(S,y(l==="X10")):S===12?v(S,y(g.cursorBlink)):S===25?v(S,y(!c.isCursorHidden)):S===45?v(S,y(r.reverseWraparound)):S===66?v(S,y(r.applicationKeypad)):S===67?v(S,4):S===1e3?v(S,y(l==="VT200")):S===1002?v(S,y(l==="DRAG")):S===1003?v(S,y(l==="ANY")):S===1004?v(S,y(r.sendFocus)):S===1005?v(S,4):S===1006?v(S,y(a==="SGR")):S===1015?v(S,4):S===1016?v(S,y(a==="SGR_PIXELS")):S===1048?v(S,1):S===47||S===1047||S===1049?v(S,y(f===m)):S===2004?v(S,y(r.bracketedPasteMode)):S===2026?v(S,y(r.synchronizedOutput)):v(S,0)}_updateAttrColor(e,t,i,r,l){return t===2?(e|=50331648,e&=-16777216,e|=Ra.fromColorRGB([i,r,l])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],l=0,a=0;do{if(r[a+l]=e.params[t+a],e.hasSubParams(t+a)){let c=e.getSubParams(t+a),h=0;do r[1]===5&&(l=1),r[a+h+1+l]=c[h];while(++h<c.length&&h+a+1+l<r.length);break}if(r[1]===5&&a+l>=2||r[1]===2&&a+l>=5)break;r[1]&&(l=1)}while(++a+t<e.length&&a+l<r.length);for(let c=2;c<r.length;++c)r[c]===-1&&(r[c]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Dt.fg,e.bg=Dt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,r=this._curAttrData;for(let l=0;l<t;l++)i=e.params[l],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=Dt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Dt.bg&16777215):i===38||i===48||i===58?l+=this._extractColor(e,l,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=Dt.fg&16777215,r.bg&=-67108864,r.bg|=Dt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[?${t};${i}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Dt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!o1(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>l1&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>l1&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let r=i.shift(),l=i.shift();if(/^\d+$/.exec(r)){let a=parseInt(r);if(u1(a))if(l==="?")t.push({type:0,index:a});else{let c=s1(l);c&&t.push({type:1,index:a,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),r,l=i.findIndex(a=>a.startsWith("id="));return l!==-1&&(r=i[l].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=s1(i[r]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let l=parseInt(i[r]);u1(l)&&t.push({type:2,index:l})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Ss),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(I4[e[0]],It[e[1]]||Ss),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Dt.clone(),this._eraseAttrDataInternal=Dt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Zi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=c=>(this._coreService.triggerDataEvent(`${ue.ESC}${c}${ue.ESC}\\`),!0),r=this._bufferService.buffer,l=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},xg=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(c1=e,e=t,t=c1),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};xg=yt([ve(0,ai)],xg);function u1(e){return 0<=e&&e<256}var U4=5e7,h1=12,q4=50,V4=class extends Pe{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>U4)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],l=this._action(r,t);if(l){let c=h=>performance.now()-i>=h1?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(i,h);l.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(c);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=h1)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>q4&&(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()}},wg=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),d={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._dataByLinkId.set(d.id,d),d.id}let i=e,r=this._getEntryIdKey(i),l=this._entriesWithId.get(r);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let a=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};wg=yt([ve(0,ai)],wg);var f1=!1,F4=class extends Pe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Pl),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new p4,this.optionsService=this._register(new C4(e)),this._instantiationService.setService(ci,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(vg)),this._instantiationService.setService(ai,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(_g)),this._instantiationService.setService(lw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(yg)),this._instantiationService.setService(Rs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Sg)),this._instantiationService.setService(sw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(xs)),this._instantiationService.setService(uD,this.unicodeService),this._charsetService=this._instantiationService.createInstance(A4),this._instantiationService.setService(cD,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(wg),this._instantiationService.setService(ow,this._oscLinkService),this._inputHandler=this._register(new j4(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Qt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Qt.forward(this._bufferService.onResize,this._onResize)),this._register(Qt.forward(this.coreService.onData,this._onData)),this._register(Qt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new V4((t,i)=>this._inputHandler.parse(t,i))),this._register(Qt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!f1&&(this._logService.warn("writeSync is unreliable and will be removed soon."),f1=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Iw),t=Math.max(t,jw),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(n1.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(n1(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ft(()=>{for(let t of e)t.dispose()})}}},Y4={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function $4(e,t,i,r){var c;let l={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?l.key=ue.ESC+"OA":l.key=ue.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ue.ESC+"OD":l.key=ue.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ue.ESC+"OC":l.key=ue.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ue.ESC+"OB":l.key=ue.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ue.DEL,e.altKey&&(l.key=ue.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ue.ESC+"[Z";break}l.key=ue.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ue.ESC+ue.CR:ue.CR,l.cancel=!0;break;case 27:l.key=ue.ESC,e.altKey&&(l.key=ue.ESC+ue.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"D":t?l.key=ue.ESC+"OD":l.key=ue.ESC+"[D";break;case 39:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"C":t?l.key=ue.ESC+"OC":l.key=ue.ESC+"[C";break;case 38:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"A":t?l.key=ue.ESC+"OA":l.key=ue.ESC+"[A";break;case 40:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"B":t?l.key=ue.ESC+"OB":l.key=ue.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ue.ESC+"[2~");break;case 46:a?l.key=ue.ESC+"[3;"+(a+1)+"~":l.key=ue.ESC+"[3~";break;case 36:a?l.key=ue.ESC+"[1;"+(a+1)+"H":t?l.key=ue.ESC+"OH":l.key=ue.ESC+"[H";break;case 35:a?l.key=ue.ESC+"[1;"+(a+1)+"F":t?l.key=ue.ESC+"OF":l.key=ue.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ue.ESC+"[5;"+(a+1)+"~":l.key=ue.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ue.ESC+"[6;"+(a+1)+"~":l.key=ue.ESC+"[6~";break;case 112:a?l.key=ue.ESC+"[1;"+(a+1)+"P":l.key=ue.ESC+"OP";break;case 113:a?l.key=ue.ESC+"[1;"+(a+1)+"Q":l.key=ue.ESC+"OQ";break;case 114:a?l.key=ue.ESC+"[1;"+(a+1)+"R":l.key=ue.ESC+"OR";break;case 115:a?l.key=ue.ESC+"[1;"+(a+1)+"S":l.key=ue.ESC+"OS";break;case 116:a?l.key=ue.ESC+"[15;"+(a+1)+"~":l.key=ue.ESC+"[15~";break;case 117:a?l.key=ue.ESC+"[17;"+(a+1)+"~":l.key=ue.ESC+"[17~";break;case 118:a?l.key=ue.ESC+"[18;"+(a+1)+"~":l.key=ue.ESC+"[18~";break;case 119:a?l.key=ue.ESC+"[19;"+(a+1)+"~":l.key=ue.ESC+"[19~";break;case 120:a?l.key=ue.ESC+"[20;"+(a+1)+"~":l.key=ue.ESC+"[20~";break;case 121:a?l.key=ue.ESC+"[21;"+(a+1)+"~":l.key=ue.ESC+"[21~";break;case 122:a?l.key=ue.ESC+"[23;"+(a+1)+"~":l.key=ue.ESC+"[23~";break;case 123:a?l.key=ue.ESC+"[24;"+(a+1)+"~":l.key=ue.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ue.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ue.DEL:e.keyCode===219?l.key=ue.ESC:e.keyCode===220?l.key=ue.FS:e.keyCode===221&&(l.key=ue.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let h=(c=Y4[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(h)l.key=ue.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(d);e.shiftKey&&(f=f.toUpperCase()),l.key=ue.ESC+f}else if(e.keyCode===32)l.key=ue.ESC+(e.ctrlKey?ue.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),l.key=ue.ESC+d,l.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ue.US),e.key==="@"&&(l.key=ue.NUL));break}return l}var Ct=0,W4=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Qu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Qu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((l,a)=>this._getKey(l)-this._getKey(a)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<r.length;l++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[l]=e[t],t++):r[l]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Ct=this._search(t),Ct===-1)||this._getKey(this._array[Ct])!==t)return!1;do if(this._array[Ct]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ct),!0;while(++Ct<this._array.length&&this._getKey(this._array[Ct])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,a)=>l-a),t=0,i=new Array(this._array.length-e.length),r=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:i[r++]=this._array[l];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ct=this._search(e),!(Ct<0||Ct>=this._array.length)&&this._getKey(this._array[Ct])===e))do yield this._array[Ct];while(++Ct<this._array.length&&this._getKey(this._array[Ct])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ct=this._search(e),!(Ct<0||Ct>=this._array.length)&&this._getKey(this._array[Ct])===e))do t(this._array[Ct]);while(++Ct<this._array.length&&this._getKey(this._array[Ct])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,l=this._getKey(this._array[r]);if(l>e)i=r-1;else if(l<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},pp=0,d1=0,X4=class extends Pe{constructor(){super(),this._decorations=new W4(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ft(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new K4(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let r=0,l=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,l=r+(a.options.width??1),e>=r&&e<l&&(!i||(a.options.layer??"bottom")===i)&&(yield a)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,l=>{pp=l.options.x??0,d1=pp+(l.options.width??1),e>=pp&&e<d1&&(!i||(l.options.layer??"bottom")===i)&&r(l)})}},K4=class extends Wr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=gt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=gt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},G4=1e3,Z4=class{constructor(e,t=G4){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=r-this._lastRefreshMs,a=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},p1=20,Ju=class extends Pe{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Z4(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
95
+ `))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ft(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<p1+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
96
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===p1+1&&(this._liveRegion.textContent+=Vp.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,r=i.lines.length.toString();for(let l=e;l<=t;l++){let a=i.lines.get(i.ydisp+l),c=[],h=(a==null?void 0:a.translateToString(!0,void 0,void 0,c))||"",d=(i.ydisp+l+1).toString(),f=this._rowElements[l];f&&(h.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=h,this._rowColumns.set(f,c)),f.setAttribute("aria-posinset",d),f.setAttribute("aria-setsize",r),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],l=i.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===a||e.relatedTarget!==r)return;let c,h;if(t===0?(c=i,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(c=this._rowElements.shift(),h=i,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var h;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((h=r.textContent)==null?void 0:h.length)??0}),!this._rowContainer.contains(i.node))return;let l=({node:d,offset:f})=>{let m=d instanceof Text?d.parentNode:d,g=parseInt(m==null?void 0:m.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(m);if(!v)return console.warn("columns is null. Race condition?"),null;let y=f<v.length?v[f]:v.slice(-1)[0]+1;return y>=this._terminal.cols&&(++g,y=0),{row:g,column:y}},a=l(t),c=l(i);if(!(!a||!c)){if(a.row>c.row||a.row===c.row&&a.column>=c.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(c.row-a.row)*this._terminal.cols-a.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var l,a;e.style.transform="";let t=e.getBoundingClientRect().width,i=(a=(l=this._rowColumns.get(e))==null?void 0:l.slice(-1))==null?void 0:a[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Ju=yt([ve(1,Jg),ve(2,lr),ve(3,or)],Ju);var Cg=class extends Pe{constructor(e,t,i,r,l){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ft(()=>{var a;Ns(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let r=0;r<i.length;r++){let l=i[r];if(l.classList.contains("xterm"))break;if(l.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,l;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(a=>{a==null||a.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[a,c]of this._linkProviderService.linkProviders.entries())t?(l=this._activeProviderReplies)!=null&&l.get(a)&&(i=this._checkLinkProviderResult(a,e,i)):c.provideLinks(e.y,h=>{var f,m;if(this._isMouseOut)return;let d=h==null?void 0:h.map(g=>({link:g}));(f=this._activeProviderReplies)==null||f.set(a,d),i=this._checkLinkProviderResult(a,e,i),((m=this._activeProviderReplies)==null?void 0:m.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let l=t.get(r);if(l)for(let a=0;a<l.length;a++){let c=l[a],h=c.link.range.start.y<e?0:c.link.range.start.x,d=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let f=h;f<=d;f++){if(i.has(f)){l.splice(a--,1);break}i.add(f)}}}}_checkLinkProviderResult(e,t,i){var a;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),l=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(l=!0);if(!l&&r){let c=r.find(h=>this._linkAtPosition(h.link,t));c&&(i=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let c=0;c<this._activeProviderReplies.size;c++){let h=(a=this._activeProviderReplies.get(c))==null?void 0:a.find(d=>this._linkAtPosition(d.link,t));if(h){i=!0,this._handleNewLink(h);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Q4(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ns(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,l,a;(r=this._currentLink)!=null&&r.state&&((a=(l=this._currentLink)==null?void 0:l.state)==null?void 0:a.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(r,l),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,r=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,t,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,l=t.y*this._bufferService.cols+t.x;return i<=l&&l<=r}_positionFromMouseEvent(e,t,i){let r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,r,l){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:l}}};Cg=yt([ve(1,em),ve(2,or),ve(3,ai),ve(4,cw)],Cg);function Q4(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var J4=class extends F4{constructor(e={}){super(e),this._linkifier=this._register(new Pl),this.browser=Tw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Pl),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(X4),this._instantiationService.setService(Ba,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(qR),this._instantiationService.setService(cw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Yp)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Qt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Qt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Qt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Qt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ft(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let l=ct.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${ue.ESC}]${r};${P4(l)}${kw.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=Rt.toColor(...t.color));else{let a=i;this._themeService.modifyColors(c=>c[a]=Rt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ju,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,l=t.getWidth(i),a=this._renderService.dimensions.css.cell.width*l,c=this.buffer.y*this._renderService.dimensions.css.cell.height,h=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=c+"px",this.textarea.style.width=a+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&nD(t,this._selectionService)}));let e=t=>rD(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),Aw?this._register(Te(this.element,"mousedown",t=>{t.button===2&&CS(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{CS(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),am&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&ew(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var l;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((l=this.element)==null?void 0:l.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",qp.get()),Rw||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(jR,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(lr,this._coreBrowserService),this._register(Te(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(fg,this._document,this._helperContainer),this._instantiationService.setService(vh,this._charSizeService),this._themeService=this._instantiationService.createInstance(mg),this._instantiationService.setService(Il,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Gu),this._instantiationService.setService(aw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(pg,this.rows,this.screenElement)),this._instantiationService.setService(or,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(cg,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(dg),this._instantiationService.setService(em,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Cg,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(og,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(gg,this.element,this.screenElement,r)),this._instantiationService.setService(fD,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Qt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(ag,this.screenElement)),this._register(Te(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Ju,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ku,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ku,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(hg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(a){var f,m,g,v,y;let c=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!c)return!1;let h,d;switch(a.overrideType||a.type){case"mousemove":d=32,a.buttons===void 0?(h=3,a.button!==void 0&&(h=a.button<3?a.button:3)):h=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":d=0,h=a.button<3?a.button:3;break;case"mousedown":d=1,h=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let S=a.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(a,(v=(g=(m=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:m.device)==null?void 0:g.cell)==null?void 0:v.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;d=S<0?0:1,h=4;break;default:return!1}return d===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:h,action:d,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:a=>(i(a),a.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(a)),wheel:a=>(i(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&i(a)},mousemove:a=>{a.buttons||i(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?r.mousemove||(t.addEventListener("mousemove",l.mousemove),r.mousemove=l.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),a&16?r.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),r.wheel=l.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),a&2?r.mouseup||(r.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),a&4?r.mousedrag||(r.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return i(a),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(a)})),this._register(Te(t,"wheel",a=>{var c,h,d,f,m;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(f=(d=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:f.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return this.cancel(a,!0);let g=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Jx(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=$4(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===ue.ETX||i.key===ue.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(eB(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var i;(i=this._charSizeService)==null||i.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Dt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ue.ESC}[4;${i};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ue.ESC}[6;${l};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function eB(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var tB=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},iB=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Zi)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},g1=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new iB(t)}getNullCell(){return new Zi}},nB=class extends Pe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new g1(this._core.buffers.normal,"normal"),this._alternate=new g1(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)}},rB=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,r)=>t(i,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},sB=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},lB=["cols","rows"],vn=0,oB=class extends Pe{constructor(e){super(),this._core=this._register(new J4(e)),this._addonManager=this._register(new tB),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],i=(r,l)=>{this._checkReadonlyOptions(r),this._core.options[r]=l};for(let r in this._core.options){let l={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,l)}}_checkReadonlyOptions(e){if(lB.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new rB(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new sB(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 nB(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
97
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return qp.get()},set promptLabel(e){qp.set(e)},get tooMuchOutput(){return Vp.get()},set tooMuchOutput(e){Vp.set(e)}}}_verifyIntegers(...e){for(vn of e)if(vn===1/0||isNaN(vn)||vn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(vn of e)if(vn&&(vn===1/0||isNaN(vn)||vn%1!==0||vn<0))throw new Error("This API only accepts positive integers")}};/**
98
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
99
+ * @license MIT
100
+ *
101
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
102
+ * @license MIT
103
+ *
104
+ * Originally forked from (with the author's permission):
105
+ * Fabrice Bellard's javascript vt100 for jslinux:
106
+ * http://bellard.org/jslinux/
107
+ * Copyright (c) 2011 Fabrice Bellard
108
+ */var aB=2,cB=1,uB=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var g;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((g=this._terminal.options.overviewRuler)==null?void 0:g.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),c={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},h=c.top+c.bottom,d=c.right+c.left,f=r-h,m=l-d-t;return{cols:Math.max(aB,Math.floor(m/e.css.cell.width)),rows:Math.max(cB,Math.floor(f/e.css.cell.height))}}};/**
109
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
110
+ * @license MIT
111
+ *
112
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
113
+ * @license MIT
114
+ *
115
+ * Originally forked from (with the author's permission):
116
+ * Fabrice Bellard's javascript vt100 for jslinux:
117
+ * http://bellard.org/jslinux/
118
+ * Copyright (c) 2011 Fabrice Bellard
119
+ */var hB=class{constructor(e,t,i,r={}){this._terminal=e,this._regex=t,this._handler=i,this._options=r}provideLinks(e,t){let i=dB.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,r)=>{if(this._options.hover){let{range:l}=t;this._options.hover(i,r,l)}},t))}};function fB(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var dB=class Ou{static computeLink(t,i,r,l){let a=new RegExp(i.source,(i.flags||"")+"g"),[c,h]=Ou._getWindowedLineStrings(t-1,r),d=c.join(""),f,m=[];for(;f=a.exec(d);){let g=f[0];if(!fB(g))continue;let[v,y]=Ou._mapStrIdx(r,h,0,f.index),[S,b]=Ou._mapStrIdx(r,v,y,g.length);if(v===-1||y===-1||S===-1||b===-1)continue;let E={start:{x:y+1,y:v+1},end:{x:b,y:S+1}};m.push({range:E,text:g,activate:l})}return m}static _getWindowedLineStrings(t,i){let r,l=t,a=t,c=0,h="",d=[];if(r=i.buffer.active.getLine(t)){let f=r.translateToString(!0);if(r.isWrapped&&f[0]!==" "){for(c=0;(r=i.buffer.active.getLine(--l))&&c<2048&&(h=r.translateToString(!0),c+=h.length,d.push(h),!(!r.isWrapped||h.indexOf(" ")!==-1)););d.reverse()}for(d.push(f),c=0;(r=i.buffer.active.getLine(++a))&&r.isWrapped&&c<2048&&(h=r.translateToString(!0),c+=h.length,d.push(h),h.indexOf(" ")===-1););}return[d,l]}static _mapStrIdx(t,i,r,l){let a=t.buffer.active,c=a.getNullCell(),h=r;for(;l;){let d=a.getLine(i);if(!d)return[-1,-1];for(let f=h;f<d.length;++f){d.getCell(f,c);let m=c.getChars();if(c.getWidth()&&(l-=m.length||1,f===d.length-1&&m==="")){let g=a.getLine(i+1);g&&g.isWrapped&&(g.getCell(0,c),c.getWidth()===2&&(l+=1))}if(l<0)return[i,f]}i++,h=0}return[i,h]}},pB=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function gB(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var mB=class{constructor(e=gB,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||pB;this._linkProvider=this._terminal.registerLinkProvider(new hB(this._terminal,i,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};function _B(e){const t=new oB({fontFamily:"'SF Mono', Menlo, Monaco, 'Courier New', monospace",fontSize:12,lineHeight:1.2,theme:{background:"#1a1a1a",foreground:"#e8e4df",cursor:"#1a1a1a",cursorAccent:"#1a1a1a",selectionBackground:"rgba(255, 255, 255, 0.15)",black:"#1a1a1a",brightBlack:"#787068",white:"#e8e4df",brightWhite:"#faf9f7",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee"},cursorBlink:!1,cursorInactiveStyle:"none",scrollback:1e4,convertEol:!0}),i=new uB;return t.loadAddon(i),t.loadAddon(new mB),t.onData(r=>{e.current({type:"pty-input",data:r})}),{term:t,fitAddon:i}}function vB({sendMessage:e,ptyEvents:t}){const[i,r]=q.useState(!1),[l,a]=q.useState(!1),c=q.useRef(e);c.current=e;const h=q.useRef(null);h.current||(h.current=_B(c));const{term:d,fitAddon:f}=h.current,m=q.useRef(!1),g=q.useRef([]);q.useEffect(()=>()=>{d.dispose(),h.current=null},[d]),q.useEffect(()=>{const b=z=>{const C=z.detail;m.current?(d.write(C),a(!0)):g.current.push(C)},E=z=>{r(!1);const C=`\r
120
+ \x1B[90m[Process exited with code ${z.detail}. Press Enter to restart.]\x1B[0m`;m.current?d.writeln(C):g.current.push(C+`\r
121
+ `)},w=()=>{r(!0)};return t.addEventListener("data",b),t.addEventListener("exit",E),t.addEventListener("spawned",w),()=>{t.removeEventListener("data",b),t.removeEventListener("exit",E),t.removeEventListener("spawned",w)}},[t,d]);const v=q.useCallback(b=>{if(b){if(m.current)d.element&&b.appendChild(d.element);else if(d.open(b),m.current=!0,g.current.length>0){for(const E of g.current)d.write(E);g.current=[],a(!0)}f.fit(),d.focus(),c.current({type:"pty-resize",data:{cols:d.cols,rows:d.rows}})}},[d,f]),y=q.useCallback(()=>{f.fit(),c.current({type:"pty-resize",data:{cols:d.cols,rows:d.rows}})},[d,f]),S=q.useCallback(()=>{d.clear(),c.current({type:"pty-spawn"})},[d]);return{attachTo:v,fit:y,ptyAlive:i,hasData:l,restart:S}}function m1({defaultWidth:e,minWidth:t,maxWidth:i,side:r}){const[l,a]=q.useState(e),c=q.useRef(!1),h=q.useRef(0),d=q.useRef(0),f=q.useCallback(m=>{m.preventDefault(),c.current=!0,h.current=m.clientX,d.current=l},[l]);return q.useEffect(()=>{const m=v=>{if(!c.current)return;const y=v.clientX-h.current,S=r==="right"?d.current+y:d.current-y;a(Math.max(t,Math.min(i,S)))},g=()=>{c.current=!1};return window.addEventListener("mousemove",m),window.addEventListener("mouseup",g),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",g)}},[t,i,r]),{width:l,onDragStart:f}}const yB={node:"<>",agent:"AI",workflow:"wf",input:"IN",output:"OUT",condition:"?"},SB={node:"CUSTOM CODE",agent:"AI AGENT",workflow:"WORKFLOW",input:"INPUT",output:"OUTPUT",condition:"CONDITION"},bB={node:"#d1fae5",agent:"#ede9fe",workflow:"#d1fae5",input:"#e5e7eb",output:"#e5e7eb",condition:"#fef3c7"},xB={node:"#ecfdf5",agent:"#f5f3ff",workflow:"#ecfdf5",input:"#f3f4f6",output:"#f3f4f6",condition:"#fffbeb"},wB={node:"#10b981",agent:"#8b5cf6",workflow:"#10b981",input:"#9ca3af",output:"#9ca3af",condition:"#f59e0b"},CB={node:"#10b981",agent:"#8b5cf6",workflow:"#10b981",input:"#9ca3af",output:"#9ca3af",condition:"#f59e0b"};function EB({data:e}){const t=e.type??"node",i=e.label??"",r=e.fields??void 0,l=yB[t]??"<>",a=t==="input"||t==="output";return k.jsxs("div",{className:"bg-white rounded-lg border",style:{borderColor:bB[t],minWidth:a?120:160,maxWidth:260,boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[k.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[k.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:xB[t]},children:k.jsx("span",{className:"text-[11px] font-bold",style:{color:wB[t]},children:l})}),k.jsxs("div",{className:"min-w-0",children:[k.jsx("div",{className:`font-medium truncate ${a?"text-[13px] text-gray-500":"text-sm text-gray-800"}`,children:i}),k.jsx("div",{className:"text-[10px] font-semibold tracking-wider",style:{color:CB[t]},children:SB[t]})]})]}),a&&r&&r.length>0&&k.jsx("div",{className:"border-t border-gray-100 px-3 py-1.5 flex flex-wrap gap-x-2 gap-y-0.5",children:r.map(c=>k.jsx("span",{className:"text-[11px] text-gray-400",children:c},c))}),t!=="input"&&k.jsx(Xr,{type:"target",position:we.Left,className:"!w-[6px] !h-[6px] !bg-gray-300 !border !border-gray-200 !opacity-60"}),t!=="output"&&k.jsx(Xr,{type:"source",position:we.Right,className:"!w-[6px] !h-[6px] !bg-gray-300 !border !border-gray-200 !opacity-60"})]})}function kB({data:e}){const t=e.label??"",i=e.width,r=e.height;return k.jsxs("div",{className:"relative rounded-xl",style:{width:i,height:r,border:"1.5px dashed #d1d5db",background:"rgba(249, 250, 251, 0.5)"},children:[k.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 border-b border-gray-200",children:[k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:"shrink-0 text-gray-400",children:[k.jsx("path",{d:"M3 4C2 4 1 5 1 6.5C1 8 2 9 3 9H11C12 9 13 8 13 6.5C13 5 12 4 11 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),k.jsx("path",{d:"M9.5 3L11 4L9.5 5",fill:"currentColor"})]}),k.jsx("span",{className:"text-[12px] font-semibold text-gray-500 truncate",children:t})]}),k.jsx(Xr,{type:"target",position:we.Left,className:"!bg-transparent !w-0 !h-0 !border-0"}),k.jsx(Xr,{type:"source",position:we.Right,className:"!bg-transparent !w-0 !h-0 !border-0"})]})}function MB(e){const{sourceX:t,sourceY:i,sourcePosition:r,targetX:l,targetY:a,targetPosition:c,markerEnd:h,label:d,style:f}=e,[m,g,v]=$g({sourceX:t,sourceY:i,sourcePosition:r,targetX:l,targetY:a,targetPosition:c});return k.jsxs("g",{children:[k.jsx("path",{d:m,fill:"none",strokeWidth:20,stroke:"transparent",className:"react-flow__edge-interaction"}),k.jsx("path",{d:m,fill:"none",stroke:(f==null?void 0:f.stroke)??"#d1d5db",strokeWidth:(f==null?void 0:f.strokeWidth)??1.5,markerEnd:h}),d&&k.jsx("text",{x:g,y:v,textAnchor:"middle",dominantBaseline:"central",className:"react-flow__edge-text",children:d})]})}function TB(e,t){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const AB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DB={};function _1(e,t){return(DB.jsx?NB:AB).test(e)}const RB=/[ \t\n\f\r]/g;function BB(e){return typeof e=="object"?e.type==="text"?v1(e.value):!1:v1(e)}function v1(e){return e.replace(RB,"")===""}class Oa{constructor(t,i,r){this.normal=i,this.property=t,r&&(this.space=r)}}Oa.prototype.normal={};Oa.prototype.property={};Oa.prototype.space=void 0;function qw(e,t){const i={},r={};for(const l of e)Object.assign(i,l.property),Object.assign(r,l.normal);return new Oa(i,r,t)}function Eg(e){return e.toLowerCase()}class wi{constructor(t,i){this.attribute=i,this.property=t}}wi.prototype.attribute="";wi.prototype.booleanish=!1;wi.prototype.boolean=!1;wi.prototype.commaOrSpaceSeparated=!1;wi.prototype.commaSeparated=!1;wi.prototype.defined=!1;wi.prototype.mustUseProperty=!1;wi.prototype.number=!1;wi.prototype.overloadedBoolean=!1;wi.prototype.property="";wi.prototype.spaceSeparated=!1;wi.prototype.space=void 0;let LB=0;const Le=Bs(),Nt=Bs(),kg=Bs(),de=Bs(),st=Bs(),Al=Bs(),zi=Bs();function Bs(){return 2**++LB}const Mg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:Nt,commaOrSpaceSeparated:zi,commaSeparated:Al,number:de,overloadedBoolean:kg,spaceSeparated:st},Symbol.toStringTag,{value:"Module"})),gp=Object.keys(Mg);class cm extends wi{constructor(t,i,r,l){let a=-1;if(super(t,i),y1(this,"space",l),typeof r=="number")for(;++a<gp.length;){const c=gp[a];y1(this,gp[a],(r&Mg[c])===Mg[c])}}}cm.prototype.defined=!0;function y1(e,t,i){i&&(e[t]=i)}function Ul(e){const t={},i={};for(const[r,l]of Object.entries(e.properties)){const a=new cm(r,e.transform(e.attributes||{},r),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,i[Eg(r)]=r,i[Eg(a.attribute)]=r}return new Oa(t,i,e.space)}const Vw=Ul({properties:{ariaActiveDescendant:null,ariaAtomic:Nt,ariaAutoComplete:null,ariaBusy:Nt,ariaChecked:Nt,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:st,ariaCurrent:null,ariaDescribedBy:st,ariaDetails:null,ariaDisabled:Nt,ariaDropEffect:st,ariaErrorMessage:null,ariaExpanded:Nt,ariaFlowTo:st,ariaGrabbed:Nt,ariaHasPopup:null,ariaHidden:Nt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:st,ariaLevel:de,ariaLive:null,ariaModal:Nt,ariaMultiLine:Nt,ariaMultiSelectable:Nt,ariaOrientation:null,ariaOwns:st,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:Nt,ariaReadOnly:Nt,ariaRelevant:null,ariaRequired:Nt,ariaRoleDescription:st,ariaRowCount:de,ariaRowIndex:de,ariaRowSpan:de,ariaSelected:Nt,ariaSetSize:de,ariaSort:null,ariaValueMax:de,ariaValueMin:de,ariaValueNow:de,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Fw(e,t){return t in e?e[t]:t}function Yw(e,t){return Fw(e,t.toLowerCase())}const zB=Ul({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Al,acceptCharset:st,accessKey:st,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:st,autoFocus:Le,autoPlay:Le,blocking:st,capture:null,charSet:null,checked:Le,cite:null,className:st,cols:de,colSpan:null,content:null,contentEditable:Nt,controls:Le,controlsList:st,coords:de|Al,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:kg,draggable:Nt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:st,height:de,hidden:kg,high:de,href:null,hrefLang:null,htmlFor:st,httpEquiv:st,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:st,itemRef:st,itemScope:Le,itemType:st,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:de,manifest:null,max:null,maxLength:de,media:null,method:null,min:null,minLength:de,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Le,optimum:de,pattern:null,ping:st,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:st,required:Le,reversed:Le,rows:de,rowSpan:de,sandbox:st,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:de,sizes:null,slot:null,span:de,spellCheck:Nt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:de,step:null,style:null,tabIndex:de,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:Nt,width:de,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:st,axis:null,background:null,bgColor:null,border:de,borderColor:null,bottomMargin:de,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:de,leftMargin:de,link:null,longDesc:null,lowSrc:null,marginHeight:de,marginWidth:de,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:de,rules:null,scheme:null,scrolling:Nt,standby:null,summary:null,text:null,topMargin:de,valueType:null,version:null,vAlign:null,vLink:null,vSpace:de,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:Yw}),OB=Ul({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zi,accentHeight:de,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:de,amplitude:de,arabicForm:null,ascent:de,attributeName:null,attributeType:null,azimuth:de,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:de,by:null,calcMode:null,capHeight:de,className:st,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:de,diffuseConstant:de,direction:null,display:null,dur:null,divisor:de,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:de,enableBackground:null,end:null,event:null,exponent:de,externalResourcesRequired:null,fill:null,fillOpacity:de,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Al,g2:Al,glyphName:Al,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:de,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:de,horizOriginX:de,horizOriginY:de,id:null,ideographic:de,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:de,k:de,k1:de,k2:de,k3:de,k4:de,kernelMatrix:zi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:de,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:de,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:de,overlineThickness:de,paintOrder:null,panose1:null,path:null,pathLength:de,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:st,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zi,rev:zi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zi,requiredFeatures:zi,requiredFonts:zi,requiredFormats:zi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:de,specularExponent:de,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:de,strikethroughThickness:de,string:null,stroke:null,strokeDashArray:zi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:de,strokeOpacity:de,strokeWidth:null,style:null,surfaceScale:de,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zi,tabIndex:de,tableValues:null,target:null,targetX:de,targetY:de,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:de,underlineThickness:de,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:de,values:null,vAlphabetic:de,vMathematical:de,vectorEffect:null,vHanging:de,vIdeographic:de,version:null,vertAdvY:de,vertOriginX:de,vertOriginY:de,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:de,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fw}),$w=Ul({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Ww=Ul({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Yw}),Xw=Ul({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),HB={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},PB=/[A-Z]/g,S1=/-[a-z]/g,IB=/^data[-\w.:]+$/i;function jB(e,t){const i=Eg(t);let r=t,l=wi;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&IB.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(S1,qB);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!S1.test(a)){let c=a.replace(PB,UB);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=cm}return new l(r,t)}function UB(e){return"-"+e.toLowerCase()}function qB(e){return e.charAt(1).toUpperCase()}const VB=qw([Vw,zB,$w,Ww,Xw],"html"),um=qw([Vw,OB,$w,Ww,Xw],"svg");function FB(e){return e.join(" ").trim()}var xl={},mp,b1;function YB(){if(b1)return mp;b1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,i=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,h=/^\s+|\s+$/g,d=`
122
+ `,f="/",m="*",g="",v="comment",y="declaration";function S(E,w){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];w=w||{};var z=1,C=1;function T(R){var O=R.match(t);O&&(z+=O.length);var M=R.lastIndexOf(d);C=~M?R.length-M:C+R.length}function I(){var R={line:z,column:C};return function(O){return O.position=new B(R),G(),O}}function B(R){this.start=R,this.end={line:z,column:C},this.source=w.source}B.prototype.content=E;function U(R){var O=new Error(w.source+":"+z+":"+C+": "+R);if(O.reason=R,O.filename=w.source,O.line=z,O.column=C,O.source=E,!w.silent)throw O}function X(R){var O=R.exec(E);if(O){var M=O[0];return T(M),E=E.slice(M.length),O}}function G(){X(i)}function ne(R){var O;for(R=R||[];O=V();)O!==!1&&R.push(O);return R}function V(){var R=I();if(!(f!=E.charAt(0)||m!=E.charAt(1))){for(var O=2;g!=E.charAt(O)&&(m!=E.charAt(O)||f!=E.charAt(O+1));)++O;if(O+=2,g===E.charAt(O-1))return U("End of comment missing");var M=E.slice(2,O-2);return C+=2,T(M),E=E.slice(O),C+=2,R({type:v,comment:M})}}function j(){var R=I(),O=X(r);if(O){if(V(),!X(l))return U("property missing ':'");var M=X(a),P=R({type:y,property:b(O[0].replace(e,g)),value:M?b(M[0].replace(e,g)):g});return X(c),P}}function F(){var R=[];ne(R);for(var O;O=j();)O!==!1&&(R.push(O),ne(R));return R}return G(),F()}function b(E){return E?E.replace(h,g):g}return mp=S,mp}var x1;function $B(){if(x1)return xl;x1=1;var e=xl&&xl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xl,"__esModule",{value:!0}),xl.default=i;const t=e(YB());function i(r,l){let a=null;if(!r||typeof r!="string")return a;const c=(0,t.default)(r),h=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:m}=d;h?l(f,m,d):m&&(a=a||{},a[f]=m)}),a}return xl}var Wo={},w1;function WB(){if(w1)return Wo;w1=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,i=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,a=function(f){return!f||i.test(f)||e.test(f)},c=function(f,m){return m.toUpperCase()},h=function(f,m){return"".concat(m,"-")},d=function(f,m){return m===void 0&&(m={}),a(f)?f:(f=f.toLowerCase(),m.reactCompat?f=f.replace(l,h):f=f.replace(r,h),f.replace(t,c))};return Wo.camelCase=d,Wo}var Xo,C1;function XB(){if(C1)return Xo;C1=1;var e=Xo&&Xo.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e($B()),i=WB();function r(l,a){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(h,d){h&&d&&(c[(0,i.camelCase)(h,a)]=d)}),c}return r.default=r,Xo=r,Xo}var KB=XB();const GB=nh(KB),Kw=Gw("end"),hm=Gw("start");function Gw(e){return t;function t(i){const r=i&&i.position&&i.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ZB(e){const t=hm(e),i=Kw(e);if(t&&i)return{start:t,end:i}}function oa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?E1(e.position):"start"in e||"end"in e?E1(e):"line"in e||"column"in e?Tg(e):""}function Tg(e){return k1(e&&e.line)+":"+k1(e&&e.column)}function E1(e){return Tg(e&&e.start)+"-"+Tg(e&&e.end)}function k1(e){return e&&typeof e=="number"?e:1}class ri extends Error{constructor(t,i,r){super(),typeof i=="string"&&(r=i,i=void 0);let l="",a={},c=!1;if(i&&("line"in i&&"column"in i?a={place:i}:"start"in i&&"end"in i?a={place:i}:"type"in i?a={ancestors:[i],place:i.position}:a={...i}),typeof t=="string"?l=t:!a.cause&&t&&(c=!0,l=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const h=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=h?h.line:void 0,this.name=oa(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=c&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ri.prototype.file="";ri.prototype.name="";ri.prototype.reason="";ri.prototype.message="";ri.prototype.stack="";ri.prototype.column=void 0;ri.prototype.line=void 0;ri.prototype.ancestors=void 0;ri.prototype.cause=void 0;ri.prototype.fatal=void 0;ri.prototype.place=void 0;ri.prototype.ruleId=void 0;ri.prototype.source=void 0;const fm={}.hasOwnProperty,QB=new Map,JB=/[A-Z]/g,e6=new Set(["table","tbody","thead","tfoot","tr"]),t6=new Set(["td","th"]),Zw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function i6(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=u6(i,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=c6(i,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?um:VB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Qw(l,e,void 0);return a&&typeof a!="string"?a:l.create(e,l.Fragment,{children:a||void 0},void 0)}function Qw(e,t,i){if(t.type==="element")return n6(e,t,i);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return r6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return l6(e,t,i);if(t.type==="mdxjsEsm")return s6(e,t);if(t.type==="root")return o6(e,t,i);if(t.type==="text")return a6(e,t)}function n6(e,t,i){const r=e.schema;let l=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(l=um,e.schema=l),e.ancestors.push(t);const a=eC(e,t.tagName,!1),c=h6(e,t);let h=pm(e,t);return e6.has(t.tagName)&&(h=h.filter(function(d){return typeof d=="string"?!BB(d):!0})),Jw(e,c,a,t),dm(c,h),e.ancestors.pop(),e.schema=r,e.create(t,a,c,i)}function r6(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wa(e,t.position)}function s6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wa(e,t.position)}function l6(e,t,i){const r=e.schema;let l=r;t.name==="svg"&&r.space==="html"&&(l=um,e.schema=l),e.ancestors.push(t);const a=t.name===null?e.Fragment:eC(e,t.name,!0),c=f6(e,t),h=pm(e,t);return Jw(e,c,a,t),dm(c,h),e.ancestors.pop(),e.schema=r,e.create(t,a,c,i)}function o6(e,t,i){const r={};return dm(r,pm(e,t)),e.create(t,e.Fragment,r,i)}function a6(e,t){return t.value}function Jw(e,t,i,r){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(t.node=r)}function dm(e,t){if(t.length>0){const i=t.length>1?t:t[0];i&&(e.children=i)}}function c6(e,t,i){return r;function r(l,a,c,h){const f=Array.isArray(c.children)?i:t;return h?f(a,c,h):f(a,c)}}function u6(e,t){return i;function i(r,l,a,c){const h=Array.isArray(a.children),d=hm(r);return t(l,a,c,h,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function h6(e,t){const i={};let r,l;for(l in t.properties)if(l!=="children"&&fm.call(t.properties,l)){const a=d6(e,l,t.properties[l]);if(a){const[c,h]=a;e.tableCellAlignToStyle&&c==="align"&&typeof h=="string"&&t6.has(t.tagName)?r=h:i[c]=h}}if(r){const a=i.style||(i.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return i}function f6(e,t){const i={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const c=a.expression;c.type;const h=c.properties[0];h.type,Object.assign(i,e.evaluater.evaluateExpression(h.argument))}else wa(e,t.position);else{const l=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const h=r.value.data.estree.body[0];h.type,a=e.evaluater.evaluateExpression(h.expression)}else wa(e,t.position);else a=r.value===null?!0:r.value;i[l]=a}return i}function pm(e,t){const i=[];let r=-1;const l=e.passKeys?new Map:QB;for(;++r<t.children.length;){const a=t.children[r];let c;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const f=l.get(d)||0;c=d+"-"+f,l.set(d,f+1)}}const h=Qw(e,a,c);h!==void 0&&i.push(h)}return i}function d6(e,t,i){const r=jB(e.schema,t);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=r.commaSeparated?TB(i):FB(i)),r.property==="style"){let l=typeof i=="object"?i:p6(e,String(i));return e.stylePropertyNameCase==="css"&&(l=g6(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&r.space?HB[r.property]||r.property:r.attribute,i]}}function p6(e,t){try{return GB(t,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const r=i,l=new ri("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Zw+"#cannot-parse-style-attribute",l}}function eC(e,t,i){let r;if(!i)r={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let a=-1,c;for(;++a<l.length;){const h=_1(l[a])?{type:"Identifier",name:l[a]}:{type:"Literal",value:l[a]};c=c?{type:"MemberExpression",object:c,property:h,computed:!!(a&&h.type==="Literal"),optional:!1}:h}r=c}else r=_1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const l=r.value;return fm.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(r);wa(e)}function wa(e,t){const i=new ri("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Zw+"#cannot-handle-mdx-estrees-without-createevaluater",i}function g6(e){const t={};let i;for(i in e)fm.call(e,i)&&(t[m6(i)]=e[i]);return t}function m6(e){let t=e.replace(JB,_6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function _6(e){return"-"+e.toLowerCase()}const _p={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},v6={};function y6(e,t){const i=v6,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,l=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return tC(e,r,l)}function tC(e,t,i){if(S6(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return M1(e.children,t,i)}return Array.isArray(e)?M1(e,t,i):""}function M1(e,t,i){const r=[];let l=-1;for(;++l<e.length;)r[l]=tC(e[l],t,i);return r.join("")}function S6(e){return!!(e&&typeof e=="object")}const T1=document.createElement("i");function gm(e){const t="&"+e+";";T1.innerHTML=t;const i=T1.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===t?!1:i}function Tn(e,t,i,r){const l=e.length;let a=0,c;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,i=i>0?i:0,r.length<1e4)c=Array.from(r),c.unshift(t,i),e.splice(...c);else for(i&&e.splice(t,i);a<r.length;)c=r.slice(a,a+1e4),c.unshift(t,0),e.splice(...c),a+=1e4,t+=1e4}function Gi(e,t){return e.length>0?(Tn(e,e.length,0,t),e):t}const A1={}.hasOwnProperty;function b6(e){const t={};let i=-1;for(;++i<e.length;)x6(t,e[i]);return t}function x6(e,t){let i;for(i in t){const l=(A1.call(e,i)?e[i]:void 0)||(e[i]={}),a=t[i];let c;if(a)for(c in a){A1.call(l,c)||(l[c]=[]);const h=a[c];w6(l[c],Array.isArray(h)?h:h?[h]:[])}}}function w6(e,t){let i=-1;const r=[];for(;++i<t.length;)(t[i].add==="after"?e:r).push(t[i]);Tn(e,0,0,r)}function iC(e,t){const i=Number.parseInt(e,t);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Nl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xn=Kr(/[A-Za-z]/),Hi=Kr(/[\dA-Za-z]/),C6=Kr(/[#-'*+\--9=?A-Z^-~]/);function Ag(e){return e!==null&&(e<32||e===127)}const Ng=Kr(/\d/),E6=Kr(/[\dA-Fa-f]/),k6=Kr(/[!-/:-@[-`{-~]/);function Ae(e){return e!==null&&e<-2}function xi(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const M6=Kr(new RegExp("\\p{P}|\\p{S}","u")),T6=Kr(/\s/);function Kr(e){return t;function t(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function ql(e){const t=[];let i=-1,r=0,l=0;for(;++i<e.length;){const a=e.charCodeAt(i);let c="";if(a===37&&Hi(e.charCodeAt(i+1))&&Hi(e.charCodeAt(i+2)))l=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(c=String.fromCharCode(a));else if(a>55295&&a<57344){const h=e.charCodeAt(i+1);a<56320&&h>56319&&h<57344?(c=String.fromCharCode(a,h),l=1):c="�"}else c=String.fromCharCode(a);c&&(t.push(e.slice(r,i),encodeURIComponent(c)),r=i+l+1,c=""),l&&(i+=l,l=0)}return t.join("")+e.slice(r)}function lt(e,t,i,r){const l=r?r-1:Number.POSITIVE_INFINITY;let a=0;return c;function c(d){return Ge(d)?(e.enter(i),h(d)):t(d)}function h(d){return Ge(d)&&a++<l?(e.consume(d),h):(e.exit(i),t(d))}}const A6={tokenize:N6};function N6(e){const t=e.attempt(this.parser.constructs.contentInitial,r,l);let i;return t;function r(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),lt(e,t,"linePrefix")}function l(h){return e.enter("paragraph"),a(h)}function a(h){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,c(h)}function c(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ae(h)?(e.consume(h),e.exit("chunkText"),a):(e.consume(h),c)}}const D6={tokenize:R6},N1={tokenize:B6};function R6(e){const t=this,i=[];let r=0,l,a,c;return h;function h(C){if(r<i.length){const T=i[r];return t.containerState=T[1],e.attempt(T[0].continuation,d,f)(C)}return f(C)}function d(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&z();const T=t.events.length;let I=T,B;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){B=t.events[I][1].end;break}w(r);let U=T;for(;U<t.events.length;)t.events[U][1].end={...B},U++;return Tn(t.events,I+1,0,t.events.slice(T)),t.events.length=U,f(C)}return h(C)}function f(C){if(r===i.length){if(!l)return v(C);if(l.currentConstruct&&l.currentConstruct.concrete)return S(C);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(N1,m,g)(C)}function m(C){return l&&z(),w(r),v(C)}function g(C){return t.parser.lazy[t.now().line]=r!==i.length,c=t.now().offset,S(C)}function v(C){return t.containerState={},e.attempt(N1,y,S)(C)}function y(C){return r++,i.push([t.currentConstruct,t.containerState]),v(C)}function S(C){if(C===null){l&&z(),w(0),e.consume(C);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:a}),b(C)}function b(C){if(C===null){E(e.exit("chunkFlow"),!0),w(0),e.consume(C);return}return Ae(C)?(e.consume(C),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,h):(e.consume(C),b)}function E(C,T){const I=t.sliceStream(C);if(T&&I.push(null),C.previous=a,a&&(a.next=C),a=C,l.defineSkip(C.start),l.write(I),t.parser.lazy[C.start.line]){let B=l.events.length;for(;B--;)if(l.events[B][1].start.offset<c&&(!l.events[B][1].end||l.events[B][1].end.offset>c))return;const U=t.events.length;let X=U,G,ne;for(;X--;)if(t.events[X][0]==="exit"&&t.events[X][1].type==="chunkFlow"){if(G){ne=t.events[X][1].end;break}G=!0}for(w(r),B=U;B<t.events.length;)t.events[B][1].end={...ne},B++;Tn(t.events,X+1,0,t.events.slice(U)),t.events.length=B}}function w(C){let T=i.length;for(;T-- >C;){const I=i[T];t.containerState=I[1],I[0].exit.call(t,e)}i.length=C}function z(){l.write([null]),a=void 0,l=void 0,t.containerState._closeFlow=void 0}}function B6(e,t,i){return lt(e,e.attempt(this.parser.constructs.document,t,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function D1(e){if(e===null||xi(e)||T6(e))return 1;if(M6(e))return 2}function mm(e,t,i){const r=[];let l=-1;for(;++l<e.length;){const a=e[l].resolveAll;a&&!r.includes(a)&&(t=a(t,i),r.push(a))}return t}const Dg={name:"attention",resolveAll:L6,tokenize:z6};function L6(e,t){let i=-1,r,l,a,c,h,d,f,m;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(r=i;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[r][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const g={...e[r][1].end},v={...e[i][1].start};R1(g,-d),R1(v,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},h={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:v},a={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[i][1].start}},l={type:d>1?"strong":"emphasis",start:{...c.start},end:{...h.end}},e[r][1].end={...c.start},e[i][1].start={...h.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Gi(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Gi(f,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",a,t]]),f=Gi(f,mm(t.parser.constructs.insideSpan.null,e.slice(r+1,i),t)),f=Gi(f,[["exit",a,t],["enter",h,t],["exit",h,t],["exit",l,t]]),e[i][1].end.offset-e[i][1].start.offset?(m=2,f=Gi(f,[["enter",e[i][1],t],["exit",e[i][1],t]])):m=0,Tn(e,r-1,i-r+3,f),i=r+f.length-m-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function z6(e,t){const i=this.parser.constructs.attentionMarkers.null,r=this.previous,l=D1(r);let a;return c;function c(d){return a=d,e.enter("attentionSequence"),h(d)}function h(d){if(d===a)return e.consume(d),h;const f=e.exit("attentionSequence"),m=D1(d),g=!m||m===2&&l||i.includes(d),v=!l||l===2&&m||i.includes(r);return f._open=!!(a===42?g:g&&(l||!v)),f._close=!!(a===42?v:v&&(m||!g)),t(d)}}function R1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const O6={name:"autolink",tokenize:H6};function H6(e,t,i){let r=0;return l;function l(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(y){return xn(y)?(e.consume(y),c):y===64?i(y):f(y)}function c(y){return y===43||y===45||y===46||Hi(y)?(r=1,h(y)):f(y)}function h(y){return y===58?(e.consume(y),r=0,d):(y===43||y===45||y===46||Hi(y))&&r++<32?(e.consume(y),h):(r=0,f(y))}function d(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Ag(y)?i(y):(e.consume(y),d)}function f(y){return y===64?(e.consume(y),m):C6(y)?(e.consume(y),f):i(y)}function m(y){return Hi(y)?g(y):i(y)}function g(y){return y===46?(e.consume(y),r=0,m):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):v(y)}function v(y){if((y===45||Hi(y))&&r++<63){const S=y===45?v:g;return e.consume(y),S}return i(y)}}const bh={partial:!0,tokenize:P6};function P6(e,t,i){return r;function r(a){return Ge(a)?lt(e,l,"linePrefix")(a):l(a)}function l(a){return a===null||Ae(a)?t(a):i(a)}}const nC={continuation:{tokenize:j6},exit:U6,name:"blockQuote",tokenize:I6};function I6(e,t,i){const r=this;return l;function l(c){if(c===62){const h=r.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),a}return i(c)}function a(c){return Ge(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function j6(e,t,i){const r=this;return l;function l(c){return Ge(c)?lt(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):a(c)}function a(c){return e.attempt(nC,t,i)(c)}}function U6(e){e.exit("blockQuote")}const rC={name:"characterEscape",tokenize:q6};function q6(e,t,i){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),l}function l(a){return k6(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):i(a)}}const sC={name:"characterReference",tokenize:V6};function V6(e,t,i){const r=this;let l=0,a,c;return h;function h(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),a=31,c=Hi,m(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,c=E6,m):(e.enter("characterReferenceValue"),a=7,c=Ng,m(g))}function m(g){if(g===59&&l){const v=e.exit("characterReferenceValue");return c===Hi&&!gm(r.sliceSerialize(v))?i(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<a?(e.consume(g),m):i(g)}}const B1={partial:!0,tokenize:Y6},L1={concrete:!0,name:"codeFenced",tokenize:F6};function F6(e,t,i){const r=this,l={partial:!0,tokenize:I};let a=0,c=0,h;return d;function d(B){return f(B)}function f(B){const U=r.events[r.events.length-1];return a=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,h=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(B)}function m(B){return B===h?(c++,e.consume(B),m):c<3?i(B):(e.exit("codeFencedFenceSequence"),Ge(B)?lt(e,g,"whitespace")(B):g(B))}function g(B){return B===null||Ae(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(B1,b,T)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(B))}function v(B){return B===null||Ae(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(B)):Ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,y,"whitespace")(B)):B===96&&B===h?i(B):(e.consume(B),v)}function y(B){return B===null||Ae(B)?g(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(B))}function S(B){return B===null||Ae(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(B)):B===96&&B===h?i(B):(e.consume(B),S)}function b(B){return e.attempt(l,T,E)(B)}function E(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),w}function w(B){return a>0&&Ge(B)?lt(e,z,"linePrefix",a+1)(B):z(B)}function z(B){return B===null||Ae(B)?e.check(B1,b,T)(B):(e.enter("codeFlowValue"),C(B))}function C(B){return B===null||Ae(B)?(e.exit("codeFlowValue"),z(B)):(e.consume(B),C)}function T(B){return e.exit("codeFenced"),t(B)}function I(B,U,X){let G=0;return ne;function ne(O){return B.enter("lineEnding"),B.consume(O),B.exit("lineEnding"),V}function V(O){return B.enter("codeFencedFence"),Ge(O)?lt(B,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):j(O)}function j(O){return O===h?(B.enter("codeFencedFenceSequence"),F(O)):X(O)}function F(O){return O===h?(G++,B.consume(O),F):G>=c?(B.exit("codeFencedFenceSequence"),Ge(O)?lt(B,R,"whitespace")(O):R(O)):X(O)}function R(O){return O===null||Ae(O)?(B.exit("codeFencedFence"),U(O)):X(O)}}}function Y6(e,t,i){const r=this;return l;function l(c){return c===null?i(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a)}function a(c){return r.parser.lazy[r.now().line]?i(c):t(c)}}const vp={name:"codeIndented",tokenize:W6},$6={partial:!0,tokenize:X6};function W6(e,t,i){const r=this;return l;function l(f){return e.enter("codeIndented"),lt(e,a,"linePrefix",5)(f)}function a(f){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?c(f):i(f)}function c(f){return f===null?d(f):Ae(f)?e.attempt($6,c,d)(f):(e.enter("codeFlowValue"),h(f))}function h(f){return f===null||Ae(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),h)}function d(f){return e.exit("codeIndented"),t(f)}}function X6(e,t,i){const r=this;return l;function l(c){return r.parser.lazy[r.now().line]?i(c):Ae(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):lt(e,a,"linePrefix",5)(c)}function a(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(c):Ae(c)?l(c):i(c)}}const K6={name:"codeText",previous:Z6,resolve:G6,tokenize:Q6};function G6(e){let t=e.length-4,i=3,r,l;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=i;++r<t;)if(e[r][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[t][1].type="codeTextPadding",i+=2,t-=2;break}}for(r=i-1,t++;++r<=t;)l===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(l=r):(r===t||e[r][1].type==="lineEnding")&&(e[l][1].type="codeTextData",r!==l+2&&(e[l][1].end=e[r-1][1].end,e.splice(l+2,r-l-2),t-=r-l-2,r=l+2),l=void 0);return e}function Z6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Q6(e,t,i){let r=0,l,a;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),h(g)}function h(g){return g===96?(e.consume(g),r++,h):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?i(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(a=e.enter("codeTextSequence"),l=0,m(g)):Ae(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Ae(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),f)}function m(g){return g===96?(e.consume(g),l++,m):l===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(a.type="codeTextData",f(g))}}class J6{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,i){const r=i??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,i,r){const l=i||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return r&&Ko(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ko(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ko(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const i=this.left.splice(t,Number.POSITIVE_INFINITY);Ko(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ko(this.left,i.reverse())}}}function Ko(e,t){let i=0;if(t.length<1e4)e.push(...t);else for(;i<t.length;)e.push(...t.slice(i,i+1e4)),i+=1e4}function lC(e){const t={};let i=-1,r,l,a,c,h,d,f;const m=new J6(e);for(;++i<m.length;){for(;i in t;)i=t[i];if(r=m.get(i),i&&r[1].type==="chunkFlow"&&m.get(i-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,eL(m,i)),i=t[i],f=!0);else if(r[1]._container){for(a=i,l=void 0;a--;)if(c=m.get(a),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(m.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=a);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(r[1].end={...m.get(l)[1].start},h=m.slice(l,i),h.unshift(r),m.splice(l,i-l+1,h))}}return Tn(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!f}function eL(e,t){const i=e.get(t)[1],r=e.get(t)[2];let l=t-1;const a=[];let c=i._tokenizer;c||(c=r.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const h=c.events,d=[],f={};let m,g,v=-1,y=i,S=0,b=0;const E=[b];for(;y;){for(;e.get(++l)[1]!==y;);a.push(l),y._tokenizer||(m=r.sliceStream(y),y.next||m.push(null),g&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(m),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=i;++v<h.length;)h[v][0]==="exit"&&h[v-1][0]==="enter"&&h[v][1].type===h[v-1][1].type&&h[v][1].start.line!==h[v][1].end.line&&(b=v+1,E.push(b),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):E.pop(),v=E.length;v--;){const w=h.slice(E[v],E[v+1]),z=a.pop();d.push([z,z+w.length-1]),e.splice(z,2,w)}for(d.reverse(),v=-1;++v<d.length;)f[S+d[v][0]]=S+d[v][1],S+=d[v][1]-d[v][0]-1;return f}const tL={resolve:nL,tokenize:rL},iL={partial:!0,tokenize:sL};function nL(e){return lC(e),e}function rL(e,t){let i;return r;function r(h){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),l(h)}function l(h){return h===null?a(h):Ae(h)?e.check(iL,c,a)(h):(e.consume(h),l)}function a(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function c(h){return e.consume(h),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,l}}function sL(e,t,i){const r=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),lt(e,a,"linePrefix")}function a(c){if(c===null||Ae(c))return i(c);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(c):e.interrupt(r.parser.constructs.flow,i,t)(c)}}function oC(e,t,i,r,l,a,c,h,d){const f=d||Number.POSITIVE_INFINITY;let m=0;return g;function g(w){return w===60?(e.enter(r),e.enter(l),e.enter(a),e.consume(w),e.exit(a),v):w===null||w===32||w===41||Ag(w)?i(w):(e.enter(r),e.enter(c),e.enter(h),e.enter("chunkString",{contentType:"string"}),b(w))}function v(w){return w===62?(e.enter(a),e.consume(w),e.exit(a),e.exit(l),e.exit(r),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===62?(e.exit("chunkString"),e.exit(h),v(w)):w===null||w===60||Ae(w)?i(w):(e.consume(w),w===92?S:y)}function S(w){return w===60||w===62||w===92?(e.consume(w),y):y(w)}function b(w){return!m&&(w===null||w===41||xi(w))?(e.exit("chunkString"),e.exit(h),e.exit(c),e.exit(r),t(w)):m<f&&w===40?(e.consume(w),m++,b):w===41?(e.consume(w),m--,b):w===null||w===32||w===40||Ag(w)?i(w):(e.consume(w),w===92?E:b)}function E(w){return w===40||w===41||w===92?(e.consume(w),b):b(w)}}function aC(e,t,i,r,l,a){const c=this;let h=0,d;return f;function f(y){return e.enter(r),e.enter(l),e.consume(y),e.exit(l),e.enter(a),m}function m(y){return h>999||y===null||y===91||y===93&&!d||y===94&&!h&&"_hiddenFootnoteSupport"in c.parser.constructs?i(y):y===93?(e.exit(a),e.enter(l),e.consume(y),e.exit(l),e.exit(r),t):Ae(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Ae(y)||h++>999?(e.exit("chunkString"),m(y)):(e.consume(y),d||(d=!Ge(y)),y===92?v:g)}function v(y){return y===91||y===92||y===93?(e.consume(y),h++,g):g(y)}}function cC(e,t,i,r,l,a){let c;return h;function h(v){return v===34||v===39||v===40?(e.enter(r),e.enter(l),e.consume(v),e.exit(l),c=v===40?41:v,d):i(v)}function d(v){return v===c?(e.enter(l),e.consume(v),e.exit(l),e.exit(r),t):(e.enter(a),f(v))}function f(v){return v===c?(e.exit(a),d(c)):v===null?i(v):Ae(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),lt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===c||v===null||Ae(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?g:m)}function g(v){return v===c||v===92?(e.consume(v),m):m(v)}}function aa(e,t){let i;return r;function r(l){return Ae(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i=!0,r):Ge(l)?lt(e,r,i?"linePrefix":"lineSuffix")(l):t(l)}}const lL={name:"definition",tokenize:aL},oL={partial:!0,tokenize:cL};function aL(e,t,i){const r=this;let l;return a;function a(y){return e.enter("definition"),c(y)}function c(y){return aC.call(r,e,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return l=Nl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):i(y)}function d(y){return xi(y)?aa(e,f)(y):f(y)}function f(y){return oC(e,m,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(oL,g,g)(y)}function g(y){return Ge(y)?lt(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Ae(y)?(e.exit("definition"),r.parser.defined.push(l),t(y)):i(y)}}function cL(e,t,i){return r;function r(h){return xi(h)?aa(e,l)(h):i(h)}function l(h){return cC(e,a,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function a(h){return Ge(h)?lt(e,c,"whitespace")(h):c(h)}function c(h){return h===null||Ae(h)?t(h):i(h)}}const uL={name:"hardBreakEscape",tokenize:hL};function hL(e,t,i){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),l}function l(a){return Ae(a)?(e.exit("hardBreakEscape"),t(a)):i(a)}}const fL={name:"headingAtx",resolve:dL,tokenize:pL};function dL(e,t){let i=e.length-2,r=3,l,a;return e[r][1].type==="whitespace"&&(r+=2),i-2>r&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(r===i-1||i-4>r&&e[i-2][1].type==="whitespace")&&(i-=r+1===i?2:4),i>r&&(l={type:"atxHeadingText",start:e[r][1].start,end:e[i][1].end},a={type:"chunkText",start:e[r][1].start,end:e[i][1].end,contentType:"text"},Tn(e,r,i-r+1,[["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t]])),e}function pL(e,t,i){let r=0;return l;function l(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),c(m)}function c(m){return m===35&&r++<6?(e.consume(m),c):m===null||xi(m)?(e.exit("atxHeadingSequence"),h(m)):i(m)}function h(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||Ae(m)?(e.exit("atxHeading"),t(m)):Ge(m)?lt(e,h,"whitespace")(m):(e.enter("atxHeadingText"),f(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),h(m))}function f(m){return m===null||m===35||xi(m)?(e.exit("atxHeadingText"),h(m)):(e.consume(m),f)}}const gL=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],z1=["pre","script","style","textarea"],mL={concrete:!0,name:"htmlFlow",resolveTo:yL,tokenize:SL},_L={partial:!0,tokenize:xL},vL={partial:!0,tokenize:bL};function yL(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function SL(e,t,i){const r=this;let l,a,c,h,d;return f;function f(N){return m(N)}function m(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),g}function g(N){return N===33?(e.consume(N),v):N===47?(e.consume(N),a=!0,b):N===63?(e.consume(N),l=3,r.interrupt?t:A):xn(N)?(e.consume(N),c=String.fromCharCode(N),E):i(N)}function v(N){return N===45?(e.consume(N),l=2,y):N===91?(e.consume(N),l=5,h=0,S):xn(N)?(e.consume(N),l=4,r.interrupt?t:A):i(N)}function y(N){return N===45?(e.consume(N),r.interrupt?t:A):i(N)}function S(N){const ee="CDATA[";return N===ee.charCodeAt(h++)?(e.consume(N),h===ee.length?r.interrupt?t:j:S):i(N)}function b(N){return xn(N)?(e.consume(N),c=String.fromCharCode(N),E):i(N)}function E(N){if(N===null||N===47||N===62||xi(N)){const ee=N===47,ce=c.toLowerCase();return!ee&&!a&&z1.includes(ce)?(l=1,r.interrupt?t(N):j(N)):gL.includes(c.toLowerCase())?(l=6,ee?(e.consume(N),w):r.interrupt?t(N):j(N)):(l=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(N):a?z(N):C(N))}return N===45||Hi(N)?(e.consume(N),c+=String.fromCharCode(N),E):i(N)}function w(N){return N===62?(e.consume(N),r.interrupt?t:j):i(N)}function z(N){return Ge(N)?(e.consume(N),z):ne(N)}function C(N){return N===47?(e.consume(N),ne):N===58||N===95||xn(N)?(e.consume(N),T):Ge(N)?(e.consume(N),C):ne(N)}function T(N){return N===45||N===46||N===58||N===95||Hi(N)?(e.consume(N),T):I(N)}function I(N){return N===61?(e.consume(N),B):Ge(N)?(e.consume(N),I):C(N)}function B(N){return N===null||N===60||N===61||N===62||N===96?i(N):N===34||N===39?(e.consume(N),d=N,U):Ge(N)?(e.consume(N),B):X(N)}function U(N){return N===d?(e.consume(N),d=null,G):N===null||Ae(N)?i(N):(e.consume(N),U)}function X(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||xi(N)?I(N):(e.consume(N),X)}function G(N){return N===47||N===62||Ge(N)?C(N):i(N)}function ne(N){return N===62?(e.consume(N),V):i(N)}function V(N){return N===null||Ae(N)?j(N):Ge(N)?(e.consume(N),V):i(N)}function j(N){return N===45&&l===2?(e.consume(N),M):N===60&&l===1?(e.consume(N),P):N===62&&l===4?(e.consume(N),L):N===63&&l===3?(e.consume(N),A):N===93&&l===5?(e.consume(N),Y):Ae(N)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(_L,$,F)(N)):N===null||Ae(N)?(e.exit("htmlFlowData"),F(N)):(e.consume(N),j)}function F(N){return e.check(vL,R,$)(N)}function R(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),O}function O(N){return N===null||Ae(N)?F(N):(e.enter("htmlFlowData"),j(N))}function M(N){return N===45?(e.consume(N),A):j(N)}function P(N){return N===47?(e.consume(N),c="",H):j(N)}function H(N){if(N===62){const ee=c.toLowerCase();return z1.includes(ee)?(e.consume(N),L):j(N)}return xn(N)&&c.length<8?(e.consume(N),c+=String.fromCharCode(N),H):j(N)}function Y(N){return N===93?(e.consume(N),A):j(N)}function A(N){return N===62?(e.consume(N),L):N===45&&l===2?(e.consume(N),A):j(N)}function L(N){return N===null||Ae(N)?(e.exit("htmlFlowData"),$(N)):(e.consume(N),L)}function $(N){return e.exit("htmlFlow"),t(N)}}function bL(e,t,i){const r=this;return l;function l(c){return Ae(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):i(c)}function a(c){return r.parser.lazy[r.now().line]?i(c):t(c)}}function xL(e,t,i){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(bh,t,i)}}const wL={name:"htmlText",tokenize:CL};function CL(e,t,i){const r=this;let l,a,c;return h;function h(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),d}function d(A){return A===33?(e.consume(A),f):A===47?(e.consume(A),I):A===63?(e.consume(A),C):xn(A)?(e.consume(A),X):i(A)}function f(A){return A===45?(e.consume(A),m):A===91?(e.consume(A),a=0,S):xn(A)?(e.consume(A),z):i(A)}function m(A){return A===45?(e.consume(A),y):i(A)}function g(A){return A===null?i(A):A===45?(e.consume(A),v):Ae(A)?(c=g,P(A)):(e.consume(A),g)}function v(A){return A===45?(e.consume(A),y):g(A)}function y(A){return A===62?M(A):A===45?v(A):g(A)}function S(A){const L="CDATA[";return A===L.charCodeAt(a++)?(e.consume(A),a===L.length?b:S):i(A)}function b(A){return A===null?i(A):A===93?(e.consume(A),E):Ae(A)?(c=b,P(A)):(e.consume(A),b)}function E(A){return A===93?(e.consume(A),w):b(A)}function w(A){return A===62?M(A):A===93?(e.consume(A),w):b(A)}function z(A){return A===null||A===62?M(A):Ae(A)?(c=z,P(A)):(e.consume(A),z)}function C(A){return A===null?i(A):A===63?(e.consume(A),T):Ae(A)?(c=C,P(A)):(e.consume(A),C)}function T(A){return A===62?M(A):C(A)}function I(A){return xn(A)?(e.consume(A),B):i(A)}function B(A){return A===45||Hi(A)?(e.consume(A),B):U(A)}function U(A){return Ae(A)?(c=U,P(A)):Ge(A)?(e.consume(A),U):M(A)}function X(A){return A===45||Hi(A)?(e.consume(A),X):A===47||A===62||xi(A)?G(A):i(A)}function G(A){return A===47?(e.consume(A),M):A===58||A===95||xn(A)?(e.consume(A),ne):Ae(A)?(c=G,P(A)):Ge(A)?(e.consume(A),G):M(A)}function ne(A){return A===45||A===46||A===58||A===95||Hi(A)?(e.consume(A),ne):V(A)}function V(A){return A===61?(e.consume(A),j):Ae(A)?(c=V,P(A)):Ge(A)?(e.consume(A),V):G(A)}function j(A){return A===null||A===60||A===61||A===62||A===96?i(A):A===34||A===39?(e.consume(A),l=A,F):Ae(A)?(c=j,P(A)):Ge(A)?(e.consume(A),j):(e.consume(A),R)}function F(A){return A===l?(e.consume(A),l=void 0,O):A===null?i(A):Ae(A)?(c=F,P(A)):(e.consume(A),F)}function R(A){return A===null||A===34||A===39||A===60||A===61||A===96?i(A):A===47||A===62||xi(A)?G(A):(e.consume(A),R)}function O(A){return A===47||A===62||xi(A)?G(A):i(A)}function M(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):i(A)}function P(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),H}function H(A){return Ge(A)?lt(e,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):Y(A)}function Y(A){return e.enter("htmlTextData"),c(A)}}const _m={name:"labelEnd",resolveAll:TL,resolveTo:AL,tokenize:NL},EL={tokenize:DL},kL={tokenize:RL},ML={tokenize:BL};function TL(e){let t=-1;const i=[];for(;++t<e.length;){const r=e[t][1];if(i.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const l=r.type==="labelImage"?4:2;r.type="data",t+=l}}return e.length!==i.length&&Tn(e,0,e.length,i),e}function AL(e,t){let i=e.length,r=0,l,a,c,h;for(;i--;)if(l=e[i][1],a){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[i][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[i][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(a=i,l.type!=="labelLink")){r=2;break}}else l.type==="labelEnd"&&(c=i);const d={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[c][1].end}},m={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[c-2][1].start}};return h=[["enter",d,t],["enter",f,t]],h=Gi(h,e.slice(a+1,a+r+3)),h=Gi(h,[["enter",m,t]]),h=Gi(h,mm(t.parser.constructs.insideSpan.null,e.slice(a+r+4,c-3),t)),h=Gi(h,[["exit",m,t],e[c-2],e[c-1],["exit",f,t]]),h=Gi(h,e.slice(c+1)),h=Gi(h,[["exit",d,t]]),Tn(e,a,e.length,h),e}function NL(e,t,i){const r=this;let l=r.events.length,a,c;for(;l--;)if((r.events[l][1].type==="labelImage"||r.events[l][1].type==="labelLink")&&!r.events[l][1]._balanced){a=r.events[l][1];break}return h;function h(v){return a?a._inactive?g(v):(c=r.parser.defined.includes(Nl(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):i(v)}function d(v){return v===40?e.attempt(EL,m,c?m:g)(v):v===91?e.attempt(kL,m,c?f:g)(v):c?m(v):g(v)}function f(v){return e.attempt(ML,m,g)(v)}function m(v){return t(v)}function g(v){return a._balanced=!0,i(v)}}function DL(e,t,i){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return xi(g)?aa(e,a)(g):a(g)}function a(g){return g===41?m(g):oC(e,c,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return xi(g)?aa(e,d)(g):m(g)}function h(g){return i(g)}function d(g){return g===34||g===39||g===40?cC(e,f,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function f(g){return xi(g)?aa(e,m)(g):m(g)}function m(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):i(g)}}function RL(e,t,i){const r=this;return l;function l(h){return aC.call(r,e,a,c,"reference","referenceMarker","referenceString")(h)}function a(h){return r.parser.defined.includes(Nl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(h):i(h)}function c(h){return i(h)}}function BL(e,t,i){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),l}function l(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):i(a)}}const LL={name:"labelStartImage",resolveAll:_m.resolveAll,tokenize:zL};function zL(e,t,i){const r=this;return l;function l(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),a}function a(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),c):i(h)}function c(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(h):t(h)}}const OL={name:"labelStartLink",resolveAll:_m.resolveAll,tokenize:HL};function HL(e,t,i){const r=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),a}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(c):t(c)}}const yp={name:"lineEnding",tokenize:PL};function PL(e,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),lt(e,t,"linePrefix")}}const Hu={name:"thematicBreak",tokenize:IL};function IL(e,t,i){let r=0,l;return a;function a(f){return e.enter("thematicBreak"),c(f)}function c(f){return l=f,h(f)}function h(f){return f===l?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Ae(f))?(e.exit("thematicBreak"),t(f)):i(f)}function d(f){return f===l?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Ge(f)?lt(e,h,"whitespace")(f):h(f))}}const Si={continuation:{tokenize:VL},exit:YL,name:"list",tokenize:qL},jL={partial:!0,tokenize:$L},UL={partial:!0,tokenize:FL};function qL(e,t,i){const r=this,l=r.events[r.events.length-1];let a=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return h;function h(y){const S=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Ng(y)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Hu,i,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return i(y)}function d(y){return Ng(y)&&++c<10?(e.consume(y),d):(!r.interrupt||c<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):i(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(bh,r.interrupt?i:m,e.attempt(jL,v,g))}function m(y){return r.containerState.initialBlankLine=!0,a++,v(y)}function g(y){return Ge(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):i(y)}function v(y){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function VL(e,t,i){const r=this;return r.containerState._closeFlow=void 0,e.check(bh,l,a);function l(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,lt(e,t,"listItemIndent",r.containerState.size+1)(h)}function a(h){return r.containerState.furtherBlankLines||!Ge(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(UL,t,c)(h))}function c(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,lt(e,e.attempt(Si,t,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function FL(e,t,i){const r=this;return lt(e,l,"listItemIndent",r.containerState.size+1);function l(a){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(a):i(a)}}function YL(e){e.exit(this.containerState.type)}function $L(e,t,i){const r=this;return lt(e,l,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(a){const c=r.events[r.events.length-1];return!Ge(a)&&c&&c[1].type==="listItemPrefixWhitespace"?t(a):i(a)}}const O1={name:"setextUnderline",resolveTo:WL,tokenize:XL};function WL(e,t){let i=e.length,r,l,a;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){r=i;break}e[i][1].type==="paragraph"&&(l=i)}else e[i][1].type==="content"&&e.splice(i,1),!a&&e[i][1].type==="definition"&&(a=i);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",a?(e.splice(l,0,["enter",c,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function XL(e,t,i){const r=this;let l;return a;function a(f){let m=r.events.length,g;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){g=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),l=f,c(f)):i(f)}function c(f){return e.enter("setextHeadingLineSequence"),h(f)}function h(f){return f===l?(e.consume(f),h):(e.exit("setextHeadingLineSequence"),Ge(f)?lt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Ae(f)?(e.exit("setextHeadingLine"),t(f)):i(f)}}const KL={tokenize:GL};function GL(e){const t=this,i=e.attempt(bh,r,e.attempt(this.parser.constructs.flowInitial,l,lt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(tL,l)),"linePrefix")));return i;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,i}function l(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,i}}const ZL={resolveAll:hC()},QL=uC("string"),JL=uC("text");function uC(e){return{resolveAll:hC(e==="text"?ez:void 0),tokenize:t};function t(i){const r=this,l=this.parser.constructs[e],a=i.attempt(l,c,h);return c;function c(m){return f(m)?a(m):h(m)}function h(m){if(m===null){i.consume(m);return}return i.enter("data"),i.consume(m),d}function d(m){return f(m)?(i.exit("data"),a(m)):(i.consume(m),d)}function f(m){if(m===null)return!0;const g=l[m];let v=-1;if(g)for(;++v<g.length;){const y=g[v];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function hC(e){return t;function t(i,r){let l=-1,a;for(;++l<=i.length;)a===void 0?i[l]&&i[l][1].type==="data"&&(a=l,l++):(!i[l]||i[l][1].type!=="data")&&(l!==a+2&&(i[a][1].end=i[l-1][1].end,i.splice(a+2,l-a-2),l=a+2),a=void 0);return e?e(i,r):i}}function ez(e,t){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const r=e[i-1][1],l=t.sliceStream(r);let a=l.length,c=-1,h=0,d;for(;a--;){const f=l[a];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)h++,c--;if(c)break;c=-1}else if(f===-2)d=!0,h++;else if(f!==-1){a++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(h=0),h){const f={type:i===e.length||d||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?c:r.start._bufferIndex+c,_index:r.start._index+a,line:r.end.line,column:r.end.column-h,offset:r.end.offset-h},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(i,0,["enter",f,t],["exit",f,t]),i+=2)}i++}return e}const tz={42:Si,43:Si,45:Si,48:Si,49:Si,50:Si,51:Si,52:Si,53:Si,54:Si,55:Si,56:Si,57:Si,62:nC},iz={91:lL},nz={[-2]:vp,[-1]:vp,32:vp},rz={35:fL,42:Hu,45:[O1,Hu],60:mL,61:O1,95:Hu,96:L1,126:L1},sz={38:sC,92:rC},lz={[-5]:yp,[-4]:yp,[-3]:yp,33:LL,38:sC,42:Dg,60:[O6,wL],91:OL,92:[uL,rC],93:_m,95:Dg,96:K6},oz={null:[Dg,ZL]},az={null:[42,95]},cz={null:[]},uz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:az,contentInitial:iz,disable:cz,document:tz,flow:rz,flowInitial:nz,insideSpan:oz,string:sz,text:lz},Symbol.toStringTag,{value:"Module"}));function hz(e,t,i){let r={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const l={},a=[];let c=[],h=[];const d={attempt:U(I),check:U(B),consume:z,enter:C,exit:T,interrupt:U(B,{interrupt:!0})},f={code:null,containerState:{},defineSkip:b,events:[],now:S,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:g};let m=t.tokenize.call(f,d);return t.resolveAll&&a.push(t),f;function g(V){return c=Gi(c,V),E(),c[c.length-1]!==null?[]:(X(t,0),f.events=mm(a,f.events,f),f.events)}function v(V,j){return dz(y(V),j)}function y(V){return fz(c,V)}function S(){const{_bufferIndex:V,_index:j,line:F,column:R,offset:O}=r;return{_bufferIndex:V,_index:j,line:F,column:R,offset:O}}function b(V){l[V.line]=V.column,ne()}function E(){let V;for(;r._index<c.length;){const j=c[r._index];if(typeof j=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<j.length;)w(j.charCodeAt(r._bufferIndex));else w(j)}}function w(V){m=m(V)}function z(V){Ae(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,ne()):V!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=V}function C(V,j){const F=j||{};return F.type=V,F.start=S(),f.events.push(["enter",F,f]),h.push(F),F}function T(V){const j=h.pop();return j.end=S(),f.events.push(["exit",j,f]),j}function I(V,j){X(V,j.from)}function B(V,j){j.restore()}function U(V,j){return F;function F(R,O,M){let P,H,Y,A;return Array.isArray(R)?$(R):"tokenize"in R?$([R]):L(R);function L(oe){return fe;function fe(he){const pe=he!==null&&oe[he],Ce=he!==null&&oe.null,xe=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return $(xe)(he)}}function $(oe){return P=oe,H=0,oe.length===0?M:N(oe[H])}function N(oe){return fe;function fe(he){return A=G(),Y=oe,oe.partial||(f.currentConstruct=oe),oe.name&&f.parser.constructs.disable.null.includes(oe.name)?ce():oe.tokenize.call(j?Object.assign(Object.create(f),j):f,d,ee,ce)(he)}}function ee(oe){return V(Y,A),O}function ce(oe){return A.restore(),++H<P.length?N(P[H]):M}}}function X(V,j){V.resolveAll&&!a.includes(V)&&a.push(V),V.resolve&&Tn(f.events,j,f.events.length-j,V.resolve(f.events.slice(j),f)),V.resolveTo&&(f.events=V.resolveTo(f.events,f))}function G(){const V=S(),j=f.previous,F=f.currentConstruct,R=f.events.length,O=Array.from(h);return{from:R,restore:M};function M(){r=V,f.previous=j,f.currentConstruct=F,f.events.length=R,h=O,ne()}}function ne(){r.line in l&&r.column<2&&(r.column=l[r.line],r.offset+=l[r.line]-1)}}function fz(e,t){const i=t.start._index,r=t.start._bufferIndex,l=t.end._index,a=t.end._bufferIndex;let c;if(i===l)c=[e[i].slice(r,a)];else{if(c=e.slice(i,l),r>-1){const h=c[0];typeof h=="string"?c[0]=h.slice(r):c.shift()}a>0&&c.push(e[l].slice(0,a))}return c}function dz(e,t){let i=-1;const r=[];let l;for(;++i<e.length;){const a=e[i];let c;if(typeof a=="string")c=a;else switch(a){case-5:{c="\r";break}case-4:{c=`
123
+ `;break}case-3:{c=`\r
124
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(a)}l=a===-2,r.push(c)}return r.join("")}function pz(e){const r={constructs:b6([uz,...(e||{}).extensions||[]]),content:l(A6),defined:[],document:l(D6),flow:l(KL),lazy:{},string:l(QL),text:l(JL)};return r;function l(a){return c;function c(h){return hz(r,a,h)}}}function gz(e){for(;!lC(e););return e}const H1=/[\0\t\n\r]/g;function mz(){let e=1,t="",i=!0,r;return l;function l(a,c,h){const d=[];let f,m,g,v,y;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(c||void 0).decode(a)),g=0,t="",i&&(a.charCodeAt(0)===65279&&g++,i=void 0);g<a.length;){if(H1.lastIndex=g,f=H1.exec(a),v=f&&f.index!==void 0?f.index:a.length,y=a.charCodeAt(v),!f){t=a.slice(g);break}if(y===10&&g===v&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),g<v&&(d.push(a.slice(g,v)),e+=v-g),y){case 0:{d.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,d.push(-2);e++<m;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}g=v+1}return h&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const _z=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vz(e){return e.replace(_z,yz)}function yz(e,t,i){if(t)return t;if(i.charCodeAt(0)===35){const l=i.charCodeAt(1),a=l===120||l===88;return iC(i.slice(a?2:1),a?16:10)}return gm(i)||e}const fC={}.hasOwnProperty;function Sz(e,t,i){return t&&typeof t=="object"&&(i=t,t=void 0),bz(i)(gz(pz(i).document().write(mz()(e,t,!0))))}function bz(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Jt),autolinkProtocol:G,autolinkEmail:G,atxHeading:a($e),blockQuote:a(Ce),characterEscape:G,characterReference:G,codeFenced:a(xe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:a(xe,c),codeText:a(Se,c),codeTextData:G,data:G,codeFlowValue:G,definition:a(me),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:a(Ne),hardBreakEscape:a(ze),hardBreakTrailing:a(ze),htmlFlow:a(St,c),htmlFlowData:G,htmlText:a(St,c),htmlTextData:G,image:a(Ci),label:c,link:a(Jt),listItem:a(Qi),listItemValue:v,listOrdered:a(ui,g),listUnordered:a(ui),paragraph:a(Nn),reference:N,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:a($e),strong:a(Dn),thematicBreak:a(ar)},exit:{atxHeading:d(),atxHeadingSequence:I,autolink:d(),autolinkEmail:pe,autolinkProtocol:he,blockQuote:d(),characterEscapeValue:ne,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:oe,characterReference:fe,codeFenced:d(E),codeFencedFence:b,codeFencedFenceInfo:y,codeFencedFenceMeta:S,codeFlowValue:ne,codeIndented:d(w),codeText:d(O),codeTextData:ne,data:ne,definition:d(),definitionDestinationString:T,definitionLabelString:z,definitionTitleString:C,emphasis:d(),hardBreakEscape:d(j),hardBreakTrailing:d(j),htmlFlow:d(F),htmlFlowData:ne,htmlText:d(R),htmlTextData:ne,image:d(P),label:Y,labelText:H,lineEnding:V,link:d(M),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ee,resourceDestinationString:A,resourceTitleString:L,resource:$,setextHeading:d(X),setextHeadingLineSequence:U,setextHeadingText:B,strong:d(),thematicBreak:d()}};dC(t,(e||{}).mdastExtensions||[]);const i={};return r;function r(re){let ge={type:"root",children:[]};const ke={stack:[ge],tokenStack:[],config:t,enter:h,exit:f,buffer:c,resume:m,data:i},Oe=[];let Fe=-1;for(;++Fe<re.length;)if(re[Fe][1].type==="listOrdered"||re[Fe][1].type==="listUnordered")if(re[Fe][0]==="enter")Oe.push(Fe);else{const si=Oe.pop();Fe=l(re,si,Fe)}for(Fe=-1;++Fe<re.length;){const si=t[re[Fe][0]];fC.call(si,re[Fe][1].type)&&si[re[Fe][1].type].call(Object.assign({sliceSerialize:re[Fe][2].sliceSerialize},ke),re[Fe][1])}if(ke.tokenStack.length>0){const si=ke.tokenStack[ke.tokenStack.length-1];(si[1]||P1).call(ke,void 0,si[0])}for(ge.position={start:Vr(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Vr(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ge=t.transforms[Fe](ge)||ge;return ge}function l(re,ge,ke){let Oe=ge-1,Fe=-1,si=!1,Ji,$t,bt,ei;for(;++Oe<=ke;){const Ze=re[Oe];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Fe++:Fe--,ei=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(Ji&&!ei&&!Fe&&!bt&&(bt=Oe),ei=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ei=void 0}if(!Fe&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Fe===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(Ji){let hn=Oe;for($t=void 0;hn--;){const Ei=re[hn];if(Ei[1].type==="lineEnding"||Ei[1].type==="lineEndingBlank"){if(Ei[0]==="exit")continue;$t&&(re[$t][1].type="lineEndingBlank",si=!0),Ei[1].type="lineEnding",$t=hn}else if(!(Ei[1].type==="linePrefix"||Ei[1].type==="blockQuotePrefix"||Ei[1].type==="blockQuotePrefixWhitespace"||Ei[1].type==="blockQuoteMarker"||Ei[1].type==="listItemIndent"))break}bt&&(!$t||bt<$t)&&(Ji._spread=!0),Ji.end=Object.assign({},$t?re[$t][1].start:Ze[1].end),re.splice($t||Oe,0,["exit",Ji,Ze[2]]),Oe++,ke++}if(Ze[1].type==="listItemPrefix"){const hn={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};Ji=hn,re.splice(Oe,0,["enter",hn,Ze[2]]),Oe++,ke++,bt=void 0,ei=!0}}}return re[ge][1]._spread=si,ke}function a(re,ge){return ke;function ke(Oe){h.call(this,re(Oe),Oe),ge&&ge.call(this,Oe)}}function c(){this.stack.push({type:"fragment",children:[]})}function h(re,ge,ke){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ge,ke||void 0]),re.position={start:Vr(ge.start),end:void 0}}function d(re){return ge;function ge(ke){re&&re.call(this,ke),f.call(this,ke)}}function f(re,ge){const ke=this.stack.pop(),Oe=this.tokenStack.pop();if(Oe)Oe[0].type!==re.type&&(ge?ge.call(this,re,Oe[0]):(Oe[1]||P1).call(this,re,Oe[0]));else throw new Error("Cannot close `"+re.type+"` ("+oa({start:re.start,end:re.end})+"): it’s not open");ke.position.end=Vr(re.end)}function m(){return y6(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function v(re){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function y(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=re}function S(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=re}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re.replace(/(\r?\n|\r)$/g,"")}function z(re){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=Nl(this.sliceSerialize(re)).toLowerCase()}function C(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.title=re}function T(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.url=re}function I(re){const ge=this.stack[this.stack.length-1];if(!ge.depth){const ke=this.sliceSerialize(re).length;ge.depth=ke}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function U(re){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function G(re){const ke=this.stack[this.stack.length-1].children;let Oe=ke[ke.length-1];(!Oe||Oe.type!=="text")&&(Oe=Lt(),Oe.position={start:Vr(re.start),end:void 0},ke.push(Oe)),this.stack.push(Oe)}function ne(re){const ge=this.stack.pop();ge.value+=this.sliceSerialize(re),ge.position.end=Vr(re.end)}function V(re){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=ge.children[ge.children.length-1];ke.position.end=Vr(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(G.call(this,re),ne.call(this,re))}function j(){this.data.atHardBreak=!0}function F(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re}function R(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re}function O(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re}function M(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ge,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function P(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ge,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function H(re){const ge=this.sliceSerialize(re),ke=this.stack[this.stack.length-2];ke.label=vz(ge),ke.identifier=Nl(ge).toLowerCase()}function Y(){const re=this.stack[this.stack.length-1],ge=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const Oe=re.children;ke.children=Oe}else ke.alt=ge}function A(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.url=re}function L(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.title=re}function $(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function ee(re){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=Nl(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function ce(re){this.data.characterReferenceType=re.type}function oe(re){const ge=this.sliceSerialize(re),ke=this.data.characterReferenceType;let Oe;ke?(Oe=iC(ge,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=gm(ge);const Fe=this.stack[this.stack.length-1];Fe.value+=Oe}function fe(re){const ge=this.stack.pop();ge.position.end=Vr(re.end)}function he(re){ne.call(this,re);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(re)}function pe(re){ne.call(this,re);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(re)}function Ce(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ne(){return{type:"emphasis",children:[]}}function $e(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function St(){return{type:"html",value:""}}function Ci(){return{type:"image",title:null,url:"",alt:null}}function Jt(){return{type:"link",title:null,url:"",children:[]}}function ui(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Qi(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function Nn(){return{type:"paragraph",children:[]}}function Dn(){return{type:"strong",children:[]}}function Lt(){return{type:"text",value:""}}function ar(){return{type:"thematicBreak"}}}function Vr(e){return{line:e.line,column:e.column,offset:e.offset}}function dC(e,t){let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)?dC(e,r):xz(e,r)}}function xz(e,t){let i;for(i in t)if(fC.call(t,i))switch(i){case"canContainEols":{const r=t[i];r&&e[i].push(...r);break}case"transforms":{const r=t[i];r&&e[i].push(...r);break}case"enter":case"exit":{const r=t[i];r&&Object.assign(e[i],r);break}}}function P1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+oa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is still open")}function wz(e){const t=this;t.parser=i;function i(r){return Sz(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Cz(e,t){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,i),e.applyData(t,i)}function Ez(e,t){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,i),[e.applyData(t,i),{type:"text",value:`
125
+ `}]}function kz(e,t){const i=t.value?t.value+`
126
+ `:"",r={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(r.className=["language-"+l[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:i}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function Mz(e,t){const i={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Tz(e,t){const i={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Az(e,t){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),l=ql(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let c,h=e.footnoteCounts.get(r);h===void 0?(h=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=a+1,h+=1,e.footnoteCounts.set(r,h);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+l,id:i+"fnref-"+l+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function Nz(e,t){const i={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Dz(e,t){if(e.options.allowDangerousHtml){const i={type:"raw",value:t.value};return e.patch(t,i),e.applyData(t,i)}}function pC(e,t){const i=t.referenceType;let r="]";if(i==="collapsed"?r+="[]":i==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const l=e.all(t),a=l[0];a&&a.type==="text"?a.value="["+a.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=r:l.push({type:"text",value:r}),l}function Rz(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return pC(e,t);const l={src:ql(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(l.title=r.title);const a={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,a),e.applyData(t,a)}function Bz(e,t){const i={src:ql(t.url)};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),t.title!==null&&t.title!==void 0&&(i.title=t.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function Lz(e,t){const i={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,i);const r={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(t,r),e.applyData(t,r)}function zz(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return pC(e,t);const l={href:ql(r.url||"")};r.title!==null&&r.title!==void 0&&(l.title=r.title);const a={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Oz(e,t){const i={href:ql(t.url)};t.title!==null&&t.title!==void 0&&(i.title=t.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Hz(e,t,i){const r=e.all(t),l=i?Pz(i):gC(t),a={},c=[];if(typeof t.checked=="boolean"){const m=r[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let h=-1;for(;++h<r.length;){const m=r[h];(l||h!==0||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
127
+ `}),m.type==="element"&&m.tagName==="p"&&!l?c.push(...m.children):c.push(m)}const d=r[r.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
128
+ `});const f={type:"element",tagName:"li",properties:a,children:c};return e.patch(t,f),e.applyData(t,f)}function Pz(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const i=e.children;let r=-1;for(;!t&&++r<i.length;)t=gC(i[r])}return t}function gC(e){const t=e.spread;return t??e.children.length>1}function Iz(e,t){const i={},r=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(i.start=t.start);++l<r.length;){const c=r[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:i,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function jz(e,t){const i={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Uz(e,t){const i={type:"root",children:e.wrap(e.all(t))};return e.patch(t,i),e.applyData(t,i)}function qz(e,t){const i={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Vz(e,t){const i=e.all(t),r=i.shift(),l=[];if(r){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],c),l.push(c)}if(i.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},h=hm(t.children[1]),d=Kw(t.children[t.children.length-1]);h&&d&&(c.position={start:h,end:d}),l.push(c)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,a),e.applyData(t,a)}function Fz(e,t,i){const r=i?i.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",c=i&&i.type==="table"?i.align:void 0,h=c?c.length:t.children.length;let d=-1;const f=[];for(;++d<h;){const g=t.children[d],v={},y=c?c[d]:void 0;y&&(v.align=y);let S={type:"element",tagName:a,properties:v,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),f.push(S)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,m),e.applyData(t,m)}function Yz(e,t){const i={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}const I1=9,j1=32;function $z(e){const t=String(e),i=/\r?\n|\r/g;let r=i.exec(t),l=0;const a=[];for(;r;)a.push(U1(t.slice(l,r.index),l>0,!0),r[0]),l=r.index+r[0].length,r=i.exec(t);return a.push(U1(t.slice(l),l>0,!1)),a.join("")}function U1(e,t,i){let r=0,l=e.length;if(t){let a=e.codePointAt(r);for(;a===I1||a===j1;)r++,a=e.codePointAt(r)}if(i){let a=e.codePointAt(l-1);for(;a===I1||a===j1;)l--,a=e.codePointAt(l-1)}return l>r?e.slice(r,l):""}function Wz(e,t){const i={type:"text",value:$z(String(t.value))};return e.patch(t,i),e.applyData(t,i)}function Xz(e,t){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,i),e.applyData(t,i)}const Kz={blockquote:Cz,break:Ez,code:kz,delete:Mz,emphasis:Tz,footnoteReference:Az,heading:Nz,html:Dz,imageReference:Rz,image:Bz,inlineCode:Lz,linkReference:zz,link:Oz,listItem:Hz,list:Iz,paragraph:jz,root:Uz,strong:qz,table:Vz,tableCell:Yz,tableRow:Fz,text:Wz,thematicBreak:Xz,toml:xu,yaml:xu,definition:xu,footnoteDefinition:xu};function xu(){}const mC=-1,xh=0,ca=1,eh=2,vm=3,ym=4,Sm=5,bm=6,_C=7,vC=8,q1=typeof self=="object"?self:globalThis,Gz=(e,t)=>{const i=(l,a)=>(e.set(a,l),l),r=l=>{if(e.has(l))return e.get(l);const[a,c]=t[l];switch(a){case xh:case mC:return i(c,l);case ca:{const h=i([],l);for(const d of c)h.push(r(d));return h}case eh:{const h=i({},l);for(const[d,f]of c)h[r(d)]=r(f);return h}case vm:return i(new Date(c),l);case ym:{const{source:h,flags:d}=c;return i(new RegExp(h,d),l)}case Sm:{const h=i(new Map,l);for(const[d,f]of c)h.set(r(d),r(f));return h}case bm:{const h=i(new Set,l);for(const d of c)h.add(r(d));return h}case _C:{const{name:h,message:d}=c;return i(new q1[h](d),l)}case vC:return i(BigInt(c),l);case"BigInt":return i(Object(BigInt(c)),l);case"ArrayBuffer":return i(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:h}=new Uint8Array(c);return i(new DataView(h),c)}}return i(new q1[a](c),l)};return r},V1=e=>Gz(new Map,e)(0),wl="",{toString:Zz}={},{keys:Qz}=Object,Go=e=>{const t=typeof e;if(t!=="object"||!e)return[xh,t];const i=Zz.call(e).slice(8,-1);switch(i){case"Array":return[ca,wl];case"Object":return[eh,wl];case"Date":return[vm,wl];case"RegExp":return[ym,wl];case"Map":return[Sm,wl];case"Set":return[bm,wl];case"DataView":return[ca,i]}return i.includes("Array")?[ca,i]:i.includes("Error")?[_C,i]:[eh,i]},wu=([e,t])=>e===xh&&(t==="function"||t==="symbol"),Jz=(e,t,i,r)=>{const l=(c,h)=>{const d=r.push(c)-1;return i.set(h,d),d},a=c=>{if(i.has(c))return i.get(c);let[h,d]=Go(c);switch(h){case xh:{let m=c;switch(d){case"bigint":h=vC,m=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return l([mC],c)}return l([h,m],c)}case ca:{if(d){let v=c;return d==="DataView"?v=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(c)),l([d,[...v]],c)}const m=[],g=l([h,m],c);for(const v of c)m.push(a(v));return g}case eh:{if(d)switch(d){case"BigInt":return l([d,c.toString()],c);case"Boolean":case"Number":case"String":return l([d,c.valueOf()],c)}if(t&&"toJSON"in c)return a(c.toJSON());const m=[],g=l([h,m],c);for(const v of Qz(c))(e||!wu(Go(c[v])))&&m.push([a(v),a(c[v])]);return g}case vm:return l([h,c.toISOString()],c);case ym:{const{source:m,flags:g}=c;return l([h,{source:m,flags:g}],c)}case Sm:{const m=[],g=l([h,m],c);for(const[v,y]of c)(e||!(wu(Go(v))||wu(Go(y))))&&m.push([a(v),a(y)]);return g}case bm:{const m=[],g=l([h,m],c);for(const v of c)(e||!wu(Go(v)))&&m.push(a(v));return g}}const{message:f}=c;return l([h,{name:d,message:f}],c)};return a},F1=(e,{json:t,lossy:i}={})=>{const r=[];return Jz(!(t||i),!!t,new Map,r)(e),r},th=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?V1(F1(e,t)):structuredClone(e):(e,t)=>V1(F1(e,t));function eO(e,t){const i=[{type:"text",value:"↩"}];return t>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),i}function tO(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function iO(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||eO,r=e.options.footnoteBackLabel||tO,l=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const m=e.all(f),g=String(f.identifier).toUpperCase(),v=ql(g.toLowerCase());let y=0;const S=[],b=e.footnoteCounts.get(g);for(;b!==void 0&&++y<=b;){S.length>0&&S.push({type:"text",value:" "});let z=typeof i=="string"?i:i(d,y);typeof z=="string"&&(z={type:"text",value:z}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,y),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const E=m[m.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const z=E.children[E.children.length-1];z&&z.type==="text"?z.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else m.push(...S);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(m,!0)};e.patch(f,w),h.push(w)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...th(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
129
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
130
+ `}]}}const yC=(function(e){if(e==null)return lO;if(typeof e=="function")return wh(e);if(typeof e=="object")return Array.isArray(e)?nO(e):rO(e);if(typeof e=="string")return sO(e);throw new Error("Expected function, string, or object as test")});function nO(e){const t=[];let i=-1;for(;++i<e.length;)t[i]=yC(e[i]);return wh(r);function r(...l){let a=-1;for(;++a<t.length;)if(t[a].apply(this,l))return!0;return!1}}function rO(e){const t=e;return wh(i);function i(r){const l=r;let a;for(a in e)if(l[a]!==t[a])return!1;return!0}}function sO(e){return wh(t);function t(i){return i&&i.type===e}}function wh(e){return t;function t(i,r,l){return!!(oO(i)&&e.call(this,i,typeof r=="number"?r:void 0,l||void 0))}}function lO(){return!0}function oO(e){return e!==null&&typeof e=="object"&&"type"in e}const SC=[],aO=!0,Y1=!1,cO="skip";function uO(e,t,i,r){let l;typeof t=="function"&&typeof i!="function"?(r=i,i=t):l=t;const a=yC(l),c=r?-1:1;h(e,void 0,[])();function h(d,f,m){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=SC,S,b,E;if((!t||a(d,f,m[m.length-1]||void 0))&&(y=hO(i(d,m)),y[0]===Y1))return y;if("children"in d&&d.children){const w=d;if(w.children&&y[0]!==cO)for(b=(r?w.children.length:-1)+c,E=m.concat(w);b>-1&&b<w.children.length;){const z=w.children[b];if(S=h(z,b,E)(),S[0]===Y1)return S;b=typeof S[1]=="number"?S[1]:b+c}}return y}}}function hO(e){return Array.isArray(e)?e:typeof e=="number"?[aO,e]:e==null?SC:[e]}function bC(e,t,i,r){let l,a,c;typeof t=="function"&&typeof i!="function"?(a=void 0,c=t,l=i):(a=t,c=i,l=r),uO(e,a,h,l);function h(d,f){const m=f[f.length-1],g=m?m.children.indexOf(d):void 0;return c(d,g,m)}}const Rg={}.hasOwnProperty,fO={};function dO(e,t){const i=t||fO,r=new Map,l=new Map,a=new Map,c={...Kz,...i.handlers},h={all:f,applyData:gO,definitionById:r,footnoteById:l,footnoteCounts:a,footnoteOrder:[],handlers:c,one:d,options:i,patch:pO,wrap:_O};return bC(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const g=m.type==="definition"?r:l,v=String(m.identifier).toUpperCase();g.has(v)||g.set(v,m)}}),h;function d(m,g){const v=m.type,y=h.handlers[v];if(Rg.call(h.handlers,v)&&y)return y(h,m,g);if(h.options.passThrough&&h.options.passThrough.includes(v)){if("children"in m){const{children:b,...E}=m,w=th(E);return w.children=h.all(m),w}return th(m)}return(h.options.unknownHandler||mO)(h,m,g)}function f(m){const g=[];if("children"in m){const v=m.children;let y=-1;for(;++y<v.length;){const S=h.one(v[y],m);if(S){if(y&&v[y-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=$1(S.value)),!Array.isArray(S)&&S.type==="element")){const b=S.children[0];b&&b.type==="text"&&(b.value=$1(b.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function pO(e,t){e.position&&(t.position=ZB(e))}function gO(e,t){let i=t;if(e&&e.data){const r=e.data.hName,l=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(i.type==="element")i.tagName=r;else{const c="children"in i?i.children:[i];i={type:"element",tagName:r,properties:{},children:c}}i.type==="element"&&a&&Object.assign(i.properties,th(a)),"children"in i&&i.children&&l!==null&&l!==void 0&&(i.children=l)}return i}function mO(e,t){const i=t.data||{},r="value"in t&&!(Rg.call(i,"hProperties")||Rg.call(i,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _O(e,t){const i=[];let r=-1;for(t&&i.push({type:"text",value:`
131
+ `});++r<e.length;)r&&i.push({type:"text",value:`
132
+ `}),i.push(e[r]);return t&&e.length>0&&i.push({type:"text",value:`
133
+ `}),i}function $1(e){let t=0,i=e.charCodeAt(t);for(;i===9||i===32;)t++,i=e.charCodeAt(t);return e.slice(t)}function W1(e,t){const i=dO(e,t),r=i.one(e,void 0),l=iO(i),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return l&&a.children.push({type:"text",value:`
134
+ `},l),a}function vO(e,t){return e&&"run"in e?async function(i,r){const l=W1(i,{file:r,...t});await e.run(l,r)}:function(i,r){return W1(i,{file:r,...e||t})}}function X1(e){if(e)throw e}var Sp,K1;function yO(){if(K1)return Sp;K1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,i=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},a=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!g)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},c=function(f,m){i&&m.name==="__proto__"?i(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},h=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(r)return r(f,m).value}else return;return f[m]};return Sp=function d(){var f,m,g,v,y,S,b=arguments[0],E=1,w=arguments.length,z=!1;for(typeof b=="boolean"&&(z=b,b=arguments[1]||{},E=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});E<w;++E)if(f=arguments[E],f!=null)for(m in f)g=h(b,m),v=h(f,m),b!==v&&(z&&v&&(a(v)||(y=l(v)))?(y?(y=!1,S=g&&l(g)?g:[]):S=g&&a(g)?g:{},c(b,{name:m,newValue:d(z,S,v)})):typeof v<"u"&&c(b,{name:m,newValue:v}));return b},Sp}var SO=yO();const bp=nh(SO);function Bg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function bO(){const e=[],t={run:i,use:r};return t;function i(...l){let a=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);h(null,...l);function h(d,...f){const m=e[++a];let g=-1;if(d){c(d);return}for(;++g<l.length;)(f[g]===null||f[g]===void 0)&&(f[g]=l[g]);l=f,m?xO(m,h)(...f):c(null,...f)}}function r(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function xO(e,t){let i;return r;function r(...c){const h=e.length>c.length;let d;h&&c.push(l);try{d=e.apply(this,c)}catch(f){const m=f;if(h&&i)throw m;return l(m)}h||(d&&d.then&&typeof d.then=="function"?d.then(a,l):d instanceof Error?l(d):a(d))}function l(c,...h){i||(i=!0,t(c,...h))}function a(c){l(null,c)}}const Sn={basename:wO,dirname:CO,extname:EO,join:kO,sep:"/"};function wO(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ha(e);let i=0,r=-1,l=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(a){i=l+1;break}}else r<0&&(a=!0,r=l+1);return r<0?"":e.slice(i,r)}if(t===e)return"";let c=-1,h=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(a){i=l+1;break}}else c<0&&(a=!0,c=l+1),h>-1&&(e.codePointAt(l)===t.codePointAt(h--)?h<0&&(r=l):(h=-1,r=c));return i===r?r=c:r<0&&(r=e.length),e.slice(i,r)}function CO(e){if(Ha(e),e.length===0)return".";let t=-1,i=e.length,r;for(;--i;)if(e.codePointAt(i)===47){if(r){t=i;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function EO(e){Ha(e);let t=e.length,i=-1,r=0,l=-1,a=0,c;for(;t--;){const h=e.codePointAt(t);if(h===47){if(c){r=t+1;break}continue}i<0&&(c=!0,i=t+1),h===46?l<0?l=t:a!==1&&(a=1):l>-1&&(a=-1)}return l<0||i<0||a===0||a===1&&l===i-1&&l===r+1?"":e.slice(l,i)}function kO(...e){let t=-1,i;for(;++t<e.length;)Ha(e[t]),e[t]&&(i=i===void 0?e[t]:i+"/"+e[t]);return i===void 0?".":MO(i)}function MO(e){Ha(e);const t=e.codePointAt(0)===47;let i=TO(e,!t);return i.length===0&&!t&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),t?"/"+i:i}function TO(e,t){let i="",r=0,l=-1,a=0,c=-1,h,d;for(;++c<=e.length;){if(c<e.length)h=e.codePointAt(c);else{if(h===47)break;h=47}if(h===47){if(!(l===c-1||a===1))if(l!==c-1&&a===2){if(i.length<2||r!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",r=0):(i=i.slice(0,d),r=i.length-1-i.lastIndexOf("/")),l=c,a=0;continue}}else if(i.length>0){i="",r=0,l=c,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",r=2)}else i.length>0?i+="/"+e.slice(l+1,c):i=e.slice(l+1,c),r=c-l-1;l=c,a=0}else h===46&&a>-1?a++:a=-1}return i}function Ha(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const AO={cwd:NO};function NO(){return"/"}function Lg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function DO(e){if(typeof e=="string")e=new URL(e);else if(!Lg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return RO(e)}function RO(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let i=-1;for(;++i<t.length;)if(t.codePointAt(i)===37&&t.codePointAt(i+1)===50){const r=t.codePointAt(i+2);if(r===70||r===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const xp=["history","path","basename","stem","extname","dirname"];class xC{constructor(t){let i;t?Lg(t)?i={path:t}:typeof t=="string"||BO(t)?i={value:t}:i=t:i={},this.cwd="cwd"in i?"":AO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<xp.length;){const a=xp[r];a in i&&i[a]!==void 0&&i[a]!==null&&(this[a]=a==="history"?[...i[a]]:i[a])}let l;for(l in i)xp.includes(l)||(this[l]=i[l])}get basename(){return typeof this.path=="string"?Sn.basename(this.path):void 0}set basename(t){Cp(t,"basename"),wp(t,"basename"),this.path=Sn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Sn.dirname(this.path):void 0}set dirname(t){G1(this.basename,"dirname"),this.path=Sn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Sn.extname(this.path):void 0}set extname(t){if(wp(t,"extname"),G1(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Sn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Lg(t)&&(t=DO(t)),Cp(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Sn.basename(this.path,this.extname):void 0}set stem(t){Cp(t,"stem"),wp(t,"stem"),this.path=Sn.join(this.dirname||"",t+(this.extname||""))}fail(t,i,r){const l=this.message(t,i,r);throw l.fatal=!0,l}info(t,i,r){const l=this.message(t,i,r);return l.fatal=void 0,l}message(t,i,r){const l=new ri(t,i,r);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function wp(e,t){if(e&&e.includes(Sn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Sn.sep+"`")}function Cp(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function G1(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function BO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const LO=(function(e){const r=this.constructor.prototype,l=r[e],a=function(){return l.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),zO={}.hasOwnProperty;class xm extends LO{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=bO()}copy(){const t=new xm;let i=-1;for(;++i<this.attachers.length;){const r=this.attachers[i];t.use(...r)}return t.data(bp(!0,{},this.namespace)),t}data(t,i){return typeof t=="string"?arguments.length===2?(Mp("data",this.frozen),this.namespace[t]=i,this):zO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Mp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const l=i.call(t,...r);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const i=Cu(t),r=this.parser||this.Parser;return Ep("parse",r),r(String(i),i)}process(t,i){const r=this;return this.freeze(),Ep("process",this.parser||this.Parser),kp("process",this.compiler||this.Compiler),i?l(void 0,i):new Promise(l);function l(a,c){const h=Cu(t),d=r.parse(h);r.run(d,h,function(m,g,v){if(m||!g||!v)return f(m);const y=g,S=r.stringify(y,v);PO(S)?v.value=S:v.result=S,f(m,v)});function f(m,g){m||!g?c(m):a?a(g):i(void 0,g)}}}processSync(t){let i=!1,r;return this.freeze(),Ep("processSync",this.parser||this.Parser),kp("processSync",this.compiler||this.Compiler),this.process(t,l),Q1("processSync","process",i),r;function l(a,c){i=!0,X1(a),r=c}}run(t,i,r){Z1(t),this.freeze();const l=this.transformers;return!r&&typeof i=="function"&&(r=i,i=void 0),r?a(void 0,r):new Promise(a);function a(c,h){const d=Cu(i);l.run(t,d,f);function f(m,g,v){const y=g||t;m?h(m):c?c(y):r(void 0,y,v)}}}runSync(t,i){let r=!1,l;return this.run(t,i,a),Q1("runSync","run",r),l;function a(c,h){X1(c),l=h,r=!0}}stringify(t,i){this.freeze();const r=Cu(i),l=this.compiler||this.Compiler;return kp("stringify",l),Z1(t),l(t,r)}use(t,...i){const r=this.attachers,l=this.namespace;if(Mp("use",this.frozen),t!=null)if(typeof t=="function")d(t,i);else if(typeof t=="object")Array.isArray(t)?h(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...g]=f;d(m,g)}else c(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function c(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(f.plugins),f.settings&&(l.settings=bp(!0,l.settings,f.settings))}function h(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const g=f[m];a(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,m){let g=-1,v=-1;for(;++g<r.length;)if(r[g][0]===f){v=g;break}if(v===-1)r.push([f,...m]);else if(m.length>0){let[y,...S]=m;const b=r[v][1];Bg(b)&&Bg(y)&&(y=bp(!0,b,y)),r[v]=[f,y,...S]}}}}const OO=new xm().freeze();function Ep(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function kp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Mp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Z1(e){if(!Bg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Q1(e,t,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cu(e){return HO(e)?e:new xC(e)}function HO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function PO(e){return typeof e=="string"||IO(e)}function IO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",J1=[],eb={allowDangerousHtml:!0},UO=/^(https?|ircs?|mailto|xmpp)$/i,qO=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function VO(e){const t=FO(e),i=YO(e);return $O(t.runSync(t.parse(i),i),e)}function FO(e){const t=e.rehypePlugins||J1,i=e.remarkPlugins||J1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...eb}:eb;return OO().use(wz).use(i).use(vO,r).use(t)}function YO(e){const t=e.children||"",i=new xC;return typeof t=="string"&&(i.value=t),i}function $O(e,t){const i=t.allowedElements,r=t.allowElement,l=t.components,a=t.disallowedElements,c=t.skipHtml,h=t.unwrapDisallowed,d=t.urlTransform||WO;for(const m of qO)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+jO+m.id,void 0);return bC(e,f),i6(e,{Fragment:k.Fragment,components:l,ignoreInvalidStyle:!0,jsx:k.jsx,jsxs:k.jsxs,passKeys:!0,passNode:!0});function f(m,g,v){if(m.type==="raw"&&v&&typeof g=="number")return c?v.children.splice(g,1):v.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let y;for(y in _p)if(Object.hasOwn(_p,y)&&Object.hasOwn(m.properties,y)){const S=m.properties[y],b=_p[y];(b===null||b.includes(m.tagName))&&(m.properties[y]=d(String(S||""),y,m))}}if(m.type==="element"){let y=i?!i.includes(m.tagName):a?a.includes(m.tagName):!1;if(!y&&r&&typeof g=="number"&&(y=!r(m,g,v)),y&&v&&typeof g=="number")return h&&m.children?v.children.splice(g,1,...m.children):v.children.splice(g,1),g}}}function WO(e){const t=e.indexOf(":"),i=e.indexOf("?"),r=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||i!==-1&&t>i||r!==-1&&t>r||UO.test(e.slice(0,t))?e:""}const XO="modulepreload",KO=function(e){return"/"+e},tb={},GO=function(t,i,r){let l=Promise.resolve();if(i&&i.length>0){let c=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),d=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));l=c(i.map(f=>{if(f=KO(f),f in tb)return;tb[f]=!0;const m=f.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":XO,m||(v.as="script"),v.crossOrigin="",v.href=f,d&&v.setAttribute("nonce",d),document.head.appendChild(v),m)return new Promise((y,S)=>{v.addEventListener("load",y),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function a(c){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=c,window.dispatchEvent(h),!h.defaultPrevented)throw c}return l.then(c=>{for(const h of c||[])h.status==="rejected"&&a(h.reason);return t().catch(a)})};function wC({integrationId:e,workflowName:t,nodeName:i,connectionsApi:r}){const{nangoConnections:l,loading:a,refetch:c}=GN(e,r.mutationVersion),[h,d]=q.useState(!1),f=r.getForNode(t,i,e),m=q.useCallback(async v=>{await r.upsert({workflow_name:t,node_name:i,integration_id:e,connection_id:v})},[r,t,i,e]),g=q.useCallback(async()=>{d(!0);try{const v=await fetch("/api/nango/connect-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integration_id:e})});if(!v.ok)return;const{token:y}=await v.json(),b=(await GO(()=>import("./index-DAKTQEvj.js"),[])).default;new b().openConnectUI({sessionToken:y,onEvent:async w=>{if(w.type==="connect"){c();const z=w.payload.connectionId;z&&(await m(z),t!=="*"&&await r.upsert({workflow_name:"*",node_name:"*",integration_id:e,connection_id:z}))}else w.type==="close"&&c()}})}catch{}finally{d(!1)}},[e,c,m,t,r]);return k.jsxs("div",{className:"flex flex-col gap-1.5",children:[k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx("span",{className:"text-[12px] font-medium text-popover-foreground capitalize",children:e}),k.jsx("button",{onClick:g,disabled:h,className:"text-[10px] px-2.5 py-0.5 rounded-full bg-[#e0d9cf] text-[#6b6358] hover:bg-[#d5cdc0] transition-colors cursor-pointer disabled:opacity-50",children:h?"...":"Connect"})]}),a?k.jsx("p",{className:"text-[11px] text-[#a8a099] italic",children:"Loading connections..."}):l.length===0?k.jsx("p",{className:"text-[11px] text-[#a8a099] italic",children:"No connections. Click Connect to add one."}):k.jsxs("select",{value:(f==null?void 0:f.connection_id)??"",onChange:v=>m(v.target.value),className:"text-[12px] px-2 py-1 rounded-md border border-border bg-background text-foreground",children:[k.jsx("option",{value:"",children:"Select a connection..."}),l.map(v=>k.jsx("option",{value:v.connection_id,children:v.display_name},v.connection_id))]})]})}const ZO={node:"fn",agent:"AI",workflow:"wf",input:"IN",output:"OUT",condition:"?"},ib={node:{iconBg:"bg-emerald-50 text-emerald-600"},agent:{iconBg:"bg-purple-50 text-purple-600"},workflow:{iconBg:"bg-emerald-50 text-emerald-600"},input:{iconBg:"bg-[#f5f3f0] text-[#a8a099]"},output:{iconBg:"bg-[#f5f3f0] text-[#a8a099]"},condition:{iconBg:"bg-amber-50 text-amber-600"}},QO={node:"Node",agent:"Agent",workflow:"Workflow",input:"Input",output:"Output",condition:"Condition"};function JO({node:e,position:t,onClose:i,workflowName:r,connectionsApi:l}){const a=q.useRef(null),c=ZO[e.type]??"fn",h=ib[e.type]??ib.node,d=QO[e.type]??e.type;q.useEffect(()=>{const b=E=>{E.key==="Escape"&&i()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[i]),q.useEffect(()=>{const b=w=>{a.current&&!a.current.contains(w.target)&&i()},E=setTimeout(()=>{document.addEventListener("mousedown",b)},0);return()=>{clearTimeout(E),document.removeEventListener("mousedown",b)}},[i]);const f=300,m=400,g=12,[v,y]=q.useState({left:t.x+12,top:t.y-20});q.useLayoutEffect(()=>{const b=a.current;if(!b)return;const E=b.offsetParent,w=(E==null?void 0:E.clientWidth)??window.innerWidth,z=(E==null?void 0:E.clientHeight)??window.innerHeight;y({left:Math.max(g,Math.min(t.x+12,w-f-g)),top:Math.max(g,Math.min(t.y-20,z-m-g))})},[t.x,t.y]);const S=e.integrations&&e.integrations.length>0&&e.nodeName&&r&&l;return k.jsxs("div",{ref:a,style:{left:v.left,top:v.top},className:"absolute z-50 w-[300px] bg-popover rounded-xl border border-border shadow-lg",children:[k.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-accent",children:[k.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[k.jsx("div",{className:`w-7 h-7 rounded-md flex items-center justify-center shrink-0 ${h.iconBg}`,children:k.jsx("span",{className:"text-[10px] font-bold",children:c})}),k.jsxs("div",{className:"min-w-0",children:[k.jsx("p",{className:"text-[13px] font-medium text-popover-foreground truncate",children:e.label}),k.jsx("p",{className:"text-[10px] text-[#a8a099] uppercase tracking-wide",children:d})]})]}),k.jsx("button",{onClick:i,"aria-label":"Close node details",className:"p-1 rounded-md text-[#a8a099] hover:text-popover-foreground hover:bg-accent transition-colors cursor-pointer",children:k.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:k.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),k.jsxs("div",{className:"px-4 py-3",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-1.5",children:"Description"}),e.description?k.jsx("div",{className:"text-[13px] text-muted-foreground leading-relaxed prose-sm",children:k.jsx(VO,{components:{p:({children:b})=>k.jsx("p",{className:"mb-2 last:mb-0",children:b}),strong:({children:b})=>k.jsx("strong",{className:"font-semibold text-popover-foreground",children:b}),blockquote:({children:b})=>k.jsx("blockquote",{className:"border-l-2 border-border pl-2.5 my-2 text-muted-foreground italic",children:b}),ul:({children:b})=>k.jsx("ul",{className:"list-disc pl-4 mb-2",children:b}),ol:({children:b})=>k.jsx("ol",{className:"list-decimal pl-4 mb-2",children:b}),li:({children:b})=>k.jsx("li",{className:"mb-0.5",children:b}),code:({children:b})=>k.jsx("code",{className:"text-[12px] bg-muted px-1 py-0.5 rounded",children:b})},children:e.description})}):k.jsx("p",{className:"text-[13px] text-[#a8a099] italic",children:"No description available"})]}),S&&k.jsxs("div",{className:"px-4 py-3 border-t border-accent",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2",children:"Integrations"}),k.jsx("div",{className:"flex flex-col gap-3",children:e.integrations.map(b=>k.jsx(wC,{integrationId:b,workflowName:r,nodeName:e.nodeName,connectionsApi:l},b))})]})]})}const ih=220,Ca=50,e8=80,nb=40,rb=20,sb=16,lb=28;function t8(e,t){if(e.length===0)return new Map;const i=new Map,r=new Map,l=new Set(e);for(const f of e)i.set(f,[]),r.set(f,[]);for(const f of t)l.has(f.source)&&l.has(f.target)&&(i.get(f.source).push(f.target),r.get(f.target).push(f.source));const a=i8(e,i,r),c=new Map;for(const[f,m]of a)c.has(m)||c.set(m,[]),c.get(m).push(f);n8(c,a,i);const h=Math.max(...c.keys()),d=new Map;for(let f=0;f<=h;f++){const m=c.get(f)||[],v=-(m.length*Ca+(m.length-1)*nb)/2;for(let y=0;y<m.length;y++)d.set(m[y],{x:Math.round(f*(ih+e8)),y:Math.round(v+y*(Ca+nb))})}return d}function i8(e,t,i){const r=new Map,l=e.filter(h=>i.get(h).length===0),a=l.length>0?l:[e[0]],c=[...a];for(const h of a)r.set(h,0);for(const h of e)r.has(h)||(r.set(h,0),c.push(h));for(;c.length>0;){const h=c.shift(),d=r.get(h);for(const f of t.get(h)||[]){const m=r.get(f),g=d+1;(m===void 0||g>m)&&(r.set(f,g),c.push(f))}}return r}function n8(e,t,i){const r=Math.max(...e.keys()),l=new Map;for(const[a,c]of i)for(const h of c)l.has(h)||l.set(h,[]),l.get(h).push(a);for(let a=1;a<=r;a++){const c=e.get(a);if(!c||c.length<=1)continue;const h=e.get(a-1)||[],d=new Map;h.forEach((f,m)=>d.set(f,m)),c.sort((f,m)=>{const g=(l.get(f)||[]).filter(b=>t.get(b)===a-1),v=(l.get(m)||[]).filter(b=>t.get(b)===a-1),y=g.length>0?g.reduce((b,E)=>b+(d.get(E)||0),0)/g.length:0,S=v.length>0?v.reduce((b,E)=>b+(d.get(E)||0),0)/v.length:0;return y-S}),e.set(a,c)}}function r8(e,t){const i=[];for(const r of t){const l=new Map;let a=1/0,c=1/0,h=-1/0,d=-1/0;for(const y of r.nodeIds){const S=e.get(y);S&&(a=Math.min(a,S.x),c=Math.min(c,S.y),h=Math.max(h,S.x+ih),d=Math.max(d,S.y+Ca))}if(a===1/0)continue;const f=a-rb,m=c-lb-sb,g=h-a+2*rb,v=d-c+lb+2*sb;for(const y of r.nodeIds){const S=e.get(y);S&&l.set(y,{x:S.x-f,y:S.y-m})}i.push({id:r.id,position:{x:f,y:m},width:g,height:v,childPositions:l})}return i}const s8={workflowNode:EB,loopGroup:kB},l8={clean:MB};function o8({dag:e,connectionsApi:t}){const{fitView:i}=ph(),[r,l]=q.useState(null),[a,c]=q.useState(null),{flowNodes:h,flowEdges:d}=q.useMemo(()=>{const z=t8(e.nodes.map(X=>X.id),e.edges.map(X=>({source:X.source,target:X.target}))),C=e.loopGroups??[],T=r8(z,C),I=new Map;for(const X of T){const G=C.find(ne=>ne.id===X.id);if(G)for(const ne of G.nodeIds)I.set(ne,X)}const B=[];for(const X of T){const G=C.find(ne=>ne.id===X.id);B.push({id:X.id,type:"loopGroup",position:X.position,data:{label:(G==null?void 0:G.label)??"",width:X.width,height:X.height},draggable:!0,style:{width:X.width,height:X.height}})}for(const X of e.nodes){const G=I.get(X.id);if(G){const ne=G.childPositions.get(X.id)??{x:0,y:0};B.push({id:X.id,type:"workflowNode",position:ne,parentId:G.id,extent:"parent",data:{...X},draggable:!0,width:ih,height:Ca})}else{const ne=z.get(X.id)??{x:0,y:0};B.push({id:X.id,type:"workflowNode",position:ne,data:{...X},draggable:!0,width:ih,height:Ca})}}const U=e.edges.map(X=>({id:X.id,source:X.source,target:X.target,label:X.label,type:"clean",animated:!1,style:{stroke:"#c4b5a0",strokeWidth:1.5},labelStyle:{fontSize:12,fill:"#6b7280"},markerEnd:{type:ma.ArrowClosed,width:12,height:12,color:"#c4b5a0"}}));return{flowNodes:B,flowEdges:U}},[e]),[f,m,g]=gN(h),[v,y,S]=mN(d);q.useEffect(()=>{m(h),y(d),setTimeout(()=>i({padding:.2,duration:300}),50)},[h,d,m,y,i]);const b=q.useCallback((z,C)=>{const T=C.data;if(T.type==="input"||T.type==="output"||T.type==="condition")return;const B=z.currentTarget.closest(".react-flow"),U=(B==null?void 0:B.getBoundingClientRect())??{left:0,top:0};l(T),c({x:z.clientX-U.left,y:z.clientY-U.top})},[]),E=q.useCallback(()=>{l(null),c(null)},[]),w=q.useCallback(()=>{setTimeout(()=>i({padding:.2,duration:200}),50)},[i]);return k.jsxs("div",{className:"relative w-full h-full",children:[k.jsxs(pN,{nodes:f,edges:v,onNodesChange:g,onEdgesChange:S,nodeTypes:s8,edgeTypes:l8,onInit:w,onNodeClick:b,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,proOptions:{hideAttribution:!0},children:[k.jsx(bN,{variant:nr.Cross,color:"#d5cdc0",gap:24,size:1.5}),k.jsx(TN,{showInteractive:!1}),k.jsx(UN,{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{width:120,height:80},maskColor:"rgba(240, 235, 227, 0.7)"})]}),r&&a&&k.jsx(JO,{node:r,position:a,onClose:E,workflowName:e.workflowName,connectionsApi:t})]})}function a8({workflows:e,parseErrors:t,selected:i,onSelect:r}){return k.jsxs("div",{className:"flex flex-col gap-1",children:[k.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1",children:"Workflows"}),e.length===0&&t.length===0&&k.jsx("p",{className:"text-xs text-[#a8a099] italic",children:"No workflows found"}),e.map(l=>k.jsxs("button",{onClick:()=>r(l.workflowName),className:`
135
+ text-left px-2.5 py-1.5 rounded-md text-sm transition-colors
136
+ ${i===l.workflowName?"bg-[#e8e0d4] text-foreground font-medium shadow-[inset_0_0_0_1px_rgba(0,0,0,0.04)]":"text-muted-foreground hover:bg-accent/60"}
137
+ `,children:[k.jsx("div",{className:"font-medium truncate",children:l.workflowName}),k.jsx("div",{className:"text-[10px] text-[#a8a099] truncate",children:l.filePath})]},`${l.filePath}:${l.workflowName}`)),t.length>0&&k.jsxs(k.Fragment,{children:[k.jsx("h2",{className:"text-xs font-semibold text-amber-600 uppercase tracking-wider mt-3 mb-1",children:"Parse Errors"}),t.map(l=>k.jsxs("div",{className:"px-2.5 py-1.5 rounded-md text-xs bg-amber-50 text-amber-700 border border-amber-200",children:[k.jsx("div",{className:"font-medium truncate",children:l.filePath}),k.jsx("div",{className:"truncate mt-0.5 text-amber-600",children:l.error})]},l.filePath))]})]})}function c8({workflows:e,connectionsApi:t}){const{integrations:i,loading:r}=KN(),l=q.useMemo(()=>{const c=new Set;for(const h of e)for(const d of h.nodes)if(d.integrations)for(const f of d.integrations)c.add(f);return c},[e]),a=q.useMemo(()=>{const c=new Set(l);for(const h of i)c.add(h.id);return Array.from(c).sort((h,d)=>{const f=l.has(h)?0:1,m=l.has(d)?0:1;return f-m||h.localeCompare(d)})},[i,l]);return r||a.length===0?null:k.jsxs("div",{className:"border-t border-border pt-3",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2 px-1",children:"Global Connections"}),k.jsx("div",{className:"flex flex-col gap-3",children:a.map(c=>k.jsx(wC,{integrationId:c,workflowName:"*",nodeName:"*",connectionsApi:t},c))})]})}function u8(){const[e,t]=q.useState({status:"idle"}),[i,r]=q.useState(null),[l,a]=q.useState("unknown");q.useEffect(()=>{const d=()=>{fetch("/api/deploy").then(m=>m.json()).then(m=>{m.deployed&&m.url&&(r(m.url),a(m.freshness??"unknown"))}).catch(()=>{})};d();const f=setInterval(d,3e4);return()=>clearInterval(f)},[]);const c=q.useCallback(async()=>{var d;t({status:"deploying",message:"Starting deploy..."});try{const f=await fetch("/api/deploy",{method:"POST"});if(!f.ok){t({status:"error",error:`Deploy request failed (HTTP ${f.status})`});return}const m=(d=f.body)==null?void 0:d.getReader();if(!m){t({status:"error",error:"No response body"});return}const g=new TextDecoder;let v="";for(;;){const{done:y,value:S}=await m.read();if(y)break;v+=g.decode(S,{stream:!0});const b=v.split(`
138
+ `);v=b.pop()??"";for(const E of b)if(E.startsWith("data: "))try{const w=JSON.parse(E.slice(6));w.type==="progress"?t({status:"deploying",step:w.step,message:w.message}):w.type==="done"?(w.url&&r(w.url),a("current"),t({status:"success",url:w.url})):w.type==="error"&&t({status:"error",error:w.message})}catch{}}}catch(f){t({status:"error",error:f instanceof Error?f.message:String(f)})}},[]),h=q.useCallback(()=>{t({status:"idle"})},[]);return{...e,deployedUrl:i,freshness:l,startDeploy:c,reset:h}}function ob(e){return e.replace(/^https?:\/\//,"")}function h8(){const e=u8();return k.jsxs("div",{className:"border-t border-border pt-3",children:[k.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2 px-1",children:"Deploy"}),e.deployedUrl&&e.status!=="deploying"&&e.status!=="success"&&k.jsxs("a",{href:e.deployedUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground px-1 mb-2 group transition-colors",title:e.freshness==="outdated"?"Local changes not yet deployed":e.freshness==="current"?"Up to date":void 0,children:[k.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.freshness==="outdated"?"bg-yellow-400":e.freshness==="current"?"bg-green-400":"bg-zinc-400"}`}),k.jsx("span",{className:"truncate group-hover:underline",children:ob(e.deployedUrl)}),k.jsx("svg",{className:"w-2.5 h-2.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:k.jsx("path",{d:"M3.5 1.5h7v7M10.5 1.5L1.5 10.5"})})]}),e.status==="idle"&&k.jsx("button",{onClick:e.startDeploy,className:"w-full px-3 py-1.5 text-xs bg-foreground text-background rounded hover:opacity-90 transition-opacity cursor-pointer",children:e.deployedUrl?"Re-deploy":"Deploy to Cloud"}),e.status==="deploying"&&k.jsxs("div",{className:"text-xs text-muted-foreground px-1 flex items-center gap-2",children:[k.jsxs("svg",{className:"animate-spin h-3 w-3",viewBox:"0 0 24 24",fill:"none",children:[k.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),k.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),k.jsx("span",{children:e.message??"Deploying..."})]}),e.status==="success"&&k.jsxs("div",{className:"text-xs px-1",children:[k.jsx("p",{className:"text-green-400 mb-1",children:"Deployed successfully!"}),e.url&&k.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 underline break-all",children:ob(e.url)}),k.jsx("button",{onClick:e.reset,className:"mt-1 block text-muted-foreground hover:text-foreground underline cursor-pointer",children:"Done"})]}),e.status==="error"&&k.jsxs("div",{className:"text-xs px-1",children:[k.jsx("p",{className:"text-red-400 mb-1",children:e.error}),k.jsx("button",{onClick:e.reset,className:"text-muted-foreground hover:text-foreground underline cursor-pointer",children:"Try again"})]})]})}function f8({onClose:e}){const t=q.useRef(null);q.useEffect(()=>{const r=setTimeout(e,4500);return()=>clearTimeout(r)},[e]);const i=q.useCallback(r=>{r.target===t.current&&e()},[e]);return k.jsxs("div",{ref:t,onClick:i,className:"fixed inset-0 z-50 flex items-center justify-center",style:{animation:"ssh-backdrop 4.5s ease both"},children:[k.jsxs("div",{className:"relative w-[480px] h-[300px] rounded-xl border-2 border-foreground/20 bg-card shadow-2xl overflow-hidden",style:{animation:"ssh-screen 4.5s ease both"},children:[k.jsxs("div",{className:"absolute inset-y-0 left-0 w-1/2 flex flex-col items-center justify-center gap-3",style:{animation:"ssh-pane-left 4.5s ease both"},children:[k.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#1a1a1a] flex items-center justify-center",children:k.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#e8e4df",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[k.jsx("polyline",{points:"4 17 10 11 4 5"}),k.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),k.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Claude Code"}),k.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Your terminal"})]}),k.jsx("div",{className:"absolute top-0 left-1/2 w-[2px] h-full bg-foreground/15 -translate-x-1/2",style:{animation:"ssh-divider 4.5s ease both"}}),k.jsxs("div",{className:"absolute inset-y-0 right-0 w-1/2 flex flex-col items-center justify-center gap-3",style:{animation:"ssh-pane-right 4.5s ease both"},children:[k.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#f3ede5] border border-border flex items-center justify-center",children:k.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-foreground",children:[k.jsx("rect",{x:"3",y:"3",width:"7",height:"5",rx:"1.5"}),k.jsx("rect",{x:"14",y:"3",width:"7",height:"5",rx:"1.5"}),k.jsx("rect",{x:"8.5",y:"16",width:"7",height:"5",rx:"1.5"}),k.jsx("path",{d:"M6.5 8v3.5a2 2 0 002 2h7a2 2 0 002-2V8"}),k.jsx("path",{d:"M12 13.5V16"})]})}),k.jsx("span",{className:"text-sm font-semibold text-foreground",children:"0pflow"}),k.jsx("span",{className:"text-[10px] text-muted-foreground",children:"This browser"})]}),k.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-foreground text-background text-[11px] font-medium px-3 py-1 rounded-full",style:{animation:"ssh-banner 4.5s ease both"},children:"Copied to clipboard"})]}),k.jsx("style",{children:`
139
+ @keyframes ssh-backdrop {
140
+ 0% { background: rgba(0,0,0,0); }
141
+ 5% { background: rgba(0,0,0,0.2); }
142
+ 88% { background: rgba(0,0,0,0.2); }
143
+ 100% { background: rgba(0,0,0,0); }
144
+ }
145
+ @keyframes ssh-screen {
146
+ 0% { opacity: 0; transform: scale(0.95); }
147
+ 5% { opacity: 1; transform: scale(1); }
148
+ 88% { opacity: 1; transform: scale(1); }
149
+ 100% { opacity: 0; transform: scale(0.97); }
150
+ }
151
+ @keyframes ssh-divider {
152
+ 0%, 7% { transform: translateX(-50%) scaleY(0); }
153
+ 17% { transform: translateX(-50%) scaleY(1); }
154
+ 88% { opacity: 1; }
155
+ 100% { opacity: 0; }
156
+ }
157
+ @keyframes ssh-pane-left {
158
+ 0%, 15% { opacity: 0; }
159
+ 25% { opacity: 1; }
160
+ 88% { opacity: 1; }
161
+ 100% { opacity: 0; }
162
+ }
163
+ @keyframes ssh-pane-right {
164
+ 0%, 20% { opacity: 0; }
165
+ 30% { opacity: 1; }
166
+ 88% { opacity: 1; }
167
+ 100% { opacity: 0; }
168
+ }
169
+ @keyframes ssh-banner {
170
+ 0%, 5% { opacity: 0; transform: translateX(-50%) translateY(8px); }
171
+ 12% { opacity: 1; transform: translateX(-50%) translateY(0); }
172
+ 75% { opacity: 1; }
173
+ 88% { opacity: 0; }
174
+ 100% { opacity: 0; }
175
+ }
176
+ `})]})}const d8=150,p8=400;function g8({tabs:e,defaultTab:t,onClose:i}){var C,T;const[r,l]=q.useState(t??((C=e[0])==null?void 0:C.id)??""),[a,c]=q.useState(p8),[h,d]=q.useState(null),[f,m]=q.useState(!1),[g,v]=q.useState(!1),y=q.useRef(!1),S=q.useRef(0),b=q.useRef(0),E=q.useCallback(I=>{I.preventDefault(),y.current=!0,S.current=I.clientY,b.current=a},[a]);q.useEffect(()=>{const I=U=>{if(!y.current)return;const X=window.innerHeight*.6,G=S.current-U.clientY;c(Math.max(d8,Math.min(X,b.current+G)))},B=()=>{y.current=!1};return window.addEventListener("mousemove",I),window.addEventListener("mouseup",B),()=>{window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",B)}},[]),q.useEffect(()=>{fetch("/api/claude-command").then(I=>I.ok?I.json():null).then(I=>{I!=null&&I.projectRoot&&d(`cd ${I.projectRoot} && claude --continue`)}).catch(()=>{})},[]);const w=q.useCallback(()=>{h&&navigator.clipboard.writeText(h).then(()=>{m(!0),v(!0),setTimeout(()=>m(!1),1500)})},[h]),z=(T=e.find(I=>I.id===r))==null?void 0:T.content;return k.jsxs("div",{className:"border-t border-border flex flex-col bg-background",style:{height:a},children:[k.jsx("div",{onMouseDown:E,className:"h-1 cursor-ns-resize hover:bg-accent shrink-0"}),k.jsxs("div",{className:"shrink-0 px-3 flex items-center gap-0 border-b border-border",children:[e.map(I=>k.jsxs("button",{onClick:()=>l(I.id),className:`relative text-[12px] tracking-wide px-3 py-2 cursor-pointer transition-colors ${r===I.id?"text-foreground":"text-muted-foreground hover:text-foreground/70"}`,children:[I.label,r===I.id&&k.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-[1.5px] bg-[#b8ad9e] rounded-full"})]},I.id)),k.jsx("div",{className:"flex-1"}),h&&k.jsxs("button",{onClick:w,className:"flex items-center gap-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer mr-2 max-w-[50%] group",title:"Copy to open in your terminal",children:[k.jsx("span",{className:"shrink-0",children:"Prefer your own terminal?"}),k.jsx("span",{className:"truncate font-mono",children:h}),f?k.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"Copied!"}):k.jsxs("svg",{className:"w-3 h-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[k.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),k.jsx("path",{d:"M5 11H3.5A1.5 1.5 0 012 9.5v-7A1.5 1.5 0 013.5 1h7A1.5 1.5 0 0112 2.5V5"})]})]}),k.jsx("button",{onClick:i,className:"text-muted-foreground hover:text-foreground text-sm px-1.5 py-0.5 cursor-pointer",title:"Close panel",children:"×"})]}),k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:z}),g&&k.jsx(f8,{onClose:()=>v(!1)})]})}const m8={SUCCESS:{bg:"bg-emerald-50",text:"text-emerald-700",label:"Success"},ERROR:{bg:"bg-red-50",text:"text-red-700",label:"Failed"},PENDING:{bg:"bg-amber-50",text:"text-amber-700",label:"Pending"},RETRIES_EXCEEDED:{bg:"bg-red-50",text:"text-red-700",label:"Retries Exceeded"}};function _8({runs:e,loading:t,selectedRunId:i,trace:r,traceLoading:l,selectRun:a,refresh:c}){return t&&e.length===0?k.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading runs..."}):e.length===0?k.jsx("div",{className:"flex items-center justify-center h-full",children:k.jsxs("div",{className:"rounded-lg border border-dashed border-border p-8 text-center",children:[k.jsx("p",{className:"text-[13px] text-foreground/60",children:"No runs yet"}),k.jsx("p",{className:"text-[11px] text-muted-foreground mt-1 leading-relaxed max-w-[240px]",children:"Workflow runs will appear here with their status, duration, and step-by-step trace."})]})}):k.jsxs("div",{className:"h-full flex flex-col",children:[k.jsxs("div",{className:"shrink-0 px-3 py-1.5 flex items-center justify-between border-b border-border",children:[k.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:[e.length," run",e.length!==1?"s":""]}),k.jsx("button",{onClick:c,className:"text-[11px] text-muted-foreground hover:text-foreground cursor-pointer transition-colors",children:"Refresh"})]}),k.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-3 py-2 space-y-1",children:e.map(h=>k.jsx(v8,{run:h,isExpanded:i===h.workflow_uuid,trace:i===h.workflow_uuid?r:null,traceLoading:i===h.workflow_uuid&&l,onToggle:()=>a(i===h.workflow_uuid?null:h.workflow_uuid)},h.workflow_uuid))})]})}function v8({run:e,isExpanded:t,trace:i,traceLoading:r,onToggle:l}){var d;const a=m8[e.status]??{bg:"bg-gray-50",text:"text-gray-700",label:e.status},c=(d=i==null?void 0:i.workflow)==null?void 0:d.duration_ms,h=b8(e.created_at);return k.jsxs("div",{className:`rounded-lg border transition-colors ${e.status==="PENDING"?"border-amber-200":"border-border"} bg-muted`,children:[k.jsxs("button",{onClick:l,className:"w-full flex items-center gap-2 px-3 py-2 text-left cursor-pointer",children:[k.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:t?"▾":"▸"}),k.jsx("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium ${a.bg} ${a.text}`,children:a.label}),k.jsx("span",{className:"text-[12px] font-medium text-foreground truncate",children:e.name}),k.jsx("div",{className:"flex-1"}),c!=null&&k.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:wm(c)}),k.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:x8(h)})]}),t&&k.jsxs("div",{className:"border-t border-border px-3 py-2",children:[r?k.jsx("p",{className:"text-[11px] text-muted-foreground text-center py-3",children:"Loading trace..."}):i&&i.operations.length>0?k.jsx(y8,{operations:i.operations,rootWorkflowId:e.workflow_uuid}):k.jsx("p",{className:"text-[11px] text-muted-foreground text-center py-3 italic",children:"No operations recorded."}),e.error&&k.jsx("div",{className:"mt-2",children:k.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded p-1.5 whitespace-pre-wrap break-all",children:e.error})})]})]})}function y8({operations:e,rootWorkflowId:t}){const[i,r]=q.useState(new Set),l=q.useCallback(f=>{r(m=>{const g=new Set(m);return g.has(f)?g.delete(f):g.add(f),g})},[]),a=new Map;for(const f of e){const m=a.get(f.workflow_uuid)??[];m.push(f),a.set(f.workflow_uuid,m)}const c=a.get(t)??[],h=new Set;for(const f of c)f.function_name==="DBOS.getResult"&&f.child_workflow_id&&h.add(f.child_workflow_id);const d=c.filter(f=>!f.child_workflow_id||f.function_name==="DBOS.getResult"?!0:!h.has(f.child_workflow_id));return k.jsx("div",{className:"space-y-0.5",children:d.map(f=>{let m=f.function_name;if(f.function_name==="DBOS.getResult"&&f.child_workflow_id){const b=c.find(E=>E.child_workflow_id===f.child_workflow_id&&E.function_name!=="DBOS.getResult");b&&(m=b.function_name)}const g=!!(f.output_preview||f.error||f.child_workflow_id),v=`${f.workflow_uuid}-${f.function_id}`,y=i.has(v),S=f.child_workflow_id?a.get(f.child_workflow_id)??[]:[];return k.jsxs("div",{children:[k.jsxs("button",{onClick:()=>g&&l(v),className:`w-full flex items-center gap-2 px-2 py-1 rounded text-left transition-colors ${g?"cursor-pointer hover:bg-accent":"cursor-default"} ${f.error?"bg-red-50/30":""}`,children:[g?k.jsx("span",{className:"text-muted-foreground text-[9px] w-3 shrink-0",children:y?"▾":"▸"}):k.jsx("span",{className:"w-3 shrink-0"}),k.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${f.error?"bg-red-500":f.duration_ms!=null?"bg-emerald-500":"bg-amber-400"}`}),k.jsx("span",{className:`text-[12px] font-medium truncate flex-1 ${f.error?"text-red-700":"text-foreground"}`,children:m}),f.duration_ms!=null&&k.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:wm(f.duration_ms)})]}),y&&k.jsxs("div",{className:"ml-7 mt-0.5 mb-1 space-y-1",children:[f.error&&k.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded p-1.5 whitespace-pre-wrap break-all",children:f.error}),S.length>0&&k.jsx("div",{className:"space-y-0.5 border-l-2 border-border pl-2",children:S.map(b=>k.jsx(S8,{op:b},`${b.workflow_uuid}-${b.function_id}`))}),f.output_preview&&!f.error&&k.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground bg-background rounded p-1.5 whitespace-pre-wrap break-all max-h-[100px] overflow-auto",children:w8(f.output_preview)})]})]},v)})})}function S8({op:e}){return k.jsxs("div",{className:`flex items-center gap-2 px-2 py-0.5 rounded text-[11px] ${e.error?"bg-red-50/30":""}`,children:[k.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.error?"bg-red-500":e.duration_ms!=null?"bg-emerald-500":"bg-amber-400"}`}),k.jsx("span",{className:`truncate flex-1 ${e.error?"text-red-700":"text-foreground/80"}`,children:e.function_name}),e.duration_ms!=null&&k.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:wm(e.duration_ms)})]})}function b8(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^\d+$/.test(e))return parseInt(e,10);const t=new Date(e).getTime();if(!isNaN(t))return t}return Date.now()}function wm(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),i=Math.floor(e%6e4/1e3);return`${t}m ${i}s`}function x8(e){const t=Date.now()-e;return t<0?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:t<6048e5?`${Math.floor(t/864e5)}d ago`:new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function w8(e){if(!e)return"";try{const t=JSON.parse(e),i=JSON.stringify(t,null,2);return i.length>200?i.slice(0,197)+"...":i}catch{return e.length>200?e.slice(0,197)+"...":e}}function C8({dag:e,onClose:t,onSuccess:i}){const r=e.nodes.find(C=>C.type==="input"),l=(r==null?void 0:r.fields)??[],[a,c]=q.useState(()=>Object.fromEntries(l.map(C=>[C,""]))),[h,d]=q.useState("{}"),[f,m]=q.useState(l.length===0),[g,v]=q.useState(!1),[y,S]=q.useState(null),b=q.useRef(null);q.useEffect(()=>{const C=T=>{T.key==="Escape"&&!g&&t()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[t,g]);const E=q.useCallback(C=>{C.target===b.current&&!g&&t()},[t,g]),w=q.useCallback(()=>{if(f)return JSON.parse(h);const C={};for(const[T,I]of Object.entries(a))if(I!=="")try{C[T]=JSON.parse(I)}catch{C[T]=I}return C},[f,h,a]),z=q.useCallback(async()=>{S(null);let C;try{C=w()}catch(T){S(`Invalid JSON: ${T instanceof Error?T.message:String(T)}`);return}v(!0);try{const I=await(await fetch(`/api/workflows/${encodeURIComponent(e.workflowName)}/run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:C})})).json();if(I.status==="ERROR"){S(I.error??"Workflow failed"),v(!1);return}i()}catch(T){S(T instanceof Error?T.message:"Request failed"),v(!1)}},[e.workflowName,w,i]);return k.jsx("div",{ref:b,onClick:E,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[2px]",children:k.jsxs("div",{className:"bg-card rounded-xl shadow-xl border border-border w-full max-w-md mx-4",children:[k.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[k.jsxs("div",{children:[k.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Run workflow"}),k.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.workflowName})]}),k.jsx("button",{onClick:t,disabled:g,className:"text-muted-foreground hover:text-foreground text-lg px-1 cursor-pointer disabled:opacity-50",children:"×"})]}),k.jsxs("div",{className:"px-5 py-4 space-y-3 max-h-[60vh] overflow-auto",children:[l.length>0&&k.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[k.jsx("input",{type:"checkbox",checked:f,onChange:C=>m(C.target.checked),className:"accent-foreground"}),"Raw JSON"]}),f?k.jsx("textarea",{value:h,onChange:C=>d(C.target.value),spellCheck:!1,className:"w-full h-40 font-mono text-xs bg-background border border-border rounded-lg p-3 resize-y focus:outline-none focus:ring-1 focus:ring-foreground/20",placeholder:"{}"}):l.length>0?l.map(C=>k.jsxs("div",{children:[k.jsx("label",{className:"block text-xs font-medium text-foreground mb-1",children:C}),k.jsx("input",{type:"text",value:a[C]??"",onChange:T=>c(I=>({...I,[C]:T.target.value})),onKeyDown:T=>{T.key==="Enter"&&!g&&z()},className:"w-full text-sm bg-background border border-border rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-foreground/20",placeholder:`Enter ${C}`})]},C)):k.jsx("p",{className:"text-xs text-muted-foreground italic",children:"This workflow has no input fields."}),y&&k.jsx("pre",{className:"text-xs font-mono text-red-600 bg-red-50 rounded-lg p-3 whitespace-pre-wrap break-all max-h-32 overflow-auto",children:y})]}),k.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border",children:[k.jsx("button",{onClick:t,disabled:g,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground rounded-md transition-colors cursor-pointer disabled:opacity-50",children:"Cancel"}),k.jsx("button",{onClick:z,disabled:g,className:"px-4 py-1.5 text-xs bg-foreground text-background rounded-md hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-60 flex items-center gap-2",children:g?k.jsxs(k.Fragment,{children:[k.jsxs("svg",{className:"animate-spin h-3 w-3",viewBox:"0 0 24 24",fill:"none",children:[k.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),k.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Running..."]}):"Run"})]})]})})}function E8({attachTo:e,fit:t,ptyAlive:i,hasData:r,restart:l}){const a=q.useRef(null);return q.useEffect(()=>(a.current&&e(a.current),()=>e(null)),[e]),q.useEffect(()=>{if(!a.current)return;const c=new ResizeObserver(()=>{requestAnimationFrame(t)});return c.observe(a.current),()=>c.disconnect()},[t]),q.useEffect(()=>{const c=setTimeout(t,50);return()=>clearTimeout(c)},[t]),q.useEffect(()=>{if(i)return;const c=a.current;if(!c)return;const h=d=>{d.key==="Enter"&&l()};return c.addEventListener("keydown",h),()=>c.removeEventListener("keydown",h)},[i,l]),k.jsxs("div",{className:"relative h-full w-full overflow-hidden bg-[#1a1a1a] px-4 py-2",children:[k.jsx("div",{ref:a,className:"h-full w-full"}),!r&&k.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:k.jsxs("div",{className:"flex items-center gap-3 text-zinc-500",children:[k.jsxs("svg",{className:"h-5 w-5 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[k.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),k.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),k.jsx("span",{children:"Starting Claude Code..."})]})})]})}function k8(){const{state:e,connected:t,sendMessage:i,ptyEvents:r}=WN(),l=vB({sendMessage:i,ptyEvents:r}),a=XN(),[c,h]=q.useState(null),[d,f]=q.useState(!0),[m,g]=q.useState(!1),[v,y]=q.useState(!1),S=m1({defaultWidth:224,minWidth:160,maxWidth:400,side:"right"}),b=m1({defaultWidth:288,minWidth:200,maxWidth:500,side:"left"}),E=QN(c);q.useEffect(()=>{!c&&e.workflows.length>0&&h(e.workflows[0].workflowName)},[e.workflows,c]);const w=e.workflows.find(C=>C.workflowName===c),z=q.useMemo(()=>[{id:"terminal",label:"Terminal",content:k.jsx(E8,{attachTo:l.attachTo,fit:l.fit,ptyAlive:l.ptyAlive,hasData:l.hasData,restart:l.restart})}],[l]);return k.jsxs("div",{className:"h-screen w-screen flex bg-background",children:[k.jsxs("div",{className:"flex flex-col bg-[#f3ede5] shrink-0 relative",style:{width:S.width},children:[k.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[k.jsx("h1",{className:"text-sm font-bold text-foreground font-serif tracking-wide",children:"0pflow"}),k.jsx("span",{className:`w-2 h-2 rounded-full ${t?"bg-green-400":"bg-red-400"}`,title:t?"Connected":"Disconnected"})]}),k.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[k.jsx(a8,{workflows:e.workflows,parseErrors:e.parseErrors,selected:c,onSelect:h}),k.jsx(c8,{workflows:e.workflows,connectionsApi:a}),k.jsx(h8,{})]}),k.jsx("div",{onMouseDown:S.onDragStart,className:"absolute top-0 right-0 w-1 h-full cursor-ew-resize hover:bg-accent z-20"})]}),k.jsxs("div",{className:"flex-1 flex flex-col min-w-0 border-x border-border",children:[k.jsxs("div",{className:"flex-1 relative min-h-0",children:[w?k.jsxs(Xx,{children:[k.jsx("div",{className:"absolute inset-0 shadow-[inset_0_0_20px_rgba(0,0,0,0.03)]",children:k.jsx(o8,{dag:w,connectionsApi:a})}),k.jsxs("div",{className:"absolute top-3 left-3 flex items-center gap-2",children:[k.jsxs("div",{className:"bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-lg shadow-[0_1px_4px_rgba(0,0,0,0.04)] border border-border",children:[k.jsx("span",{className:"text-[15px] font-semibold text-foreground",children:w.workflowName}),k.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["v",w.version]})]}),k.jsxs("button",{onClick:()=>y(!0),className:"bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-md shadow-sm border border-border text-[12px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer flex items-center gap-1.5",title:"Run workflow",children:[k.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"currentColor",children:k.jsx("path",{d:"M2.5 1.5L10 6L2.5 10.5V1.5Z"})}),"Run"]})]})]},w.workflowName):k.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:e.workflows.length===0?"No workflow files found. Create a workflow to get started.":"Select a workflow from the sidebar."}),k.jsxs("div",{className:"absolute top-3 right-3 flex gap-1.5",children:[E.available&&k.jsx("button",{onClick:()=>g(!m),className:`bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-md shadow-sm border border-border text-[12px] cursor-pointer transition-colors ${m?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"History"}),k.jsx("button",{onClick:()=>f(!d),className:`bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-md shadow-sm border border-border text-[12px] cursor-pointer transition-colors ${d?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Terminal"})]})]}),d&&k.jsx(g8,{tabs:z,defaultTab:"terminal",onClose:()=>f(!1)})]}),v&&w&&k.jsx(C8,{dag:w,onClose:()=>y(!1),onSuccess:()=>{y(!1),g(!0),E.refresh()}}),m&&E.available&&k.jsxs("div",{className:"flex flex-col bg-[#f3ede5] shrink-0 relative",style:{width:b.width},children:[k.jsx("div",{onMouseDown:b.onDragStart,className:"absolute top-0 left-0 w-1 h-full cursor-ew-resize hover:bg-accent z-20"}),k.jsxs("div",{className:"shrink-0 px-4 py-3 border-b border-border flex items-center justify-between",children:[k.jsx("span",{className:"text-[12px] font-medium text-foreground tracking-wide",children:"History"}),k.jsx("button",{onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-sm px-1 cursor-pointer",title:"Close",children:"×"})]}),k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:k.jsx(_8,{runs:E.runs,loading:E.loading,selectedRunId:E.selectedRunId,trace:E.trace,traceLoading:E.traceLoading,selectRun:E.selectRun,refresh:E.refresh})})]})]})}PE.createRoot(document.getElementById("root")).render(k.jsx(q.StrictMode,{children:k.jsx(k8,{})}));